sdk: const correctness
[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 const 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 const 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 const char *  name;
106 unsigned int isProperty;
107 int memberAccess;
108 int id;
109 struct __ecereNameSpace__ecere__com__Class * _class;
110 const 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 const char *  category;
122 unsigned int compiled;
123 unsigned int selfWatchable;
124 unsigned int isWatchable;
125 } __attribute__ ((gcc_struct));
126
127 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
128
129 struct CodePosition
130 {
131 int line;
132 int charPos;
133 int pos;
134 int included;
135 } __attribute__ ((gcc_struct));
136
137 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
138
139 struct Location
140 {
141 struct CodePosition start;
142 struct CodePosition end;
143 } __attribute__ ((gcc_struct));
144
145 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attrib;
146
147 struct Attrib;
148
149 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ExtDecl;
150
151 struct ExtDecl
152 {
153 struct Location loc;
154 int type;
155 union
156 {
157 char * s;
158 struct Attrib * attr;
159 } __attribute__ ((gcc_struct));
160 } __attribute__ ((gcc_struct));
161
162 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
163
164 struct ClassDefinition
165 {
166 struct ClassDefinition * prev;
167 struct ClassDefinition * next;
168 struct Location loc;
169 struct Specifier * _class;
170 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
171 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
172 struct Symbol * symbol;
173 struct Location blockStart;
174 struct Location nameLoc;
175 int endid;
176 int declMode;
177 unsigned int deleteWatchable;
178 } __attribute__ ((gcc_struct));
179
180 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
181
182 struct Context
183 {
184 struct Context * parent;
185 struct __ecereNameSpace__ecere__sys__BinaryTree types;
186 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
187 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
188 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
189 int nextID;
190 int simpleID;
191 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
192 struct ClassDefinition * classDef;
193 unsigned int templateTypesOnly;
194 unsigned int hasNameSpace;
195 } __attribute__ ((gcc_struct));
196
197 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
198
199 struct Instantiation
200 {
201 struct Instantiation * prev;
202 struct Instantiation * next;
203 struct Location loc;
204 struct Specifier * _class;
205 struct Expression * exp;
206 struct __ecereNameSpace__ecere__sys__OldList *  members;
207 struct Symbol * symbol;
208 unsigned int fullSet;
209 unsigned int isConstant;
210 unsigned char *  data;
211 struct Location nameLoc;
212 struct Location insideLoc;
213 unsigned int built;
214 } __attribute__ ((gcc_struct));
215
216 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
217
218 struct Declaration
219 {
220 struct Declaration * prev;
221 struct Declaration * next;
222 struct Location loc;
223 int type;
224 union
225 {
226 struct
227 {
228 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
229 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
230 } __attribute__ ((gcc_struct));
231 struct Instantiation * inst;
232 struct
233 {
234 struct Identifier * id;
235 struct Expression * exp;
236 } __attribute__ ((gcc_struct));
237 } __attribute__ ((gcc_struct));
238 struct Specifier * extStorage;
239 struct Symbol * symbol;
240 int declMode;
241 } __attribute__ ((gcc_struct));
242
243 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
244
245 struct Statement
246 {
247 struct Statement * prev;
248 struct Statement * next;
249 struct Location loc;
250 int type;
251 union
252 {
253 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
254 struct
255 {
256 struct Identifier * id;
257 struct Statement * stmt;
258 } __attribute__ ((gcc_struct)) labeled;
259 struct
260 {
261 struct Expression * exp;
262 struct Statement * stmt;
263 } __attribute__ ((gcc_struct)) caseStmt;
264 struct
265 {
266 struct __ecereNameSpace__ecere__sys__OldList * declarations;
267 struct __ecereNameSpace__ecere__sys__OldList * statements;
268 struct Context * context;
269 unsigned int isSwitch;
270 } __attribute__ ((gcc_struct)) compound;
271 struct
272 {
273 struct __ecereNameSpace__ecere__sys__OldList * exp;
274 struct Statement * stmt;
275 struct Statement * elseStmt;
276 } __attribute__ ((gcc_struct)) ifStmt;
277 struct
278 {
279 struct __ecereNameSpace__ecere__sys__OldList * exp;
280 struct Statement * stmt;
281 } __attribute__ ((gcc_struct)) switchStmt;
282 struct
283 {
284 struct __ecereNameSpace__ecere__sys__OldList * exp;
285 struct Statement * stmt;
286 } __attribute__ ((gcc_struct)) whileStmt;
287 struct
288 {
289 struct __ecereNameSpace__ecere__sys__OldList * exp;
290 struct Statement * stmt;
291 } __attribute__ ((gcc_struct)) doWhile;
292 struct
293 {
294 struct Statement * init;
295 struct Statement * check;
296 struct __ecereNameSpace__ecere__sys__OldList * increment;
297 struct Statement * stmt;
298 } __attribute__ ((gcc_struct)) forStmt;
299 struct
300 {
301 struct Identifier * id;
302 } __attribute__ ((gcc_struct)) gotoStmt;
303 struct
304 {
305 struct Specifier * spec;
306 char * statements;
307 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
308 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
309 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
310 } __attribute__ ((gcc_struct)) asmStmt;
311 struct
312 {
313 struct Expression * watcher;
314 struct Expression * object;
315 struct __ecereNameSpace__ecere__sys__OldList * watches;
316 } __attribute__ ((gcc_struct)) _watch;
317 struct
318 {
319 struct Identifier * id;
320 struct __ecereNameSpace__ecere__sys__OldList * exp;
321 struct __ecereNameSpace__ecere__sys__OldList * filter;
322 struct Statement * stmt;
323 } __attribute__ ((gcc_struct)) forEachStmt;
324 struct Declaration * decl;
325 } __attribute__ ((gcc_struct));
326 } __attribute__ ((gcc_struct));
327
328 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
329
330 struct TypeName
331 {
332 struct TypeName * prev;
333 struct TypeName * next;
334 struct Location loc;
335 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
336 struct Declarator * declarator;
337 int classObjectType;
338 struct Expression * bitCount;
339 } __attribute__ ((gcc_struct));
340
341 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
342
343 struct Initializer
344 {
345 struct Initializer * prev;
346 struct Initializer * next;
347 struct Location loc;
348 int type;
349 union
350 {
351 struct Expression * exp;
352 struct __ecereNameSpace__ecere__sys__OldList *  list;
353 } __attribute__ ((gcc_struct));
354 unsigned int isConstant;
355 struct Identifier * id;
356 } __attribute__ ((gcc_struct));
357
358 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
359
360 struct __ecereNameSpace__ecere__com__DataValue
361 {
362 union
363 {
364 char c;
365 unsigned char uc;
366 short s;
367 unsigned short us;
368 int i;
369 unsigned int ui;
370 void *  p;
371 float f;
372 double d;
373 long long i64;
374 uint64 ui64;
375 } __attribute__ ((gcc_struct));
376 } __attribute__ ((gcc_struct));
377
378 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
379
380 struct Expression
381 {
382 struct Expression * prev;
383 struct Expression * next;
384 struct Location loc;
385 int type;
386 union
387 {
388 struct
389 {
390 char *  constant;
391 struct Identifier * identifier;
392 } __attribute__ ((gcc_struct));
393 struct Statement * compound;
394 struct Instantiation * instance;
395 struct
396 {
397 char *  string;
398 unsigned int intlString;
399 } __attribute__ ((gcc_struct));
400 struct __ecereNameSpace__ecere__sys__OldList *  list;
401 struct
402 {
403 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
404 struct Declarator * decl;
405 } __attribute__ ((gcc_struct)) _classExp;
406 struct
407 {
408 struct Identifier * id;
409 } __attribute__ ((gcc_struct)) classData;
410 struct
411 {
412 struct Expression * exp;
413 struct __ecereNameSpace__ecere__sys__OldList * arguments;
414 struct Location argLoc;
415 } __attribute__ ((gcc_struct)) call;
416 struct
417 {
418 struct Expression * exp;
419 struct __ecereNameSpace__ecere__sys__OldList * index;
420 } __attribute__ ((gcc_struct)) index;
421 struct
422 {
423 struct Expression * exp;
424 struct Identifier * member;
425 int memberType;
426 unsigned int thisPtr;
427 } __attribute__ ((gcc_struct)) member;
428 struct
429 {
430 int op;
431 struct Expression * exp1;
432 struct Expression * exp2;
433 } __attribute__ ((gcc_struct)) op;
434 struct TypeName * typeName;
435 struct Specifier * _class;
436 struct
437 {
438 struct TypeName * typeName;
439 struct Expression * exp;
440 } __attribute__ ((gcc_struct)) cast;
441 struct
442 {
443 struct Expression * cond;
444 struct __ecereNameSpace__ecere__sys__OldList * exp;
445 struct Expression * elseExp;
446 } __attribute__ ((gcc_struct)) cond;
447 struct
448 {
449 struct TypeName * typeName;
450 struct Expression * size;
451 } __attribute__ ((gcc_struct)) _new;
452 struct
453 {
454 struct TypeName * typeName;
455 struct Expression * size;
456 struct Expression * exp;
457 } __attribute__ ((gcc_struct)) _renew;
458 struct
459 {
460 char * table;
461 struct Identifier * id;
462 } __attribute__ ((gcc_struct)) db;
463 struct
464 {
465 struct Expression * ds;
466 struct Expression * name;
467 } __attribute__ ((gcc_struct)) dbopen;
468 struct
469 {
470 struct TypeName * typeName;
471 struct Initializer * initializer;
472 } __attribute__ ((gcc_struct)) initializer;
473 struct
474 {
475 struct Expression * exp;
476 struct TypeName * typeName;
477 } __attribute__ ((gcc_struct)) vaArg;
478 } __attribute__ ((gcc_struct));
479 unsigned int debugValue;
480 struct __ecereNameSpace__ecere__com__DataValue val;
481 uint64 address;
482 unsigned int hasAddress;
483 struct Type * expType;
484 struct Type * destType;
485 unsigned int usage;
486 int tempCount;
487 unsigned int byReference;
488 unsigned int isConstant;
489 unsigned int addedThis;
490 unsigned int needCast;
491 unsigned int thisPtr;
492 unsigned int opDestType;
493 } __attribute__ ((gcc_struct));
494
495 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
496
497 struct TemplateDatatype
498 {
499 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
500 struct Declarator * decl;
501 } __attribute__ ((gcc_struct));
502
503 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
504
505 struct TemplateArgument;
506
507 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
508
509 struct TemplateParameter
510 {
511 struct TemplateParameter * prev;
512 struct TemplateParameter * next;
513 struct Location loc;
514 int type;
515 struct Identifier * identifier;
516 union
517 {
518 struct TemplateDatatype * dataType;
519 int memberType;
520 } __attribute__ ((gcc_struct));
521 struct TemplateArgument * defaultArgument;
522 const char *  dataTypeString;
523 struct Type * baseType;
524 } __attribute__ ((gcc_struct));
525
526 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
527
528 struct Specifier
529 {
530 struct Specifier * prev;
531 struct Specifier * next;
532 struct Location loc;
533 int type;
534 union
535 {
536 int specifier;
537 struct
538 {
539 struct ExtDecl * extDecl;
540 char *  name;
541 struct Symbol * symbol;
542 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
543 } __attribute__ ((gcc_struct));
544 struct
545 {
546 struct Identifier * id;
547 struct __ecereNameSpace__ecere__sys__OldList *  list;
548 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
549 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
550 unsigned int addNameSpace;
551 struct Context * ctx;
552 struct ExtDecl * extDeclStruct;
553 } __attribute__ ((gcc_struct));
554 struct Expression * expression;
555 struct Specifier * _class;
556 struct TemplateParameter * templateParameter;
557 } __attribute__ ((gcc_struct));
558 } __attribute__ ((gcc_struct));
559
560 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
561
562 struct Identifier
563 {
564 struct Identifier * prev;
565 struct Identifier * next;
566 struct Location loc;
567 struct Symbol * classSym;
568 struct Specifier * _class;
569 char *  string;
570 struct Identifier * badID;
571 } __attribute__ ((gcc_struct));
572
573 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
574
575 struct Pointer;
576
577 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
578
579 struct Declarator
580 {
581 struct Declarator * prev;
582 struct Declarator * next;
583 struct Location loc;
584 int type;
585 struct Symbol * symbol;
586 struct Declarator * declarator;
587 union
588 {
589 struct Identifier * identifier;
590 struct
591 {
592 struct Expression * exp;
593 struct Expression * posExp;
594 struct Attrib * attrib;
595 } __attribute__ ((gcc_struct)) structDecl;
596 struct
597 {
598 struct Expression * exp;
599 struct Specifier * enumClass;
600 } __attribute__ ((gcc_struct)) array;
601 struct
602 {
603 struct __ecereNameSpace__ecere__sys__OldList * parameters;
604 } __attribute__ ((gcc_struct)) function;
605 struct
606 {
607 struct Pointer * pointer;
608 } __attribute__ ((gcc_struct)) pointer;
609 struct
610 {
611 struct ExtDecl * extended;
612 } __attribute__ ((gcc_struct)) extended;
613 } __attribute__ ((gcc_struct));
614 } __attribute__ ((gcc_struct));
615
616 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
617
618 struct FunctionDefinition
619 {
620 struct FunctionDefinition * prev;
621 struct FunctionDefinition * next;
622 struct Location loc;
623 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
624 struct Declarator * declarator;
625 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
626 struct Statement * body;
627 struct __ecereNameSpace__ecere__com__Class * _class;
628 struct __ecereNameSpace__ecere__sys__OldList attached;
629 int declMode;
630 struct Type * type;
631 struct Symbol * propSet;
632 int tempCount;
633 unsigned int propertyNoThis;
634 } __attribute__ ((gcc_struct));
635
636 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
637
638 struct DBTableDef;
639
640 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
641
642 struct External
643 {
644 struct External * prev;
645 struct External * next;
646 struct Location loc;
647 int type;
648 struct Symbol * symbol;
649 union
650 {
651 struct FunctionDefinition * function;
652 struct ClassDefinition * _class;
653 struct Declaration * declaration;
654 char *  importString;
655 struct Identifier * id;
656 struct DBTableDef * table;
657 } __attribute__ ((gcc_struct));
658 int importType;
659 } __attribute__ ((gcc_struct));
660
661 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
662
663 struct ModuleImport
664 {
665 struct ModuleImport * prev;
666 struct ModuleImport * next;
667 char *  name;
668 struct __ecereNameSpace__ecere__sys__OldList classes;
669 struct __ecereNameSpace__ecere__sys__OldList functions;
670 int importType;
671 int importAccess;
672 } __attribute__ ((gcc_struct));
673
674 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
675
676 struct ClassImport
677 {
678 struct ClassImport * prev;
679 struct ClassImport * next;
680 char *  name;
681 struct __ecereNameSpace__ecere__sys__OldList methods;
682 struct __ecereNameSpace__ecere__sys__OldList properties;
683 unsigned int itself;
684 int isRemote;
685 } __attribute__ ((gcc_struct));
686
687 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
688
689 struct Symbol
690 {
691 char *  string;
692 struct Symbol * parent;
693 struct Symbol * left;
694 struct Symbol * right;
695 int depth;
696 struct Type * type;
697 union
698 {
699 struct __ecereNameSpace__ecere__com__Method * method;
700 struct __ecereNameSpace__ecere__com__Property * _property;
701 struct __ecereNameSpace__ecere__com__Class * registered;
702 } __attribute__ ((gcc_struct));
703 int id;
704 int idCode;
705 union
706 {
707 struct
708 {
709 struct External * pointerExternal;
710 struct External * structExternal;
711 } __attribute__ ((gcc_struct));
712 struct
713 {
714 struct External * externalGet;
715 struct External * externalSet;
716 struct External * externalPtr;
717 struct External * externalIsSet;
718 } __attribute__ ((gcc_struct));
719 struct
720 {
721 struct External * methodExternal;
722 struct External * methodCodeExternal;
723 } __attribute__ ((gcc_struct));
724 } __attribute__ ((gcc_struct));
725 unsigned int imported;
726 unsigned int declaredStructSym;
727 struct __ecereNameSpace__ecere__com__Class * _class;
728 unsigned int declaredStruct;
729 unsigned int needConstructor;
730 unsigned int needDestructor;
731 char *  constructorName;
732 char *  structName;
733 char *  className;
734 char *  destructorName;
735 struct ModuleImport * module;
736 struct ClassImport * _import;
737 struct Location nameLoc;
738 unsigned int isParam;
739 unsigned int isRemote;
740 unsigned int isStruct;
741 unsigned int fireWatchersDone;
742 int declaring;
743 unsigned int classData;
744 unsigned int isStatic;
745 char *  shortName;
746 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
747 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
748 struct Context * ctx;
749 int isIterator;
750 struct Expression * propCategory;
751 } __attribute__ ((gcc_struct));
752
753 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
754
755 struct Type
756 {
757 struct Type * prev;
758 struct Type * next;
759 int refCount;
760 union
761 {
762 struct Symbol * _class;
763 struct
764 {
765 struct __ecereNameSpace__ecere__sys__OldList members;
766 char *  enumName;
767 } __attribute__ ((gcc_struct));
768 struct
769 {
770 struct Type * returnType;
771 struct __ecereNameSpace__ecere__sys__OldList params;
772 struct Symbol * thisClass;
773 unsigned int staticMethod;
774 struct TemplateParameter * thisClassTemplate;
775 } __attribute__ ((gcc_struct));
776 struct
777 {
778 struct __ecereNameSpace__ecere__com__Method * method;
779 struct __ecereNameSpace__ecere__com__Class * methodClass;
780 struct __ecereNameSpace__ecere__com__Class * usedClass;
781 } __attribute__ ((gcc_struct));
782 struct
783 {
784 struct Type * arrayType;
785 int arraySize;
786 struct Expression * arraySizeExp;
787 unsigned int freeExp;
788 struct Symbol * enumClass;
789 } __attribute__ ((gcc_struct));
790 struct Type * type;
791 struct TemplateParameter * templateParameter;
792 } __attribute__ ((gcc_struct));
793 int kind;
794 unsigned int size;
795 char *  name;
796 char *  typeName;
797 int classObjectType;
798 int alignment;
799 unsigned int offset;
800 int bitFieldCount;
801 int count;
802 unsigned int isSigned : 1;
803 unsigned int constant : 1;
804 unsigned int truth : 1;
805 unsigned int byReference : 1;
806 unsigned int extraParam : 1;
807 unsigned int directClassAccess : 1;
808 unsigned int computing : 1;
809 unsigned int keepCast : 1;
810 unsigned int passAsTemplate : 1;
811 unsigned int dllExport : 1;
812 unsigned int attrStdcall : 1;
813 unsigned int declaredWithStruct : 1;
814 unsigned int typedByReference : 1;
815 unsigned int casted : 1;
816 } __attribute__ ((gcc_struct));
817
818 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
819
820 struct __ecereNameSpace__ecere__com__Class
821 {
822 struct __ecereNameSpace__ecere__com__Class * prev;
823 struct __ecereNameSpace__ecere__com__Class * next;
824 const char *  name;
825 int offset;
826 int structSize;
827 int (* *  _vTbl)();
828 int vTblSize;
829 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
830 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
831 int offsetClass;
832 int sizeClass;
833 struct __ecereNameSpace__ecere__com__Class * base;
834 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
835 struct __ecereNameSpace__ecere__sys__BinaryTree members;
836 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
837 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
838 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
839 struct __ecereNameSpace__ecere__sys__OldList derivatives;
840 int memberID;
841 int startMemberID;
842 int type;
843 struct __ecereNameSpace__ecere__com__Instance * module;
844 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
845 const char *  dataTypeString;
846 struct Type * dataType;
847 int typeSize;
848 int defaultAlignment;
849 void (*  Initialize)();
850 int memberOffset;
851 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
852 const char *  designerClass;
853 unsigned int noExpansion;
854 const char *  defaultProperty;
855 unsigned int comRedefinition;
856 int count;
857 int isRemote;
858 unsigned int internalDecl;
859 void *  data;
860 unsigned int computeSize;
861 int structAlignment;
862 int destructionWatchOffset;
863 unsigned int fixed;
864 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
865 int inheritanceAccess;
866 const char *  fullName;
867 void *  symbol;
868 struct __ecereNameSpace__ecere__sys__OldList conversions;
869 struct __ecereNameSpace__ecere__sys__OldList templateParams;
870 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
871 struct __ecereNameSpace__ecere__com__Class * templateClass;
872 struct __ecereNameSpace__ecere__sys__OldList templatized;
873 int numParams;
874 unsigned int isInstanceClass;
875 unsigned int byValueSystemClass;
876 } __attribute__ ((gcc_struct));
877
878 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name);
879
880 extern void __ecereNameSpace__ecere__com__eClass_SetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, long long value);
881
882 extern void __ecereNameSpace__ecere__com__eInstance_FireSelfWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
883
884 extern void __ecereNameSpace__ecere__com__eInstance_SetMethod(struct __ecereNameSpace__ecere__com__Instance * instance, const char *  name, void *  function);
885
886 extern void __ecereNameSpace__ecere__com__eInstance_IncRef(struct __ecereNameSpace__ecere__com__Instance * instance);
887
888 extern void __ecereNameSpace__ecere__com__eInstance_StopWatching(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property, struct __ecereNameSpace__ecere__com__Instance * object);
889
890 extern void __ecereNameSpace__ecere__com__eInstance_Watch(void *  instance, struct __ecereNameSpace__ecere__com__Property * _property, void *  object, void (*  callback)(void * , void * ));
891
892 extern void __ecereNameSpace__ecere__com__eInstance_FireWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
893
894 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
895
896 struct __ecereNameSpace__ecere__com__Instance
897 {
898 int (* *  _vTbl)();
899 struct __ecereNameSpace__ecere__com__Class * _class;
900 int _refCount;
901 } __attribute__ ((gcc_struct));
902
903 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
904
905 struct __ecereNameSpace__ecere__com__DataMember
906 {
907 struct __ecereNameSpace__ecere__com__DataMember * prev;
908 struct __ecereNameSpace__ecere__com__DataMember * next;
909 const char *  name;
910 unsigned int isProperty;
911 int memberAccess;
912 int id;
913 struct __ecereNameSpace__ecere__com__Class * _class;
914 const char *  dataTypeString;
915 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
916 struct Type * dataType;
917 int type;
918 int offset;
919 int memberID;
920 struct __ecereNameSpace__ecere__sys__OldList members;
921 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
922 int memberOffset;
923 int structAlignment;
924 } __attribute__ ((gcc_struct));
925
926 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
927
928 struct __ecereNameSpace__ecere__com__SerialBuffer
929 {
930 unsigned char *  _buffer;
931 unsigned int count;
932 unsigned int _size;
933 unsigned int pos;
934 } __attribute__ ((gcc_struct));
935
936 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
937
938 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
939 {
940 union
941 {
942 struct
943 {
944 const char *  dataTypeString;
945 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
946 } __attribute__ ((gcc_struct));
947 struct __ecereNameSpace__ecere__com__DataValue expression;
948 struct
949 {
950 const char *  memberString;
951 union
952 {
953 struct __ecereNameSpace__ecere__com__DataMember * member;
954 struct __ecereNameSpace__ecere__com__Property * prop;
955 struct __ecereNameSpace__ecere__com__Method * method;
956 } __attribute__ ((gcc_struct));
957 } __attribute__ ((gcc_struct));
958 } __attribute__ ((gcc_struct));
959 } __attribute__ ((gcc_struct));
960
961 void exit(int status);
962
963 void * calloc(size_t nmemb, size_t size);
964
965 void free(void * ptr);
966
967 void * malloc(size_t size);
968
969 void * realloc(void * ptr, size_t size);
970
971 long int strtol(const char * nptr, char ** endptr, int base);
972
973 long long int strtoll(const char * nptr, char ** endptr, int base);
974
975 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
976
977 enum yytokentype
978 {
979 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
980 };
981
982 typedef union YYSTYPE
983 {
984 int specifierType;
985 int i;
986 int declMode;
987 struct Identifier * id;
988 struct Expression * exp;
989 struct Specifier * specifier;
990 struct __ecereNameSpace__ecere__sys__OldList * list;
991 struct Enumerator * enumerator;
992 struct Declarator * declarator;
993 struct Pointer * pointer;
994 struct Initializer * initializer;
995 struct InitDeclarator * initDeclarator;
996 struct TypeName * typeName;
997 struct Declaration * declaration;
998 struct Statement * stmt;
999 struct FunctionDefinition * function;
1000 struct External * external;
1001 struct Context * context;
1002 struct AsmField * asmField;
1003 struct Attrib * attrib;
1004 struct ExtDecl * extDecl;
1005 struct Attribute * attribute;
1006 struct Instantiation * instance;
1007 struct MembersInit * membersInit;
1008 struct MemberInit * memberInit;
1009 struct ClassFunction * classFunction;
1010 struct ClassDefinition * _class;
1011 struct ClassDef * classDef;
1012 struct PropertyDef * prop;
1013 char * string;
1014 struct Symbol * symbol;
1015 struct PropertyWatch * propertyWatch;
1016 struct TemplateParameter * templateParameter;
1017 struct TemplateArgument * templateArgument;
1018 struct TemplateDatatype * templateDatatype;
1019 struct DBTableEntry * dbtableEntry;
1020 struct DBIndexItem * dbindexItem;
1021 struct DBTableDef * dbtableDef;
1022 } __attribute__ ((gcc_struct)) YYSTYPE;
1023
1024 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
1025
1026 struct Enumerator
1027 {
1028 struct Enumerator * prev;
1029 struct Enumerator * next;
1030 struct Location loc;
1031 struct Identifier * id;
1032 struct Expression * exp;
1033 } __attribute__ ((gcc_struct));
1034
1035 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
1036
1037 struct InitDeclarator
1038 {
1039 struct InitDeclarator * prev;
1040 struct InitDeclarator * next;
1041 struct Location loc;
1042 struct Declarator * declarator;
1043 struct Initializer * initializer;
1044 } __attribute__ ((gcc_struct));
1045
1046 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
1047
1048 struct AsmField
1049 {
1050 struct AsmField * prev;
1051 struct AsmField * next;
1052 struct Location loc;
1053 char *  command;
1054 struct Expression * expression;
1055 struct Identifier * symbolic;
1056 } __attribute__ ((gcc_struct));
1057
1058 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
1059
1060 struct Attribute;
1061
1062 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
1063
1064 struct ClassFunction
1065 {
1066 struct ClassFunction * prev;
1067 struct ClassFunction * next;
1068 struct Location loc;
1069 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1070 struct Declarator * declarator;
1071 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1072 struct Statement * body;
1073 struct __ecereNameSpace__ecere__com__Class * _class;
1074 struct __ecereNameSpace__ecere__sys__OldList attached;
1075 int declMode;
1076 struct Type * type;
1077 struct Symbol * propSet;
1078 unsigned int isVirtual;
1079 unsigned int isConstructor;
1080 unsigned int isDestructor;
1081 unsigned int dontMangle;
1082 int id;
1083 int idCode;
1084 } __attribute__ ((gcc_struct));
1085
1086 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1087
1088 struct MembersInit
1089 {
1090 struct MembersInit * prev;
1091 struct MembersInit * next;
1092 struct Location loc;
1093 int type;
1094 union
1095 {
1096 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1097 struct ClassFunction * function;
1098 } __attribute__ ((gcc_struct));
1099 } __attribute__ ((gcc_struct));
1100
1101 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1102
1103 struct MemberInit
1104 {
1105 struct MemberInit * prev;
1106 struct MemberInit * next;
1107 struct Location loc;
1108 struct Location realLoc;
1109 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1110 struct Initializer * initializer;
1111 unsigned int used;
1112 unsigned int variable;
1113 unsigned int takeOutExp;
1114 } __attribute__ ((gcc_struct));
1115
1116 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1117
1118 struct PropertyDef
1119 {
1120 struct PropertyDef * prev;
1121 struct PropertyDef * next;
1122 struct Location loc;
1123 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1124 struct Declarator * declarator;
1125 struct Identifier * id;
1126 struct Statement * getStmt;
1127 struct Statement * setStmt;
1128 struct Statement * issetStmt;
1129 struct Symbol * symbol;
1130 struct Expression * category;
1131 struct
1132 {
1133 unsigned int conversion : 1;
1134 unsigned int isWatchable : 1;
1135 unsigned int isDBProp : 1;
1136 } __attribute__ ((gcc_struct));
1137 } __attribute__ ((gcc_struct));
1138
1139 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1140
1141 struct PropertyWatch
1142 {
1143 struct PropertyWatch * prev;
1144 struct PropertyWatch * next;
1145 struct Location loc;
1146 struct Statement * compound;
1147 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1148 unsigned int deleteWatch;
1149 } __attribute__ ((gcc_struct));
1150
1151 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1152
1153 struct ClassDef
1154 {
1155 struct ClassDef * prev;
1156 struct ClassDef * next;
1157 struct Location loc;
1158 int type;
1159 union
1160 {
1161 struct Declaration * decl;
1162 struct ClassFunction * function;
1163 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1164 struct PropertyDef * propertyDef;
1165 struct PropertyWatch * propertyWatch;
1166 char *  designer;
1167 struct Identifier * defaultProperty;
1168 struct
1169 {
1170 struct Identifier * id;
1171 struct Initializer * initializer;
1172 } __attribute__ ((gcc_struct));
1173 } __attribute__ ((gcc_struct));
1174 int memberAccess;
1175 void *  object;
1176 } __attribute__ ((gcc_struct));
1177
1178 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1179
1180 struct DBTableEntry;
1181
1182 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1183
1184 struct DBIndexItem;
1185
1186 extern YYSTYPE yylval;
1187
1188 extern struct Location yylloc;
1189
1190 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1191
1192 extern int returnCode;
1193
1194 extern struct Expression * parsedExpression;
1195
1196 extern unsigned int yydebug;
1197
1198 void SetYydebug(unsigned int b)
1199 {
1200 yydebug = b;
1201 }
1202
1203 extern unsigned int echoOn;
1204
1205 void resetScanner();
1206
1207 int propWatcherID;
1208
1209 int expression_yyparse();
1210
1211 static struct Statement * curCompound;
1212
1213 struct External * curExternal, * afterExternal;
1214
1215 static struct Type * curSwitchType;
1216
1217 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1218
1219 struct __ecereNameSpace__ecere__com__Class * thisClass;
1220
1221 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1222 {
1223 thisClass = c;
1224 }
1225
1226 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1227 {
1228 return thisClass;
1229 }
1230
1231 static char * thisNameSpace;
1232
1233 struct __ecereNameSpace__ecere__com__Class * containerClass;
1234
1235 unsigned int thisClassParams = 0x1;
1236
1237 unsigned int internalValueCounter;
1238
1239 extern unsigned int outputLineNumbers;
1240
1241 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1242
1243 extern size_t strlen(const char * );
1244
1245 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1246
1247 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1248
1249 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1250
1251 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1252
1253 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1254
1255 void PrintExpression(struct Expression * exp, char * string)
1256 {
1257 {
1258 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1259 int count;
1260 unsigned int backOutputLineNumbers = outputLineNumbers;
1261
1262 outputLineNumbers = 0x0;
1263 if(exp)
1264 OutputExpression(exp, f);
1265 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
1266 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = f;
1267
1268 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1269 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1270 count = strlen(string);
1271 count += ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
1272 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = f;
1273
1274 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1275 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Read])(f, string + count, 1, 1023);
1276 string[count] = '\0';
1277 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1278 outputLineNumbers = backOutputLineNumbers;
1279 }
1280 }
1281
1282 extern struct Type * ProcessTypeString(const char *  string, unsigned int staticMethod);
1283
1284 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1285
1286 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1287 {
1288 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1289 {
1290 if(!param->baseType)
1291 {
1292 if(param->dataTypeString)
1293 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1294 else
1295 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1296 }
1297 return param->baseType;
1298 }
1299 return (((void *)0));
1300 }
1301
1302 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1303 {
1304 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1305 return 0x1;
1306 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1307 {
1308 return 0x0;
1309 }
1310 if(type1->kind == type2->kind)
1311 {
1312 switch(type1->kind)
1313 {
1314 case 24:
1315 case 1:
1316 case 2:
1317 case 3:
1318 case 4:
1319 case 22:
1320 case 23:
1321 if(type1->passAsTemplate && !type2->passAsTemplate)
1322 return 0x1;
1323 return type1->isSigned != type2->isSigned;
1324 case 8:
1325 return type1->_class != type2->_class;
1326 case 13:
1327 return (type1->type && type2->type && type1->type->constant != type2->type->constant) || NeedCast(type1->type, type2->type);
1328 default:
1329 return 0x1;
1330 }
1331 }
1332 return 0x1;
1333 }
1334
1335 extern int strcmp(const char * , const char * );
1336
1337 extern struct Context * curContext;
1338
1339 extern struct Context * topContext;
1340
1341 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1342
1343 extern struct __ecereNameSpace__ecere__com__Property * __ecereNameSpace__ecere__com__eClass_FindProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, struct __ecereNameSpace__ecere__com__Instance * module);
1344
1345 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1346
1347 extern struct __ecereNameSpace__ecere__com__Method * __ecereNameSpace__ecere__com__eClass_FindMethod(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, struct __ecereNameSpace__ecere__com__Instance * module);
1348
1349 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_FindDataMember(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, struct __ecereNameSpace__ecere__com__Instance * module, struct __ecereNameSpace__ecere__com__DataMember **  subMemberStack, int *  subMemberStackPos);
1350
1351 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1352
1353 struct __ecereNameSpace__ecere__com__ClassProperty
1354 {
1355 const char *  name;
1356 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1357 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1358 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1359 int depth;
1360 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, long long);
1361 long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1362 const char *  dataTypeString;
1363 struct Type * dataType;
1364 unsigned int constant;
1365 } __attribute__ ((gcc_struct));
1366
1367 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name);
1368
1369 extern struct Expression * QMkExpId(const char *  id);
1370
1371 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1372
1373 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1374 {
1375 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1376 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1377 const char *  name;
1378 int type;
1379 union
1380 {
1381 const char *  dataTypeString;
1382 int memberType;
1383 } __attribute__ ((gcc_struct));
1384 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1385 void *  param;
1386 } __attribute__ ((gcc_struct));
1387
1388 extern struct Expression * GetTemplateArgExpByName(const char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1389
1390 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1391
1392 extern void FreeIdentifier(struct Identifier * id);
1393
1394 void ProcessExpressionType(struct Expression * exp);
1395
1396 extern struct Declarator * SpecDeclFromString(const char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1397
1398 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1399
1400 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1401
1402 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1403
1404 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1405
1406 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1407
1408 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1409
1410 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, const char *  key);
1411
1412 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1413 {
1414 if(exp->type == 0 && exp->identifier)
1415 {
1416 struct Identifier * id = exp->identifier;
1417 struct Context * ctx;
1418 struct Symbol * symbol = (((void *)0));
1419
1420 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1421 {
1422 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1423 {
1424 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1425 if(symbol)
1426 break;
1427 }
1428 }
1429 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1430 {
1431 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1432 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1433 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1434 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
1435
1436 if(!prop)
1437 {
1438 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1439 }
1440 if(!prop && !method)
1441 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1442 if(!prop && !method && !member)
1443 {
1444 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1445 }
1446 if(prop || method || member || classProp)
1447 {
1448 exp->type = 8;
1449 exp->member.member = id;
1450 exp->member.memberType = 0;
1451 exp->member.exp = QMkExpId("this");
1452 exp->addedThis = 0x1;
1453 }
1454 else if(_class && _class->templateParams.first)
1455 {
1456 struct __ecereNameSpace__ecere__com__Class * sClass;
1457
1458 for(sClass = _class; sClass; sClass = sClass->base)
1459 {
1460 if(sClass->templateParams.first)
1461 {
1462 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1463
1464 for(param = sClass->templateParams.first; param; param = param->next)
1465 {
1466 if(param->type == 2 && !strcmp(param->name, id->string))
1467 {
1468 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1469
1470 if(argExp)
1471 {
1472 struct Declarator * decl;
1473 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1474
1475 FreeIdentifier(exp->member.member);
1476 ProcessExpressionType(argExp);
1477 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1478 exp->expType = ProcessType(specs, decl);
1479 exp->type = 5;
1480 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1481 }
1482 }
1483 }
1484 }
1485 }
1486 }
1487 }
1488 }
1489 }
1490
1491 extern int sprintf(char * , const char * , ...);
1492
1493 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1494
1495 extern char *  strcat(char * , const char * );
1496
1497 extern char *  __ecereNameSpace__ecere__sys__CopyString(const char *  string);
1498
1499 char * PrintInt(long long result)
1500 {
1501 char temp[100];
1502
1503 if(result > (((int)0x7fffffff)))
1504 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1505 else
1506 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1507 if(result > (((int)0x7fffffff)) || result < (((int)0x80000000)))
1508 strcat(temp, "LL");
1509 return __ecereNameSpace__ecere__sys__CopyString(temp);
1510 }
1511
1512 char * PrintUInt(uint64 result)
1513 {
1514 char temp[100];
1515
1516 if(result > (0xffffffff))
1517 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1518 else if(result > (((int)0x7fffffff)))
1519 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1520 else
1521 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1522 return __ecereNameSpace__ecere__sys__CopyString(temp);
1523 }
1524
1525 char * PrintInt64(long long result)
1526 {
1527 char temp[100];
1528
1529 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1530 return __ecereNameSpace__ecere__sys__CopyString(temp);
1531 }
1532
1533 char * PrintUInt64(uint64 result)
1534 {
1535 char temp[100];
1536
1537 if(result > (((long long)0x7fffffffffffffffLL)))
1538 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1539 else
1540 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1541 return __ecereNameSpace__ecere__sys__CopyString(temp);
1542 }
1543
1544 char * PrintHexUInt(uint64 result)
1545 {
1546 char temp[100];
1547
1548 if(result > (0xffffffff))
1549 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1550 else
1551 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1552 if(result > (0xffffffff))
1553 strcat(temp, "LL");
1554 return __ecereNameSpace__ecere__sys__CopyString(temp);
1555 }
1556
1557 char * PrintHexUInt64(uint64 result)
1558 {
1559 char temp[100];
1560
1561 if(result > (0xffffffff))
1562 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1563 else
1564 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1565 return __ecereNameSpace__ecere__sys__CopyString(temp);
1566 }
1567
1568 char * PrintShort(short result)
1569 {
1570 char temp[100];
1571
1572 sprintf(temp, "%d", (unsigned short)result);
1573 return __ecereNameSpace__ecere__sys__CopyString(temp);
1574 }
1575
1576 char * PrintUShort(unsigned short result)
1577 {
1578 char temp[100];
1579
1580 if(result > (unsigned short)32767)
1581 sprintf(temp, "0x%X", (int)result);
1582 else
1583 sprintf(temp, "%d", (int)result);
1584 return __ecereNameSpace__ecere__sys__CopyString(temp);
1585 }
1586
1587 extern int isprint(int c);
1588
1589 char * PrintChar(char result)
1590 {
1591 char temp[100];
1592
1593 if(result > (char)0 && isprint(result))
1594 sprintf(temp, "'%c'", result);
1595 else if(result < (char)0)
1596 sprintf(temp, "%d", (int)result);
1597 else
1598 sprintf(temp, "0x%X", (unsigned char)result);
1599 return __ecereNameSpace__ecere__sys__CopyString(temp);
1600 }
1601
1602 char * PrintUChar(unsigned char result)
1603 {
1604 char temp[100];
1605
1606 sprintf(temp, "0x%X", result);
1607 return __ecereNameSpace__ecere__sys__CopyString(temp);
1608 }
1609
1610 extern char *  strcpy(char * , const char * );
1611
1612 extern unsigned int (* __ecereProp_float_Get_isInf)(float this);
1613
1614 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_float_isInf;
1615
1616 extern int (* __ecereProp_float_Get_signBit)(float this);
1617
1618 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_float_signBit;
1619
1620 extern unsigned int (* __ecereProp_float_Get_isNan)(float this);
1621
1622 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_float_isNan;
1623
1624 char * PrintFloat(float result)
1625 {
1626 char temp[350];
1627
1628 if(__ecereProp_float_Get_isInf(result))
1629 {
1630 if(__ecereProp_float_Get_signBit(result))
1631 strcpy(temp, "-inf");
1632 else
1633 strcpy(temp, "inf");
1634 }
1635 else if(__ecereProp_float_Get_isNan(result))
1636 {
1637 if(__ecereProp_float_Get_signBit(result))
1638 strcpy(temp, "-nan");
1639 else
1640 strcpy(temp, "nan");
1641 }
1642 else
1643 sprintf(temp, "%.16ff", result);
1644 return __ecereNameSpace__ecere__sys__CopyString(temp);
1645 }
1646
1647 extern unsigned int (* __ecereProp_double_Get_isInf)(double this);
1648
1649 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_double_isInf;
1650
1651 extern int (* __ecereProp_double_Get_signBit)(double this);
1652
1653 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_double_signBit;
1654
1655 extern unsigned int (* __ecereProp_double_Get_isNan)(double this);
1656
1657 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_double_isNan;
1658
1659 char * PrintDouble(double result)
1660 {
1661 char temp[350];
1662
1663 if(__ecereProp_double_Get_isInf(result))
1664 {
1665 if(__ecereProp_double_Get_signBit(result))
1666 strcpy(temp, "-inf");
1667 else
1668 strcpy(temp, "inf");
1669 }
1670 else if(__ecereProp_double_Get_isNan(result))
1671 {
1672 if(__ecereProp_double_Get_signBit(result))
1673 strcpy(temp, "-nan");
1674 else
1675 strcpy(temp, "nan");
1676 }
1677 else
1678 sprintf(temp, "%.16f", result);
1679 return __ecereNameSpace__ecere__sys__CopyString(temp);
1680 }
1681
1682 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1683
1684 struct OpTable
1685 {
1686 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1687 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1688 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1689 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1690 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1691 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1692 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1693 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1694 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1695 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1696 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1697 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1698 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1699 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1700 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1701 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1702 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1703 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1704 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1705 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1706 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1707 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1708 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1709 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1710 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1711 unsigned int (*  Not)(struct Expression *, struct Operand *);
1712 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1713 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1714 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1715 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1716 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1717 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1718 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1719 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1720 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1721 } __attribute__ ((gcc_struct));
1722
1723 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1724
1725 struct Operand
1726 {
1727 int kind;
1728 struct Type * type;
1729 unsigned int ptrSize;
1730 union
1731 {
1732 char c;
1733 unsigned char uc;
1734 short s;
1735 unsigned short us;
1736 int i;
1737 unsigned int ui;
1738 float f;
1739 double d;
1740 long long i64;
1741 uint64 ui64;
1742 } __attribute__ ((gcc_struct));
1743 struct OpTable ops;
1744 } __attribute__ ((gcc_struct));
1745
1746 unsigned int GetOpInt(struct Operand * op2, int * value2)
1747 {
1748 if(op2->kind == 3 && op2->type->isSigned)
1749 *value2 = op2->i;
1750 else if(op2->kind == 3)
1751 *value2 = (int)op2->ui;
1752 else if(op2->kind == 4 && op2->type->isSigned)
1753 *value2 = (int)op2->i64;
1754 else if(op2->kind == 4)
1755 *value2 = (int)op2->ui64;
1756 else if(op2->kind == 23 && op2->type->isSigned)
1757 *value2 = (int)op2->i64;
1758 else if(op2->kind == 23)
1759 *value2 = (int)op2->ui64;
1760 else if(op2->kind == 22 && op2->type->isSigned)
1761 *value2 = (int)op2->i64;
1762 else if(op2->kind == 22)
1763 *value2 = (int)op2->ui64;
1764 else if(op2->kind == 2 && op2->type->isSigned)
1765 *value2 = (int)op2->s;
1766 else if(op2->kind == 2)
1767 *value2 = (int)op2->us;
1768 else if(op2->kind == 1 && op2->type->isSigned)
1769 *value2 = (int)op2->c;
1770 else if(op2->kind == 24 || op2->kind == 1)
1771 *value2 = (int)op2->uc;
1772 else if(op2->kind == 6)
1773 *value2 = (int)op2->f;
1774 else if(op2->kind == 7)
1775 *value2 = (int)op2->d;
1776 else if(op2->kind == 13)
1777 *value2 = (int)op2->ui64;
1778 else
1779 return 0x0;
1780 return 0x1;
1781 }
1782
1783 struct Operand GetOperand(struct Expression * exp);
1784
1785 unsigned int GetInt(struct Expression * exp, int * value2)
1786 {
1787 struct Operand op2 = GetOperand(exp);
1788
1789 return GetOpInt(&op2, value2);
1790 }
1791
1792 unsigned int GetOpUInt(struct Operand * op2, unsigned int * value2)
1793 {
1794 if(op2->kind == 3 && op2->type->isSigned)
1795 *value2 = (unsigned int)op2->i;
1796 else if(op2->kind == 3)
1797 *value2 = op2->ui;
1798 else if(op2->kind == 4 && op2->type->isSigned)
1799 *value2 = (unsigned int)op2->i64;
1800 else if(op2->kind == 4)
1801 *value2 = (unsigned int)op2->ui64;
1802 else if(op2->kind == 23 && op2->type->isSigned)
1803 *value2 = (unsigned int)op2->i64;
1804 else if(op2->kind == 23)
1805 *value2 = (unsigned int)op2->ui64;
1806 else if(op2->kind == 22 && op2->type->isSigned)
1807 *value2 = (unsigned int)op2->i64;
1808 else if(op2->kind == 22)
1809 *value2 = (unsigned int)op2->ui64;
1810 else if(op2->kind == 2 && op2->type->isSigned)
1811 *value2 = (unsigned int)op2->s;
1812 else if(op2->kind == 2)
1813 *value2 = (unsigned int)op2->us;
1814 else if(op2->kind == 1 && op2->type->isSigned)
1815 *value2 = (unsigned int)op2->c;
1816 else if(op2->kind == 24 || op2->kind == 1)
1817 *value2 = (unsigned int)op2->uc;
1818 else if(op2->kind == 6)
1819 *value2 = (unsigned int)op2->f;
1820 else if(op2->kind == 7)
1821 *value2 = (unsigned int)op2->d;
1822 else if(op2->kind == 13)
1823 *value2 = (unsigned int)op2->ui64;
1824 else
1825 return 0x0;
1826 return 0x1;
1827 }
1828
1829 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1830 {
1831 struct Operand op2 = GetOperand(exp);
1832
1833 return GetOpUInt(&op2, value2);
1834 }
1835
1836 unsigned int GetOpInt64(struct Operand * op2, long long * value2)
1837 {
1838 if(op2->kind == 3 && op2->type->isSigned)
1839 *value2 = (long long)op2->i;
1840 else if(op2->kind == 3)
1841 *value2 = (long long)op2->ui;
1842 else if(op2->kind == 4 && op2->type->isSigned)
1843 *value2 = op2->i64;
1844 else if(op2->kind == 4)
1845 *value2 = (long long)op2->ui64;
1846 else if(op2->kind == 23 && op2->type->isSigned)
1847 *value2 = op2->i64;
1848 else if(op2->kind == 23)
1849 *value2 = (long long)op2->ui64;
1850 else if(op2->kind == 22 && op2->type->isSigned)
1851 *value2 = op2->i64;
1852 else if(op2->kind == 22)
1853 *value2 = (long long)op2->ui64;
1854 else if(op2->kind == 2 && op2->type->isSigned)
1855 *value2 = (long long)op2->s;
1856 else if(op2->kind == 2)
1857 *value2 = (long long)op2->us;
1858 else if(op2->kind == 1 && op2->type->isSigned)
1859 *value2 = (long long)op2->c;
1860 else if(op2->kind == 24 || op2->kind == 1)
1861 *value2 = (long long)op2->uc;
1862 else if(op2->kind == 6)
1863 *value2 = (long long)op2->f;
1864 else if(op2->kind == 7)
1865 *value2 = (long long)op2->d;
1866 else if(op2->kind == 13)
1867 *value2 = (long long)op2->ui64;
1868 else
1869 return 0x0;
1870 return 0x1;
1871 }
1872
1873 unsigned int GetInt64(struct Expression * exp, long long * value2)
1874 {
1875 struct Operand op2 = GetOperand(exp);
1876
1877 return GetOpInt64(&op2, value2);
1878 }
1879
1880 unsigned int GetOpUInt64(struct Operand * op2, uint64 * value2)
1881 {
1882 if(op2->kind == 3 && op2->type->isSigned)
1883 *value2 = (uint64)op2->i;
1884 else if(op2->kind == 3)
1885 *value2 = (uint64)op2->ui;
1886 else if(op2->kind == 4 && op2->type->isSigned)
1887 *value2 = (uint64)op2->i64;
1888 else if(op2->kind == 4)
1889 *value2 = op2->ui64;
1890 else if(op2->kind == 23 && op2->type->isSigned)
1891 *value2 = (uint64)op2->i64;
1892 else if(op2->kind == 23)
1893 *value2 = op2->ui64;
1894 else if(op2->kind == 22 && op2->type->isSigned)
1895 *value2 = (uint64)op2->i64;
1896 else if(op2->kind == 22)
1897 *value2 = op2->ui64;
1898 else if(op2->kind == 2 && op2->type->isSigned)
1899 *value2 = (uint64)op2->s;
1900 else if(op2->kind == 2)
1901 *value2 = (uint64)op2->us;
1902 else if(op2->kind == 1 && op2->type->isSigned)
1903 *value2 = (uint64)op2->c;
1904 else if(op2->kind == 24 || op2->kind == 1)
1905 *value2 = (uint64)op2->uc;
1906 else if(op2->kind == 6)
1907 *value2 = (uint64)op2->f;
1908 else if(op2->kind == 7)
1909 *value2 = (uint64)op2->d;
1910 else if(op2->kind == 13)
1911 *value2 = op2->ui64;
1912 else
1913 return 0x0;
1914 return 0x1;
1915 }
1916
1917 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1918 {
1919 struct Operand op2 = GetOperand(exp);
1920
1921 return GetOpUInt64(&op2, value2);
1922 }
1923
1924 unsigned int GetOpIntPtr(struct Operand * op2, intptr_t * value2)
1925 {
1926 if(op2->kind == 3 && op2->type->isSigned)
1927 *value2 = (intptr_t)op2->i;
1928 else if(op2->kind == 3)
1929 *value2 = (intptr_t)op2->ui;
1930 else if(op2->kind == 4 && op2->type->isSigned)
1931 *value2 = (intptr_t)op2->i64;
1932 else if(op2->kind == 4)
1933 *value2 = (intptr_t)op2->ui64;
1934 else if(op2->kind == 23 && op2->type->isSigned)
1935 *value2 = (intptr_t)op2->i64;
1936 else if(op2->kind == 23)
1937 *value2 = (intptr_t)op2->ui64;
1938 else if(op2->kind == 22 && op2->type->isSigned)
1939 *value2 = (intptr_t)op2->i64;
1940 else if(op2->kind == 22)
1941 *value2 = (intptr_t)op2->ui64;
1942 else if(op2->kind == 2 && op2->type->isSigned)
1943 *value2 = (intptr_t)op2->s;
1944 else if(op2->kind == 2)
1945 *value2 = (intptr_t)op2->us;
1946 else if(op2->kind == 1 && op2->type->isSigned)
1947 *value2 = (intptr_t)op2->c;
1948 else if(op2->kind == 24 || op2->kind == 1)
1949 *value2 = (intptr_t)op2->uc;
1950 else if(op2->kind == 6)
1951 *value2 = (intptr_t)op2->f;
1952 else if(op2->kind == 7)
1953 *value2 = (intptr_t)op2->d;
1954 else if(op2->kind == 13)
1955 *value2 = (intptr_t)op2->ui64;
1956 else
1957 return 0x0;
1958 return 0x1;
1959 }
1960
1961 unsigned int GetIntPtr(struct Expression * exp, intptr_t * value2)
1962 {
1963 struct Operand op2 = GetOperand(exp);
1964
1965 return GetOpIntPtr(&op2, value2);
1966 }
1967
1968 unsigned int GetOpUIntPtr(struct Operand * op2, uintptr_t * value2)
1969 {
1970 if(op2->kind == 3 && op2->type->isSigned)
1971 *value2 = (uintptr_t)op2->i;
1972 else if(op2->kind == 3)
1973 *value2 = (uintptr_t)op2->ui;
1974 else if(op2->kind == 4 && op2->type->isSigned)
1975 *value2 = (uintptr_t)op2->i64;
1976 else if(op2->kind == 4)
1977 *value2 = (uintptr_t)op2->ui64;
1978 else if(op2->kind == 23 && op2->type->isSigned)
1979 *value2 = (uintptr_t)op2->i64;
1980 else if(op2->kind == 23)
1981 *value2 = (uintptr_t)op2->ui64;
1982 else if(op2->kind == 22 && op2->type->isSigned)
1983 *value2 = (uintptr_t)op2->i64;
1984 else if(op2->kind == 22)
1985 *value2 = (uintptr_t)op2->ui64;
1986 else if(op2->kind == 2 && op2->type->isSigned)
1987 *value2 = (uintptr_t)op2->s;
1988 else if(op2->kind == 2)
1989 *value2 = (uintptr_t)op2->us;
1990 else if(op2->kind == 1 && op2->type->isSigned)
1991 *value2 = (uintptr_t)op2->c;
1992 else if(op2->kind == 24 || op2->kind == 1)
1993 *value2 = (uintptr_t)op2->uc;
1994 else if(op2->kind == 6)
1995 *value2 = (uintptr_t)op2->f;
1996 else if(op2->kind == 7)
1997 *value2 = (uintptr_t)op2->d;
1998 else if(op2->kind == 13)
1999 *value2 = (uintptr_t)op2->ui64;
2000 else
2001 return 0x0;
2002 return 0x1;
2003 }
2004
2005 unsigned int GetUIntPtr(struct Expression * exp, uintptr_t * value2)
2006 {
2007 struct Operand op2 = GetOperand(exp);
2008
2009 return GetOpUIntPtr(&op2, value2);
2010 }
2011
2012 unsigned int GetOpIntSize(struct Operand * op2, ssize_t * value2)
2013 {
2014 if(op2->kind == 3 && op2->type->isSigned)
2015 *value2 = (ssize_t)op2->i;
2016 else if(op2->kind == 3)
2017 *value2 = (ssize_t)op2->ui;
2018 else if(op2->kind == 4 && op2->type->isSigned)
2019 *value2 = (ssize_t)op2->i64;
2020 else if(op2->kind == 4)
2021 *value2 = (ssize_t)op2->ui64;
2022 else if(op2->kind == 23 && op2->type->isSigned)
2023 *value2 = (ssize_t)op2->i64;
2024 else if(op2->kind == 23)
2025 *value2 = (ssize_t)op2->ui64;
2026 else if(op2->kind == 22 && op2->type->isSigned)
2027 *value2 = (ssize_t)op2->i64;
2028 else if(op2->kind == 22)
2029 *value2 = (ssize_t)op2->ui64;
2030 else if(op2->kind == 2 && op2->type->isSigned)
2031 *value2 = (ssize_t)op2->s;
2032 else if(op2->kind == 2)
2033 *value2 = (ssize_t)op2->us;
2034 else if(op2->kind == 1 && op2->type->isSigned)
2035 *value2 = (ssize_t)op2->c;
2036 else if(op2->kind == 24 || op2->kind == 1)
2037 *value2 = (ssize_t)op2->uc;
2038 else if(op2->kind == 6)
2039 *value2 = (ssize_t)op2->f;
2040 else if(op2->kind == 7)
2041 *value2 = (ssize_t)op2->d;
2042 else if(op2->kind == 13)
2043 *value2 = (ssize_t)op2->ui64;
2044 else
2045 return 0x0;
2046 return 0x1;
2047 }
2048
2049 unsigned int GetIntSize(struct Expression * exp, ssize_t * value2)
2050 {
2051 struct Operand op2 = GetOperand(exp);
2052
2053 return GetOpIntSize(&op2, value2);
2054 }
2055
2056 unsigned int GetOpUIntSize(struct Operand * op2, size_t * value2)
2057 {
2058 if(op2->kind == 3 && op2->type->isSigned)
2059 *value2 = (size_t)op2->i;
2060 else if(op2->kind == 3)
2061 *value2 = (size_t)op2->ui;
2062 else if(op2->kind == 4 && op2->type->isSigned)
2063 *value2 = (size_t)op2->i64;
2064 else if(op2->kind == 4)
2065 *value2 = (size_t)op2->ui64;
2066 else if(op2->kind == 23 && op2->type->isSigned)
2067 *value2 = (size_t)op2->i64;
2068 else if(op2->kind == 23)
2069 *value2 = (size_t)op2->ui64;
2070 else if(op2->kind == 22 && op2->type->isSigned)
2071 *value2 = (size_t)op2->i64;
2072 else if(op2->kind == 22)
2073 *value2 = (size_t)op2->ui64;
2074 else if(op2->kind == 2 && op2->type->isSigned)
2075 *value2 = (size_t)op2->s;
2076 else if(op2->kind == 2)
2077 *value2 = (size_t)op2->us;
2078 else if(op2->kind == 1 && op2->type->isSigned)
2079 *value2 = (size_t)op2->c;
2080 else if(op2->kind == 24 || op2->kind == 1)
2081 *value2 = (size_t)op2->uc;
2082 else if(op2->kind == 6)
2083 *value2 = (size_t)op2->f;
2084 else if(op2->kind == 7)
2085 *value2 = (size_t)op2->d;
2086 else if(op2->kind == 13)
2087 *value2 = (size_t)op2->ui64;
2088 else
2089 return 0x0;
2090 return 0x1;
2091 }
2092
2093 unsigned int GetUIntSize(struct Expression * exp, size_t * value2)
2094 {
2095 struct Operand op2 = GetOperand(exp);
2096
2097 return GetOpUIntSize(&op2, value2);
2098 }
2099
2100 unsigned int GetOpShort(struct Operand * op2, short * value2)
2101 {
2102 if(op2->kind == 3 && op2->type->isSigned)
2103 *value2 = (short)op2->i;
2104 else if(op2->kind == 3)
2105 *value2 = (short)op2->ui;
2106 else if(op2->kind == 4 && op2->type->isSigned)
2107 *value2 = (short)op2->i64;
2108 else if(op2->kind == 4)
2109 *value2 = (short)op2->ui64;
2110 else if(op2->kind == 23 && op2->type->isSigned)
2111 *value2 = (short)op2->i64;
2112 else if(op2->kind == 23)
2113 *value2 = (short)op2->ui64;
2114 else if(op2->kind == 22 && op2->type->isSigned)
2115 *value2 = (short)op2->i64;
2116 else if(op2->kind == 22)
2117 *value2 = (short)op2->ui64;
2118 else if(op2->kind == 2 && op2->type->isSigned)
2119 *value2 = op2->s;
2120 else if(op2->kind == 2)
2121 *value2 = (short)op2->us;
2122 else if(op2->kind == 1 && op2->type->isSigned)
2123 *value2 = (short)op2->c;
2124 else if(op2->kind == 24 || op2->kind == 1)
2125 *value2 = (short)op2->uc;
2126 else if(op2->kind == 6)
2127 *value2 = (short)op2->f;
2128 else if(op2->kind == 7)
2129 *value2 = (short)op2->d;
2130 else if(op2->kind == 13)
2131 *value2 = (short)op2->ui64;
2132 else
2133 return 0x0;
2134 return 0x1;
2135 }
2136
2137 unsigned int GetShort(struct Expression * exp, short * value2)
2138 {
2139 struct Operand op2 = GetOperand(exp);
2140
2141 return GetOpShort(&op2, value2);
2142 }
2143
2144 unsigned int GetOpUShort(struct Operand * op2, unsigned short * value2)
2145 {
2146 if(op2->kind == 3 && op2->type->isSigned)
2147 *value2 = (unsigned short)op2->i;
2148 else if(op2->kind == 3)
2149 *value2 = (unsigned short)op2->ui;
2150 else if(op2->kind == 4 && op2->type->isSigned)
2151 *value2 = (unsigned short)op2->i64;
2152 else if(op2->kind == 4)
2153 *value2 = (unsigned short)op2->ui64;
2154 else if(op2->kind == 23 && op2->type->isSigned)
2155 *value2 = (unsigned short)op2->i64;
2156 else if(op2->kind == 23)
2157 *value2 = (unsigned short)op2->ui64;
2158 else if(op2->kind == 22 && op2->type->isSigned)
2159 *value2 = (unsigned short)op2->i64;
2160 else if(op2->kind == 22)
2161 *value2 = (unsigned short)op2->ui64;
2162 else if(op2->kind == 2 && op2->type->isSigned)
2163 *value2 = (unsigned short)op2->s;
2164 else if(op2->kind == 2)
2165 *value2 = op2->us;
2166 else if(op2->kind == 1 && op2->type->isSigned)
2167 *value2 = (unsigned short)op2->c;
2168 else if(op2->kind == 24 || op2->kind == 1)
2169 *value2 = (unsigned short)op2->uc;
2170 else if(op2->kind == 6)
2171 *value2 = (unsigned short)op2->f;
2172 else if(op2->kind == 7)
2173 *value2 = (unsigned short)op2->d;
2174 else if(op2->kind == 13)
2175 *value2 = (unsigned short)op2->ui64;
2176 else
2177 return 0x0;
2178 return 0x1;
2179 }
2180
2181 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
2182 {
2183 struct Operand op2 = GetOperand(exp);
2184
2185 return GetOpUShort(&op2, value2);
2186 }
2187
2188 unsigned int GetOpChar(struct Operand * op2, char * value2)
2189 {
2190 if(op2->kind == 3 && op2->type->isSigned)
2191 *value2 = (char)op2->i;
2192 else if(op2->kind == 3)
2193 *value2 = (char)op2->ui;
2194 else if(op2->kind == 4 && op2->type->isSigned)
2195 *value2 = (char)op2->i64;
2196 else if(op2->kind == 4)
2197 *value2 = (char)op2->ui64;
2198 else if(op2->kind == 23 && op2->type->isSigned)
2199 *value2 = (char)op2->i64;
2200 else if(op2->kind == 23)
2201 *value2 = (char)op2->ui64;
2202 else if(op2->kind == 22 && op2->type->isSigned)
2203 *value2 = (char)op2->i64;
2204 else if(op2->kind == 22)
2205 *value2 = (char)op2->ui64;
2206 else if(op2->kind == 2 && op2->type->isSigned)
2207 *value2 = (char)op2->s;
2208 else if(op2->kind == 2)
2209 *value2 = (char)op2->us;
2210 else if(op2->kind == 1 && op2->type->isSigned)
2211 *value2 = op2->c;
2212 else if(op2->kind == 24 || op2->kind == 1)
2213 *value2 = (char)op2->uc;
2214 else if(op2->kind == 6)
2215 *value2 = (char)op2->f;
2216 else if(op2->kind == 7)
2217 *value2 = (char)op2->d;
2218 else if(op2->kind == 13)
2219 *value2 = (char)op2->ui64;
2220 else
2221 return 0x0;
2222 return 0x1;
2223 }
2224
2225 unsigned int GetChar(struct Expression * exp, char * value2)
2226 {
2227 struct Operand op2 = GetOperand(exp);
2228
2229 return GetOpChar(&op2, value2);
2230 }
2231
2232 unsigned int GetOpUChar(struct Operand * op2, unsigned char * value2)
2233 {
2234 if(op2->kind == 3 && op2->type->isSigned)
2235 *value2 = (unsigned char)op2->i;
2236 else if(op2->kind == 3)
2237 *value2 = (unsigned char)op2->ui;
2238 else if(op2->kind == 4 && op2->type->isSigned)
2239 *value2 = (unsigned char)op2->i64;
2240 else if(op2->kind == 4)
2241 *value2 = (unsigned char)op2->ui64;
2242 else if(op2->kind == 23 && op2->type->isSigned)
2243 *value2 = (unsigned char)op2->i64;
2244 else if(op2->kind == 23)
2245 *value2 = (unsigned char)op2->ui64;
2246 else if(op2->kind == 22 && op2->type->isSigned)
2247 *value2 = (unsigned char)op2->i64;
2248 else if(op2->kind == 22)
2249 *value2 = (unsigned char)op2->ui64;
2250 else if(op2->kind == 2 && op2->type->isSigned)
2251 *value2 = (unsigned char)op2->s;
2252 else if(op2->kind == 2)
2253 *value2 = (unsigned char)op2->us;
2254 else if(op2->kind == 1 && op2->type->isSigned)
2255 *value2 = (unsigned char)op2->c;
2256 else if(op2->kind == 24 || op2->kind == 1)
2257 *value2 = op2->uc;
2258 else if(op2->kind == 6)
2259 *value2 = (unsigned char)op2->f;
2260 else if(op2->kind == 7)
2261 *value2 = (unsigned char)op2->d;
2262 else if(op2->kind == 13)
2263 *value2 = (unsigned char)op2->ui64;
2264 else
2265 return 0x0;
2266 return 0x1;
2267 }
2268
2269 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
2270 {
2271 struct Operand op2 = GetOperand(exp);
2272
2273 return GetOpUChar(&op2, value2);
2274 }
2275
2276 unsigned int GetOpFloat(struct Operand * op2, float * value2)
2277 {
2278 if(op2->kind == 3 && op2->type->isSigned)
2279 *value2 = (float)(float)op2->i;
2280 else if(op2->kind == 3)
2281 *value2 = (float)(float)op2->ui;
2282 else if(op2->kind == 4 && op2->type->isSigned)
2283 *value2 = (float)(float)op2->i64;
2284 else if(op2->kind == 4)
2285 *value2 = (float)(float)op2->ui64;
2286 else if(op2->kind == 23 && op2->type->isSigned)
2287 *value2 = (float)(float)op2->i64;
2288 else if(op2->kind == 23)
2289 *value2 = (float)(float)op2->ui64;
2290 else if(op2->kind == 22 && op2->type->isSigned)
2291 *value2 = (float)(float)op2->i64;
2292 else if(op2->kind == 22)
2293 *value2 = (float)(float)op2->ui64;
2294 else if(op2->kind == 2 && op2->type->isSigned)
2295 *value2 = (float)(float)op2->s;
2296 else if(op2->kind == 2)
2297 *value2 = (float)(float)op2->us;
2298 else if(op2->kind == 1 && op2->type->isSigned)
2299 *value2 = (float)(float)op2->c;
2300 else if(op2->kind == 24 || op2->kind == 1)
2301 *value2 = (float)(float)op2->uc;
2302 else if(op2->kind == 6)
2303 *value2 = (float)op2->f;
2304 else if(op2->kind == 7)
2305 *value2 = (float)op2->d;
2306 else if(op2->kind == 13)
2307 *value2 = (float)(float)op2->ui64;
2308 else
2309 return 0x0;
2310 return 0x1;
2311 }
2312
2313 unsigned int GetFloat(struct Expression * exp, float * value2)
2314 {
2315 struct Operand op2 = GetOperand(exp);
2316
2317 return GetOpFloat(&op2, value2);
2318 }
2319
2320 unsigned int GetOpDouble(struct Operand * op2, double * value2)
2321 {
2322 if(op2->kind == 3 && op2->type->isSigned)
2323 *value2 = (double)(double)op2->i;
2324 else if(op2->kind == 3)
2325 *value2 = (double)(double)op2->ui;
2326 else if(op2->kind == 4 && op2->type->isSigned)
2327 *value2 = (double)(double)op2->i64;
2328 else if(op2->kind == 4)
2329 *value2 = (double)(double)op2->ui64;
2330 else if(op2->kind == 23 && op2->type->isSigned)
2331 *value2 = (double)(double)op2->i64;
2332 else if(op2->kind == 23)
2333 *value2 = (double)(double)op2->ui64;
2334 else if(op2->kind == 22 && op2->type->isSigned)
2335 *value2 = (double)(double)op2->i64;
2336 else if(op2->kind == 22)
2337 *value2 = (double)(double)op2->ui64;
2338 else if(op2->kind == 2 && op2->type->isSigned)
2339 *value2 = (double)(double)op2->s;
2340 else if(op2->kind == 2)
2341 *value2 = (double)(double)op2->us;
2342 else if(op2->kind == 1 && op2->type->isSigned)
2343 *value2 = (double)(double)op2->c;
2344 else if(op2->kind == 24 || op2->kind == 1)
2345 *value2 = (double)(double)op2->uc;
2346 else if(op2->kind == 6)
2347 *value2 = (double)op2->f;
2348 else if(op2->kind == 7)
2349 *value2 = (double)op2->d;
2350 else if(op2->kind == 13)
2351 *value2 = (double)(double)op2->ui64;
2352 else
2353 return 0x0;
2354 return 0x1;
2355 }
2356
2357 unsigned int GetDouble(struct Expression * exp, double * value2)
2358 {
2359 struct Operand op2 = GetOperand(exp);
2360
2361 return GetOpDouble(&op2, value2);
2362 }
2363
2364 void ComputeExpression(struct Expression * exp);
2365
2366 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2367
2368 extern int targetBits;
2369
2370 int ComputeTypeSize(struct Type * type);
2371
2372 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2373
2374 struct __ecereNameSpace__ecere__com__BitMember
2375 {
2376 struct __ecereNameSpace__ecere__com__BitMember * prev;
2377 struct __ecereNameSpace__ecere__com__BitMember * next;
2378 const char *  name;
2379 unsigned int isProperty;
2380 int memberAccess;
2381 int id;
2382 struct __ecereNameSpace__ecere__com__Class * _class;
2383 const char *  dataTypeString;
2384 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2385 struct Type * dataType;
2386 int type;
2387 int size;
2388 int pos;
2389 uint64 mask;
2390 } __attribute__ ((gcc_struct));
2391
2392 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2393
2394 struct __ecereNameSpace__ecere__sys__OldLink
2395 {
2396 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2397 struct __ecereNameSpace__ecere__sys__OldLink * next;
2398 void *  data;
2399 } __attribute__ ((gcc_struct));
2400
2401 void FinishTemplatesContext(struct Context * context);
2402
2403 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2404 {
2405 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2406 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2407
2408 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))
2409 {
2410 int unionMemberOffset = 0;
2411 int bitFields = 0;
2412
2413 if(member)
2414 {
2415 member->memberOffset = 0;
2416 if(targetBits < sizeof(void *) * 8)
2417 member->structAlignment = 0;
2418 }
2419 else if(targetBits < sizeof(void *) * 8)
2420 _class->structAlignment = 0;
2421 if(!member && ((_class->type == 0 || _class->type == 5) || (_class->type == 1 && _class->memberOffset && _class->memberOffset > _class->base->structSize)))
2422 _class->memberOffset = (_class->base && _class->type == 1) ? _class->base->structSize : 0;
2423 if(!member && _class->destructionWatchOffset)
2424 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2425 {
2426 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2427
2428 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2429 {
2430 if(!dataMember->isProperty)
2431 {
2432 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2433 {
2434 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2435 }
2436 }
2437 }
2438 }
2439 {
2440 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2441
2442 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2443 {
2444 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2445 {
2446 if(!isMember && _class->type == 2 && dataMember->dataType)
2447 {
2448 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2449 uint64 mask = 0;
2450 int d;
2451
2452 ComputeTypeSize(dataMember->dataType);
2453 if(bitMember->pos == -1)
2454 bitMember->pos = _class->memberOffset;
2455 if(!bitMember->size)
2456 bitMember->size = dataMember->dataType->size * 8;
2457 _class->memberOffset = bitMember->pos + bitMember->size;
2458 for(d = 0; d < bitMember->size; d++)
2459 {
2460 if(d)
2461 mask <<= 1;
2462 mask |= 1;
2463 }
2464 bitMember->mask = mask << bitMember->pos;
2465 }
2466 else if(dataMember->type == 0 && dataMember->dataType)
2467 {
2468 int size;
2469 int alignment = 0;
2470
2471 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2472 ComputeTypeSize(dataMember->dataType);
2473 if(dataMember->dataType->bitFieldCount)
2474 {
2475 bitFields += dataMember->dataType->bitFieldCount;
2476 size = 0;
2477 }
2478 else
2479 {
2480 if(bitFields)
2481 {
2482 int size = (bitFields + 7) / 8;
2483
2484 if(isMember)
2485 {
2486 int __simpleStruct0;
2487
2488 if(alignment)
2489 {
2490 int __simpleStruct0;
2491
2492 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2493 if(member->memberOffset % alignment)
2494 member->memberOffset += alignment - (member->memberOffset % alignment);
2495 }
2496 dataMember->offset = member->memberOffset;
2497 if(member->type == 1)
2498 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2499 else
2500 {
2501 member->memberOffset += size;
2502 }
2503 }
2504 else
2505 {
2506 if(alignment)
2507 {
2508 int __simpleStruct0;
2509
2510 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2511 if(_class->memberOffset % alignment)
2512 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2513 }
2514 dataMember->offset = _class->memberOffset;
2515 _class->memberOffset += size;
2516 }
2517 bitFields = 0;
2518 }
2519 size = dataMember->dataType->size;
2520 alignment = dataMember->dataType->alignment;
2521 }
2522 if(isMember)
2523 {
2524 int __simpleStruct0;
2525
2526 if(alignment)
2527 {
2528 int __simpleStruct0;
2529
2530 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2531 if(member->memberOffset % alignment)
2532 member->memberOffset += alignment - (member->memberOffset % alignment);
2533 }
2534 dataMember->offset = member->memberOffset;
2535 if(member->type == 1)
2536 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2537 else
2538 {
2539 member->memberOffset += size;
2540 }
2541 }
2542 else
2543 {
2544 if(alignment)
2545 {
2546 int __simpleStruct0;
2547
2548 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2549 if(_class->memberOffset % alignment)
2550 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2551 }
2552 dataMember->offset = _class->memberOffset;
2553 _class->memberOffset += size;
2554 }
2555 }
2556 else
2557 {
2558 int alignment;
2559
2560 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2561 alignment = dataMember->structAlignment;
2562 if(isMember)
2563 {
2564 int __simpleStruct0;
2565
2566 if(alignment)
2567 {
2568 int __simpleStruct0;
2569
2570 if(member->memberOffset % alignment)
2571 member->memberOffset += alignment - (member->memberOffset % alignment);
2572 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2573 }
2574 dataMember->offset = member->memberOffset;
2575 if(member->type == 1)
2576 unionMemberOffset = (__simpleStruct0 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2577 else
2578 member->memberOffset += dataMember->memberOffset;
2579 }
2580 else
2581 {
2582 if(alignment)
2583 {
2584 int __simpleStruct0;
2585
2586 if(_class->memberOffset % alignment)
2587 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2588 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2589 }
2590 dataMember->offset = _class->memberOffset;
2591 _class->memberOffset += dataMember->memberOffset;
2592 }
2593 }
2594 }
2595 }
2596 if(bitFields)
2597 {
2598 int alignment = 0;
2599 int size = (bitFields + 7) / 8;
2600
2601 if(isMember)
2602 {
2603 int __simpleStruct0;
2604
2605 if(alignment)
2606 {
2607 int __simpleStruct0;
2608
2609 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2610 if(member->memberOffset % alignment)
2611 member->memberOffset += alignment - (member->memberOffset % alignment);
2612 }
2613 if(member->type == 1)
2614 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2615 else
2616 {
2617 member->memberOffset += size;
2618 }
2619 }
2620 else
2621 {
2622 if(alignment)
2623 {
2624 int __simpleStruct0;
2625
2626 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2627 if(_class->memberOffset % alignment)
2628 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2629 }
2630 _class->memberOffset += size;
2631 }
2632 bitFields = 0;
2633 }
2634 }
2635 if(member && member->type == 1)
2636 {
2637 member->memberOffset = unionMemberOffset;
2638 }
2639 if(!isMember)
2640 {
2641 if(_class->type != 2)
2642 {
2643 int extra = 0;
2644
2645 if(_class->structAlignment)
2646 {
2647 if(_class->memberOffset % _class->structAlignment)
2648 extra += _class->structAlignment - (_class->memberOffset % _class->structAlignment);
2649 }
2650 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset + extra;
2651 if(!member)
2652 {
2653 struct __ecereNameSpace__ecere__com__Property * prop;
2654
2655 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2656 {
2657 if(prop->isProperty && prop->isWatchable)
2658 {
2659 prop->watcherOffset = _class->structSize;
2660 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2661 }
2662 }
2663 }
2664 {
2665 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2666
2667 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2668 {
2669 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2670
2671 if(deriv->computeSize)
2672 {
2673 deriv->offset = _class->structSize;
2674 deriv->memberOffset = 0;
2675 deriv->structSize = deriv->offset;
2676 ComputeClassMembers(deriv, 0x0);
2677 }
2678 }
2679 }
2680 }
2681 }
2682 }
2683 if(context)
2684 FinishTemplatesContext(context);
2685 }
2686
2687 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2688
2689 struct __ecereNameSpace__ecere__com__NameSpace
2690 {
2691 const char *  name;
2692 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2693 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2694 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2695 int depth;
2696 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2697 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2698 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2699 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2700 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2701 } __attribute__ ((gcc_struct));
2702
2703 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2704
2705 struct __ecereNameSpace__ecere__com__Module
2706 {
2707 struct __ecereNameSpace__ecere__com__Instance * application;
2708 struct __ecereNameSpace__ecere__sys__OldList classes;
2709 struct __ecereNameSpace__ecere__sys__OldList defines;
2710 struct __ecereNameSpace__ecere__sys__OldList functions;
2711 struct __ecereNameSpace__ecere__sys__OldList modules;
2712 struct __ecereNameSpace__ecere__com__Instance * prev;
2713 struct __ecereNameSpace__ecere__com__Instance * next;
2714 const char *  name;
2715 void *  library;
2716 void *  Unload;
2717 int importType;
2718 int origImportType;
2719 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2720 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2721 } __attribute__ ((gcc_struct));
2722
2723 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2724 {
2725 struct __ecereNameSpace__ecere__com__Class * _class;
2726 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2727
2728 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
2729 ComputeModuleClasses(subModule->data);
2730 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->classes.first; _class; _class = _class->next)
2731 ComputeClassMembers(_class, 0x0);
2732 }
2733
2734 extern unsigned int inCompiler;
2735
2736 extern void Compiler_Error(const char *  format, ...);
2737
2738 extern const char *  __ecereNameSpace__ecere__GetTranslatedString(const char * name, const char *  string, const char *  stringAndContext);
2739
2740 int ComputeTypeSize(struct Type * type)
2741 {
2742 unsigned int size = type ? type->size : 0;
2743
2744 if(!size && type && !type->computing)
2745 {
2746 type->computing = 0x1;
2747 switch(type->kind)
2748 {
2749 case 24:
2750 type->alignment = size = sizeof(char);
2751 break;
2752 case 1:
2753 type->alignment = size = sizeof(char);
2754 break;
2755 case 3:
2756 type->alignment = size = sizeof(int);
2757 break;
2758 case 4:
2759 type->alignment = size = sizeof(long long);
2760 break;
2761 case 22:
2762 type->alignment = size = targetBits / 8;
2763 break;
2764 case 23:
2765 type->alignment = size = targetBits / 8;
2766 break;
2767 case 5:
2768 type->alignment = size = sizeof(long);
2769 break;
2770 case 2:
2771 type->alignment = size = sizeof(short);
2772 break;
2773 case 6:
2774 type->alignment = size = sizeof(float);
2775 break;
2776 case 7:
2777 type->alignment = size = sizeof(double);
2778 break;
2779 case 8:
2780 {
2781 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2782
2783 if(_class && _class->type == 1)
2784 {
2785 ComputeClassMembers(_class, 0x0);
2786 type->alignment = _class->structAlignment;
2787 size = _class->structSize;
2788 if(type->alignment && size % type->alignment)
2789 size += type->alignment - (size % type->alignment);
2790 }
2791 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2792 {
2793 if(!_class->dataType)
2794 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2795 size = type->alignment = ComputeTypeSize(_class->dataType);
2796 }
2797 else
2798 size = type->alignment = targetBits / 8;
2799 break;
2800 }
2801 case 13:
2802 case 19:
2803 size = type->alignment = targetBits / 8;
2804 break;
2805 case 12:
2806 if(type->arraySizeExp)
2807 {
2808 ProcessExpressionType(type->arraySizeExp);
2809 ComputeExpression(type->arraySizeExp);
2810 if(!type->arraySizeExp->isConstant || (type->arraySizeExp->expType->kind != 3 && type->arraySizeExp->expType->kind != 2 && type->arraySizeExp->expType->kind != 1 && type->arraySizeExp->expType->kind != 5 && type->arraySizeExp->expType->kind != 4 && type->arraySizeExp->expType->kind != 23 && type->arraySizeExp->expType->kind != 22 && type->arraySizeExp->expType->kind != 15 && (type->arraySizeExp->expType->kind != 8 || !type->arraySizeExp->expType->_class->registered || type->arraySizeExp->expType->_class->registered->type != 4)))
2811 {
2812 struct Location oldLoc = yylloc;
2813 char expression[10240];
2814
2815 expression[0] = '\0';
2816 type->arraySizeExp->expType = (((void *)0));
2817 yylloc = type->arraySizeExp->loc;
2818 if(inCompiler)
2819 PrintExpression(type->arraySizeExp, expression);
2820 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Array size not constant int (%s)\n", (((void *)0))), expression);
2821 yylloc = oldLoc;
2822 }
2823 GetInt(type->arraySizeExp, &type->arraySize);
2824 }
2825 else if(type->enumClass)
2826 {
2827 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2828 {
2829 type->arraySize = (int)__ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2830 }
2831 else
2832 type->arraySize = 0;
2833 }
2834 else
2835 {
2836 type->arraySize = 0;
2837 }
2838 size = ComputeTypeSize(type->type) * type->arraySize;
2839 if(type->type)
2840 type->alignment = type->type->alignment;
2841 break;
2842 case 9:
2843 {
2844 struct Type * member;
2845
2846 for(member = type->members.first; member; member = member->next)
2847 {
2848 int __simpleStruct0, __simpleStruct1;
2849 unsigned int addSize = ComputeTypeSize(member);
2850
2851 member->offset = size;
2852 if(member->alignment && size % member->alignment)
2853 member->offset += member->alignment - (size % member->alignment);
2854 size = member->offset;
2855 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2856 size += addSize;
2857 }
2858 if(type->alignment && size % type->alignment)
2859 size += type->alignment - (size % type->alignment);
2860 break;
2861 }
2862 case 10:
2863 {
2864 struct Type * member;
2865
2866 for(member = type->members.first; member; member = member->next)
2867 {
2868 int __simpleStruct0, __simpleStruct1;
2869 unsigned int addSize = ComputeTypeSize(member);
2870
2871 member->offset = size;
2872 if(member->alignment && size % member->alignment)
2873 member->offset += member->alignment - (size % member->alignment);
2874 size = member->offset;
2875 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2876 size = ((size > addSize) ? size : addSize);
2877 }
2878 if(type->alignment && size % type->alignment)
2879 size += type->alignment - (size % type->alignment);
2880 break;
2881 }
2882 case 20:
2883 {
2884 struct TemplateParameter * param = type->templateParameter;
2885 struct Type * baseType = ProcessTemplateParameterType(param);
2886
2887 if(baseType)
2888 {
2889 size = ComputeTypeSize(baseType);
2890 type->alignment = baseType->alignment;
2891 }
2892 else
2893 type->alignment = size = sizeof(uint64);
2894 break;
2895 }
2896 case 15:
2897 {
2898 type->alignment = size = sizeof(enum
2899 {
2900 test
2901 });
2902 break;
2903 }
2904 case 21:
2905 {
2906 type->alignment = size = targetBits / 8;
2907 break;
2908 }
2909 }
2910 type->size = size;
2911 type->computing = 0x0;
2912 }
2913 return size;
2914 }
2915
2916 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2917
2918 extern struct Identifier * MkIdentifier(const char *  string);
2919
2920 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2921
2922 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2923
2924 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2925
2926 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2927
2928 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2929
2930 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2931
2932 extern void FreeType(struct Type * type);
2933
2934 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2935
2936 extern struct Specifier * MkSpecifier(int specifier);
2937
2938 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2939
2940 extern struct Expression * MkExpConstant(const char *  string);
2941
2942 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)
2943 {
2944 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2945 unsigned int totalSize = 0;
2946 unsigned int maxSize = 0;
2947 int alignment;
2948 unsigned int size;
2949 struct __ecereNameSpace__ecere__com__DataMember * member;
2950 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2951
2952 if(addedPadding)
2953 *addedPadding = 0x0;
2954 if(!isMember && _class->base)
2955 {
2956 maxSize = _class->structSize;
2957 {
2958 if(_class->type == 1 || _class->type == 5)
2959 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass, (((void *)0)));
2960 else
2961 {
2962 unsigned int baseSize = _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2963
2964 if(maxSize > baseSize)
2965 maxSize -= baseSize;
2966 else
2967 maxSize = 0;
2968 }
2969 }
2970 }
2971 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2972 {
2973 if(!member->isProperty)
2974 {
2975 switch(member->type)
2976 {
2977 case 0:
2978 {
2979 if(member->dataTypeString)
2980 {
2981 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2982 struct Declarator * decl;
2983
2984 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2985 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2986 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2987 if(!member->dataType)
2988 member->dataType = ProcessType(specs, decl);
2989 ReplaceThisClassSpecifiers(specs, topClass);
2990 {
2991 struct Type * type = ProcessType(specs, decl);
2992
2993 DeclareType(member->dataType, 0x0, 0x0);
2994 FreeType(type);
2995 }
2996 ComputeTypeSize(member->dataType);
2997 size = member->dataType->size;
2998 alignment = member->dataType->alignment;
2999 if(alignment)
3000 {
3001 if(totalSize % alignment)
3002 totalSize += alignment - (totalSize % alignment);
3003 }
3004 totalSize += size;
3005 }
3006 break;
3007 }
3008 case 1:
3009 case 2:
3010 {
3011 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
3012
3013 size = 0;
3014 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass, (((void *)0)));
3015 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
3016 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
3017 alignment = member->structAlignment;
3018 if(alignment)
3019 {
3020 if(totalSize % alignment)
3021 totalSize += alignment - (totalSize % alignment);
3022 }
3023 totalSize += size;
3024 break;
3025 }
3026 }
3027 }
3028 }
3029 if(retSize)
3030 {
3031 unsigned int __simpleStruct0;
3032
3033 if(topMember && topMember->type == 1)
3034 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
3035 else
3036 *retSize += totalSize;
3037 }
3038 else if(totalSize < maxSize && _class->type != 1000)
3039 {
3040 int autoPadding = 0;
3041
3042 if(!isMember && _class->structAlignment && totalSize % _class->structAlignment)
3043 autoPadding = _class->structAlignment - (totalSize % _class->structAlignment);
3044 if(totalSize + autoPadding < maxSize)
3045 {
3046 char sizeString[50];
3047
3048 sprintf(sizeString, "%d", maxSize - totalSize);
3049 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
3050 if(addedPadding)
3051 *addedPadding = 0x1;
3052 }
3053 }
3054 if(context)
3055 FinishTemplatesContext(context);
3056 return topMember ? topMember->memberID : _class->memberID;
3057 }
3058
3059 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
3060 {
3061 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
3062 struct __ecereNameSpace__ecere__com__DataMember * member;
3063 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
3064
3065 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
3066 DeclareMembers(_class->base, 0x0);
3067 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
3068 {
3069 if(!member->isProperty)
3070 {
3071 switch(member->type)
3072 {
3073 case 0:
3074 {
3075 if(!member->dataType && member->dataTypeString)
3076 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
3077 if(member->dataType)
3078 DeclareType(member->dataType, 0x0, 0x0);
3079 break;
3080 }
3081 case 1:
3082 case 2:
3083 {
3084 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
3085 break;
3086 }
3087 }
3088 }
3089 }
3090 if(context)
3091 FinishTemplatesContext(context);
3092 return topMember ? topMember->memberID : _class->memberID;
3093 }
3094
3095 extern struct Symbol * FindClass(const char *  name);
3096
3097 extern char *  strchr(const char * , int);
3098
3099 extern void FullClassNameCat(char *  output, const char *  className, unsigned int includeTemplateParams);
3100
3101 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (*  FreeFunction)(void * ));
3102
3103 extern void FreeClassDef(struct ClassDef * def);
3104
3105 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
3106
3107 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
3108
3109 extern void MangleClassName(char *  className);
3110
3111 extern void DeclareClass(struct Symbol * classSym, const char *  className);
3112
3113 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
3114
3115 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
3116
3117 void DeclareStruct(const char * name, unsigned int skipNoHead)
3118 {
3119 struct External * external = (((void *)0));
3120 struct Symbol * classSym = FindClass(name);
3121
3122 if(!inCompiler || !classSym)
3123 return ;
3124 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
3125 return ;
3126 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
3127 {
3128 struct Declaration * decl;
3129 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3130 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
3131 char structName[1024];
3132 struct Specifier * spec = (((void *)0));
3133
3134 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
3135 classSym->declaring++;
3136 if(strchr(classSym->string, '<'))
3137 {
3138 if(classSym->registered->templateClass)
3139 {
3140 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
3141 classSym->declaring--;
3142 }
3143 return ;
3144 }
3145 DeclareMembers(classSym->registered, 0x0);
3146 structName[0] = (char)0;
3147 FullClassNameCat(structName, name, 0x0);
3148 if(external && external->declaration && external->declaration->specifiers)
3149 {
3150 for(spec = (*external->declaration->specifiers).first; spec; spec = spec->next)
3151 {
3152 if(spec->type == 3 || spec->type == 4)
3153 break;
3154 }
3155 }
3156 if(!skipNoHead && (!spec || !spec->definitions))
3157 {
3158 unsigned int addedPadding = 0x0;
3159
3160 classSym->declaredStructSym = 0x1;
3161 declarations = MkList();
3162 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered, &addedPadding);
3163 if(!(*declarations).count || ((*declarations).count == 1 && addedPadding))
3164 {
3165 FreeList(declarations, FreeClassDef);
3166 declarations = (((void *)0));
3167 }
3168 }
3169 if(skipNoHead || declarations)
3170 {
3171 if(spec)
3172 {
3173 if(declarations)
3174 spec->definitions = declarations;
3175 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3176 {
3177 if(classSym->structExternal)
3178 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3179 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3180 classSym->id = curExternal->symbol->idCode;
3181 classSym->idCode = curExternal->symbol->idCode;
3182 }
3183 }
3184 else
3185 {
3186 if(!external)
3187 external = MkExternalDeclaration((((void *)0)));
3188 specifiers = MkList();
3189 declarators = MkList();
3190 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
3191 external->declaration = decl = MkDeclaration(specifiers, declarators);
3192 if(decl->symbol && !decl->symbol->pointerExternal)
3193 decl->symbol->pointerExternal = external;
3194 if(classSym->registered && classSym->registered->type == 1)
3195 {
3196 char className[1024];
3197
3198 strcpy(className, "__ecereClass_");
3199 FullClassNameCat(className, classSym->string, 0x1);
3200 MangleClassName(className);
3201 DeclareClass(classSym, className);
3202 external->symbol = classSym;
3203 classSym->pointerExternal = external;
3204 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3205 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3206 }
3207 else
3208 {
3209 char className[1024];
3210
3211 strcpy(className, "__ecereClass_");
3212 FullClassNameCat(className, classSym->string, 0x1);
3213 MangleClassName(className);
3214 classSym->structExternal = external;
3215 DeclareClass(classSym, className);
3216 external->symbol = classSym;
3217 }
3218 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
3219 }
3220 }
3221 classSym->declaring--;
3222 }
3223 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3224 {
3225 classSym->declaring++;
3226 {
3227 if(classSym->registered)
3228 DeclareMembers(classSym->registered, 0x0);
3229 }
3230 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
3231 {
3232 if(classSym->structExternal)
3233 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3234 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3235 classSym->id = curExternal->symbol->idCode;
3236 classSym->idCode = curExternal->symbol->idCode;
3237 }
3238 classSym->declaring--;
3239 }
3240 }
3241
3242 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
3243
3244 extern struct ModuleImport * mainModule;
3245
3246 extern struct Specifier * MkSpecifierName(const char *  name);
3247
3248 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
3249
3250 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
3251
3252 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
3253
3254 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
3255
3256 extern void FreeDeclarator(struct Declarator * decl);
3257
3258 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
3259
3260 struct PropertyImport
3261 {
3262 struct PropertyImport * prev;
3263 struct PropertyImport * next;
3264 char *  name;
3265 unsigned int isVirtual;
3266 unsigned int hasSet;
3267 unsigned int hasGet;
3268 } __attribute__ ((gcc_struct));
3269
3270 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3271
3272 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
3273 {
3274 struct Symbol * symbol = prop->symbol;
3275 char propName[1024];
3276
3277 strcpy(setName, "__ecereProp_");
3278 FullClassNameCat(setName, prop->_class->fullName, 0x0);
3279 strcat(setName, "_Set_");
3280 FullClassNameCat(setName, prop->name, 0x1);
3281 strcpy(getName, "__ecereProp_");
3282 FullClassNameCat(getName, prop->_class->fullName, 0x0);
3283 strcat(getName, "_Get_");
3284 FullClassNameCat(getName, prop->name, 0x1);
3285 strcpy(propName, "__ecereProp_");
3286 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3287 strcat(propName, "_");
3288 FullClassNameCat(propName, prop->name, 0x1);
3289 MangleClassName(getName);
3290 MangleClassName(setName);
3291 MangleClassName(propName);
3292 if(prop->_class->type == 1)
3293 DeclareStruct(prop->_class->fullName, 0x0);
3294 if(!symbol || curExternal->symbol->idCode < symbol->id)
3295 {
3296 unsigned int imported = 0x0;
3297 unsigned int dllImport = 0x0;
3298
3299 if(!symbol || symbol->_import)
3300 {
3301 if(!symbol)
3302 {
3303 struct Symbol * classSym;
3304
3305 if(!prop->_class->symbol)
3306 prop->_class->symbol = FindClass(prop->_class->fullName);
3307 classSym = prop->_class->symbol;
3308 if(classSym && !classSym->_import)
3309 {
3310 struct ModuleImport * module;
3311
3312 if(prop->_class->module)
3313 module = FindModule(prop->_class->module);
3314 else
3315 module = mainModule;
3316 classSym->_import = __extension__ ({
3317 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
3318
3319 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), __ecereInstance1->isRemote = prop->_class->isRemote, __ecereInstance1;
3320 });
3321 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3322 }
3323 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3324 symbol->_import = (struct ClassImport *)__extension__ ({
3325 struct PropertyImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport);
3326
3327 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), __ecereInstance1->isVirtual = 0x0, __ecereInstance1->hasSet = prop->Set ? 0x1 : 0x0, __ecereInstance1->hasGet = prop->Get ? 0x1 : 0x0, __ecereInstance1;
3328 });
3329 if(classSym)
3330 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
3331 }
3332 imported = 0x1;
3333 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)
3334 dllImport = 0x1;
3335 }
3336 if(!symbol->type)
3337 {
3338 struct Context * context = SetupTemplatesContext(prop->_class);
3339
3340 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
3341 FinishTemplatesContext(context);
3342 }
3343 if(prop->Get)
3344 {
3345 if(!symbol->externalGet || symbol->externalGet->type == 0)
3346 {
3347 struct Declaration * decl;
3348 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3349 struct Declarator * d;
3350 struct __ecereNameSpace__ecere__sys__OldList * params;
3351 struct Specifier * spec;
3352 struct External * external;
3353 struct Declarator * typeDecl;
3354 unsigned int simple = 0x0;
3355
3356 specifiers = MkList();
3357 declarators = MkList();
3358 params = MkList();
3359 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3360 d = MkDeclaratorIdentifier(MkIdentifier(getName));
3361 if(dllImport)
3362 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3363 {
3364 struct Context * context = SetupTemplatesContext(prop->_class);
3365
3366 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
3367 FinishTemplatesContext(context);
3368 }
3369 for(spec = (*specifiers).first; spec; spec = spec->next)
3370 {
3371 if(spec->type == 1)
3372 {
3373 if((!typeDecl || typeDecl->type == 1))
3374 {
3375 struct Symbol * classSym = spec->symbol;
3376
3377 symbol->_class = classSym->registered;
3378 if(classSym->registered && classSym->registered->type == 1)
3379 {
3380 DeclareStruct(spec->name, 0x0);
3381 simple = 0x1;
3382 }
3383 }
3384 }
3385 }
3386 if(!simple)
3387 d = PlugDeclarator(typeDecl, d);
3388 else
3389 {
3390 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3391 specifiers = MkList();
3392 }
3393 d = MkDeclaratorFunction(d, params);
3394 if(dllImport)
3395 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3396 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3397 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3398 if(simple)
3399 ListAdd(specifiers, MkSpecifier(VOID));
3400 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3401 decl = MkDeclaration(specifiers, declarators);
3402 external = MkExternalDeclaration(decl);
3403 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3404 external->symbol = symbol;
3405 symbol->externalGet = external;
3406 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3407 if(typeDecl)
3408 FreeDeclarator(typeDecl);
3409 }
3410 else
3411 {
3412 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3413 }
3414 }
3415 if(prop->Set)
3416 {
3417 if(!symbol->externalSet || symbol->externalSet->type == 0)
3418 {
3419 struct Declaration * decl;
3420 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3421 struct Declarator * d;
3422 struct __ecereNameSpace__ecere__sys__OldList * params;
3423 struct Specifier * spec;
3424 struct External * external;
3425 struct Declarator * typeDecl;
3426
3427 declarators = MkList();
3428 params = MkList();
3429 if(!prop->conversion || prop->_class->type == 1)
3430 {
3431 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3432 }
3433 specifiers = MkList();
3434 {
3435 struct Context * context = SetupTemplatesContext(prop->_class);
3436
3437 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3438 FinishTemplatesContext(context);
3439 }
3440 ListAdd(params, MkTypeName(specifiers, d));
3441 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3442 if(dllImport)
3443 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3444 d = MkDeclaratorFunction(d, params);
3445 for(spec = (*specifiers).first; spec; spec = spec->next)
3446 {
3447 if(spec->type == 1)
3448 {
3449 if((!typeDecl || typeDecl->type == 1))
3450 {
3451 struct Symbol * classSym = spec->symbol;
3452
3453 symbol->_class = classSym->registered;
3454 if(classSym->registered && classSym->registered->type == 1)
3455 DeclareStruct(spec->name, 0x0);
3456 }
3457 }
3458 }
3459 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3460 specifiers = MkList();
3461 if(dllImport)
3462 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3463 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3464 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3465 if(!prop->conversion || prop->_class->type == 1)
3466 ListAdd(specifiers, MkSpecifier(VOID));
3467 else
3468 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3469 decl = MkDeclaration(specifiers, declarators);
3470 external = MkExternalDeclaration(decl);
3471 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3472 external->symbol = symbol;
3473 symbol->externalSet = external;
3474 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3475 }
3476 else
3477 {
3478 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3479 }
3480 }
3481 if(!symbol->externalPtr)
3482 {
3483 struct Declaration * decl;
3484 struct External * external;
3485 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3486
3487 if(imported)
3488 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3489 else
3490 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3491 ListAdd(specifiers, MkSpecifierName("Property"));
3492 {
3493 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3494
3495 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3496 if(!imported)
3497 {
3498 strcpy(propName, "__ecerePropM_");
3499 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3500 strcat(propName, "_");
3501 FullClassNameCat(propName, prop->name, 0x1);
3502 MangleClassName(propName);
3503 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3504 }
3505 decl = MkDeclaration(specifiers, list);
3506 }
3507 external = MkExternalDeclaration(decl);
3508 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3509 external->symbol = symbol;
3510 symbol->externalPtr = external;
3511 }
3512 else
3513 {
3514 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3515 }
3516 symbol->id = curExternal->symbol->idCode;
3517 }
3518 }
3519
3520 struct Type * Dereference(struct Type * source)
3521 {
3522 struct Type * type = (((void *)0));
3523
3524 if(source)
3525 {
3526 if(source->kind == 13 || source->kind == 12)
3527 {
3528 type = source->type;
3529 source->type->refCount++;
3530 }
3531 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3532 {
3533 type = __extension__ ({
3534 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3535
3536 __ecereInstance1->kind = 1, __ecereInstance1->refCount = 1, __ecereInstance1;
3537 });
3538 }
3539 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3540 {
3541 type = source;
3542 source->refCount++;
3543 }
3544 else
3545 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "cannot dereference type\n", (((void *)0))));
3546 }
3547 return type;
3548 }
3549
3550 static struct Type * Reference(struct Type * source)
3551 {
3552 struct Type * type = (((void *)0));
3553
3554 if(source)
3555 {
3556 type = __extension__ ({
3557 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3558
3559 __ecereInstance1->kind = 13, __ecereInstance1->type = source, __ecereInstance1->refCount = 1, __ecereInstance1;
3560 });
3561 source->refCount++;
3562 }
3563 return type;
3564 }
3565
3566 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);
3567
3568 extern void *  memcpy(void * , const void * , size_t size);
3569
3570 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3571
3572 extern void FreeExpression(struct Expression * exp);
3573
3574 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3575
3576 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, unsigned int warnConst);
3577
3578 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3579
3580 extern struct Type * MkClassType(const char *  name);
3581
3582 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_AddDataMember(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, const char *  type, unsigned int size, unsigned int alignment, int declMode);
3583
3584 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)
3585 {
3586 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3587 unsigned int found = 0x0;
3588 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3589 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3590 unsigned int freeType = 0x0;
3591
3592 yylloc = member->loc;
3593 if(!ident)
3594 {
3595 if(curMember)
3596 {
3597 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3598 if(*curMember)
3599 {
3600 found = 0x1;
3601 dataMember = *curMember;
3602 }
3603 }
3604 }
3605 else
3606 {
3607 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3608 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3609 int _subMemberStackPos = 0;
3610
3611 if(!thisMember)
3612 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3613 if(thisMember)
3614 {
3615 dataMember = thisMember;
3616 if(curMember && thisMember->memberAccess == 1)
3617 {
3618 *curMember = thisMember;
3619 *curClass = thisMember->_class;
3620 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
3621 *subMemberStackPos = _subMemberStackPos;
3622 }
3623 found = 0x1;
3624 }
3625 else
3626 {
3627 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3628 if(method && method->type == 1)
3629 found = 0x1;
3630 else
3631 method = (((void *)0));
3632 }
3633 }
3634 if(found)
3635 {
3636 struct Type * type = (((void *)0));
3637
3638 if(dataMember)
3639 {
3640 if(!dataMember->dataType && dataMember->dataTypeString)
3641 {
3642 struct Context * context = SetupTemplatesContext(_class);
3643
3644 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3645 FinishTemplatesContext(context);
3646 }
3647 type = dataMember->dataType;
3648 }
3649 else if(method)
3650 {
3651 if(!method->dataType)
3652 ProcessMethodType(method);
3653 type = method->dataType;
3654 }
3655 if(ident && ident->next)
3656 {
3657 for(ident = ident->next; ident && type; ident = ident->next)
3658 {
3659 if(type->kind == 8)
3660 {
3661 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3662 if(!dataMember)
3663 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3664 if(dataMember)
3665 type = dataMember->dataType;
3666 }
3667 else if(type->kind == 9 || type->kind == 10)
3668 {
3669 struct Type * memberType;
3670
3671 for(memberType = type->members.first; memberType; memberType = memberType->next)
3672 {
3673 if(!strcmp(memberType->name, ident->string))
3674 {
3675 type = memberType;
3676 break;
3677 }
3678 }
3679 }
3680 }
3681 }
3682 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3683 {
3684 int id = 0;
3685 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3686 struct __ecereNameSpace__ecere__com__Class * sClass;
3687
3688 for(sClass = _class; sClass; sClass = sClass->base)
3689 {
3690 id = 0;
3691 if(sClass->templateClass)
3692 sClass = sClass->templateClass;
3693 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3694 {
3695 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3696 {
3697 for(sClass = sClass->base; sClass; sClass = sClass->base)
3698 {
3699 if(sClass->templateClass)
3700 sClass = sClass->templateClass;
3701 id += sClass->templateParams.count;
3702 }
3703 break;
3704 }
3705 id++;
3706 }
3707 if(curParam)
3708 break;
3709 }
3710 if(curParam)
3711 {
3712 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3713
3714 if(arg.dataTypeString)
3715 {
3716 unsigned int constant = type->constant;
3717
3718 type = ProcessTypeString(arg.dataTypeString, 0x0);
3719 if(type->kind == 8 && constant)
3720 type->constant = 0x1;
3721 else if(type->kind == 13)
3722 {
3723 struct Type * t = type->type;
3724
3725 while(t->kind == 13)
3726 t = t->type;
3727 if(constant)
3728 t->constant = constant;
3729 }
3730 freeType = 0x1;
3731 if(type && _class->templateClass)
3732 type->passAsTemplate = 0x1;
3733 if(type)
3734 {
3735 }
3736 }
3737 }
3738 }
3739 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3740 {
3741 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3742 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3743 int c;
3744 int paramCount = 0;
3745 int lastParam = -1;
3746 char templateString[1024];
3747 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3748
3749 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3750 for(cClass = expClass; cClass; cClass = cClass->base)
3751 {
3752 int p = 0;
3753
3754 if(cClass->templateClass)
3755 cClass = cClass->templateClass;
3756 for(param = cClass->templateParams.first; param; param = param->next)
3757 {
3758 int id = p;
3759 struct __ecereNameSpace__ecere__com__Class * sClass;
3760 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3761
3762 for(sClass = cClass->base; sClass; sClass = sClass->base)
3763 {
3764 if(sClass->templateClass)
3765 sClass = sClass->templateClass;
3766 id += sClass->templateParams.count;
3767 }
3768 arg = expClass->templateArgs[id];
3769 for(sClass = _class; sClass; sClass = sClass->base)
3770 {
3771 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3772 int p = 0;
3773 struct __ecereNameSpace__ecere__com__Class * nextClass;
3774
3775 if(sClass->templateClass)
3776 sClass = sClass->templateClass;
3777 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3778 {
3779 if(nextClass->templateClass)
3780 nextClass = nextClass->templateClass;
3781 p += nextClass->templateParams.count;
3782 }
3783 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3784 {
3785 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3786 {
3787 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3788 {
3789 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3790 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3791 break;
3792 }
3793 }
3794 }
3795 }
3796 {
3797 char argument[256];
3798
3799 argument[0] = '\0';
3800 switch(param->type)
3801 {
3802 case 2:
3803 {
3804 char expString[1024];
3805 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3806 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3807 struct Expression * exp;
3808 char * string = PrintHexUInt64(arg.expression.ui64);
3809
3810 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3811 (__ecereNameSpace__ecere__com__eSystem_Delete(string), string = 0);
3812 ProcessExpressionType(exp);
3813 ComputeExpression(exp);
3814 expString[0] = '\0';
3815 PrintExpression(exp, expString);
3816 strcat(argument, expString);
3817 FreeExpression(exp);
3818 break;
3819 }
3820 case 1:
3821 {
3822 strcat(argument, arg.member->name);
3823 break;
3824 }
3825 case 0:
3826 {
3827 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3828 strcat(argument, arg.dataTypeString);
3829 break;
3830 }
3831 }
3832 if(argument[0])
3833 {
3834 if(paramCount)
3835 strcat(templateString, ", ");
3836 if(lastParam != p - 1)
3837 {
3838 strcat(templateString, param->name);
3839 strcat(templateString, " = ");
3840 }
3841 strcat(templateString, argument);
3842 paramCount++;
3843 lastParam = p;
3844 }
3845 p++;
3846 }
3847 }
3848 }
3849 {
3850 int len = strlen(templateString);
3851
3852 if(templateString[len - 1] == '<')
3853 len--;
3854 else
3855 {
3856 if(templateString[len - 1] == '>')
3857 templateString[len++] = ' ';
3858 templateString[len++] = '>';
3859 }
3860 templateString[len++] = '\0';
3861 }
3862 {
3863 struct Context * context = SetupTemplatesContext(_class);
3864
3865 if(freeType)
3866 FreeType(type);
3867 type = ProcessTypeString(templateString, 0x0);
3868 freeType = 0x1;
3869 FinishTemplatesContext(context);
3870 }
3871 }
3872 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3873 {
3874 ProcessExpressionType(member->initializer->exp);
3875 if(!member->initializer->exp->expType)
3876 {
3877 if(inCompiler)
3878 {
3879 char expString[10240];
3880
3881 expString[0] = '\0';
3882 PrintExpression(member->initializer->exp, expString);
3883 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3884 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3885 }
3886 }
3887 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0, 0x1))
3888 {
3889 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible instance method %s\n", (((void *)0))), ident->string);
3890 }
3891 }
3892 else if(member->initializer)
3893 {
3894 ProcessInitializer(member->initializer, type);
3895 }
3896 if(freeType)
3897 FreeType(type);
3898 }
3899 else
3900 {
3901 if(_class && _class->type == 3)
3902 {
3903 if(member->initializer)
3904 {
3905 struct Type * type = MkClassType(_class->fullName);
3906
3907 ProcessInitializer(member->initializer, type);
3908 FreeType(type);
3909 }
3910 }
3911 else
3912 {
3913 if(member->initializer)
3914 {
3915 ProcessInitializer(member->initializer, (((void *)0)));
3916 }
3917 if(ident)
3918 {
3919 if(method)
3920 {
3921 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3922 }
3923 else if(_class)
3924 {
3925 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3926 if(inCompiler)
3927 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3928 }
3929 }
3930 else if(_class)
3931 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3932 }
3933 }
3934 }
3935
3936 extern struct Identifier * GetDeclId(struct Declarator * decl);
3937
3938 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);
3939
3940 extern void FreeSpecifier(struct Specifier * spec);
3941
3942 static void ProcessFunction(struct FunctionDefinition * function);
3943
3944 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (*  CopyFunction)(void * ));
3945
3946 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3947
3948 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3949
3950 extern void FreeClassFunction(struct ClassFunction * func);
3951
3952 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3953
3954 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3955
3956 void ProcessInstantiationType(struct Instantiation * inst)
3957 {
3958 yylloc = inst->loc;
3959 if(inst->_class)
3960 {
3961 struct MembersInit * members;
3962 struct Symbol * classSym;
3963 struct __ecereNameSpace__ecere__com__Class * _class;
3964
3965 classSym = inst->_class->symbol;
3966 _class = classSym ? classSym->registered : (((void *)0));
3967 if(!_class || _class->type != 5)
3968 DeclareStruct(inst->_class->name, 0x0);
3969 afterExternal = afterExternal ? afterExternal : curExternal;
3970 if(inst->exp)
3971 ProcessExpressionType(inst->exp);
3972 inst->isConstant = 0x1;
3973 if(inst->members)
3974 {
3975 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3976 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3977 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3978 int subMemberStackPos = 0;
3979
3980 for(members = (*inst->members).first; members; members = members->next)
3981 {
3982 switch(members->type)
3983 {
3984 case 1:
3985 {
3986 char name[1024];
3987 static unsigned int instMethodID = 0;
3988 struct External * external = curExternal;
3989 struct Context * context = curContext;
3990 struct Declarator * declarator = members->function->declarator;
3991 struct Identifier * nameID = GetDeclId(declarator);
3992 char * unmangled = nameID ? nameID->string : (((void *)0));
3993 struct Expression * exp;
3994 struct External * createdExternal = (((void *)0));
3995
3996 if(inCompiler)
3997 {
3998 char number[16];
3999
4000 strcpy(name, "__ecereInstMeth_");
4001 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
4002 strcat(name, "_");
4003 strcat(name, nameID->string);
4004 strcat(name, "_");
4005 sprintf(number, "_%08d", instMethodID++);
4006 strcat(name, number);
4007 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
4008 }
4009 if(declarator)
4010 {
4011 struct Symbol * symbol = declarator->symbol;
4012 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
4013
4014 if(method && method->type == 1)
4015 {
4016 symbol->method = method;
4017 ProcessMethodType(method);
4018 if(!symbol->type->thisClass)
4019 {
4020 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
4021 {
4022 if(!currentClass->symbol)
4023 currentClass->symbol = FindClass(currentClass->fullName);
4024 symbol->type->thisClass = currentClass->symbol;
4025 }
4026 else
4027 {
4028 if(!_class->symbol)
4029 _class->symbol = FindClass(_class->fullName);
4030 symbol->type->thisClass = _class->symbol;
4031 }
4032 }
4033 DeclareType(symbol->type, 0x1, 0x1);
4034 }
4035 else if(classSym)
4036 {
4037 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
4038 }
4039 }
4040 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
4041 if(nameID)
4042 {
4043 FreeSpecifier(nameID->_class);
4044 nameID->_class = (((void *)0));
4045 }
4046 if(inCompiler)
4047 {
4048 struct External * oldExternal = curExternal;
4049
4050 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
4051 {
4052 struct External * externalDecl;
4053
4054 externalDecl = MkExternalDeclaration((((void *)0)));
4055 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
4056 if(createdExternal->function)
4057 {
4058 ProcessFunction(createdExternal->function);
4059 {
4060 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
4061
4062 externalDecl->declaration = decl;
4063 if(decl->symbol && !decl->symbol->pointerExternal)
4064 decl->symbol->pointerExternal = externalDecl;
4065 declarator->symbol->pointerExternal = externalDecl;
4066 }
4067 }
4068 }
4069 }
4070 else if(declarator)
4071 {
4072 curExternal = declarator->symbol->pointerExternal;
4073 ProcessFunction((struct FunctionDefinition *)members->function);
4074 }
4075 curExternal = external;
4076 curContext = context;
4077 if(inCompiler)
4078 {
4079 FreeClassFunction(members->function);
4080 exp = QMkExpId(name);
4081 members->type = 0;
4082 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
4083 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
4084 }
4085 break;
4086 }
4087 case 0:
4088 {
4089 if(members->dataMembers && classSym)
4090 {
4091 struct MemberInit * member;
4092 struct Location oldyyloc = yylloc;
4093
4094 for(member = (*members->dataMembers).first; member; member = member->next)
4095 {
4096 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
4097 if(member->initializer && !member->initializer->isConstant)
4098 inst->isConstant = 0x0;
4099 }
4100 yylloc = oldyyloc;
4101 }
4102 break;
4103 }
4104 }
4105 }
4106 }
4107 }
4108 }
4109
4110 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
4111 {
4112 if(inCompiler)
4113 {
4114 if(type->kind == 11)
4115 {
4116 struct Type * param;
4117
4118 if(declareParams)
4119 {
4120 for(param = type->params.first; param; param = param->next)
4121 DeclareType(param, declarePointers, 0x1);
4122 }
4123 DeclareType(type->returnType, declarePointers, 0x1);
4124 }
4125 else if(type->kind == 13 && declarePointers)
4126 DeclareType(type->type, declarePointers, 0x0);
4127 else if(type->kind == 8)
4128 {
4129 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
4130 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
4131 }
4132 else if(type->kind == 9 || type->kind == 10)
4133 {
4134 struct Type * member;
4135
4136 for(member = type->members.first; member; member = member->next)
4137 DeclareType(member, 0x0, 0x0);
4138 }
4139 else if(type->kind == 12)
4140 DeclareType(type->arrayType, declarePointers, 0x0);
4141 }
4142 }
4143
4144 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, const char *  name);
4145
4146 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
4147 {
4148 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
4149 int id = 0;
4150 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4151 struct __ecereNameSpace__ecere__com__Class * sClass;
4152
4153 for(sClass = _class; sClass; sClass = sClass->base)
4154 {
4155 id = 0;
4156 if(sClass->templateClass)
4157 sClass = sClass->templateClass;
4158 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4159 {
4160 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
4161 {
4162 for(sClass = sClass->base; sClass; sClass = sClass->base)
4163 {
4164 if(sClass->templateClass)
4165 sClass = sClass->templateClass;
4166 id += sClass->templateParams.count;
4167 }
4168 break;
4169 }
4170 id++;
4171 }
4172 if(curParam)
4173 break;
4174 }
4175 if(curParam)
4176 {
4177 arg = &_class->templateArgs[id];
4178 if(arg && param->type == 0)
4179 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
4180 }
4181 return arg;
4182 }
4183
4184 extern struct Context * PushContext(void);
4185
4186 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
4187
4188 struct TemplatedType
4189 {
4190 uintptr_t key;
4191 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4192 struct __ecereNameSpace__ecere__sys__BTNode * left;
4193 struct __ecereNameSpace__ecere__sys__BTNode * right;
4194 int depth;
4195 struct TemplateParameter * param;
4196 } __attribute__ ((gcc_struct));
4197
4198 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
4199
4200 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
4201 {
4202 struct Context * context = PushContext();
4203
4204 context->templateTypesOnly = 0x1;
4205 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
4206 {
4207 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
4208
4209 for(; param; param = param->next)
4210 {
4211 if(param->type == 0 && param->identifier)
4212 {
4213 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (uintptr_t)param->identifier->string, type->param = param, type);
4214
4215 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4216 }
4217 }
4218 }
4219 else if(_class)
4220 {
4221 struct __ecereNameSpace__ecere__com__Class * sClass;
4222
4223 for(sClass = _class; sClass; sClass = sClass->base)
4224 {
4225 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
4226
4227 for(p = sClass->templateParams.first; p; p = p->next)
4228 {
4229 if(p->type == 0)
4230 {
4231 struct TemplateParameter * param = p->param;
4232 struct TemplatedType * type;
4233
4234 if(!param)
4235 {
4236 p->param = param = __extension__ ({
4237 struct TemplateParameter * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter);
4238
4239 __ecereInstance1->identifier = MkIdentifier(p->name), __ecereInstance1->type = p->type, __ecereInstance1->dataTypeString = p->dataTypeString, __ecereInstance1;
4240 });
4241 }
4242 type = __extension__ ({
4243 struct TemplatedType * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType);
4244
4245 __ecereInstance1->key = (uintptr_t)p->name, __ecereInstance1->param = param, __ecereInstance1;
4246 });
4247 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4248 }
4249 }
4250 }
4251 }
4252 return context;
4253 }
4254
4255 extern void PopContext(struct Context * ctx);
4256
4257 extern void FreeContext(struct Context * context);
4258
4259 void FinishTemplatesContext(struct Context * context)
4260 {
4261 PopContext(context);
4262 FreeContext(context);
4263 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor((void *)context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
4264 }
4265
4266 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
4267 {
4268 if(!method->dataType)
4269 {
4270 struct Context * context = SetupTemplatesContext(method->_class);
4271
4272 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4273 FinishTemplatesContext(context);
4274 if(method->type != 1 && method->dataType)
4275 {
4276 if(!method->dataType->thisClass && !method->dataType->staticMethod)
4277 {
4278 if(!method->_class->symbol)
4279 method->_class->symbol = FindClass(method->_class->fullName);
4280 method->dataType->thisClass = method->_class->symbol;
4281 }
4282 }
4283 }
4284 }
4285
4286 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
4287 {
4288 if(!prop->dataType)
4289 {
4290 struct Context * context = SetupTemplatesContext(prop->_class);
4291
4292 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
4293 FinishTemplatesContext(context);
4294 }
4295 }
4296
4297 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
4298
4299 extern void FreeTypeName(struct TypeName * typeName);
4300
4301 static void ProcessDeclarator(struct Declarator * decl);
4302
4303 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
4304
4305 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
4306
4307 struct MethodImport
4308 {
4309 struct MethodImport * prev;
4310 struct MethodImport * next;
4311 char *  name;
4312 unsigned int isVirtual;
4313 } __attribute__ ((gcc_struct));
4314
4315 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
4316
4317 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, const char * name)
4318 {
4319 struct Symbol * symbol = method->symbol;
4320
4321 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
4322 {
4323 unsigned int imported = 0x0;
4324 unsigned int dllImport = 0x0;
4325
4326 if(!method->dataType)
4327 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4328 if(!symbol || symbol->_import || method->type == 1)
4329 {
4330 if(!symbol || method->type == 1)
4331 {
4332 struct Symbol * classSym;
4333
4334 if(!method->_class->symbol)
4335 method->_class->symbol = FindClass(method->_class->fullName);
4336 classSym = method->_class->symbol;
4337 if(!classSym->_import)
4338 {
4339 struct ModuleImport * module;
4340
4341 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->name)
4342 module = FindModule(method->_class->module);
4343 else
4344 module = mainModule;
4345 classSym->_import = __extension__ ({
4346 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
4347
4348 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), __ecereInstance1->isRemote = method->_class->isRemote, __ecereInstance1;
4349 });
4350 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
4351 }
4352 if(!symbol)
4353 {
4354 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4355 }
4356 if(!symbol->_import)
4357 {
4358 symbol->_import = (struct ClassImport *)__extension__ ({
4359 struct MethodImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport);
4360
4361 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->name), __ecereInstance1->isVirtual = method->type == 1, __ecereInstance1;
4362 });
4363 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
4364 }
4365 if(!symbol)
4366 {
4367 symbol->type = method->dataType;
4368 if(symbol->type)
4369 symbol->type->refCount++;
4370 }
4371 }
4372 if(!method->dataType->dllExport)
4373 {
4374 imported = 0x1;
4375 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)
4376 dllImport = 0x1;
4377 }
4378 }
4379 if(method->type != 1 && method->dataType)
4380 DeclareType(method->dataType, 0x1, 0x1);
4381 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4382 {
4383 struct Declaration * decl;
4384 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4385 struct Declarator * d;
4386 struct Declarator * funcDecl;
4387 struct External * external;
4388
4389 specifiers = MkList();
4390 declarators = MkList();
4391 if(dllImport)
4392 ListAdd(specifiers, MkSpecifier(EXTERN));
4393 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
4394 ListAdd(specifiers, MkSpecifier(STATIC));
4395 if(method->type == 1)
4396 {
4397 ListAdd(specifiers, MkSpecifier(INT));
4398 d = MkDeclaratorIdentifier(MkIdentifier(name));
4399 }
4400 else
4401 {
4402 d = MkDeclaratorIdentifier(MkIdentifier(name));
4403 if(dllImport)
4404 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4405 {
4406 struct Context * context = SetupTemplatesContext(method->_class);
4407
4408 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
4409 FinishTemplatesContext(context);
4410 }
4411 funcDecl = GetFuncDecl(d);
4412 if(dllImport)
4413 {
4414 struct Specifier * spec, * next;
4415
4416 for(spec = (*specifiers).first; spec; spec = next)
4417 {
4418 next = spec->next;
4419 if(spec->type == 5)
4420 {
4421 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4422 FreeSpecifier(spec);
4423 }
4424 }
4425 }
4426 if(method->dataType && !method->dataType->staticMethod)
4427 {
4428 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4429 {
4430 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4431 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")));
4432 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4433 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4434
4435 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4436 {
4437 struct TypeName * param = (*funcDecl->function.parameters).first;
4438
4439 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4440 FreeTypeName(param);
4441 }
4442 if(!funcDecl->function.parameters)
4443 funcDecl->function.parameters = MkList();
4444 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4445 }
4446 }
4447 }
4448 ProcessDeclarator(d);
4449 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4450 decl = MkDeclaration(specifiers, declarators);
4451 ReplaceThisClassSpecifiers(specifiers, method->_class);
4452 if(symbol->pointerExternal)
4453 {
4454 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4455
4456 {
4457 *functionSymbol = *symbol;
4458 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4459 if(functionSymbol->type)
4460 functionSymbol->type->refCount++;
4461 }
4462 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4463 symbol->pointerExternal->symbol = functionSymbol;
4464 }
4465 external = MkExternalDeclaration(decl);
4466 if(curExternal)
4467 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4468 external->symbol = symbol;
4469 symbol->pointerExternal = external;
4470 }
4471 else if(ast)
4472 {
4473 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4474 }
4475 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4476 }
4477 }
4478
4479 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4480 {
4481 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4482 {
4483 unsigned int first = 0x1;
4484 int p = 0;
4485 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4486 int lastParam = -1;
4487 char className[1024];
4488
4489 strcpy(className, _class->fullName);
4490 for(param = _class->templateParams.first; param; param = param->next)
4491 {
4492 {
4493 if(first)
4494 strcat(className, "<");
4495 if(!first)
4496 strcat(className, ", ");
4497 if(lastParam + 1 != p)
4498 {
4499 strcat(className, param->name);
4500 strcat(className, " = ");
4501 }
4502 strcat(className, param->name);
4503 first = 0x0;
4504 lastParam = p;
4505 }
4506 p++;
4507 }
4508 if(!first)
4509 {
4510 int len = strlen(className);
4511
4512 if(className[len - 1] == '>')
4513 className[len++] = ' ';
4514 className[len++] = '>';
4515 className[len++] = '\0';
4516 }
4517 return __ecereNameSpace__ecere__sys__CopyString(className);
4518 }
4519 else
4520 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4521 }
4522
4523 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4524 {
4525 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4526 {
4527 unsigned int first = 0x1;
4528 int p = 0;
4529 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4530 int lastParam = -1;
4531 char className[1024];
4532
4533 strcpy(className, _class->fullName);
4534 for(param = _class->templateParams.first; param; param = param->next)
4535 {
4536 {
4537 if(first)
4538 strcat(className, "<");
4539 if(!first)
4540 strcat(className, ", ");
4541 if(lastParam + 1 != p)
4542 {
4543 strcat(className, param->name);
4544 strcat(className, " = ");
4545 }
4546 strcat(className, param->name);
4547 first = 0x0;
4548 lastParam = p;
4549 }
4550 p++;
4551 }
4552 if(!first)
4553 {
4554 int len = strlen(className);
4555
4556 if(className[len - 1] == '>')
4557 className[len++] = ' ';
4558 className[len++] = '>';
4559 className[len++] = '\0';
4560 }
4561 return MkClassType(className);
4562 }
4563 else
4564 {
4565 return MkClassType(_class->fullName);
4566 }
4567 }
4568
4569 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4570 {
4571 if(specs != (((void *)0)) && _class)
4572 {
4573 struct Specifier * spec;
4574
4575 for(spec = specs->first; spec; spec = spec->next)
4576 {
4577 if(spec->type == 0 && spec->specifier == THISCLASS)
4578 {
4579 spec->type = 1;
4580 spec->name = ReplaceThisClass(_class);
4581 spec->symbol = FindClass(spec->name);
4582 }
4583 }
4584 }
4585 }
4586
4587 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4588
4589 struct __ecereNameSpace__ecere__com__GlobalFunction
4590 {
4591 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4592 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4593 const char *  name;
4594 int (*  function)();
4595 struct __ecereNameSpace__ecere__com__Instance * module;
4596 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4597 const char *  dataTypeString;
4598 struct Type * dataType;
4599 void *  symbol;
4600 } __attribute__ ((gcc_struct));
4601
4602 extern struct Context * globalContext;
4603
4604 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4605
4606 struct FunctionImport
4607 {
4608 struct FunctionImport * prev;
4609 struct FunctionImport * next;
4610 char *  name;
4611 } __attribute__ ((gcc_struct));
4612
4613 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4614 {
4615 struct Symbol * symbol = function->symbol;
4616
4617 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4618 {
4619 unsigned int imported = 0x0;
4620 unsigned int dllImport = 0x0;
4621
4622 if(!function->dataType)
4623 {
4624 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4625 if(!function->dataType->thisClass)
4626 function->dataType->staticMethod = 0x1;
4627 }
4628 if(inCompiler)
4629 {
4630 if(!symbol)
4631 {
4632 struct ModuleImport * module = FindModule(function->module);
4633
4634 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4635 if(module->name)
4636 {
4637 if(!function->dataType->dllExport)
4638 {
4639 symbol->_import = (struct ClassImport *)__extension__ ({
4640 struct FunctionImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport);
4641
4642 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(function->name), __ecereInstance1;
4643 });
4644 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4645 }
4646 }
4647 {
4648 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4649 if(!symbol->type->thisClass)
4650 symbol->type->staticMethod = 0x1;
4651 }
4652 }
4653 imported = symbol->_import ? 0x1 : 0x0;
4654 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1)
4655 dllImport = 0x1;
4656 }
4657 DeclareType(function->dataType, 0x1, 0x1);
4658 if(inCompiler)
4659 {
4660 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4661 {
4662 struct Declaration * decl;
4663 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4664 struct Declarator * d;
4665 struct Declarator * funcDecl;
4666 struct External * external;
4667
4668 specifiers = MkList();
4669 declarators = MkList();
4670 ListAdd(specifiers, MkSpecifier(EXTERN));
4671 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4672 if(dllImport)
4673 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4674 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4675 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType == 1)
4676 {
4677 struct Specifier * spec;
4678
4679 for(spec = (*specifiers).first; spec; spec = spec->next)
4680 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4681 {
4682 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4683 FreeSpecifier(spec);
4684 break;
4685 }
4686 }
4687 funcDecl = GetFuncDecl(d);
4688 if(funcDecl && !funcDecl->function.parameters)
4689 {
4690 funcDecl->function.parameters = MkList();
4691 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4692 }
4693 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4694 {
4695 struct Context * oldCtx = curContext;
4696
4697 curContext = globalContext;
4698 decl = MkDeclaration(specifiers, declarators);
4699 curContext = oldCtx;
4700 }
4701 if(symbol->pointerExternal)
4702 {
4703 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4704
4705 {
4706 *functionSymbol = *symbol;
4707 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4708 if(functionSymbol->type)
4709 functionSymbol->type->refCount++;
4710 }
4711 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4712 symbol->pointerExternal->symbol = functionSymbol;
4713 }
4714 external = MkExternalDeclaration(decl);
4715 if(curExternal)
4716 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4717 external->symbol = symbol;
4718 symbol->pointerExternal = external;
4719 }
4720 else
4721 {
4722 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4723 }
4724 if(curExternal)
4725 symbol->id = curExternal->symbol->idCode;
4726 }
4727 }
4728 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1) ? 0x1 : 0x0;
4729 }
4730
4731 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4732
4733 struct GlobalData
4734 {
4735 uintptr_t key;
4736 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4737 struct __ecereNameSpace__ecere__sys__BTNode * left;
4738 struct __ecereNameSpace__ecere__sys__BTNode * right;
4739 int depth;
4740 struct __ecereNameSpace__ecere__com__Instance * module;
4741 char *  dataTypeString;
4742 struct Type * dataType;
4743 void *  symbol;
4744 char *  fullName;
4745 } __attribute__ ((gcc_struct));
4746
4747 void DeclareGlobalData(struct GlobalData * data)
4748 {
4749 struct Symbol * symbol = data->symbol;
4750
4751 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4752 {
4753 if(inCompiler)
4754 {
4755 if(!symbol)
4756 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4757 }
4758 if(!data->dataType)
4759 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4760 DeclareType(data->dataType, 0x1, 0x1);
4761 if(inCompiler)
4762 {
4763 if(!symbol->pointerExternal)
4764 {
4765 struct Declaration * decl;
4766 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4767 struct Declarator * d;
4768 struct External * external;
4769
4770 specifiers = MkList();
4771 declarators = MkList();
4772 ListAdd(specifiers, MkSpecifier(EXTERN));
4773 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4774 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4775 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4776 decl = MkDeclaration(specifiers, declarators);
4777 external = MkExternalDeclaration(decl);
4778 if(curExternal)
4779 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4780 external->symbol = symbol;
4781 symbol->pointerExternal = external;
4782 }
4783 else
4784 {
4785 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4786 }
4787 if(curExternal)
4788 symbol->id = curExternal->symbol->idCode;
4789 }
4790 }
4791 }
4792
4793 struct Conversion
4794 {
4795 struct Conversion * prev, * next;
4796 struct __ecereNameSpace__ecere__com__Property * convert;
4797 unsigned int isGet;
4798 struct Type * resultType;
4799 } __attribute__ ((gcc_struct));
4800
4801 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4802
4803 extern void Compiler_Warning(const char *  format, ...);
4804
4805 extern void CopyTypeInto(struct Type * type, struct Type * src);
4806
4807 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4808
4809 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, unsigned int warnConst)
4810 {
4811 if(source && dest)
4812 {
4813 if(warnConst && ((source->kind == 8 && source->_class && source->_class->registered) || source->kind == 12 || source->kind == 13) && ((dest->kind == 8 && dest->_class && dest->_class->registered) || dest->kind == 13))
4814 {
4815 struct __ecereNameSpace__ecere__com__Class * sourceClass = source->kind == 8 ? source->_class->registered : (((void *)0));
4816 struct __ecereNameSpace__ecere__com__Class * destClass = dest->kind == 8 ? dest->_class->registered : (((void *)0));
4817
4818 if((!sourceClass || (sourceClass && sourceClass->type == 0 && !sourceClass->structSize)) && (!destClass || (destClass && destClass->type == 0 && !destClass->structSize)))
4819 {
4820 struct Type * sourceType = source, * destType = dest;
4821
4822 while(sourceType->type && (sourceType->kind == 13 || sourceType->kind == 12))
4823 sourceType = sourceType->type;
4824 while(destType->type && (destType->kind == 13 || destType->kind == 12))
4825 destType = destType->type;
4826 if(!destType->constant && sourceType->constant)
4827 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "discarding const qualifier\n", (((void *)0))));
4828 }
4829 }
4830 if(source->kind == 20 && dest->kind != 20)
4831 {
4832 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4833
4834 if(type)
4835 source = type;
4836 }
4837 if(dest->kind == 20 && source->kind != 20)
4838 {
4839 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4840
4841 if(type)
4842 dest = type;
4843 }
4844 if(dest->classObjectType == 2)
4845 {
4846 if(source->classObjectType != 3)
4847 return 0x1;
4848 else
4849 {
4850 if((dest->_class && strcmp(dest->_class->string, "class")) || (source->_class && strcmp(source->_class->string, "class")))
4851 {
4852 return 0x1;
4853 }
4854 }
4855 }
4856 else
4857 {
4858 if(source->classObjectType == 3)
4859 return 0x1;
4860 if(dest->classObjectType == 3 && source->classObjectType != 2)
4861 return 0x1;
4862 }
4863 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4864 {
4865 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4866 return 0x1;
4867 }
4868 if(dest->kind == 14 && source->kind != 0)
4869 return 0x1;
4870 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))
4871 return 0x1;
4872 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))
4873 return 0x1;
4874 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4875 {
4876 if(source->_class->registered && source->_class->registered->type == 3)
4877 {
4878 if(conversions != (((void *)0)))
4879 {
4880 if(source->_class->registered == dest->_class->registered)
4881 return 0x1;
4882 }
4883 else
4884 {
4885 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4886
4887 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4888 ;
4889 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4890 ;
4891 if(sourceBase == destBase)
4892 return 0x1;
4893 }
4894 }
4895 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))
4896 return 0x1;
4897 else
4898 {
4899 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))
4900 {
4901 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4902 {
4903 return 0x1;
4904 }
4905 }
4906 }
4907 }
4908 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4909 return 0x1;
4910 if(doConversion)
4911 {
4912 if(source->kind == 8)
4913 {
4914 struct __ecereNameSpace__ecere__com__Class * _class;
4915
4916 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4917 {
4918 struct __ecereNameSpace__ecere__com__Property * convert;
4919
4920 for(convert = _class->conversions.first; convert; convert = convert->next)
4921 {
4922 if(convert->memberAccess == 1 || _class->module == privateModule)
4923 {
4924 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4925
4926 if(!convert->dataType)
4927 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4928 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, warnConst))
4929 {
4930 if(!conversions && !convert->Get)
4931 return 0x1;
4932 else if(conversions != (((void *)0)))
4933 {
4934 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))
4935 return 0x1;
4936 else
4937 {
4938 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4939
4940 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4941 return 0x1;
4942 }
4943 }
4944 }
4945 }
4946 }
4947 }
4948 }
4949 if(dest->kind == 8)
4950 {
4951 struct __ecereNameSpace__ecere__com__Class * _class;
4952
4953 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4954 {
4955 struct __ecereNameSpace__ecere__com__Property * convert;
4956
4957 for(convert = _class->conversions.first; convert; convert = convert->next)
4958 {
4959 if(convert->memberAccess == 1 || _class->module == privateModule)
4960 {
4961 struct Type * constType = (((void *)0));
4962 unsigned int success = 0x0;
4963
4964 if(!convert->dataType)
4965 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4966 if(warnConst && convert->dataType->kind == 13 && convert->dataType->type && dest->constant)
4967 {
4968 struct Type * ptrType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
4969
4970 constType = __extension__ ({
4971 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
4972
4973 __ecereInstance1->kind = 13, __ecereInstance1->refCount = 1, __ecereInstance1->type = ptrType, __ecereInstance1;
4974 });
4975 CopyTypeInto(ptrType, convert->dataType->type);
4976 ptrType->refCount++;
4977 ptrType->constant = 0x1;
4978 }
4979 if((constType || convert->dataType != dest) && MatchTypes(source, constType ? constType : convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1, warnConst))
4980 {
4981 if(!conversions && !convert->Set)
4982 success = 0x1;
4983 else if(conversions != (((void *)0)))
4984 {
4985 if(_class->type == 3 && convert->dataType->kind == 8 && convert->dataType->_class && convert->dataType->_class->registered && _class->base == convert->dataType->_class->registered->base && (source->kind != 8 || source->_class->registered != _class->base))
4986 success = 0x1;
4987 else
4988 {
4989 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4990
4991 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4992 success = 0x1;
4993 }
4994 }
4995 }
4996 if(success)
4997 return 0x1;
4998 if(constType)
4999 FreeType(constType);
5000 }
5001 }
5002 }
5003 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5004 {
5005 if(!dest->_class->registered->dataType)
5006 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5007 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
5008 {
5009 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, dest->_class->registered->dataType->kind == 8, 0x0, 0x0, warnConst))
5010 {
5011 return 0x1;
5012 }
5013 }
5014 }
5015 }
5016 if(source->kind == 8)
5017 {
5018 struct __ecereNameSpace__ecere__com__Class * _class;
5019
5020 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
5021 {
5022 struct __ecereNameSpace__ecere__com__Property * convert;
5023
5024 for(convert = _class->conversions.first; convert; convert = convert->next)
5025 {
5026 if(convert->memberAccess == 1 || _class->module == privateModule)
5027 {
5028 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
5029
5030 if(!convert->dataType)
5031 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
5032 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, warnConst))
5033 {
5034 if(!conversions && !convert->Get)
5035 return 0x1;
5036 else if(conversions != (((void *)0)))
5037 {
5038 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))
5039 return 0x1;
5040 else
5041 {
5042 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
5043
5044 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
5045 return 0x1;
5046 }
5047 }
5048 }
5049 }
5050 }
5051 }
5052 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
5053 {
5054 if(!source->_class->registered->dataType)
5055 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5056 if(!isConversionExploration || source->_class->registered->dataType->kind == 8 || !strcmp(source->_class->registered->name, "String"))
5057 {
5058 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, warnConst))
5059 return 0x1;
5060 else if(MatchTypes(dest, source->_class->registered->dataType, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0, warnConst))
5061 return 0x1;
5062 }
5063 }
5064 }
5065 }
5066 if(source->kind == 8 || source->kind == 19)
5067 ;
5068 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
5069 return 0x1;
5070 else if(dest->kind == 7 && source->kind == 6)
5071 return 0x1;
5072 else if(dest->kind == 2 && (source->kind == 1 || source->kind == 24))
5073 return 0x1;
5074 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 23))
5075 return 0x1;
5076 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 22 || source->kind == 23))
5077 return 0x1;
5078 else if(dest->kind == 22 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 23 || source->kind == 4))
5079 return 0x1;
5080 else if(dest->kind == 23 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 4 || source->kind == 22))
5081 return 0x1;
5082 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))
5083 return 0x1;
5084 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))
5085 return 0x1;
5086 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)))
5087 {
5088 struct Type * paramSource, * paramDest;
5089
5090 if(dest->kind == 16)
5091 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
5092 if(source->kind == 16)
5093 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
5094 if(dest->kind == 13 && dest->type->kind == 11)
5095 dest = dest->type;
5096 if(source->kind == 13 && source->type->kind == 11)
5097 source = source->type;
5098 if(dest->kind == 16)
5099 dest = dest->method->dataType;
5100 if(source->kind == 16)
5101 source = source->method->dataType;
5102 paramSource = source->params.first;
5103 if(paramSource && paramSource->kind == 0)
5104 paramSource = (((void *)0));
5105 paramDest = dest->params.first;
5106 if(paramDest && paramDest->kind == 0)
5107 paramDest = (((void *)0));
5108 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
5109 {
5110 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))))
5111 {
5112 if(paramDest && paramDest->kind == 8)
5113 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
5114 else
5115 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "method class should not take an object\n", (((void *)0))));
5116 return 0x0;
5117 }
5118 paramDest = paramDest->next;
5119 }
5120 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
5121 {
5122 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
5123 {
5124 if(dest->thisClass)
5125 {
5126 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
5127 {
5128 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
5129 return 0x0;
5130 }
5131 }
5132 else
5133 {
5134 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
5135 {
5136 if(owningClassDest)
5137 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
5138 else
5139 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "overriding class expected to be derived from method class\n", (((void *)0))));
5140 return 0x0;
5141 }
5142 }
5143 paramSource = paramSource->next;
5144 }
5145 else
5146 {
5147 if(dest->thisClass)
5148 {
5149 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
5150 {
5151 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
5152 return 0x0;
5153 }
5154 }
5155 else
5156 {
5157 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
5158 {
5159 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
5160 return 0x0;
5161 }
5162 }
5163 }
5164 }
5165 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0, warnConst))
5166 {
5167 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible return type for function\n", (((void *)0))));
5168 return 0x0;
5169 }
5170 for(; paramDest; paramDest = paramDest->next)
5171 {
5172 if(!paramSource)
5173 {
5174 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "not enough parameters\n", (((void *)0))));
5175 return 0x0;
5176 }
5177 {
5178 struct Type * paramDestType = paramDest;
5179 struct Type * paramSourceType = paramSource;
5180 struct Type * type = paramDestType;
5181
5182 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
5183 {
5184 int id = 0;
5185 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
5186 struct __ecereNameSpace__ecere__com__Class * sClass;
5187
5188 for(sClass = owningClassSource; sClass; sClass = sClass->base)
5189 {
5190 id = 0;
5191 if(sClass->templateClass)
5192 sClass = sClass->templateClass;
5193 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
5194 {
5195 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
5196 {
5197 for(sClass = sClass->base; sClass; sClass = sClass->base)
5198 {
5199 if(sClass->templateClass)
5200 sClass = sClass->templateClass;
5201 id += sClass->templateParams.count;
5202 }
5203 break;
5204 }
5205 id++;
5206 }
5207 if(curParam)
5208 break;
5209 }
5210 if(curParam)
5211 {
5212 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
5213
5214 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
5215 }
5216 }
5217 if(!MatchTypes(paramDestType, paramSourceType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0, warnConst) && (!acceptReversedParams || !MatchTypes(paramSourceType, paramDestType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0, warnConst)))
5218 {
5219 char type[1024];
5220
5221 type[0] = (char)0;
5222 PrintType(paramDest, type, 0x0, 0x1);
5223 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
5224 if(paramDestType != paramDest)
5225 FreeType(paramDestType);
5226 return 0x0;
5227 }
5228 if(paramDestType != paramDest)
5229 FreeType(paramDestType);
5230 }
5231 paramSource = paramSource->next;
5232 }
5233 if(paramSource)
5234 {
5235 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "too many parameters\n", (((void *)0))));
5236 return 0x0;
5237 }
5238 return 0x1;
5239 }
5240 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
5241 {
5242 return 0x1;
5243 }
5244 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
5245 {
5246 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0, warnConst))
5247 return 0x1;
5248 }
5249 }
5250 return 0x0;
5251 }
5252
5253 static void FreeConvert(struct Conversion * convert)
5254 {
5255 if(convert->resultType)
5256 FreeType(convert->resultType);
5257 }
5258
5259 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
5260
5261 struct __ecereNameSpace__ecere__com__BTNamedLink
5262 {
5263 const char *  name;
5264 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
5265 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
5266 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
5267 int depth;
5268 void *  data;
5269 } __attribute__ ((gcc_struct));
5270
5271 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
5272
5273 struct __ecereNameSpace__ecere__com__EnumClassData
5274 {
5275 struct __ecereNameSpace__ecere__sys__OldList values;
5276 int largest;
5277 } __attribute__ ((gcc_struct));
5278
5279 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
5280
5281 struct __ecereNameSpace__ecere__sys__NamedLink
5282 {
5283 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
5284 struct __ecereNameSpace__ecere__sys__NamedLink * next;
5285 char *  name;
5286 void *  data;
5287 } __attribute__ ((gcc_struct));
5288
5289 extern void FreeExpContents(struct Expression * exp);
5290
5291 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
5292
5293 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
5294
5295 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
5296
5297 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
5298
5299 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
5300
5301 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5302 {
5303 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
5304
5305 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)))
5306 {
5307 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
5308
5309 if(_class->type == 4)
5310 {
5311 struct __ecereNameSpace__ecere__sys__OldList converts =
5312 {
5313 0, 0, 0, 0, 0
5314 };
5315 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5316
5317 type->kind = 8;
5318 if(!_class->symbol)
5319 _class->symbol = FindClass(_class->fullName);
5320 type->_class = _class->symbol;
5321 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0, 0x0))
5322 {
5323 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5324 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5325
5326 if(enumClass)
5327 {
5328 struct __ecereNameSpace__ecere__com__Class * baseClass;
5329
5330 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
5331 {
5332 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
5333
5334 for(value = e->values.first; value; value = value->next)
5335 {
5336 if(!strcmp(value->name, string))
5337 break;
5338 }
5339 if(value)
5340 {
5341 FreeExpContents(sourceExp);
5342 FreeType(sourceExp->expType);
5343 sourceExp->isConstant = 0x1;
5344 sourceExp->expType = MkClassType(baseClass->fullName);
5345 {
5346 char constant[256];
5347
5348 sourceExp->type = 2;
5349 if(!strcmp(baseClass->dataTypeString, "int"))
5350 sprintf(constant, "%d", (int)value->data);
5351 else
5352 sprintf(constant, "0x%X", (int)value->data);
5353 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5354 }
5355 while(converts.first)
5356 {
5357 struct Conversion * convert = converts.first;
5358
5359 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
5360 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
5361 }
5362 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor((void *)type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5363 return 0x1;
5364 }
5365 }
5366 }
5367 }
5368 if(converts.first)
5369 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
5370 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor((void *)type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5371 }
5372 }
5373 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)))
5374 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
5375 return 0x1;
5376 return 0x0;
5377 }
5378
5379 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
5380
5381 struct __ecereNameSpace__ecere__com__SubModule
5382 {
5383 struct __ecereNameSpace__ecere__com__SubModule * prev;
5384 struct __ecereNameSpace__ecere__com__SubModule * next;
5385 struct __ecereNameSpace__ecere__com__Instance * module;
5386 int importMode;
5387 } __attribute__ ((gcc_struct));
5388
5389 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
5390 {
5391 struct __ecereNameSpace__ecere__com__SubModule * subModule;
5392
5393 if(searchFor == searchIn)
5394 return 0x1;
5395 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
5396 {
5397 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->application)
5398 {
5399 if(ModuleVisibility(subModule->module, searchFor))
5400 return 0x1;
5401 }
5402 }
5403 return 0x0;
5404 }
5405
5406 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
5407
5408 struct __ecereNameSpace__ecere__com__Application
5409 {
5410 int argc;
5411 const char * *  argv;
5412 int exitCode;
5413 unsigned int isGUIApp;
5414 struct __ecereNameSpace__ecere__sys__OldList allModules;
5415 char *  parsedCommand;
5416 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
5417 } __attribute__ ((gcc_struct));
5418
5419 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5420 {
5421 struct __ecereNameSpace__ecere__com__Instance * module;
5422
5423 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))
5424 return 0x1;
5425 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))
5426 return 0x1;
5427 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))
5428 return 0x1;
5429 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)
5430 {
5431 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5432 return 0x1;
5433 }
5434 return 0x0;
5435 }
5436
5437 extern struct Expression * CopyExpression(struct Expression * exp);
5438
5439 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
5440
5441 void ReadString(char *  output, char *  string);
5442
5443 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
5444
5445 extern struct TypeName * QMkClass(const char *  spec, struct Declarator * decl);
5446
5447 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
5448
5449 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla, unsigned int warnConst)
5450 {
5451 struct Type * source;
5452 struct Type * realDest = dest;
5453 struct Type * backupSourceExpType = (((void *)0));
5454 struct Expression * computedExp = sourceExp;
5455
5456 dest->refCount++;
5457 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)
5458 {
5459 computedExp = CopyExpression(sourceExp);
5460 ComputeExpression(computedExp);
5461 }
5462 source = sourceExp->expType;
5463 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5464 {
5465 if(computedExp != sourceExp)
5466 {
5467 FreeExpression(computedExp);
5468 computedExp = sourceExp;
5469 }
5470 FreeType(dest);
5471 return 0x1;
5472 }
5473 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5474 {
5475 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5476 {
5477 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5478
5479 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5480 ;
5481 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5482 ;
5483 if(sourceBase == destBase)
5484 {
5485 if(computedExp != sourceExp)
5486 {
5487 FreeExpression(computedExp);
5488 computedExp = sourceExp;
5489 }
5490 FreeType(dest);
5491 return 0x1;
5492 }
5493 }
5494 }
5495 if(source)
5496 {
5497 struct __ecereNameSpace__ecere__sys__OldList * specs;
5498 unsigned int flag = 0x0;
5499 long long value = (((int)0x7fffffff));
5500
5501 source->refCount++;
5502 if(computedExp->type == 2)
5503 {
5504 if(source->isSigned)
5505 value = strtoll(computedExp->constant, (((void *)0)), 0);
5506 else
5507 value = strtoull(computedExp->constant, (((void *)0)), 0);
5508 }
5509 else if(computedExp->type == 4 && sourceExp->op.op == '-' && !computedExp->op.exp1 && computedExp->op.exp2 && computedExp->op.exp2->type == 2)
5510 {
5511 if(source->isSigned)
5512 value = -strtoll(computedExp->op.exp2->constant, (((void *)0)), 0);
5513 else
5514 value = -strtoull(computedExp->op.exp2->constant, (((void *)0)), 0);
5515 }
5516 if(computedExp != sourceExp)
5517 {
5518 FreeExpression(computedExp);
5519 computedExp = sourceExp;
5520 }
5521 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5522 {
5523 FreeType(source);
5524 source = __extension__ ({
5525 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5526
5527 __ecereInstance1->kind = 3, __ecereInstance1->isSigned = 0x0, __ecereInstance1->refCount = 1, __ecereInstance1;
5528 });
5529 }
5530 if(dest->kind == 8)
5531 {
5532 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5533
5534 if(_class && _class->type == 3)
5535 {
5536 if(source->kind != 8)
5537 {
5538 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5539 struct Type * tempDest, * tempSource;
5540
5541 for(; _class->base->type != 1000; _class = _class->base)
5542 ;
5543 tempSource = dest;
5544 tempDest = tempType;
5545 tempType->kind = 8;
5546 if(!_class->symbol)
5547 _class->symbol = FindClass(_class->fullName);
5548 tempType->_class = _class->symbol;
5549 tempType->truth = dest->truth;
5550 if(tempType->_class)
5551 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0, warnConst);
5552 backupSourceExpType = sourceExp->expType;
5553 sourceExp->expType = dest;
5554 dest->refCount++;
5555 flag = 0x1;
5556 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor((void *)tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5557 }
5558 }
5559 if(_class && _class->type == 2 && source->kind != 8)
5560 {
5561 if(!dest->_class->registered->dataType)
5562 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5563 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0, warnConst))
5564 {
5565 FreeType(source);
5566 FreeType(sourceExp->expType);
5567 source = sourceExp->expType = MkClassType(dest->_class->string);
5568 source->refCount++;
5569 }
5570 }
5571 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5572 {
5573 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5574 struct Declarator * decl;
5575 char string[1024];
5576
5577 ReadString(string, sourceExp->string);
5578 decl = SpecDeclFromString(string, specs, (((void *)0)));
5579 FreeExpContents(sourceExp);
5580 FreeType(sourceExp->expType);
5581 sourceExp->type = 24;
5582 sourceExp->_classExp.specifiers = specs;
5583 sourceExp->_classExp.decl = decl;
5584 sourceExp->expType = dest;
5585 dest->refCount++;
5586 FreeType(source);
5587 FreeType(dest);
5588 if(backupSourceExpType)
5589 FreeType(backupSourceExpType);
5590 return 0x1;
5591 }
5592 }
5593 else if(source->kind == 8)
5594 {
5595 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5596
5597 if(_class && (_class->type == 3 || _class->type == 2))
5598 {
5599 if(dest->kind != 8)
5600 {
5601 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5602 struct Type * tempDest, * tempSource;
5603
5604 if(!source->_class->registered->dataType)
5605 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5606 for(; _class->base->type != 1000; _class = _class->base)
5607 ;
5608 tempDest = source;
5609 tempSource = tempType;
5610 tempType->kind = 8;
5611 tempType->_class = FindClass(_class->fullName);
5612 tempType->truth = source->truth;
5613 tempType->classObjectType = source->classObjectType;
5614 if(tempType->_class)
5615 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0, warnConst);
5616 if(conversions->last)
5617 {
5618 ((struct Conversion *)conversions->last)->resultType = dest;
5619 dest->refCount++;
5620 }
5621 FreeType(sourceExp->expType);
5622 sourceExp->expType = MkClassType(_class->fullName);
5623 sourceExp->expType->truth = source->truth;
5624 sourceExp->expType->classObjectType = source->classObjectType;
5625 if(!sourceExp->destType)
5626 {
5627 FreeType(sourceExp->destType);
5628 sourceExp->destType = sourceExp->expType;
5629 if(sourceExp->expType)
5630 sourceExp->expType->refCount++;
5631 }
5632 if(!_class->dataType)
5633 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5634 FreeType(dest);
5635 dest = MkClassType(source->_class->string);
5636 dest->truth = source->truth;
5637 dest->classObjectType = source->classObjectType;
5638 FreeType(source);
5639 source = _class->dataType;
5640 source->refCount++;
5641 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor((void *)tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5642 }
5643 }
5644 }
5645 if(!flag)
5646 {
5647 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0, warnConst))
5648 {
5649 FreeType(source);
5650 FreeType(dest);
5651 return 0x1;
5652 }
5653 }
5654 if(dest->kind == 8)
5655 {
5656 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5657 unsigned int fittingValue = 0x0;
5658
5659 if(_class && _class->type == 4)
5660 {
5661 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5662 struct __ecereNameSpace__ecere__com__EnumClassData * c = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5663
5664 if(c && value >= 0 && value <= c->largest)
5665 fittingValue = 0x1;
5666 }
5667 if(_class && !dest->truth && (_class->type == 3 || fittingValue || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5668 {
5669 if(_class->type == 0 || _class->type == 5)
5670 {
5671 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5672
5673 *newExp = *sourceExp;
5674 if(sourceExp->destType)
5675 sourceExp->destType->refCount++;
5676 if(sourceExp->expType)
5677 sourceExp->expType->refCount++;
5678 sourceExp->type = 11;
5679 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5680 sourceExp->cast.exp = newExp;
5681 FreeType(sourceExp->expType);
5682 sourceExp->expType = (((void *)0));
5683 ProcessExpressionType(sourceExp);
5684 if(!inCompiler)
5685 {
5686 FreeType(sourceExp->expType);
5687 sourceExp->expType = dest;
5688 }
5689 FreeType(source);
5690 if(inCompiler)
5691 FreeType(dest);
5692 if(backupSourceExpType)
5693 FreeType(backupSourceExpType);
5694 return 0x1;
5695 }
5696 if(!_class->dataType)
5697 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5698 FreeType(dest);
5699 dest = _class->dataType;
5700 dest->refCount++;
5701 }
5702 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))
5703 {
5704 specs = MkListOne(MkSpecifier(DOUBLE));
5705 }
5706 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))
5707 {
5708 specs = MkListOne(MkSpecifier(FLOAT));
5709 }
5710 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))
5711 {
5712 specs = MkList();
5713 if(!dest->isSigned)
5714 ListAdd(specs, MkSpecifier(UNSIGNED));
5715 ListAdd(specs, MkSpecifier(INT64));
5716 }
5717 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 6 || source->kind == 7))
5718 {
5719 specs = MkList();
5720 if(!dest->isSigned)
5721 ListAdd(specs, MkSpecifier(UNSIGNED));
5722 ListAdd(specs, MkSpecifier(INT));
5723 }
5724 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5725 {
5726 specs = MkList();
5727 if(!dest->isSigned)
5728 ListAdd(specs, MkSpecifier(UNSIGNED));
5729 ListAdd(specs, MkSpecifier(SHORT));
5730 }
5731 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 24 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5732 {
5733 specs = MkList();
5734 if(!dest->isSigned)
5735 ListAdd(specs, MkSpecifier(UNSIGNED));
5736 ListAdd(specs, MkSpecifier(CHAR));
5737 }
5738 else
5739 {
5740 FreeType(source);
5741 FreeType(dest);
5742 if(backupSourceExpType)
5743 {
5744 if(sourceExp->expType)
5745 FreeType(sourceExp->expType);
5746 sourceExp->expType = backupSourceExpType;
5747 }
5748 return 0x0;
5749 }
5750 }
5751 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))
5752 {
5753 specs = MkListOne(MkSpecifier(DOUBLE));
5754 }
5755 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))
5756 {
5757 specs = MkListOne(MkSpecifier(FLOAT));
5758 }
5759 else if(dest->kind == 24 && (source->kind == 24 || source->kind == 1 || source->kind == 15 || source->kind == 2 || source->kind == 3) && (value == 1 || value == 0))
5760 {
5761 specs = MkList();
5762 ListAdd(specs, MkSpecifier(BOOL));
5763 }
5764 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)))
5765 {
5766 specs = MkList();
5767 if(!dest->isSigned)
5768 ListAdd(specs, MkSpecifier(UNSIGNED));
5769 ListAdd(specs, MkSpecifier(CHAR));
5770 }
5771 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)))))
5772 {
5773 specs = MkList();
5774 if(!dest->isSigned)
5775 ListAdd(specs, MkSpecifier(UNSIGNED));
5776 ListAdd(specs, MkSpecifier(SHORT));
5777 }
5778 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 24 || source->kind == 1 || source->kind == 3))
5779 {
5780 specs = MkList();
5781 if(!dest->isSigned)
5782 ListAdd(specs, MkSpecifier(UNSIGNED));
5783 ListAdd(specs, MkSpecifier(INT));
5784 }
5785 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 24 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5786 {
5787 specs = MkList();
5788 if(!dest->isSigned)
5789 ListAdd(specs, MkSpecifier(UNSIGNED));
5790 ListAdd(specs, MkSpecifier(INT64));
5791 }
5792 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 24 || source->kind == 1))
5793 {
5794 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5795 }
5796 else
5797 {
5798 FreeType(source);
5799 FreeType(dest);
5800 if(backupSourceExpType)
5801 {
5802 if(sourceExp->expType)
5803 FreeType(sourceExp->expType);
5804 sourceExp->expType = backupSourceExpType;
5805 }
5806 return 0x0;
5807 }
5808 if(!flag && !sourceExp->opDestType)
5809 {
5810 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5811
5812 *newExp = *sourceExp;
5813 newExp->prev = (((void *)0));
5814 newExp->next = (((void *)0));
5815 if(sourceExp->destType)
5816 sourceExp->destType->refCount++;
5817 if(sourceExp->expType)
5818 sourceExp->expType->refCount++;
5819 sourceExp->type = 11;
5820 if(realDest->kind == 8)
5821 {
5822 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5823 FreeList(specs, FreeSpecifier);
5824 }
5825 else
5826 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5827 if(newExp->type == 4)
5828 {
5829 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5830 }
5831 else
5832 sourceExp->cast.exp = newExp;
5833 FreeType(sourceExp->expType);
5834 sourceExp->expType = (((void *)0));
5835 ProcessExpressionType(sourceExp);
5836 }
5837 else
5838 FreeList(specs, FreeSpecifier);
5839 FreeType(dest);
5840 FreeType(source);
5841 if(backupSourceExpType)
5842 FreeType(backupSourceExpType);
5843 return 0x1;
5844 }
5845 else
5846 {
5847 if(computedExp != sourceExp)
5848 {
5849 FreeExpression(computedExp);
5850 computedExp = sourceExp;
5851 }
5852 while((sourceExp->type == 5 || sourceExp->type == 32) && sourceExp->list)
5853 sourceExp = (*sourceExp->list).last;
5854 if(sourceExp->type == 0)
5855 {
5856 struct Identifier * id = sourceExp->identifier;
5857
5858 if(dest->kind == 8)
5859 {
5860 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5861 {
5862 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5863 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5864
5865 if(enumClass)
5866 {
5867 for(; _class && _class->type == 4; _class = _class->base)
5868 {
5869 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5870 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5871
5872 for(value = e->values.first; value; value = value->next)
5873 {
5874 if(!strcmp(value->name, id->string))
5875 break;
5876 }
5877 if(value)
5878 {
5879 FreeExpContents(sourceExp);
5880 FreeType(sourceExp->expType);
5881 sourceExp->isConstant = 0x1;
5882 sourceExp->expType = MkClassType(_class->fullName);
5883 {
5884 char constant[256];
5885
5886 sourceExp->type = 2;
5887 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5888 sprintf(constant, "%d", (int)value->data);
5889 else
5890 sprintf(constant, "0x%X", (int)value->data);
5891 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5892 }
5893 FreeType(dest);
5894 return 0x1;
5895 }
5896 }
5897 }
5898 }
5899 }
5900 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5901 {
5902 FreeType(dest);
5903 return 0x1;
5904 }
5905 }
5906 FreeType(dest);
5907 }
5908 return 0x0;
5909 }
5910
5911 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5912 {
5913 int value2 = op2->i;
5914
5915 exp->type = 2;
5916 exp->string = PrintInt((op1->i + value2));
5917 if(!exp->expType)
5918 {
5919 exp->expType = op1->type;
5920 if(op1->type)
5921 op1->type->refCount++;
5922 }
5923 return 0x1;
5924 }
5925
5926 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5927 {
5928 unsigned int value2 = op2->ui;
5929
5930 exp->type = 2;
5931 exp->string = PrintUInt((op1->ui + value2));
5932 if(!exp->expType)
5933 {
5934 exp->expType = op1->type;
5935 if(op1->type)
5936 op1->type->refCount++;
5937 }
5938 return 0x1;
5939 }
5940
5941 static unsigned int Int64Add(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5942 {
5943 long long value2 = op2->i64;
5944
5945 exp->type = 2;
5946 exp->string = PrintInt64((op1->i64 + value2));
5947 if(!exp->expType)
5948 {
5949 exp->expType = op1->type;
5950 if(op1->type)
5951 op1->type->refCount++;
5952 }
5953 return 0x1;
5954 }
5955
5956 static unsigned int UInt64Add(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5957 {
5958 uint64 value2 = op2->ui64;
5959
5960 exp->type = 2;
5961 exp->string = PrintUInt64((op1->ui64 + value2));
5962 if(!exp->expType)
5963 {
5964 exp->expType = op1->type;
5965 if(op1->type)
5966 op1->type->refCount++;
5967 }
5968 return 0x1;
5969 }
5970
5971 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5972 {
5973 short value2 = op2->s;
5974
5975 exp->type = 2;
5976 exp->string = PrintShort((op1->s + value2));
5977 if(!exp->expType)
5978 {
5979 exp->expType = op1->type;
5980 if(op1->type)
5981 op1->type->refCount++;
5982 }
5983 return 0x1;
5984 }
5985
5986 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5987 {
5988 unsigned short value2 = op2->us;
5989
5990 exp->type = 2;
5991 exp->string = PrintUShort((op1->us + value2));
5992 if(!exp->expType)
5993 {
5994 exp->expType = op1->type;
5995 if(op1->type)
5996 op1->type->refCount++;
5997 }
5998 return 0x1;
5999 }
6000
6001 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6002 {
6003 char value2 = op2->c;
6004
6005 exp->type = 2;
6006 exp->string = PrintChar((op1->c + value2));
6007 if(!exp->expType)
6008 {
6009 exp->expType = op1->type;
6010 if(op1->type)
6011 op1->type->refCount++;
6012 }
6013 return 0x1;
6014 }
6015
6016 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6017 {
6018 unsigned char value2 = op2->uc;
6019
6020 exp->type = 2;
6021 exp->string = PrintUChar((op1->uc + value2));
6022 if(!exp->expType)
6023 {
6024 exp->expType = op1->type;
6025 if(op1->type)
6026 op1->type->refCount++;
6027 }
6028 return 0x1;
6029 }
6030
6031 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6032 {
6033 float value2 = op2->f;
6034
6035 exp->type = 2;
6036 exp->string = PrintFloat((float)(op1->f + value2));
6037 if(!exp->expType)
6038 {
6039 exp->expType = op1->type;
6040 if(op1->type)
6041 op1->type->refCount++;
6042 }
6043 return 0x1;
6044 }
6045
6046 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6047 {
6048 double value2 = op2->d;
6049
6050 exp->type = 2;
6051 exp->string = PrintDouble((double)(op1->d + value2));
6052 if(!exp->expType)
6053 {
6054 exp->expType = op1->type;
6055 if(op1->type)
6056 op1->type->refCount++;
6057 }
6058 return 0x1;
6059 }
6060
6061 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6062 {
6063 int value2 = op2->i;
6064
6065 exp->type = 2;
6066 exp->string = PrintInt((op1->i - value2));
6067 if(!exp->expType)
6068 {
6069 exp->expType = op1->type;
6070 if(op1->type)
6071 op1->type->refCount++;
6072 }
6073 return 0x1;
6074 }
6075
6076 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6077 {
6078 unsigned int value2 = op2->ui;
6079
6080 exp->type = 2;
6081 exp->string = PrintUInt((op1->ui - value2));
6082 if(!exp->expType)
6083 {
6084 exp->expType = op1->type;
6085 if(op1->type)
6086 op1->type->refCount++;
6087 }
6088 return 0x1;
6089 }
6090
6091 static unsigned int Int64Sub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6092 {
6093 long long value2 = op2->i64;
6094
6095 exp->type = 2;
6096 exp->string = PrintInt64((op1->i64 - value2));
6097 if(!exp->expType)
6098 {
6099 exp->expType = op1->type;
6100 if(op1->type)
6101 op1->type->refCount++;
6102 }
6103 return 0x1;
6104 }
6105
6106 static unsigned int UInt64Sub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6107 {
6108 uint64 value2 = op2->ui64;
6109
6110 exp->type = 2;
6111 exp->string = PrintUInt64((op1->ui64 - value2));
6112 if(!exp->expType)
6113 {
6114 exp->expType = op1->type;
6115 if(op1->type)
6116 op1->type->refCount++;
6117 }
6118 return 0x1;
6119 }
6120
6121 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6122 {
6123 short value2 = op2->s;
6124
6125 exp->type = 2;
6126 exp->string = PrintShort((op1->s - value2));
6127 if(!exp->expType)
6128 {
6129 exp->expType = op1->type;
6130 if(op1->type)
6131 op1->type->refCount++;
6132 }
6133 return 0x1;
6134 }
6135
6136 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6137 {
6138 unsigned short value2 = op2->us;
6139
6140 exp->type = 2;
6141 exp->string = PrintUShort((op1->us - value2));
6142 if(!exp->expType)
6143 {
6144 exp->expType = op1->type;
6145 if(op1->type)
6146 op1->type->refCount++;
6147 }
6148 return 0x1;
6149 }
6150
6151 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6152 {
6153 char value2 = op2->c;
6154
6155 exp->type = 2;
6156 exp->string = PrintChar((op1->c - value2));
6157 if(!exp->expType)
6158 {
6159 exp->expType = op1->type;
6160 if(op1->type)
6161 op1->type->refCount++;
6162 }
6163 return 0x1;
6164 }
6165
6166 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6167 {
6168 unsigned char value2 = op2->uc;
6169
6170 exp->type = 2;
6171 exp->string = PrintUChar((op1->uc - value2));
6172 if(!exp->expType)
6173 {
6174 exp->expType = op1->type;
6175 if(op1->type)
6176 op1->type->refCount++;
6177 }
6178 return 0x1;
6179 }
6180
6181 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6182 {
6183 float value2 = op2->f;
6184
6185 exp->type = 2;
6186 exp->string = PrintFloat((float)(op1->f - value2));
6187 if(!exp->expType)
6188 {
6189 exp->expType = op1->type;
6190 if(op1->type)
6191 op1->type->refCount++;
6192 }
6193 return 0x1;
6194 }
6195
6196 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6197 {
6198 double value2 = op2->d;
6199
6200 exp->type = 2;
6201 exp->string = PrintDouble((double)(op1->d - value2));
6202 if(!exp->expType)
6203 {
6204 exp->expType = op1->type;
6205 if(op1->type)
6206 op1->type->refCount++;
6207 }
6208 return 0x1;
6209 }
6210
6211 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6212 {
6213 int value2 = op2->i;
6214
6215 exp->type = 2;
6216 exp->string = PrintInt((op1->i * value2));
6217 if(!exp->expType)
6218 {
6219 exp->expType = op1->type;
6220 if(op1->type)
6221 op1->type->refCount++;
6222 }
6223 return 0x1;
6224 }
6225
6226 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6227 {
6228 unsigned int value2 = op2->ui;
6229
6230 exp->type = 2;
6231 exp->string = PrintUInt((op1->ui * value2));
6232 if(!exp->expType)
6233 {
6234 exp->expType = op1->type;
6235 if(op1->type)
6236 op1->type->refCount++;
6237 }
6238 return 0x1;
6239 }
6240
6241 static unsigned int Int64Mul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6242 {
6243 long long value2 = op2->i64;
6244
6245 exp->type = 2;
6246 exp->string = PrintInt64((op1->i64 * value2));
6247 if(!exp->expType)
6248 {
6249 exp->expType = op1->type;
6250 if(op1->type)
6251 op1->type->refCount++;
6252 }
6253 return 0x1;
6254 }
6255
6256 static unsigned int UInt64Mul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6257 {
6258 uint64 value2 = op2->ui64;
6259
6260 exp->type = 2;
6261 exp->string = PrintUInt64((op1->ui64 * value2));
6262 if(!exp->expType)
6263 {
6264 exp->expType = op1->type;
6265 if(op1->type)
6266 op1->type->refCount++;
6267 }
6268 return 0x1;
6269 }
6270
6271 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6272 {
6273 short value2 = op2->s;
6274
6275 exp->type = 2;
6276 exp->string = PrintShort((op1->s * value2));
6277 if(!exp->expType)
6278 {
6279 exp->expType = op1->type;
6280 if(op1->type)
6281 op1->type->refCount++;
6282 }
6283 return 0x1;
6284 }
6285
6286 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6287 {
6288 unsigned short value2 = op2->us;
6289
6290 exp->type = 2;
6291 exp->string = PrintUShort((op1->us * value2));
6292 if(!exp->expType)
6293 {
6294 exp->expType = op1->type;
6295 if(op1->type)
6296 op1->type->refCount++;
6297 }
6298 return 0x1;
6299 }
6300
6301 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6302 {
6303 char value2 = op2->c;
6304
6305 exp->type = 2;
6306 exp->string = PrintChar((op1->c * value2));
6307 if(!exp->expType)
6308 {
6309 exp->expType = op1->type;
6310 if(op1->type)
6311 op1->type->refCount++;
6312 }
6313 return 0x1;
6314 }
6315
6316 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6317 {
6318 unsigned char value2 = op2->uc;
6319
6320 exp->type = 2;
6321 exp->string = PrintUChar((op1->uc * value2));
6322 if(!exp->expType)
6323 {
6324 exp->expType = op1->type;
6325 if(op1->type)
6326 op1->type->refCount++;
6327 }
6328 return 0x1;
6329 }
6330
6331 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6332 {
6333 float value2 = op2->f;
6334
6335 exp->type = 2;
6336 exp->string = PrintFloat((float)(op1->f * value2));
6337 if(!exp->expType)
6338 {
6339 exp->expType = op1->type;
6340 if(op1->type)
6341 op1->type->refCount++;
6342 }
6343 return 0x1;
6344 }
6345
6346 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6347 {
6348 double value2 = op2->d;
6349
6350 exp->type = 2;
6351 exp->string = PrintDouble((double)(op1->d * value2));
6352 if(!exp->expType)
6353 {
6354 exp->expType = op1->type;
6355 if(op1->type)
6356 op1->type->refCount++;
6357 }
6358 return 0x1;
6359 }
6360
6361 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6362 {
6363 int value2 = op2->i;
6364
6365 exp->type = 2;
6366 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
6367 if(!exp->expType)
6368 {
6369 exp->expType = op1->type;
6370 if(op1->type)
6371 op1->type->refCount++;
6372 }
6373 return 0x1;
6374 }
6375
6376 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6377 {
6378 unsigned int value2 = op2->ui;
6379
6380 exp->type = 2;
6381 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
6382 if(!exp->expType)
6383 {
6384 exp->expType = op1->type;
6385 if(op1->type)
6386 op1->type->refCount++;
6387 }
6388 return 0x1;
6389 }
6390
6391 static unsigned int Int64Div(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6392 {
6393 long long value2 = op2->i64;
6394
6395 exp->type = 2;
6396 exp->string = PrintInt64(value2 ? (op1->i64 / value2) : 0);
6397 if(!exp->expType)
6398 {
6399 exp->expType = op1->type;
6400 if(op1->type)
6401 op1->type->refCount++;
6402 }
6403 return 0x1;
6404 }
6405
6406 static unsigned int UInt64Div(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6407 {
6408 uint64 value2 = op2->ui64;
6409
6410 exp->type = 2;
6411 exp->string = PrintUInt64(value2 ? (op1->ui64 / value2) : 0);
6412 if(!exp->expType)
6413 {
6414 exp->expType = op1->type;
6415 if(op1->type)
6416 op1->type->refCount++;
6417 }
6418 return 0x1;
6419 }
6420
6421 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6422 {
6423 short value2 = op2->s;
6424
6425 exp->type = 2;
6426 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
6427 if(!exp->expType)
6428 {
6429 exp->expType = op1->type;
6430 if(op1->type)
6431 op1->type->refCount++;
6432 }
6433 return 0x1;
6434 }
6435
6436 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6437 {
6438 unsigned short value2 = op2->us;
6439
6440 exp->type = 2;
6441 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
6442 if(!exp->expType)
6443 {
6444 exp->expType = op1->type;
6445 if(op1->type)
6446 op1->type->refCount++;
6447 }
6448 return 0x1;
6449 }
6450
6451 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6452 {
6453 char value2 = op2->c;
6454
6455 exp->type = 2;
6456 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
6457 if(!exp->expType)
6458 {
6459 exp->expType = op1->type;
6460 if(op1->type)
6461 op1->type->refCount++;
6462 }
6463 return 0x1;
6464 }
6465
6466 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6467 {
6468 unsigned char value2 = op2->uc;
6469
6470 exp->type = 2;
6471 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
6472 if(!exp->expType)
6473 {
6474 exp->expType = op1->type;
6475 if(op1->type)
6476 op1->type->refCount++;
6477 }
6478 return 0x1;
6479 }
6480
6481 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6482 {
6483 float value2 = op2->f;
6484
6485 exp->type = 2;
6486 exp->string = PrintFloat(op1->f / value2);
6487 if(!exp->expType)
6488 {
6489 exp->expType = op1->type;
6490 if(op1->type)
6491 op1->type->refCount++;
6492 }
6493 return 0x1;
6494 }
6495
6496 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6497 {
6498 double value2 = op2->d;
6499
6500 exp->type = 2;
6501 exp->string = PrintDouble(op1->d / value2);
6502 if(!exp->expType)
6503 {
6504 exp->expType = op1->type;
6505 if(op1->type)
6506 op1->type->refCount++;
6507 }
6508 return 0x1;
6509 }
6510
6511 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6512 {
6513 int value2 = op2->i;
6514
6515 exp->type = 2;
6516 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
6517 if(!exp->expType)
6518 {
6519 exp->expType = op1->type;
6520 if(op1->type)
6521 op1->type->refCount++;
6522 }
6523 return 0x1;
6524 }
6525
6526 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6527 {
6528 unsigned int value2 = op2->ui;
6529
6530 exp->type = 2;
6531 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
6532 if(!exp->expType)
6533 {
6534 exp->expType = op1->type;
6535 if(op1->type)
6536 op1->type->refCount++;
6537 }
6538 return 0x1;
6539 }
6540
6541 static unsigned int Int64Mod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6542 {
6543 long long value2 = op2->i64;
6544
6545 exp->type = 2;
6546 exp->string = PrintInt64(value2 ? (op1->i64 % value2) : 0);
6547 if(!exp->expType)
6548 {
6549 exp->expType = op1->type;
6550 if(op1->type)
6551 op1->type->refCount++;
6552 }
6553 return 0x1;
6554 }
6555
6556 static unsigned int UInt64Mod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6557 {
6558 uint64 value2 = op2->ui64;
6559
6560 exp->type = 2;
6561 exp->string = PrintUInt64(value2 ? (op1->ui64 % value2) : 0);
6562 if(!exp->expType)
6563 {
6564 exp->expType = op1->type;
6565 if(op1->type)
6566 op1->type->refCount++;
6567 }
6568 return 0x1;
6569 }
6570
6571 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6572 {
6573 short value2 = op2->s;
6574
6575 exp->type = 2;
6576 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
6577 if(!exp->expType)
6578 {
6579 exp->expType = op1->type;
6580 if(op1->type)
6581 op1->type->refCount++;
6582 }
6583 return 0x1;
6584 }
6585
6586 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6587 {
6588 unsigned short value2 = op2->us;
6589
6590 exp->type = 2;
6591 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
6592 if(!exp->expType)
6593 {
6594 exp->expType = op1->type;
6595 if(op1->type)
6596 op1->type->refCount++;
6597 }
6598 return 0x1;
6599 }
6600
6601 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6602 {
6603 char value2 = op2->c;
6604
6605 exp->type = 2;
6606 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
6607 if(!exp->expType)
6608 {
6609 exp->expType = op1->type;
6610 if(op1->type)
6611 op1->type->refCount++;
6612 }
6613 return 0x1;
6614 }
6615
6616 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6617 {
6618 unsigned char value2 = op2->uc;
6619
6620 exp->type = 2;
6621 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
6622 if(!exp->expType)
6623 {
6624 exp->expType = op1->type;
6625 if(op1->type)
6626 op1->type->refCount++;
6627 }
6628 return 0x1;
6629 }
6630
6631 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
6632 {
6633 exp->type = 2;
6634 exp->string = PrintInt((-op1->i));
6635 if(!exp->expType)
6636 {
6637 exp->expType = op1->type;
6638 if(op1->type)
6639 op1->type->refCount++;
6640 }
6641 return 0x1;
6642 }
6643
6644 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
6645 {
6646 exp->type = 2;
6647 exp->string = PrintUInt((unsigned int)(-op1->ui));
6648 if(!exp->expType)
6649 {
6650 exp->expType = op1->type;
6651 if(op1->type)
6652 op1->type->refCount++;
6653 }
6654 return 0x1;
6655 }
6656
6657 static unsigned int Int64Neg(struct Expression * exp, struct Operand * op1)
6658 {
6659 exp->type = 2;
6660 exp->string = PrintInt64((-op1->i64));
6661 if(!exp->expType)
6662 {
6663 exp->expType = op1->type;
6664 if(op1->type)
6665 op1->type->refCount++;
6666 }
6667 return 0x1;
6668 }
6669
6670 static unsigned int UInt64Neg(struct Expression * exp, struct Operand * op1)
6671 {
6672 exp->type = 2;
6673 exp->string = PrintUInt64((uint64)(-op1->ui64));
6674 if(!exp->expType)
6675 {
6676 exp->expType = op1->type;
6677 if(op1->type)
6678 op1->type->refCount++;
6679 }
6680 return 0x1;
6681 }
6682
6683 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
6684 {
6685 exp->type = 2;
6686 exp->string = PrintShort((-op1->s));
6687 if(!exp->expType)
6688 {
6689 exp->expType = op1->type;
6690 if(op1->type)
6691 op1->type->refCount++;
6692 }
6693 return 0x1;
6694 }
6695
6696 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
6697 {
6698 exp->type = 2;
6699 exp->string = PrintUShort((unsigned short)(-op1->us));
6700 if(!exp->expType)
6701 {
6702 exp->expType = op1->type;
6703 if(op1->type)
6704 op1->type->refCount++;
6705 }
6706 return 0x1;
6707 }
6708
6709 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
6710 {
6711 exp->type = 2;
6712 exp->string = PrintChar((-op1->c));
6713 if(!exp->expType)
6714 {
6715 exp->expType = op1->type;
6716 if(op1->type)
6717 op1->type->refCount++;
6718 }
6719 return 0x1;
6720 }
6721
6722 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
6723 {
6724 exp->type = 2;
6725 exp->string = PrintUChar((unsigned char)(-op1->uc));
6726 if(!exp->expType)
6727 {
6728 exp->expType = op1->type;
6729 if(op1->type)
6730 op1->type->refCount++;
6731 }
6732 return 0x1;
6733 }
6734
6735 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
6736 {
6737 exp->type = 2;
6738 exp->string = PrintFloat((float)(-op1->f));
6739 if(!exp->expType)
6740 {
6741 exp->expType = op1->type;
6742 if(op1->type)
6743 op1->type->refCount++;
6744 }
6745 return 0x1;
6746 }
6747
6748 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6749 {
6750 exp->type = 2;
6751 exp->string = PrintDouble((double)(-op1->d));
6752 if(!exp->expType)
6753 {
6754 exp->expType = op1->type;
6755 if(op1->type)
6756 op1->type->refCount++;
6757 }
6758 return 0x1;
6759 }
6760
6761 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6762 {
6763 exp->type = 2;
6764 exp->string = PrintInt((++op1->i));
6765 if(!exp->expType)
6766 {
6767 exp->expType = op1->type;
6768 if(op1->type)
6769 op1->type->refCount++;
6770 }
6771 return 0x1;
6772 }
6773
6774 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6775 {
6776 exp->type = 2;
6777 exp->string = PrintUInt((++op1->ui));
6778 if(!exp->expType)
6779 {
6780 exp->expType = op1->type;
6781 if(op1->type)
6782 op1->type->refCount++;
6783 }
6784 return 0x1;
6785 }
6786
6787 static unsigned int Int64Inc(struct Expression * exp, struct Operand * op1)
6788 {
6789 exp->type = 2;
6790 exp->string = PrintInt64((++op1->i64));
6791 if(!exp->expType)
6792 {
6793 exp->expType = op1->type;
6794 if(op1->type)
6795 op1->type->refCount++;
6796 }
6797 return 0x1;
6798 }
6799
6800 static unsigned int UInt64Inc(struct Expression * exp, struct Operand * op1)
6801 {
6802 exp->type = 2;
6803 exp->string = PrintUInt64((++op1->ui64));
6804 if(!exp->expType)
6805 {
6806 exp->expType = op1->type;
6807 if(op1->type)
6808 op1->type->refCount++;
6809 }
6810 return 0x1;
6811 }
6812
6813 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6814 {
6815 exp->type = 2;
6816 exp->string = PrintShort((++op1->s));
6817 if(!exp->expType)
6818 {
6819 exp->expType = op1->type;
6820 if(op1->type)
6821 op1->type->refCount++;
6822 }
6823 return 0x1;
6824 }
6825
6826 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6827 {
6828 exp->type = 2;
6829 exp->string = PrintUShort((++op1->us));
6830 if(!exp->expType)
6831 {
6832 exp->expType = op1->type;
6833 if(op1->type)
6834 op1->type->refCount++;
6835 }
6836 return 0x1;
6837 }
6838
6839 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6840 {
6841 exp->type = 2;
6842 exp->string = PrintChar((++op1->c));
6843 if(!exp->expType)
6844 {
6845 exp->expType = op1->type;
6846 if(op1->type)
6847 op1->type->refCount++;
6848 }
6849 return 0x1;
6850 }
6851
6852 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6853 {
6854 exp->type = 2;
6855 exp->string = PrintUChar((++op1->uc));
6856 if(!exp->expType)
6857 {
6858 exp->expType = op1->type;
6859 if(op1->type)
6860 op1->type->refCount++;
6861 }
6862 return 0x1;
6863 }
6864
6865 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6866 {
6867 exp->type = 2;
6868 exp->string = PrintFloat((float)(++op1->f));
6869 if(!exp->expType)
6870 {
6871 exp->expType = op1->type;
6872 if(op1->type)
6873 op1->type->refCount++;
6874 }
6875 return 0x1;
6876 }
6877
6878 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6879 {
6880 exp->type = 2;
6881 exp->string = PrintDouble((double)(++op1->d));
6882 if(!exp->expType)
6883 {
6884 exp->expType = op1->type;
6885 if(op1->type)
6886 op1->type->refCount++;
6887 }
6888 return 0x1;
6889 }
6890
6891 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6892 {
6893 exp->type = 2;
6894 exp->string = PrintInt((--op1->i));
6895 if(!exp->expType)
6896 {
6897 exp->expType = op1->type;
6898 if(op1->type)
6899 op1->type->refCount++;
6900 }
6901 return 0x1;
6902 }
6903
6904 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6905 {
6906 exp->type = 2;
6907 exp->string = PrintUInt((--op1->ui));
6908 if(!exp->expType)
6909 {
6910 exp->expType = op1->type;
6911 if(op1->type)
6912 op1->type->refCount++;
6913 }
6914 return 0x1;
6915 }
6916
6917 static unsigned int Int64Dec(struct Expression * exp, struct Operand * op1)
6918 {
6919 exp->type = 2;
6920 exp->string = PrintInt64((--op1->i64));
6921 if(!exp->expType)
6922 {
6923 exp->expType = op1->type;
6924 if(op1->type)
6925 op1->type->refCount++;
6926 }
6927 return 0x1;
6928 }
6929
6930 static unsigned int UInt64Dec(struct Expression * exp, struct Operand * op1)
6931 {
6932 exp->type = 2;
6933 exp->string = PrintUInt64((--op1->ui64));
6934 if(!exp->expType)
6935 {
6936 exp->expType = op1->type;
6937 if(op1->type)
6938 op1->type->refCount++;
6939 }
6940 return 0x1;
6941 }
6942
6943 static unsigned int ShortDec(struct Expression * exp, struct Operand * op1)
6944 {
6945 exp->type = 2;
6946 exp->string = PrintShort((--op1->s));
6947 if(!exp->expType)
6948 {
6949 exp->expType = op1->type;
6950 if(op1->type)
6951 op1->type->refCount++;
6952 }
6953 return 0x1;
6954 }
6955
6956 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6957 {
6958 exp->type = 2;
6959 exp->string = PrintUShort((--op1->us));
6960 if(!exp->expType)
6961 {
6962 exp->expType = op1->type;
6963 if(op1->type)
6964 op1->type->refCount++;
6965 }
6966 return 0x1;
6967 }
6968
6969 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6970 {
6971 exp->type = 2;
6972 exp->string = PrintChar((--op1->c));
6973 if(!exp->expType)
6974 {
6975 exp->expType = op1->type;
6976 if(op1->type)
6977 op1->type->refCount++;
6978 }
6979 return 0x1;
6980 }
6981
6982 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6983 {
6984 exp->type = 2;
6985 exp->string = PrintUChar((--op1->uc));
6986 if(!exp->expType)
6987 {
6988 exp->expType = op1->type;
6989 if(op1->type)
6990 op1->type->refCount++;
6991 }
6992 return 0x1;
6993 }
6994
6995 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6996 {
6997 exp->type = 2;
6998 exp->string = PrintFloat((float)(--op1->f));
6999 if(!exp->expType)
7000 {
7001 exp->expType = op1->type;
7002 if(op1->type)
7003 op1->type->refCount++;
7004 }
7005 return 0x1;
7006 }
7007
7008 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
7009 {
7010 exp->type = 2;
7011 exp->string = PrintDouble((double)(--op1->d));
7012 if(!exp->expType)
7013 {
7014 exp->expType = op1->type;
7015 if(op1->type)
7016 op1->type->refCount++;
7017 }
7018 return 0x1;
7019 }
7020
7021 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7022 {
7023 int value2 = op2->i;
7024
7025 exp->type = 2;
7026 exp->string = PrintInt((op1->i = value2));
7027 if(!exp->expType)
7028 {
7029 exp->expType = op1->type;
7030 if(op1->type)
7031 op1->type->refCount++;
7032 }
7033 return 0x1;
7034 }
7035
7036 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7037 {
7038 unsigned int value2 = op2->ui;
7039
7040 exp->type = 2;
7041 exp->string = PrintUInt((op1->ui = value2));
7042 if(!exp->expType)
7043 {
7044 exp->expType = op1->type;
7045 if(op1->type)
7046 op1->type->refCount++;
7047 }
7048 return 0x1;
7049 }
7050
7051 static unsigned int Int64Asign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7052 {
7053 long long value2 = op2->i64;
7054
7055 exp->type = 2;
7056 exp->string = PrintInt64((op1->i64 = value2));
7057 if(!exp->expType)
7058 {
7059 exp->expType = op1->type;
7060 if(op1->type)
7061 op1->type->refCount++;
7062 }
7063 return 0x1;
7064 }
7065
7066 static unsigned int UInt64Asign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7067 {
7068 uint64 value2 = op2->ui64;
7069
7070 exp->type = 2;
7071 exp->string = PrintUInt64((op1->ui64 = value2));
7072 if(!exp->expType)
7073 {
7074 exp->expType = op1->type;
7075 if(op1->type)
7076 op1->type->refCount++;
7077 }
7078 return 0x1;
7079 }
7080
7081 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7082 {
7083 short value2 = op2->s;
7084
7085 exp->type = 2;
7086 exp->string = PrintShort((op1->s = value2));
7087 if(!exp->expType)
7088 {
7089 exp->expType = op1->type;
7090 if(op1->type)
7091 op1->type->refCount++;
7092 }
7093 return 0x1;
7094 }
7095
7096 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7097 {
7098 unsigned short value2 = op2->us;
7099
7100 exp->type = 2;
7101 exp->string = PrintUShort((op1->us = value2));
7102 if(!exp->expType)
7103 {
7104 exp->expType = op1->type;
7105 if(op1->type)
7106 op1->type->refCount++;
7107 }
7108 return 0x1;
7109 }
7110
7111 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7112 {
7113 char value2 = op2->c;
7114
7115 exp->type = 2;
7116 exp->string = PrintChar((op1->c = value2));
7117 if(!exp->expType)
7118 {
7119 exp->expType = op1->type;
7120 if(op1->type)
7121 op1->type->refCount++;
7122 }
7123 return 0x1;
7124 }
7125
7126 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7127 {
7128 unsigned char value2 = op2->uc;
7129
7130 exp->type = 2;
7131 exp->string = PrintUChar((op1->uc = value2));
7132 if(!exp->expType)
7133 {
7134 exp->expType = op1->type;
7135 if(op1->type)
7136 op1->type->refCount++;
7137 }
7138 return 0x1;
7139 }
7140
7141 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7142 {
7143 float value2 = op2->f;
7144
7145 exp->type = 2;
7146 exp->string = PrintFloat((float)(op1->f = value2));
7147 if(!exp->expType)
7148 {
7149 exp->expType = op1->type;
7150 if(op1->type)
7151 op1->type->refCount++;
7152 }
7153 return 0x1;
7154 }
7155
7156 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7157 {
7158 double value2 = op2->d;
7159
7160 exp->type = 2;
7161 exp->string = PrintDouble((double)(op1->d = value2));
7162 if(!exp->expType)
7163 {
7164 exp->expType = op1->type;
7165 if(op1->type)
7166 op1->type->refCount++;
7167 }
7168 return 0x1;
7169 }
7170
7171 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7172 {
7173 int value2 = op2->i;
7174
7175 exp->type = 2;
7176 exp->string = PrintInt((op1->i += value2));
7177 if(!exp->expType)
7178 {
7179 exp->expType = op1->type;
7180 if(op1->type)
7181 op1->type->refCount++;
7182 }
7183 return 0x1;
7184 }
7185
7186 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7187 {
7188 unsigned int value2 = op2->ui;
7189
7190 exp->type = 2;
7191 exp->string = PrintUInt((op1->ui += value2));
7192 if(!exp->expType)
7193 {
7194 exp->expType = op1->type;
7195 if(op1->type)
7196 op1->type->refCount++;
7197 }
7198 return 0x1;
7199 }
7200
7201 static unsigned int Int64AddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7202 {
7203 long long value2 = op2->i64;
7204
7205 exp->type = 2;
7206 exp->string = PrintInt64((op1->i64 += value2));
7207 if(!exp->expType)
7208 {
7209 exp->expType = op1->type;
7210 if(op1->type)
7211 op1->type->refCount++;
7212 }
7213 return 0x1;
7214 }
7215
7216 static unsigned int UInt64AddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7217 {
7218 uint64 value2 = op2->ui64;
7219
7220 exp->type = 2;
7221 exp->string = PrintUInt64((op1->ui64 += value2));
7222 if(!exp->expType)
7223 {
7224 exp->expType = op1->type;
7225 if(op1->type)
7226 op1->type->refCount++;
7227 }
7228 return 0x1;
7229 }
7230
7231 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7232 {
7233 short value2 = op2->s;
7234
7235 exp->type = 2;
7236 exp->string = PrintShort((op1->s += value2));
7237 if(!exp->expType)
7238 {
7239 exp->expType = op1->type;
7240 if(op1->type)
7241 op1->type->refCount++;
7242 }
7243 return 0x1;
7244 }
7245
7246 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7247 {
7248 unsigned short value2 = op2->us;
7249
7250 exp->type = 2;
7251 exp->string = PrintUShort((op1->us += value2));
7252 if(!exp->expType)
7253 {
7254 exp->expType = op1->type;
7255 if(op1->type)
7256 op1->type->refCount++;
7257 }
7258 return 0x1;
7259 }
7260
7261 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7262 {
7263 char value2 = op2->c;
7264
7265 exp->type = 2;
7266 exp->string = PrintChar((op1->c += value2));
7267 if(!exp->expType)
7268 {
7269 exp->expType = op1->type;
7270 if(op1->type)
7271 op1->type->refCount++;
7272 }
7273 return 0x1;
7274 }
7275
7276 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7277 {
7278 unsigned char value2 = op2->uc;
7279
7280 exp->type = 2;
7281 exp->string = PrintUChar((op1->uc += value2));
7282 if(!exp->expType)
7283 {
7284 exp->expType = op1->type;
7285 if(op1->type)
7286 op1->type->refCount++;
7287 }
7288 return 0x1;
7289 }
7290
7291 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7292 {
7293 float value2 = op2->f;
7294
7295 exp->type = 2;
7296 exp->string = PrintFloat((float)(op1->f += value2));
7297 if(!exp->expType)
7298 {
7299 exp->expType = op1->type;
7300 if(op1->type)
7301 op1->type->refCount++;
7302 }
7303 return 0x1;
7304 }
7305
7306 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7307 {
7308 double value2 = op2->d;
7309
7310 exp->type = 2;
7311 exp->string = PrintDouble((double)(op1->d += value2));
7312 if(!exp->expType)
7313 {
7314 exp->expType = op1->type;
7315 if(op1->type)
7316 op1->type->refCount++;
7317 }
7318 return 0x1;
7319 }
7320
7321 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7322 {
7323 int value2 = op2->i;
7324
7325 exp->type = 2;
7326 exp->string = PrintInt((op1->i -= value2));
7327 if(!exp->expType)
7328 {
7329 exp->expType = op1->type;
7330 if(op1->type)
7331 op1->type->refCount++;
7332 }
7333 return 0x1;
7334 }
7335
7336 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7337 {
7338 unsigned int value2 = op2->ui;
7339
7340 exp->type = 2;
7341 exp->string = PrintUInt((op1->ui -= value2));
7342 if(!exp->expType)
7343 {
7344 exp->expType = op1->type;
7345 if(op1->type)
7346 op1->type->refCount++;
7347 }
7348 return 0x1;
7349 }
7350
7351 static unsigned int Int64SubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7352 {
7353 long long value2 = op2->i64;
7354
7355 exp->type = 2;
7356 exp->string = PrintInt64((op1->i64 -= value2));
7357 if(!exp->expType)
7358 {
7359 exp->expType = op1->type;
7360 if(op1->type)
7361 op1->type->refCount++;
7362 }
7363 return 0x1;
7364 }
7365
7366 static unsigned int UInt64SubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7367 {
7368 uint64 value2 = op2->ui64;
7369
7370 exp->type = 2;
7371 exp->string = PrintUInt64((op1->ui64 -= value2));
7372 if(!exp->expType)
7373 {
7374 exp->expType = op1->type;
7375 if(op1->type)
7376 op1->type->refCount++;
7377 }
7378 return 0x1;
7379 }
7380
7381 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7382 {
7383 short value2 = op2->s;
7384
7385 exp->type = 2;
7386 exp->string = PrintShort((op1->s -= value2));
7387 if(!exp->expType)
7388 {
7389 exp->expType = op1->type;
7390 if(op1->type)
7391 op1->type->refCount++;
7392 }
7393 return 0x1;
7394 }
7395
7396 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7397 {
7398 unsigned short value2 = op2->us;
7399
7400 exp->type = 2;
7401 exp->string = PrintUShort((op1->us -= value2));
7402 if(!exp->expType)
7403 {
7404 exp->expType = op1->type;
7405 if(op1->type)
7406 op1->type->refCount++;
7407 }
7408 return 0x1;
7409 }
7410
7411 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7412 {
7413 char value2 = op2->c;
7414
7415 exp->type = 2;
7416 exp->string = PrintChar((op1->c -= value2));
7417 if(!exp->expType)
7418 {
7419 exp->expType = op1->type;
7420 if(op1->type)
7421 op1->type->refCount++;
7422 }
7423 return 0x1;
7424 }
7425
7426 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7427 {
7428 unsigned char value2 = op2->uc;
7429
7430 exp->type = 2;
7431 exp->string = PrintUChar((op1->uc -= value2));
7432 if(!exp->expType)
7433 {
7434 exp->expType = op1->type;
7435 if(op1->type)
7436 op1->type->refCount++;
7437 }
7438 return 0x1;
7439 }
7440
7441 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7442 {
7443 float value2 = op2->f;
7444
7445 exp->type = 2;
7446 exp->string = PrintFloat((float)(op1->f -= value2));
7447 if(!exp->expType)
7448 {
7449 exp->expType = op1->type;
7450 if(op1->type)
7451 op1->type->refCount++;
7452 }
7453 return 0x1;
7454 }
7455
7456 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7457 {
7458 double value2 = op2->d;
7459
7460 exp->type = 2;
7461 exp->string = PrintDouble((double)(op1->d -= value2));
7462 if(!exp->expType)
7463 {
7464 exp->expType = op1->type;
7465 if(op1->type)
7466 op1->type->refCount++;
7467 }
7468 return 0x1;
7469 }
7470
7471 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7472 {
7473 int value2 = op2->i;
7474
7475 exp->type = 2;
7476 exp->string = PrintInt((op1->i *= value2));
7477 if(!exp->expType)
7478 {
7479 exp->expType = op1->type;
7480 if(op1->type)
7481 op1->type->refCount++;
7482 }
7483 return 0x1;
7484 }
7485
7486 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7487 {
7488 unsigned int value2 = op2->ui;
7489
7490 exp->type = 2;
7491 exp->string = PrintUInt((op1->ui *= value2));
7492 if(!exp->expType)
7493 {
7494 exp->expType = op1->type;
7495 if(op1->type)
7496 op1->type->refCount++;
7497 }
7498 return 0x1;
7499 }
7500
7501 static unsigned int Int64MulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7502 {
7503 long long value2 = op2->i64;
7504
7505 exp->type = 2;
7506 exp->string = PrintInt64((op1->i64 *= value2));
7507 if(!exp->expType)
7508 {
7509 exp->expType = op1->type;
7510 if(op1->type)
7511 op1->type->refCount++;
7512 }
7513 return 0x1;
7514 }
7515
7516 static unsigned int UInt64MulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7517 {
7518 uint64 value2 = op2->ui64;
7519
7520 exp->type = 2;
7521 exp->string = PrintUInt64((op1->ui64 *= value2));
7522 if(!exp->expType)
7523 {
7524 exp->expType = op1->type;
7525 if(op1->type)
7526 op1->type->refCount++;
7527 }
7528 return 0x1;
7529 }
7530
7531 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7532 {
7533 short value2 = op2->s;
7534
7535 exp->type = 2;
7536 exp->string = PrintShort((op1->s *= value2));
7537 if(!exp->expType)
7538 {
7539 exp->expType = op1->type;
7540 if(op1->type)
7541 op1->type->refCount++;
7542 }
7543 return 0x1;
7544 }
7545
7546 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7547 {
7548 unsigned short value2 = op2->us;
7549
7550 exp->type = 2;
7551 exp->string = PrintUShort((op1->us *= value2));
7552 if(!exp->expType)
7553 {
7554 exp->expType = op1->type;
7555 if(op1->type)
7556 op1->type->refCount++;
7557 }
7558 return 0x1;
7559 }
7560
7561 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7562 {
7563 char value2 = op2->c;
7564
7565 exp->type = 2;
7566 exp->string = PrintChar((op1->c *= value2));
7567 if(!exp->expType)
7568 {
7569 exp->expType = op1->type;
7570 if(op1->type)
7571 op1->type->refCount++;
7572 }
7573 return 0x1;
7574 }
7575
7576 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7577 {
7578 unsigned char value2 = op2->uc;
7579
7580 exp->type = 2;
7581 exp->string = PrintUChar((op1->uc *= value2));
7582 if(!exp->expType)
7583 {
7584 exp->expType = op1->type;
7585 if(op1->type)
7586 op1->type->refCount++;
7587 }
7588 return 0x1;
7589 }
7590
7591 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7592 {
7593 float value2 = op2->f;
7594
7595 exp->type = 2;
7596 exp->string = PrintFloat((float)(op1->f *= value2));
7597 if(!exp->expType)
7598 {
7599 exp->expType = op1->type;
7600 if(op1->type)
7601 op1->type->refCount++;
7602 }
7603 return 0x1;
7604 }
7605
7606 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7607 {
7608 double value2 = op2->d;
7609
7610 exp->type = 2;
7611 exp->string = PrintDouble((double)(op1->d *= value2));
7612 if(!exp->expType)
7613 {
7614 exp->expType = op1->type;
7615 if(op1->type)
7616 op1->type->refCount++;
7617 }
7618 return 0x1;
7619 }
7620
7621 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7622 {
7623 int value2 = op2->i;
7624
7625 exp->type = 2;
7626 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
7627 if(!exp->expType)
7628 {
7629 exp->expType = op1->type;
7630 if(op1->type)
7631 op1->type->refCount++;
7632 }
7633 return 0x1;
7634 }
7635
7636 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7637 {
7638 unsigned int value2 = op2->ui;
7639
7640 exp->type = 2;
7641 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
7642 if(!exp->expType)
7643 {
7644 exp->expType = op1->type;
7645 if(op1->type)
7646 op1->type->refCount++;
7647 }
7648 return 0x1;
7649 }
7650
7651 static unsigned int Int64DivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7652 {
7653 long long value2 = op2->i64;
7654
7655 exp->type = 2;
7656 exp->string = PrintInt64(value2 ? (op1->i64 /= value2) : 0);
7657 if(!exp->expType)
7658 {
7659 exp->expType = op1->type;
7660 if(op1->type)
7661 op1->type->refCount++;
7662 }
7663 return 0x1;
7664 }
7665
7666 static unsigned int UInt64DivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7667 {
7668 uint64 value2 = op2->ui64;
7669
7670 exp->type = 2;
7671 exp->string = PrintUInt64(value2 ? (op1->ui64 /= value2) : 0);
7672 if(!exp->expType)
7673 {
7674 exp->expType = op1->type;
7675 if(op1->type)
7676 op1->type->refCount++;
7677 }
7678 return 0x1;
7679 }
7680
7681 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7682 {
7683 short value2 = op2->s;
7684
7685 exp->type = 2;
7686 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
7687 if(!exp->expType)
7688 {
7689 exp->expType = op1->type;
7690 if(op1->type)
7691 op1->type->refCount++;
7692 }
7693 return 0x1;
7694 }
7695
7696 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7697 {
7698 unsigned short value2 = op2->us;
7699
7700 exp->type = 2;
7701 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
7702 if(!exp->expType)
7703 {
7704 exp->expType = op1->type;
7705 if(op1->type)
7706 op1->type->refCount++;
7707 }
7708 return 0x1;
7709 }
7710
7711 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7712 {
7713 char value2 = op2->c;
7714
7715 exp->type = 2;
7716 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
7717 if(!exp->expType)
7718 {
7719 exp->expType = op1->type;
7720 if(op1->type)
7721 op1->type->refCount++;
7722 }
7723 return 0x1;
7724 }
7725
7726 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7727 {
7728 unsigned char value2 = op2->uc;
7729
7730 exp->type = 2;
7731 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
7732 if(!exp->expType)
7733 {
7734 exp->expType = op1->type;
7735 if(op1->type)
7736 op1->type->refCount++;
7737 }
7738 return 0x1;
7739 }
7740
7741 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7742 {
7743 float value2 = op2->f;
7744
7745 exp->type = 2;
7746 exp->string = PrintFloat(op1->f /= value2);
7747 if(!exp->expType)
7748 {
7749 exp->expType = op1->type;
7750 if(op1->type)
7751 op1->type->refCount++;
7752 }
7753 return 0x1;
7754 }
7755
7756 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7757 {
7758 double value2 = op2->d;
7759
7760 exp->type = 2;
7761 exp->string = PrintDouble(op1->d /= value2);
7762 if(!exp->expType)
7763 {
7764 exp->expType = op1->type;
7765 if(op1->type)
7766 op1->type->refCount++;
7767 }
7768 return 0x1;
7769 }
7770
7771 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7772 {
7773 int value2 = op2->i;
7774
7775 exp->type = 2;
7776 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
7777 if(!exp->expType)
7778 {
7779 exp->expType = op1->type;
7780 if(op1->type)
7781 op1->type->refCount++;
7782 }
7783 return 0x1;
7784 }
7785
7786 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7787 {
7788 unsigned int value2 = op2->ui;
7789
7790 exp->type = 2;
7791 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
7792 if(!exp->expType)
7793 {
7794 exp->expType = op1->type;
7795 if(op1->type)
7796 op1->type->refCount++;
7797 }
7798 return 0x1;
7799 }
7800
7801 static unsigned int Int64ModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7802 {
7803 long long value2 = op2->i64;
7804
7805 exp->type = 2;
7806 exp->string = PrintInt64(value2 ? (op1->i64 %= value2) : 0);
7807 if(!exp->expType)
7808 {
7809 exp->expType = op1->type;
7810 if(op1->type)
7811 op1->type->refCount++;
7812 }
7813 return 0x1;
7814 }
7815
7816 static unsigned int UInt64ModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7817 {
7818 uint64 value2 = op2->ui64;
7819
7820 exp->type = 2;
7821 exp->string = PrintUInt64(value2 ? (op1->ui64 %= value2) : 0);
7822 if(!exp->expType)
7823 {
7824 exp->expType = op1->type;
7825 if(op1->type)
7826 op1->type->refCount++;
7827 }
7828 return 0x1;
7829 }
7830
7831 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7832 {
7833 short value2 = op2->s;
7834
7835 exp->type = 2;
7836 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
7837 if(!exp->expType)
7838 {
7839 exp->expType = op1->type;
7840 if(op1->type)
7841 op1->type->refCount++;
7842 }
7843 return 0x1;
7844 }
7845
7846 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7847 {
7848 unsigned short value2 = op2->us;
7849
7850 exp->type = 2;
7851 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
7852 if(!exp->expType)
7853 {
7854 exp->expType = op1->type;
7855 if(op1->type)
7856 op1->type->refCount++;
7857 }
7858 return 0x1;
7859 }
7860
7861 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7862 {
7863 char value2 = op2->c;
7864
7865 exp->type = 2;
7866 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
7867 if(!exp->expType)
7868 {
7869 exp->expType = op1->type;
7870 if(op1->type)
7871 op1->type->refCount++;
7872 }
7873 return 0x1;
7874 }
7875
7876 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7877 {
7878 unsigned char value2 = op2->uc;
7879
7880 exp->type = 2;
7881 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
7882 if(!exp->expType)
7883 {
7884 exp->expType = op1->type;
7885 if(op1->type)
7886 op1->type->refCount++;
7887 }
7888 return 0x1;
7889 }
7890
7891 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7892 {
7893 int value2 = op2->i;
7894
7895 exp->type = 2;
7896 exp->string = PrintInt((op1->i & value2));
7897 if(!exp->expType)
7898 {
7899 exp->expType = op1->type;
7900 if(op1->type)
7901 op1->type->refCount++;
7902 }
7903 return 0x1;
7904 }
7905
7906 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7907 {
7908 unsigned int value2 = op2->ui;
7909
7910 exp->type = 2;
7911 exp->string = PrintUInt((op1->ui & value2));
7912 if(!exp->expType)
7913 {
7914 exp->expType = op1->type;
7915 if(op1->type)
7916 op1->type->refCount++;
7917 }
7918 return 0x1;
7919 }
7920
7921 static unsigned int Int64BitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7922 {
7923 long long value2 = op2->i64;
7924
7925 exp->type = 2;
7926 exp->string = PrintInt64((op1->i64 & value2));
7927 if(!exp->expType)
7928 {
7929 exp->expType = op1->type;
7930 if(op1->type)
7931 op1->type->refCount++;
7932 }
7933 return 0x1;
7934 }
7935
7936 static unsigned int UInt64BitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7937 {
7938 uint64 value2 = op2->ui64;
7939
7940 exp->type = 2;
7941 exp->string = PrintUInt64((op1->ui64 & value2));
7942 if(!exp->expType)
7943 {
7944 exp->expType = op1->type;
7945 if(op1->type)
7946 op1->type->refCount++;
7947 }
7948 return 0x1;
7949 }
7950
7951 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7952 {
7953 short value2 = op2->s;
7954
7955 exp->type = 2;
7956 exp->string = PrintShort((op1->s & value2));
7957 if(!exp->expType)
7958 {
7959 exp->expType = op1->type;
7960 if(op1->type)
7961 op1->type->refCount++;
7962 }
7963 return 0x1;
7964 }
7965
7966 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7967 {
7968 unsigned short value2 = op2->us;
7969
7970 exp->type = 2;
7971 exp->string = PrintUShort((op1->us & value2));
7972 if(!exp->expType)
7973 {
7974 exp->expType = op1->type;
7975 if(op1->type)
7976 op1->type->refCount++;
7977 }
7978 return 0x1;
7979 }
7980
7981 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7982 {
7983 char value2 = op2->c;
7984
7985 exp->type = 2;
7986 exp->string = PrintChar((op1->c & value2));
7987 if(!exp->expType)
7988 {
7989 exp->expType = op1->type;
7990 if(op1->type)
7991 op1->type->refCount++;
7992 }
7993 return 0x1;
7994 }
7995
7996 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7997 {
7998 unsigned char value2 = op2->uc;
7999
8000 exp->type = 2;
8001 exp->string = PrintUChar((op1->uc & value2));
8002 if(!exp->expType)
8003 {
8004 exp->expType = op1->type;
8005 if(op1->type)
8006 op1->type->refCount++;
8007 }
8008 return 0x1;
8009 }
8010
8011 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8012 {
8013 int value2 = op2->i;
8014
8015 exp->type = 2;
8016 exp->string = PrintInt((op1->i | value2));
8017 if(!exp->expType)
8018 {
8019 exp->expType = op1->type;
8020 if(op1->type)
8021 op1->type->refCount++;
8022 }
8023 return 0x1;
8024 }
8025
8026 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8027 {
8028 unsigned int value2 = op2->ui;
8029
8030 exp->type = 2;
8031 exp->string = PrintUInt((op1->ui | value2));
8032 if(!exp->expType)
8033 {
8034 exp->expType = op1->type;
8035 if(op1->type)
8036 op1->type->refCount++;
8037 }
8038 return 0x1;
8039 }
8040
8041 static unsigned int Int64BitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8042 {
8043 long long value2 = op2->i64;
8044
8045 exp->type = 2;
8046 exp->string = PrintInt64((op1->i64 | value2));
8047 if(!exp->expType)
8048 {
8049 exp->expType = op1->type;
8050 if(op1->type)
8051 op1->type->refCount++;
8052 }
8053 return 0x1;
8054 }
8055
8056 static unsigned int UInt64BitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8057 {
8058 uint64 value2 = op2->ui64;
8059
8060 exp->type = 2;
8061 exp->string = PrintUInt64((op1->ui64 | value2));
8062 if(!exp->expType)
8063 {
8064 exp->expType = op1->type;
8065 if(op1->type)
8066 op1->type->refCount++;
8067 }
8068 return 0x1;
8069 }
8070
8071 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8072 {
8073 short value2 = op2->s;
8074
8075 exp->type = 2;
8076 exp->string = PrintShort((op1->s | value2));
8077 if(!exp->expType)
8078 {
8079 exp->expType = op1->type;
8080 if(op1->type)
8081 op1->type->refCount++;
8082 }
8083 return 0x1;
8084 }
8085
8086 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8087 {
8088 unsigned short value2 = op2->us;
8089
8090 exp->type = 2;
8091 exp->string = PrintUShort((op1->us | value2));
8092 if(!exp->expType)
8093 {
8094 exp->expType = op1->type;
8095 if(op1->type)
8096 op1->type->refCount++;
8097 }
8098 return 0x1;
8099 }
8100
8101 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8102 {
8103 char value2 = op2->c;
8104
8105 exp->type = 2;
8106 exp->string = PrintChar((op1->c | value2));
8107 if(!exp->expType)
8108 {
8109 exp->expType = op1->type;
8110 if(op1->type)
8111 op1->type->refCount++;
8112 }
8113 return 0x1;
8114 }
8115
8116 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8117 {
8118 unsigned char value2 = op2->uc;
8119
8120 exp->type = 2;
8121 exp->string = PrintUChar((op1->uc | value2));
8122 if(!exp->expType)
8123 {
8124 exp->expType = op1->type;
8125 if(op1->type)
8126 op1->type->refCount++;
8127 }
8128 return 0x1;
8129 }
8130
8131 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8132 {
8133 int value2 = op2->i;
8134
8135 exp->type = 2;
8136 exp->string = PrintInt((op1->i ^ value2));
8137 if(!exp->expType)
8138 {
8139 exp->expType = op1->type;
8140 if(op1->type)
8141 op1->type->refCount++;
8142 }
8143 return 0x1;
8144 }
8145
8146 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8147 {
8148 unsigned int value2 = op2->ui;
8149
8150 exp->type = 2;
8151 exp->string = PrintUInt((op1->ui ^ value2));
8152 if(!exp->expType)
8153 {
8154 exp->expType = op1->type;
8155 if(op1->type)
8156 op1->type->refCount++;
8157 }
8158 return 0x1;
8159 }
8160
8161 static unsigned int Int64BitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8162 {
8163 long long value2 = op2->i64;
8164
8165 exp->type = 2;
8166 exp->string = PrintInt64((op1->i64 ^ value2));
8167 if(!exp->expType)
8168 {
8169 exp->expType = op1->type;
8170 if(op1->type)
8171 op1->type->refCount++;
8172 }
8173 return 0x1;
8174 }
8175
8176 static unsigned int UInt64BitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8177 {
8178 uint64 value2 = op2->ui64;
8179
8180 exp->type = 2;
8181 exp->string = PrintUInt64((op1->ui64 ^ value2));
8182 if(!exp->expType)
8183 {
8184 exp->expType = op1->type;
8185 if(op1->type)
8186 op1->type->refCount++;
8187 }
8188 return 0x1;
8189 }
8190
8191 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8192 {
8193 short value2 = op2->s;
8194
8195 exp->type = 2;
8196 exp->string = PrintShort((op1->s ^ value2));
8197 if(!exp->expType)
8198 {
8199 exp->expType = op1->type;
8200 if(op1->type)
8201 op1->type->refCount++;
8202 }
8203 return 0x1;
8204 }
8205
8206 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8207 {
8208 unsigned short value2 = op2->us;
8209
8210 exp->type = 2;
8211 exp->string = PrintUShort((op1->us ^ value2));
8212 if(!exp->expType)
8213 {
8214 exp->expType = op1->type;
8215 if(op1->type)
8216 op1->type->refCount++;
8217 }
8218 return 0x1;
8219 }
8220
8221 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8222 {
8223 char value2 = op2->c;
8224
8225 exp->type = 2;
8226 exp->string = PrintChar((op1->c ^ value2));
8227 if(!exp->expType)
8228 {
8229 exp->expType = op1->type;
8230 if(op1->type)
8231 op1->type->refCount++;
8232 }
8233 return 0x1;
8234 }
8235
8236 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8237 {
8238 unsigned char value2 = op2->uc;
8239
8240 exp->type = 2;
8241 exp->string = PrintUChar((op1->uc ^ value2));
8242 if(!exp->expType)
8243 {
8244 exp->expType = op1->type;
8245 if(op1->type)
8246 op1->type->refCount++;
8247 }
8248 return 0x1;
8249 }
8250
8251 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8252 {
8253 int value2 = op2->i;
8254
8255 exp->type = 2;
8256 exp->string = PrintInt((op1->i << value2));
8257 if(!exp->expType)
8258 {
8259 exp->expType = op1->type;
8260 if(op1->type)
8261 op1->type->refCount++;
8262 }
8263 return 0x1;
8264 }
8265
8266 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8267 {
8268 unsigned int value2 = op2->ui;
8269
8270 exp->type = 2;
8271 exp->string = PrintUInt((op1->ui << value2));
8272 if(!exp->expType)
8273 {
8274 exp->expType = op1->type;
8275 if(op1->type)
8276 op1->type->refCount++;
8277 }
8278 return 0x1;
8279 }
8280
8281 static unsigned int Int64LShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8282 {
8283 long long value2 = op2->i64;
8284
8285 exp->type = 2;
8286 exp->string = PrintInt64((op1->i64 << value2));
8287 if(!exp->expType)
8288 {
8289 exp->expType = op1->type;
8290 if(op1->type)
8291 op1->type->refCount++;
8292 }
8293 return 0x1;
8294 }
8295
8296 static unsigned int UInt64LShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8297 {
8298 uint64 value2 = op2->ui64;
8299
8300 exp->type = 2;
8301 exp->string = PrintUInt64((op1->ui64 << value2));
8302 if(!exp->expType)
8303 {
8304 exp->expType = op1->type;
8305 if(op1->type)
8306 op1->type->refCount++;
8307 }
8308 return 0x1;
8309 }
8310
8311 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8312 {
8313 short value2 = op2->s;
8314
8315 exp->type = 2;
8316 exp->string = PrintShort((op1->s << value2));
8317 if(!exp->expType)
8318 {
8319 exp->expType = op1->type;
8320 if(op1->type)
8321 op1->type->refCount++;
8322 }
8323 return 0x1;
8324 }
8325
8326 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8327 {
8328 unsigned short value2 = op2->us;
8329
8330 exp->type = 2;
8331 exp->string = PrintUShort((op1->us << value2));
8332 if(!exp->expType)
8333 {
8334 exp->expType = op1->type;
8335 if(op1->type)
8336 op1->type->refCount++;
8337 }
8338 return 0x1;
8339 }
8340
8341 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8342 {
8343 char value2 = op2->c;
8344
8345 exp->type = 2;
8346 exp->string = PrintChar((op1->c << value2));
8347 if(!exp->expType)
8348 {
8349 exp->expType = op1->type;
8350 if(op1->type)
8351 op1->type->refCount++;
8352 }
8353 return 0x1;
8354 }
8355
8356 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8357 {
8358 unsigned char value2 = op2->uc;
8359
8360 exp->type = 2;
8361 exp->string = PrintUChar((op1->uc << value2));
8362 if(!exp->expType)
8363 {
8364 exp->expType = op1->type;
8365 if(op1->type)
8366 op1->type->refCount++;
8367 }
8368 return 0x1;
8369 }
8370
8371 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8372 {
8373 int value2 = op2->i;
8374
8375 exp->type = 2;
8376 exp->string = PrintInt((op1->i >> value2));
8377 if(!exp->expType)
8378 {
8379 exp->expType = op1->type;
8380 if(op1->type)
8381 op1->type->refCount++;
8382 }
8383 return 0x1;
8384 }
8385
8386 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8387 {
8388 unsigned int value2 = op2->ui;
8389
8390 exp->type = 2;
8391 exp->string = PrintUInt((op1->ui >> value2));
8392 if(!exp->expType)
8393 {
8394 exp->expType = op1->type;
8395 if(op1->type)
8396 op1->type->refCount++;
8397 }
8398 return 0x1;
8399 }
8400
8401 static unsigned int Int64RShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8402 {
8403 long long value2 = op2->i64;
8404
8405 exp->type = 2;
8406 exp->string = PrintInt64((op1->i64 >> value2));
8407 if(!exp->expType)
8408 {
8409 exp->expType = op1->type;
8410 if(op1->type)
8411 op1->type->refCount++;
8412 }
8413 return 0x1;
8414 }
8415
8416 static unsigned int UInt64RShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8417 {
8418 uint64 value2 = op2->ui64;
8419
8420 exp->type = 2;
8421 exp->string = PrintUInt64((op1->ui64 >> value2));
8422 if(!exp->expType)
8423 {
8424 exp->expType = op1->type;
8425 if(op1->type)
8426 op1->type->refCount++;
8427 }
8428 return 0x1;
8429 }
8430
8431 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8432 {
8433 short value2 = op2->s;
8434
8435 exp->type = 2;
8436 exp->string = PrintShort((op1->s >> value2));
8437 if(!exp->expType)
8438 {
8439 exp->expType = op1->type;
8440 if(op1->type)
8441 op1->type->refCount++;
8442 }
8443 return 0x1;
8444 }
8445
8446 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8447 {
8448 unsigned short value2 = op2->us;
8449
8450 exp->type = 2;
8451 exp->string = PrintUShort((op1->us >> value2));
8452 if(!exp->expType)
8453 {
8454 exp->expType = op1->type;
8455 if(op1->type)
8456 op1->type->refCount++;
8457 }
8458 return 0x1;
8459 }
8460
8461 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8462 {
8463 char value2 = op2->c;
8464
8465 exp->type = 2;
8466 exp->string = PrintChar((op1->c >> value2));
8467 if(!exp->expType)
8468 {
8469 exp->expType = op1->type;
8470 if(op1->type)
8471 op1->type->refCount++;
8472 }
8473 return 0x1;
8474 }
8475
8476 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8477 {
8478 unsigned char value2 = op2->uc;
8479
8480 exp->type = 2;
8481 exp->string = PrintUChar((op1->uc >> value2));
8482 if(!exp->expType)
8483 {
8484 exp->expType = op1->type;
8485 if(op1->type)
8486 op1->type->refCount++;
8487 }
8488 return 0x1;
8489 }
8490
8491 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
8492 {
8493 exp->type = 2;
8494 exp->string = PrintInt((~op1->i));
8495 if(!exp->expType)
8496 {
8497 exp->expType = op1->type;
8498 if(op1->type)
8499 op1->type->refCount++;
8500 }
8501 return 0x1;
8502 }
8503
8504 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
8505 {
8506 exp->type = 2;
8507 exp->string = PrintUInt((unsigned int)(~op1->ui));
8508 if(!exp->expType)
8509 {
8510 exp->expType = op1->type;
8511 if(op1->type)
8512 op1->type->refCount++;
8513 }
8514 return 0x1;
8515 }
8516
8517 static unsigned int Int64BitNot(struct Expression * exp, struct Operand * op1)
8518 {
8519 exp->type = 2;
8520 exp->string = PrintInt64((long long)(~op1->i64));
8521 if(!exp->expType)
8522 {
8523 exp->expType = op1->type;
8524 if(op1->type)
8525 op1->type->refCount++;
8526 }
8527 return 0x1;
8528 }
8529
8530 static unsigned int UInt64BitNot(struct Expression * exp, struct Operand * op1)
8531 {
8532 exp->type = 2;
8533 exp->string = PrintUInt64((uint64)(~op1->ui64));
8534 if(!exp->expType)
8535 {
8536 exp->expType = op1->type;
8537 if(op1->type)
8538 op1->type->refCount++;
8539 }
8540 return 0x1;
8541 }
8542
8543 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
8544 {
8545 exp->type = 2;
8546 exp->string = PrintShort((short)(~op1->s));
8547 if(!exp->expType)
8548 {
8549 exp->expType = op1->type;
8550 if(op1->type)
8551 op1->type->refCount++;
8552 }
8553 return 0x1;
8554 }
8555
8556 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
8557 {
8558 exp->type = 2;
8559 exp->string = PrintUShort((unsigned short)(~op1->us));
8560 if(!exp->expType)
8561 {
8562 exp->expType = op1->type;
8563 if(op1->type)
8564 op1->type->refCount++;
8565 }
8566 return 0x1;
8567 }
8568
8569 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
8570 {
8571 exp->type = 2;
8572 exp->string = PrintChar((char)(~op1->c));
8573 if(!exp->expType)
8574 {
8575 exp->expType = op1->type;
8576 if(op1->type)
8577 op1->type->refCount++;
8578 }
8579 return 0x1;
8580 }
8581
8582 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
8583 {
8584 exp->type = 2;
8585 exp->string = PrintUChar((unsigned char)(~op1->uc));
8586 if(!exp->expType)
8587 {
8588 exp->expType = op1->type;
8589 if(op1->type)
8590 op1->type->refCount++;
8591 }
8592 return 0x1;
8593 }
8594
8595 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8596 {
8597 int value2 = op2->i;
8598
8599 exp->type = 2;
8600 exp->string = PrintInt((op1->i &= value2));
8601 if(!exp->expType)
8602 {
8603 exp->expType = op1->type;
8604 if(op1->type)
8605 op1->type->refCount++;
8606 }
8607 return 0x1;
8608 }
8609
8610 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8611 {
8612 unsigned int value2 = op2->ui;
8613
8614 exp->type = 2;
8615 exp->string = PrintUInt((op1->ui &= value2));
8616 if(!exp->expType)
8617 {
8618 exp->expType = op1->type;
8619 if(op1->type)
8620 op1->type->refCount++;
8621 }
8622 return 0x1;
8623 }
8624
8625 static unsigned int Int64AndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8626 {
8627 long long value2 = op2->i64;
8628
8629 exp->type = 2;
8630 exp->string = PrintInt64((op1->i64 &= value2));
8631 if(!exp->expType)
8632 {
8633 exp->expType = op1->type;
8634 if(op1->type)
8635 op1->type->refCount++;
8636 }
8637 return 0x1;
8638 }
8639
8640 static unsigned int UInt64AndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8641 {
8642 uint64 value2 = op2->ui64;
8643
8644 exp->type = 2;
8645 exp->string = PrintUInt64((op1->ui64 &= value2));
8646 if(!exp->expType)
8647 {
8648 exp->expType = op1->type;
8649 if(op1->type)
8650 op1->type->refCount++;
8651 }
8652 return 0x1;
8653 }
8654
8655 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8656 {
8657 short value2 = op2->s;
8658
8659 exp->type = 2;
8660 exp->string = PrintShort((op1->s &= value2));
8661 if(!exp->expType)
8662 {
8663 exp->expType = op1->type;
8664 if(op1->type)
8665 op1->type->refCount++;
8666 }
8667 return 0x1;
8668 }
8669
8670 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8671 {
8672 unsigned short value2 = op2->us;
8673
8674 exp->type = 2;
8675 exp->string = PrintUShort((op1->us &= value2));
8676 if(!exp->expType)
8677 {
8678 exp->expType = op1->type;
8679 if(op1->type)
8680 op1->type->refCount++;
8681 }
8682 return 0x1;
8683 }
8684
8685 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8686 {
8687 char value2 = op2->c;
8688
8689 exp->type = 2;
8690 exp->string = PrintChar((op1->c &= value2));
8691 if(!exp->expType)
8692 {
8693 exp->expType = op1->type;
8694 if(op1->type)
8695 op1->type->refCount++;
8696 }
8697 return 0x1;
8698 }
8699
8700 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8701 {
8702 unsigned char value2 = op2->uc;
8703
8704 exp->type = 2;
8705 exp->string = PrintUChar((op1->uc &= value2));
8706 if(!exp->expType)
8707 {
8708 exp->expType = op1->type;
8709 if(op1->type)
8710 op1->type->refCount++;
8711 }
8712 return 0x1;
8713 }
8714
8715 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8716 {
8717 int value2 = op2->i;
8718
8719 exp->type = 2;
8720 exp->string = PrintInt((op1->i |= value2));
8721 if(!exp->expType)
8722 {
8723 exp->expType = op1->type;
8724 if(op1->type)
8725 op1->type->refCount++;
8726 }
8727 return 0x1;
8728 }
8729
8730 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8731 {
8732 unsigned int value2 = op2->ui;
8733
8734 exp->type = 2;
8735 exp->string = PrintUInt((op1->ui |= value2));
8736 if(!exp->expType)
8737 {
8738 exp->expType = op1->type;
8739 if(op1->type)
8740 op1->type->refCount++;
8741 }
8742 return 0x1;
8743 }
8744
8745 static unsigned int Int64OrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8746 {
8747 long long value2 = op2->i64;
8748
8749 exp->type = 2;
8750 exp->string = PrintInt64((op1->i64 |= value2));
8751 if(!exp->expType)
8752 {
8753 exp->expType = op1->type;
8754 if(op1->type)
8755 op1->type->refCount++;
8756 }
8757 return 0x1;
8758 }
8759
8760 static unsigned int UInt64OrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8761 {
8762 uint64 value2 = op2->ui64;
8763
8764 exp->type = 2;
8765 exp->string = PrintUInt64((op1->ui64 |= value2));
8766 if(!exp->expType)
8767 {
8768 exp->expType = op1->type;
8769 if(op1->type)
8770 op1->type->refCount++;
8771 }
8772 return 0x1;
8773 }
8774
8775 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8776 {
8777 short value2 = op2->s;
8778
8779 exp->type = 2;
8780 exp->string = PrintShort((op1->s |= value2));
8781 if(!exp->expType)
8782 {
8783 exp->expType = op1->type;
8784 if(op1->type)
8785 op1->type->refCount++;
8786 }
8787 return 0x1;
8788 }
8789
8790 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8791 {
8792 unsigned short value2 = op2->us;
8793
8794 exp->type = 2;
8795 exp->string = PrintUShort((op1->us |= value2));
8796 if(!exp->expType)
8797 {
8798 exp->expType = op1->type;
8799 if(op1->type)
8800 op1->type->refCount++;
8801 }
8802 return 0x1;
8803 }
8804
8805 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8806 {
8807 char value2 = op2->c;
8808
8809 exp->type = 2;
8810 exp->string = PrintChar((op1->c |= value2));
8811 if(!exp->expType)
8812 {
8813 exp->expType = op1->type;
8814 if(op1->type)
8815 op1->type->refCount++;
8816 }
8817 return 0x1;
8818 }
8819
8820 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8821 {
8822 unsigned char value2 = op2->uc;
8823
8824 exp->type = 2;
8825 exp->string = PrintUChar((op1->uc |= value2));
8826 if(!exp->expType)
8827 {
8828 exp->expType = op1->type;
8829 if(op1->type)
8830 op1->type->refCount++;
8831 }
8832 return 0x1;
8833 }
8834
8835 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8836 {
8837 int value2 = op2->i;
8838
8839 exp->type = 2;
8840 exp->string = PrintInt((op1->i ^= value2));
8841 if(!exp->expType)
8842 {
8843 exp->expType = op1->type;
8844 if(op1->type)
8845 op1->type->refCount++;
8846 }
8847 return 0x1;
8848 }
8849
8850 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8851 {
8852 unsigned int value2 = op2->ui;
8853
8854 exp->type = 2;
8855 exp->string = PrintUInt((op1->ui ^= value2));
8856 if(!exp->expType)
8857 {
8858 exp->expType = op1->type;
8859 if(op1->type)
8860 op1->type->refCount++;
8861 }
8862 return 0x1;
8863 }
8864
8865 static unsigned int Int64XorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8866 {
8867 long long value2 = op2->i64;
8868
8869 exp->type = 2;
8870 exp->string = PrintInt64((op1->i64 ^= value2));
8871 if(!exp->expType)
8872 {
8873 exp->expType = op1->type;
8874 if(op1->type)
8875 op1->type->refCount++;
8876 }
8877 return 0x1;
8878 }
8879
8880 static unsigned int UInt64XorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8881 {
8882 uint64 value2 = op2->ui64;
8883
8884 exp->type = 2;
8885 exp->string = PrintUInt64((op1->ui64 ^= value2));
8886 if(!exp->expType)
8887 {
8888 exp->expType = op1->type;
8889 if(op1->type)
8890 op1->type->refCount++;
8891 }
8892 return 0x1;
8893 }
8894
8895 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8896 {
8897 short value2 = op2->s;
8898
8899 exp->type = 2;
8900 exp->string = PrintShort((op1->s ^= value2));
8901 if(!exp->expType)
8902 {
8903 exp->expType = op1->type;
8904 if(op1->type)
8905 op1->type->refCount++;
8906 }
8907 return 0x1;
8908 }
8909
8910 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8911 {
8912 unsigned short value2 = op2->us;
8913
8914 exp->type = 2;
8915 exp->string = PrintUShort((op1->us ^= value2));
8916 if(!exp->expType)
8917 {
8918 exp->expType = op1->type;
8919 if(op1->type)
8920 op1->type->refCount++;
8921 }
8922 return 0x1;
8923 }
8924
8925 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8926 {
8927 char value2 = op2->c;
8928
8929 exp->type = 2;
8930 exp->string = PrintChar((op1->c ^= value2));
8931 if(!exp->expType)
8932 {
8933 exp->expType = op1->type;
8934 if(op1->type)
8935 op1->type->refCount++;
8936 }
8937 return 0x1;
8938 }
8939
8940 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8941 {
8942 unsigned char value2 = op2->uc;
8943
8944 exp->type = 2;
8945 exp->string = PrintUChar((op1->uc ^= value2));
8946 if(!exp->expType)
8947 {
8948 exp->expType = op1->type;
8949 if(op1->type)
8950 op1->type->refCount++;
8951 }
8952 return 0x1;
8953 }
8954
8955 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8956 {
8957 int value2 = op2->i;
8958
8959 exp->type = 2;
8960 exp->string = PrintInt((op1->i <<= value2));
8961 if(!exp->expType)
8962 {
8963 exp->expType = op1->type;
8964 if(op1->type)
8965 op1->type->refCount++;
8966 }
8967 return 0x1;
8968 }
8969
8970 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8971 {
8972 unsigned int value2 = op2->ui;
8973
8974 exp->type = 2;
8975 exp->string = PrintUInt((op1->ui <<= value2));
8976 if(!exp->expType)
8977 {
8978 exp->expType = op1->type;
8979 if(op1->type)
8980 op1->type->refCount++;
8981 }
8982 return 0x1;
8983 }
8984
8985 static unsigned int Int64LShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8986 {
8987 long long value2 = op2->i64;
8988
8989 exp->type = 2;
8990 exp->string = PrintInt64((op1->i64 <<= value2));
8991 if(!exp->expType)
8992 {
8993 exp->expType = op1->type;
8994 if(op1->type)
8995 op1->type->refCount++;
8996 }
8997 return 0x1;
8998 }
8999
9000 static unsigned int UInt64LShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9001 {
9002 uint64 value2 = op2->ui64;
9003
9004 exp->type = 2;
9005 exp->string = PrintUInt64((op1->ui64 <<= value2));
9006 if(!exp->expType)
9007 {
9008 exp->expType = op1->type;
9009 if(op1->type)
9010 op1->type->refCount++;
9011 }
9012 return 0x1;
9013 }
9014
9015 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9016 {
9017 short value2 = op2->s;
9018
9019 exp->type = 2;
9020 exp->string = PrintShort((op1->s <<= value2));
9021 if(!exp->expType)
9022 {
9023 exp->expType = op1->type;
9024 if(op1->type)
9025 op1->type->refCount++;
9026 }
9027 return 0x1;
9028 }
9029
9030 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9031 {
9032 unsigned short value2 = op2->us;
9033
9034 exp->type = 2;
9035 exp->string = PrintUShort((op1->us <<= value2));
9036 if(!exp->expType)
9037 {
9038 exp->expType = op1->type;
9039 if(op1->type)
9040 op1->type->refCount++;
9041 }
9042 return 0x1;
9043 }
9044
9045 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9046 {
9047 char value2 = op2->c;
9048
9049 exp->type = 2;
9050 exp->string = PrintChar((op1->c <<= value2));
9051 if(!exp->expType)
9052 {
9053 exp->expType = op1->type;
9054 if(op1->type)
9055 op1->type->refCount++;
9056 }
9057 return 0x1;
9058 }
9059
9060 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9061 {
9062 unsigned char value2 = op2->uc;
9063
9064 exp->type = 2;
9065 exp->string = PrintUChar((op1->uc <<= value2));
9066 if(!exp->expType)
9067 {
9068 exp->expType = op1->type;
9069 if(op1->type)
9070 op1->type->refCount++;
9071 }
9072 return 0x1;
9073 }
9074
9075 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9076 {
9077 int value2 = op2->i;
9078
9079 exp->type = 2;
9080 exp->string = PrintInt((op1->i >>= value2));
9081 if(!exp->expType)
9082 {
9083 exp->expType = op1->type;
9084 if(op1->type)
9085 op1->type->refCount++;
9086 }
9087 return 0x1;
9088 }
9089
9090 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9091 {
9092 unsigned int value2 = op2->ui;
9093
9094 exp->type = 2;
9095 exp->string = PrintUInt((op1->ui >>= value2));
9096 if(!exp->expType)
9097 {
9098 exp->expType = op1->type;
9099 if(op1->type)
9100 op1->type->refCount++;
9101 }
9102 return 0x1;
9103 }
9104
9105 static unsigned int Int64RShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9106 {
9107 long long value2 = op2->i64;
9108
9109 exp->type = 2;
9110 exp->string = PrintInt64((op1->i64 >>= value2));
9111 if(!exp->expType)
9112 {
9113 exp->expType = op1->type;
9114 if(op1->type)
9115 op1->type->refCount++;
9116 }
9117 return 0x1;
9118 }
9119
9120 static unsigned int UInt64RShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9121 {
9122 uint64 value2 = op2->ui64;
9123
9124 exp->type = 2;
9125 exp->string = PrintUInt64((op1->ui64 >>= value2));
9126 if(!exp->expType)
9127 {
9128 exp->expType = op1->type;
9129 if(op1->type)
9130 op1->type->refCount++;
9131 }
9132 return 0x1;
9133 }
9134
9135 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9136 {
9137 short value2 = op2->s;
9138
9139 exp->type = 2;
9140 exp->string = PrintShort((op1->s >>= value2));
9141 if(!exp->expType)
9142 {
9143 exp->expType = op1->type;
9144 if(op1->type)
9145 op1->type->refCount++;
9146 }
9147 return 0x1;
9148 }
9149
9150 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9151 {
9152 unsigned short value2 = op2->us;
9153
9154 exp->type = 2;
9155 exp->string = PrintUShort((op1->us >>= value2));
9156 if(!exp->expType)
9157 {
9158 exp->expType = op1->type;
9159 if(op1->type)
9160 op1->type->refCount++;
9161 }
9162 return 0x1;
9163 }
9164
9165 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9166 {
9167 char value2 = op2->c;
9168
9169 exp->type = 2;
9170 exp->string = PrintChar((op1->c >>= value2));
9171 if(!exp->expType)
9172 {
9173 exp->expType = op1->type;
9174 if(op1->type)
9175 op1->type->refCount++;
9176 }
9177 return 0x1;
9178 }
9179
9180 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9181 {
9182 unsigned char value2 = op2->uc;
9183
9184 exp->type = 2;
9185 exp->string = PrintUChar((op1->uc >>= value2));
9186 if(!exp->expType)
9187 {
9188 exp->expType = op1->type;
9189 if(op1->type)
9190 op1->type->refCount++;
9191 }
9192 return 0x1;
9193 }
9194
9195 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
9196 {
9197 exp->type = 2;
9198 exp->string = PrintInt((int)(!op1->i));
9199 if(!exp->expType)
9200 {
9201 exp->expType = op1->type;
9202 if(op1->type)
9203 op1->type->refCount++;
9204 }
9205 return 0x1;
9206 }
9207
9208 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
9209 {
9210 exp->type = 2;
9211 exp->string = PrintUInt((unsigned int)(!op1->ui));
9212 if(!exp->expType)
9213 {
9214 exp->expType = op1->type;
9215 if(op1->type)
9216 op1->type->refCount++;
9217 }
9218 return 0x1;
9219 }
9220
9221 static unsigned int Int64Not(struct Expression * exp, struct Operand * op1)
9222 {
9223 exp->type = 2;
9224 exp->string = PrintInt64((long long)(!op1->i64));
9225 if(!exp->expType)
9226 {
9227 exp->expType = op1->type;
9228 if(op1->type)
9229 op1->type->refCount++;
9230 }
9231 return 0x1;
9232 }
9233
9234 static unsigned int UInt64Not(struct Expression * exp, struct Operand * op1)
9235 {
9236 exp->type = 2;
9237 exp->string = PrintUInt64((uint64)(!op1->ui64));
9238 if(!exp->expType)
9239 {
9240 exp->expType = op1->type;
9241 if(op1->type)
9242 op1->type->refCount++;
9243 }
9244 return 0x1;
9245 }
9246
9247 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
9248 {
9249 exp->type = 2;
9250 exp->string = PrintShort((short)(!op1->s));
9251 if(!exp->expType)
9252 {
9253 exp->expType = op1->type;
9254 if(op1->type)
9255 op1->type->refCount++;
9256 }
9257 return 0x1;
9258 }
9259
9260 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
9261 {
9262 exp->type = 2;
9263 exp->string = PrintUShort((unsigned short)(!op1->us));
9264 if(!exp->expType)
9265 {
9266 exp->expType = op1->type;
9267 if(op1->type)
9268 op1->type->refCount++;
9269 }
9270 return 0x1;
9271 }
9272
9273 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
9274 {
9275 exp->type = 2;
9276 exp->string = PrintChar((char)(!op1->c));
9277 if(!exp->expType)
9278 {
9279 exp->expType = op1->type;
9280 if(op1->type)
9281 op1->type->refCount++;
9282 }
9283 return 0x1;
9284 }
9285
9286 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
9287 {
9288 exp->type = 2;
9289 exp->string = PrintUChar((unsigned char)(!op1->uc));
9290 if(!exp->expType)
9291 {
9292 exp->expType = op1->type;
9293 if(op1->type)
9294 op1->type->refCount++;
9295 }
9296 return 0x1;
9297 }
9298
9299 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9300 {
9301 int value2 = op2->i;
9302
9303 exp->type = 2;
9304 exp->string = PrintInt((int)(op1->i == value2));
9305 if(!exp->expType)
9306 {
9307 exp->expType = op1->type;
9308 if(op1->type)
9309 op1->type->refCount++;
9310 }
9311 return 0x1;
9312 }
9313
9314 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9315 {
9316 unsigned int value2 = op2->ui;
9317
9318 exp->type = 2;
9319 exp->string = PrintUInt((unsigned int)(op1->ui == value2));
9320 if(!exp->expType)
9321 {
9322 exp->expType = op1->type;
9323 if(op1->type)
9324 op1->type->refCount++;
9325 }
9326 return 0x1;
9327 }
9328
9329 static unsigned int Int64Equ(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9330 {
9331 long long value2 = op2->i64;
9332
9333 exp->type = 2;
9334 exp->string = PrintInt64((long long)(op1->i64 == value2));
9335 if(!exp->expType)
9336 {
9337 exp->expType = op1->type;
9338 if(op1->type)
9339 op1->type->refCount++;
9340 }
9341 return 0x1;
9342 }
9343
9344 static unsigned int UInt64Equ(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9345 {
9346 uint64 value2 = op2->ui64;
9347
9348 exp->type = 2;
9349 exp->string = PrintUInt64((uint64)(op1->ui64 == value2));
9350 if(!exp->expType)
9351 {
9352 exp->expType = op1->type;
9353 if(op1->type)
9354 op1->type->refCount++;
9355 }
9356 return 0x1;
9357 }
9358
9359 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9360 {
9361 short value2 = op2->s;
9362
9363 exp->type = 2;
9364 exp->string = PrintShort((short)(op1->s == value2));
9365 if(!exp->expType)
9366 {
9367 exp->expType = op1->type;
9368 if(op1->type)
9369 op1->type->refCount++;
9370 }
9371 return 0x1;
9372 }
9373
9374 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9375 {
9376 unsigned short value2 = op2->us;
9377
9378 exp->type = 2;
9379 exp->string = PrintUShort((unsigned short)(op1->us == value2));
9380 if(!exp->expType)
9381 {
9382 exp->expType = op1->type;
9383 if(op1->type)
9384 op1->type->refCount++;
9385 }
9386 return 0x1;
9387 }
9388
9389 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9390 {
9391 char value2 = op2->c;
9392
9393 exp->type = 2;
9394 exp->string = PrintChar((char)(op1->c == value2));
9395 if(!exp->expType)
9396 {
9397 exp->expType = op1->type;
9398 if(op1->type)
9399 op1->type->refCount++;
9400 }
9401 return 0x1;
9402 }
9403
9404 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9405 {
9406 unsigned char value2 = op2->uc;
9407
9408 exp->type = 2;
9409 exp->string = PrintUChar((unsigned char)(op1->uc == value2));
9410 if(!exp->expType)
9411 {
9412 exp->expType = op1->type;
9413 if(op1->type)
9414 op1->type->refCount++;
9415 }
9416 return 0x1;
9417 }
9418
9419 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9420 {
9421 float value2 = op2->f;
9422
9423 exp->type = 2;
9424 exp->string = PrintFloat((float)(op1->f == value2));
9425 if(!exp->expType)
9426 {
9427 exp->expType = op1->type;
9428 if(op1->type)
9429 op1->type->refCount++;
9430 }
9431 return 0x1;
9432 }
9433
9434 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9435 {
9436 double value2 = op2->d;
9437
9438 exp->type = 2;
9439 exp->string = PrintDouble((double)(op1->d == value2));
9440 if(!exp->expType)
9441 {
9442 exp->expType = op1->type;
9443 if(op1->type)
9444 op1->type->refCount++;
9445 }
9446 return 0x1;
9447 }
9448
9449 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9450 {
9451 int value2 = op2->i;
9452
9453 exp->type = 2;
9454 exp->string = PrintInt((int)(op1->i != value2));
9455 if(!exp->expType)
9456 {
9457 exp->expType = op1->type;
9458 if(op1->type)
9459 op1->type->refCount++;
9460 }
9461 return 0x1;
9462 }
9463
9464 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9465 {
9466 unsigned int value2 = op2->ui;
9467
9468 exp->type = 2;
9469 exp->string = PrintUInt((unsigned int)(op1->ui != value2));
9470 if(!exp->expType)
9471 {
9472 exp->expType = op1->type;
9473 if(op1->type)
9474 op1->type->refCount++;
9475 }
9476 return 0x1;
9477 }
9478
9479 static unsigned int Int64Nqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9480 {
9481 long long value2 = op2->i64;
9482
9483 exp->type = 2;
9484 exp->string = PrintInt64((long long)(op1->i64 != value2));
9485 if(!exp->expType)
9486 {
9487 exp->expType = op1->type;
9488 if(op1->type)
9489 op1->type->refCount++;
9490 }
9491 return 0x1;
9492 }
9493
9494 static unsigned int UInt64Nqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9495 {
9496 uint64 value2 = op2->ui64;
9497
9498 exp->type = 2;
9499 exp->string = PrintUInt64((uint64)(op1->ui64 != value2));
9500 if(!exp->expType)
9501 {
9502 exp->expType = op1->type;
9503 if(op1->type)
9504 op1->type->refCount++;
9505 }
9506 return 0x1;
9507 }
9508
9509 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9510 {
9511 short value2 = op2->s;
9512
9513 exp->type = 2;
9514 exp->string = PrintShort((short)(op1->s != value2));
9515 if(!exp->expType)
9516 {
9517 exp->expType = op1->type;
9518 if(op1->type)
9519 op1->type->refCount++;
9520 }
9521 return 0x1;
9522 }
9523
9524 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9525 {
9526 unsigned short value2 = op2->us;
9527
9528 exp->type = 2;
9529 exp->string = PrintUShort((unsigned short)(op1->us != value2));
9530 if(!exp->expType)
9531 {
9532 exp->expType = op1->type;
9533 if(op1->type)
9534 op1->type->refCount++;
9535 }
9536 return 0x1;
9537 }
9538
9539 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9540 {
9541 char value2 = op2->c;
9542
9543 exp->type = 2;
9544 exp->string = PrintChar((char)(op1->c != value2));
9545 if(!exp->expType)
9546 {
9547 exp->expType = op1->type;
9548 if(op1->type)
9549 op1->type->refCount++;
9550 }
9551 return 0x1;
9552 }
9553
9554 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9555 {
9556 unsigned char value2 = op2->uc;
9557
9558 exp->type = 2;
9559 exp->string = PrintUChar((unsigned char)(op1->uc != value2));
9560 if(!exp->expType)
9561 {
9562 exp->expType = op1->type;
9563 if(op1->type)
9564 op1->type->refCount++;
9565 }
9566 return 0x1;
9567 }
9568
9569 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9570 {
9571 float value2 = op2->f;
9572
9573 exp->type = 2;
9574 exp->string = PrintFloat((float)(op1->f != value2));
9575 if(!exp->expType)
9576 {
9577 exp->expType = op1->type;
9578 if(op1->type)
9579 op1->type->refCount++;
9580 }
9581 return 0x1;
9582 }
9583
9584 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9585 {
9586 double value2 = op2->d;
9587
9588 exp->type = 2;
9589 exp->string = PrintDouble((double)(op1->d != value2));
9590 if(!exp->expType)
9591 {
9592 exp->expType = op1->type;
9593 if(op1->type)
9594 op1->type->refCount++;
9595 }
9596 return 0x1;
9597 }
9598
9599 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9600 {
9601 int value2 = op2->i;
9602
9603 exp->type = 2;
9604 exp->string = PrintInt((int)(op1->i && value2));
9605 if(!exp->expType)
9606 {
9607 exp->expType = op1->type;
9608 if(op1->type)
9609 op1->type->refCount++;
9610 }
9611 return 0x1;
9612 }
9613
9614 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9615 {
9616 unsigned int value2 = op2->ui;
9617
9618 exp->type = 2;
9619 exp->string = PrintUInt((unsigned int)(op1->ui && value2));
9620 if(!exp->expType)
9621 {
9622 exp->expType = op1->type;
9623 if(op1->type)
9624 op1->type->refCount++;
9625 }
9626 return 0x1;
9627 }
9628
9629 static unsigned int Int64And(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9630 {
9631 long long value2 = op2->i64;
9632
9633 exp->type = 2;
9634 exp->string = PrintInt64((long long)(op1->i64 && value2));
9635 if(!exp->expType)
9636 {
9637 exp->expType = op1->type;
9638 if(op1->type)
9639 op1->type->refCount++;
9640 }
9641 return 0x1;
9642 }
9643
9644 static unsigned int UInt64And(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9645 {
9646 uint64 value2 = op2->ui64;
9647
9648 exp->type = 2;
9649 exp->string = PrintUInt64((uint64)(op1->ui64 && value2));
9650 if(!exp->expType)
9651 {
9652 exp->expType = op1->type;
9653 if(op1->type)
9654 op1->type->refCount++;
9655 }
9656 return 0x1;
9657 }
9658
9659 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9660 {
9661 short value2 = op2->s;
9662
9663 exp->type = 2;
9664 exp->string = PrintShort((short)(op1->s && value2));
9665 if(!exp->expType)
9666 {
9667 exp->expType = op1->type;
9668 if(op1->type)
9669 op1->type->refCount++;
9670 }
9671 return 0x1;
9672 }
9673
9674 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9675 {
9676 unsigned short value2 = op2->us;
9677
9678 exp->type = 2;
9679 exp->string = PrintUShort((unsigned short)(op1->us && value2));
9680 if(!exp->expType)
9681 {
9682 exp->expType = op1->type;
9683 if(op1->type)
9684 op1->type->refCount++;
9685 }
9686 return 0x1;
9687 }
9688
9689 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9690 {
9691 char value2 = op2->c;
9692
9693 exp->type = 2;
9694 exp->string = PrintChar((char)(op1->c && value2));
9695 if(!exp->expType)
9696 {
9697 exp->expType = op1->type;
9698 if(op1->type)
9699 op1->type->refCount++;
9700 }
9701 return 0x1;
9702 }
9703
9704 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9705 {
9706 unsigned char value2 = op2->uc;
9707
9708 exp->type = 2;
9709 exp->string = PrintUChar((unsigned char)(op1->uc && value2));
9710 if(!exp->expType)
9711 {
9712 exp->expType = op1->type;
9713 if(op1->type)
9714 op1->type->refCount++;
9715 }
9716 return 0x1;
9717 }
9718
9719 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9720 {
9721 float value2 = op2->f;
9722
9723 exp->type = 2;
9724 exp->string = PrintFloat((float)(op1->f && value2));
9725 if(!exp->expType)
9726 {
9727 exp->expType = op1->type;
9728 if(op1->type)
9729 op1->type->refCount++;
9730 }
9731 return 0x1;
9732 }
9733
9734 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9735 {
9736 double value2 = op2->d;
9737
9738 exp->type = 2;
9739 exp->string = PrintDouble((double)(op1->d && value2));
9740 if(!exp->expType)
9741 {
9742 exp->expType = op1->type;
9743 if(op1->type)
9744 op1->type->refCount++;
9745 }
9746 return 0x1;
9747 }
9748
9749 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9750 {
9751 int value2 = op2->i;
9752
9753 exp->type = 2;
9754 exp->string = PrintInt((int)(op1->i || value2));
9755 if(!exp->expType)
9756 {
9757 exp->expType = op1->type;
9758 if(op1->type)
9759 op1->type->refCount++;
9760 }
9761 return 0x1;
9762 }
9763
9764 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9765 {
9766 unsigned int value2 = op2->ui;
9767
9768 exp->type = 2;
9769 exp->string = PrintUInt((unsigned int)(op1->ui || value2));
9770 if(!exp->expType)
9771 {
9772 exp->expType = op1->type;
9773 if(op1->type)
9774 op1->type->refCount++;
9775 }
9776 return 0x1;
9777 }
9778
9779 static unsigned int Int64Or(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9780 {
9781 long long value2 = op2->i64;
9782
9783 exp->type = 2;
9784 exp->string = PrintInt64((long long)(op1->i64 || value2));
9785 if(!exp->expType)
9786 {
9787 exp->expType = op1->type;
9788 if(op1->type)
9789 op1->type->refCount++;
9790 }
9791 return 0x1;
9792 }
9793
9794 static unsigned int UInt64Or(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9795 {
9796 uint64 value2 = op2->ui64;
9797
9798 exp->type = 2;
9799 exp->string = PrintUInt64((uint64)(op1->ui64 || value2));
9800 if(!exp->expType)
9801 {
9802 exp->expType = op1->type;
9803 if(op1->type)
9804 op1->type->refCount++;
9805 }
9806 return 0x1;
9807 }
9808
9809 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9810 {
9811 short value2 = op2->s;
9812
9813 exp->type = 2;
9814 exp->string = PrintShort((short)(op1->s || value2));
9815 if(!exp->expType)
9816 {
9817 exp->expType = op1->type;
9818 if(op1->type)
9819 op1->type->refCount++;
9820 }
9821 return 0x1;
9822 }
9823
9824 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9825 {
9826 unsigned short value2 = op2->us;
9827
9828 exp->type = 2;
9829 exp->string = PrintUShort((unsigned short)(op1->us || value2));
9830 if(!exp->expType)
9831 {
9832 exp->expType = op1->type;
9833 if(op1->type)
9834 op1->type->refCount++;
9835 }
9836 return 0x1;
9837 }
9838
9839 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9840 {
9841 char value2 = op2->c;
9842
9843 exp->type = 2;
9844 exp->string = PrintChar((char)(op1->c || value2));
9845 if(!exp->expType)
9846 {
9847 exp->expType = op1->type;
9848 if(op1->type)
9849 op1->type->refCount++;
9850 }
9851 return 0x1;
9852 }
9853
9854 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9855 {
9856 unsigned char value2 = op2->uc;
9857
9858 exp->type = 2;
9859 exp->string = PrintUChar((unsigned char)(op1->uc || value2));
9860 if(!exp->expType)
9861 {
9862 exp->expType = op1->type;
9863 if(op1->type)
9864 op1->type->refCount++;
9865 }
9866 return 0x1;
9867 }
9868
9869 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9870 {
9871 float value2 = op2->f;
9872
9873 exp->type = 2;
9874 exp->string = PrintFloat((float)(op1->f || value2));
9875 if(!exp->expType)
9876 {
9877 exp->expType = op1->type;
9878 if(op1->type)
9879 op1->type->refCount++;
9880 }
9881 return 0x1;
9882 }
9883
9884 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9885 {
9886 double value2 = op2->d;
9887
9888 exp->type = 2;
9889 exp->string = PrintDouble((double)(op1->d || value2));
9890 if(!exp->expType)
9891 {
9892 exp->expType = op1->type;
9893 if(op1->type)
9894 op1->type->refCount++;
9895 }
9896 return 0x1;
9897 }
9898
9899 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9900 {
9901 int value2 = op2->i;
9902
9903 exp->type = 2;
9904 exp->string = PrintInt((int)(op1->i > value2));
9905 if(!exp->expType)
9906 {
9907 exp->expType = op1->type;
9908 if(op1->type)
9909 op1->type->refCount++;
9910 }
9911 return 0x1;
9912 }
9913
9914 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9915 {
9916 unsigned int value2 = op2->ui;
9917
9918 exp->type = 2;
9919 exp->string = PrintUInt((unsigned int)(op1->ui > value2));
9920 if(!exp->expType)
9921 {
9922 exp->expType = op1->type;
9923 if(op1->type)
9924 op1->type->refCount++;
9925 }
9926 return 0x1;
9927 }
9928
9929 static unsigned int Int64Grt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9930 {
9931 long long value2 = op2->i64;
9932
9933 exp->type = 2;
9934 exp->string = PrintInt64((long long)(op1->i64 > value2));
9935 if(!exp->expType)
9936 {
9937 exp->expType = op1->type;
9938 if(op1->type)
9939 op1->type->refCount++;
9940 }
9941 return 0x1;
9942 }
9943
9944 static unsigned int UInt64Grt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9945 {
9946 uint64 value2 = op2->ui64;
9947
9948 exp->type = 2;
9949 exp->string = PrintUInt64((uint64)(op1->ui64 > value2));
9950 if(!exp->expType)
9951 {
9952 exp->expType = op1->type;
9953 if(op1->type)
9954 op1->type->refCount++;
9955 }
9956 return 0x1;
9957 }
9958
9959 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9960 {
9961 short value2 = op2->s;
9962
9963 exp->type = 2;
9964 exp->string = PrintShort((short)(op1->s > value2));
9965 if(!exp->expType)
9966 {
9967 exp->expType = op1->type;
9968 if(op1->type)
9969 op1->type->refCount++;
9970 }
9971 return 0x1;
9972 }
9973
9974 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9975 {
9976 unsigned short value2 = op2->us;
9977
9978 exp->type = 2;
9979 exp->string = PrintUShort((unsigned short)(op1->us > value2));
9980 if(!exp->expType)
9981 {
9982 exp->expType = op1->type;
9983 if(op1->type)
9984 op1->type->refCount++;
9985 }
9986 return 0x1;
9987 }
9988
9989 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9990 {
9991 char value2 = op2->c;
9992
9993 exp->type = 2;
9994 exp->string = PrintChar((char)(op1->c > value2));
9995 if(!exp->expType)
9996 {
9997 exp->expType = op1->type;
9998 if(op1->type)
9999 op1->type->refCount++;
10000 }
10001 return 0x1;
10002 }
10003
10004 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10005 {
10006 unsigned char value2 = op2->uc;
10007
10008 exp->type = 2;
10009 exp->string = PrintUChar((unsigned char)(op1->uc > value2));
10010 if(!exp->expType)
10011 {
10012 exp->expType = op1->type;
10013 if(op1->type)
10014 op1->type->refCount++;
10015 }
10016 return 0x1;
10017 }
10018
10019 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10020 {
10021 float value2 = op2->f;
10022
10023 exp->type = 2;
10024 exp->string = PrintFloat((float)(op1->f > value2));
10025 if(!exp->expType)
10026 {
10027 exp->expType = op1->type;
10028 if(op1->type)
10029 op1->type->refCount++;
10030 }
10031 return 0x1;
10032 }
10033
10034 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10035 {
10036 double value2 = op2->d;
10037
10038 exp->type = 2;
10039 exp->string = PrintDouble((double)(op1->d > value2));
10040 if(!exp->expType)
10041 {
10042 exp->expType = op1->type;
10043 if(op1->type)
10044 op1->type->refCount++;
10045 }
10046 return 0x1;
10047 }
10048
10049 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10050 {
10051 int value2 = op2->i;
10052
10053 exp->type = 2;
10054 exp->string = PrintInt((int)(op1->i < value2));
10055 if(!exp->expType)
10056 {
10057 exp->expType = op1->type;
10058 if(op1->type)
10059 op1->type->refCount++;
10060 }
10061 return 0x1;
10062 }
10063
10064 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10065 {
10066 unsigned int value2 = op2->ui;
10067
10068 exp->type = 2;
10069 exp->string = PrintUInt((unsigned int)(op1->ui < value2));
10070 if(!exp->expType)
10071 {
10072 exp->expType = op1->type;
10073 if(op1->type)
10074 op1->type->refCount++;
10075 }
10076 return 0x1;
10077 }
10078
10079 static unsigned int Int64Sma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10080 {
10081 long long value2 = op2->i64;
10082
10083 exp->type = 2;
10084 exp->string = PrintInt64((long long)(op1->i64 < value2));
10085 if(!exp->expType)
10086 {
10087 exp->expType = op1->type;
10088 if(op1->type)
10089 op1->type->refCount++;
10090 }
10091 return 0x1;
10092 }
10093
10094 static unsigned int UInt64Sma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10095 {
10096 uint64 value2 = op2->ui64;
10097
10098 exp->type = 2;
10099 exp->string = PrintUInt64((uint64)(op1->ui64 < value2));
10100 if(!exp->expType)
10101 {
10102 exp->expType = op1->type;
10103 if(op1->type)
10104 op1->type->refCount++;
10105 }
10106 return 0x1;
10107 }
10108
10109 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10110 {
10111 short value2 = op2->s;
10112
10113 exp->type = 2;
10114 exp->string = PrintShort((short)(op1->s < value2));
10115 if(!exp->expType)
10116 {
10117 exp->expType = op1->type;
10118 if(op1->type)
10119 op1->type->refCount++;
10120 }
10121 return 0x1;
10122 }
10123
10124 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10125 {
10126 unsigned short value2 = op2->us;
10127
10128 exp->type = 2;
10129 exp->string = PrintUShort((unsigned short)(op1->us < value2));
10130 if(!exp->expType)
10131 {
10132 exp->expType = op1->type;
10133 if(op1->type)
10134 op1->type->refCount++;
10135 }
10136 return 0x1;
10137 }
10138
10139 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10140 {
10141 char value2 = op2->c;
10142
10143 exp->type = 2;
10144 exp->string = PrintChar((char)(op1->c < value2));
10145 if(!exp->expType)
10146 {
10147 exp->expType = op1->type;
10148 if(op1->type)
10149 op1->type->refCount++;
10150 }
10151 return 0x1;
10152 }
10153
10154 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10155 {
10156 unsigned char value2 = op2->uc;
10157
10158 exp->type = 2;
10159 exp->string = PrintUChar((unsigned char)(op1->uc < value2));
10160 if(!exp->expType)
10161 {
10162 exp->expType = op1->type;
10163 if(op1->type)
10164 op1->type->refCount++;
10165 }
10166 return 0x1;
10167 }
10168
10169 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10170 {
10171 float value2 = op2->f;
10172
10173 exp->type = 2;
10174 exp->string = PrintFloat((float)(op1->f < value2));
10175 if(!exp->expType)
10176 {
10177 exp->expType = op1->type;
10178 if(op1->type)
10179 op1->type->refCount++;
10180 }
10181 return 0x1;
10182 }
10183
10184 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10185 {
10186 double value2 = op2->d;
10187
10188 exp->type = 2;
10189 exp->string = PrintDouble((double)(op1->d < value2));
10190 if(!exp->expType)
10191 {
10192 exp->expType = op1->type;
10193 if(op1->type)
10194 op1->type->refCount++;
10195 }
10196 return 0x1;
10197 }
10198
10199 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10200 {
10201 int value2 = op2->i;
10202
10203 exp->type = 2;
10204 exp->string = PrintInt((int)(op1->i >= value2));
10205 if(!exp->expType)
10206 {
10207 exp->expType = op1->type;
10208 if(op1->type)
10209 op1->type->refCount++;
10210 }
10211 return 0x1;
10212 }
10213
10214 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10215 {
10216 unsigned int value2 = op2->ui;
10217
10218 exp->type = 2;
10219 exp->string = PrintUInt((unsigned int)(op1->ui >= value2));
10220 if(!exp->expType)
10221 {
10222 exp->expType = op1->type;
10223 if(op1->type)
10224 op1->type->refCount++;
10225 }
10226 return 0x1;
10227 }
10228
10229 static unsigned int Int64GrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10230 {
10231 long long value2 = op2->i64;
10232
10233 exp->type = 2;
10234 exp->string = PrintInt64((long long)(op1->i64 >= value2));
10235 if(!exp->expType)
10236 {
10237 exp->expType = op1->type;
10238 if(op1->type)
10239 op1->type->refCount++;
10240 }
10241 return 0x1;
10242 }
10243
10244 static unsigned int UInt64GrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10245 {
10246 uint64 value2 = op2->ui64;
10247
10248 exp->type = 2;
10249 exp->string = PrintUInt64((uint64)(op1->ui64 >= value2));
10250 if(!exp->expType)
10251 {
10252 exp->expType = op1->type;
10253 if(op1->type)
10254 op1->type->refCount++;
10255 }
10256 return 0x1;
10257 }
10258
10259 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10260 {
10261 short value2 = op2->s;
10262
10263 exp->type = 2;
10264 exp->string = PrintShort((short)(op1->s >= value2));
10265 if(!exp->expType)
10266 {
10267 exp->expType = op1->type;
10268 if(op1->type)
10269 op1->type->refCount++;
10270 }
10271 return 0x1;
10272 }
10273
10274 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10275 {
10276 unsigned short value2 = op2->us;
10277
10278 exp->type = 2;
10279 exp->string = PrintUShort((unsigned short)(op1->us >= value2));
10280 if(!exp->expType)
10281 {
10282 exp->expType = op1->type;
10283 if(op1->type)
10284 op1->type->refCount++;
10285 }
10286 return 0x1;
10287 }
10288
10289 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10290 {
10291 char value2 = op2->c;
10292
10293 exp->type = 2;
10294 exp->string = PrintChar((char)(op1->c >= value2));
10295 if(!exp->expType)
10296 {
10297 exp->expType = op1->type;
10298 if(op1->type)
10299 op1->type->refCount++;
10300 }
10301 return 0x1;
10302 }
10303
10304 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10305 {
10306 unsigned char value2 = op2->uc;
10307
10308 exp->type = 2;
10309 exp->string = PrintUChar((unsigned char)(op1->uc >= value2));
10310 if(!exp->expType)
10311 {
10312 exp->expType = op1->type;
10313 if(op1->type)
10314 op1->type->refCount++;
10315 }
10316 return 0x1;
10317 }
10318
10319 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10320 {
10321 float value2 = op2->f;
10322
10323 exp->type = 2;
10324 exp->string = PrintFloat((float)(op1->f >= value2));
10325 if(!exp->expType)
10326 {
10327 exp->expType = op1->type;
10328 if(op1->type)
10329 op1->type->refCount++;
10330 }
10331 return 0x1;
10332 }
10333
10334 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10335 {
10336 double value2 = op2->d;
10337
10338 exp->type = 2;
10339 exp->string = PrintDouble((double)(op1->d >= value2));
10340 if(!exp->expType)
10341 {
10342 exp->expType = op1->type;
10343 if(op1->type)
10344 op1->type->refCount++;
10345 }
10346 return 0x1;
10347 }
10348
10349 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10350 {
10351 int value2 = op2->i;
10352
10353 exp->type = 2;
10354 exp->string = PrintInt((int)(op1->i <= value2));
10355 if(!exp->expType)
10356 {
10357 exp->expType = op1->type;
10358 if(op1->type)
10359 op1->type->refCount++;
10360 }
10361 return 0x1;
10362 }
10363
10364 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10365 {
10366 unsigned int value2 = op2->ui;
10367
10368 exp->type = 2;
10369 exp->string = PrintUInt((unsigned int)(op1->ui <= value2));
10370 if(!exp->expType)
10371 {
10372 exp->expType = op1->type;
10373 if(op1->type)
10374 op1->type->refCount++;
10375 }
10376 return 0x1;
10377 }
10378
10379 static unsigned int Int64SmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10380 {
10381 long long value2 = op2->i64;
10382
10383 exp->type = 2;
10384 exp->string = PrintInt64((long long)(op1->i64 <= value2));
10385 if(!exp->expType)
10386 {
10387 exp->expType = op1->type;
10388 if(op1->type)
10389 op1->type->refCount++;
10390 }
10391 return 0x1;
10392 }
10393
10394 static unsigned int UInt64SmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10395 {
10396 uint64 value2 = op2->ui64;
10397
10398 exp->type = 2;
10399 exp->string = PrintUInt64((uint64)(op1->ui64 <= value2));
10400 if(!exp->expType)
10401 {
10402 exp->expType = op1->type;
10403 if(op1->type)
10404 op1->type->refCount++;
10405 }
10406 return 0x1;
10407 }
10408
10409 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10410 {
10411 short value2 = op2->s;
10412
10413 exp->type = 2;
10414 exp->string = PrintShort((short)(op1->s <= value2));
10415 if(!exp->expType)
10416 {
10417 exp->expType = op1->type;
10418 if(op1->type)
10419 op1->type->refCount++;
10420 }
10421 return 0x1;
10422 }
10423
10424 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10425 {
10426 unsigned short value2 = op2->us;
10427
10428 exp->type = 2;
10429 exp->string = PrintUShort((unsigned short)(op1->us <= value2));
10430 if(!exp->expType)
10431 {
10432 exp->expType = op1->type;
10433 if(op1->type)
10434 op1->type->refCount++;
10435 }
10436 return 0x1;
10437 }
10438
10439 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10440 {
10441 char value2 = op2->c;
10442
10443 exp->type = 2;
10444 exp->string = PrintChar((char)(op1->c <= value2));
10445 if(!exp->expType)
10446 {
10447 exp->expType = op1->type;
10448 if(op1->type)
10449 op1->type->refCount++;
10450 }
10451 return 0x1;
10452 }
10453
10454 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10455 {
10456 unsigned char value2 = op2->uc;
10457
10458 exp->type = 2;
10459 exp->string = PrintUChar((unsigned char)(op1->uc <= value2));
10460 if(!exp->expType)
10461 {
10462 exp->expType = op1->type;
10463 if(op1->type)
10464 op1->type->refCount++;
10465 }
10466 return 0x1;
10467 }
10468
10469 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10470 {
10471 float value2 = op2->f;
10472
10473 exp->type = 2;
10474 exp->string = PrintFloat((float)(op1->f <= value2));
10475 if(!exp->expType)
10476 {
10477 exp->expType = op1->type;
10478 if(op1->type)
10479 op1->type->refCount++;
10480 }
10481 return 0x1;
10482 }
10483
10484 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10485 {
10486 double value2 = op2->d;
10487
10488 exp->type = 2;
10489 exp->string = PrintDouble((double)(op1->d <= value2));
10490 if(!exp->expType)
10491 {
10492 exp->expType = op1->type;
10493 if(op1->type)
10494 op1->type->refCount++;
10495 }
10496 return 0x1;
10497 }
10498
10499 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10500 {
10501 exp->type = 2;
10502 exp->string = PrintInt(op1->i ? op2->i : op3->i);
10503 if(!exp->expType)
10504 {
10505 exp->expType = op1->type;
10506 if(op1->type)
10507 op1->type->refCount++;
10508 }
10509 return 0x1;
10510 }
10511
10512 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10513 {
10514 exp->type = 2;
10515 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
10516 if(!exp->expType)
10517 {
10518 exp->expType = op1->type;
10519 if(op1->type)
10520 op1->type->refCount++;
10521 }
10522 return 0x1;
10523 }
10524
10525 static unsigned int Int64Cond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10526 {
10527 exp->type = 2;
10528 exp->string = PrintInt64(op1->i64 ? op2->i64 : op3->i64);
10529 if(!exp->expType)
10530 {
10531 exp->expType = op1->type;
10532 if(op1->type)
10533 op1->type->refCount++;
10534 }
10535 return 0x1;
10536 }
10537
10538 static unsigned int UInt64Cond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10539 {
10540 exp->type = 2;
10541 exp->string = PrintUInt64(op1->ui64 ? op2->ui64 : op3->ui64);
10542 if(!exp->expType)
10543 {
10544 exp->expType = op1->type;
10545 if(op1->type)
10546 op1->type->refCount++;
10547 }
10548 return 0x1;
10549 }
10550
10551 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10552 {
10553 exp->type = 2;
10554 exp->string = PrintShort(op1->s ? op2->s : op3->s);
10555 if(!exp->expType)
10556 {
10557 exp->expType = op1->type;
10558 if(op1->type)
10559 op1->type->refCount++;
10560 }
10561 return 0x1;
10562 }
10563
10564 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10565 {
10566 exp->type = 2;
10567 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
10568 if(!exp->expType)
10569 {
10570 exp->expType = op1->type;
10571 if(op1->type)
10572 op1->type->refCount++;
10573 }
10574 return 0x1;
10575 }
10576
10577 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10578 {
10579 exp->type = 2;
10580 exp->string = PrintChar(op1->c ? op2->c : op3->c);
10581 if(!exp->expType)
10582 {
10583 exp->expType = op1->type;
10584 if(op1->type)
10585 op1->type->refCount++;
10586 }
10587 return 0x1;
10588 }
10589
10590 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10591 {
10592 exp->type = 2;
10593 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
10594 if(!exp->expType)
10595 {
10596 exp->expType = op1->type;
10597 if(op1->type)
10598 op1->type->refCount++;
10599 }
10600 return 0x1;
10601 }
10602
10603 struct OpTable intOps =
10604 {
10605 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
10606 };
10607
10608 struct OpTable uintOps =
10609 {
10610 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
10611 };
10612
10613 struct OpTable int64Ops =
10614 {
10615 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
10616 };
10617
10618 struct OpTable uint64Ops =
10619 {
10620 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
10621 };
10622
10623 struct OpTable shortOps =
10624 {
10625 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
10626 };
10627
10628 struct OpTable ushortOps =
10629 {
10630 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
10631 };
10632
10633 struct OpTable floatOps =
10634 {
10635 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
10636 };
10637
10638 struct OpTable doubleOps =
10639 {
10640 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
10641 };
10642
10643 struct OpTable charOps =
10644 {
10645 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
10646 };
10647
10648 struct OpTable ucharOps =
10649 {
10650 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
10651 };
10652
10653 void ReadString(char * output, char * string)
10654 {
10655 int len = strlen(string);
10656 int c, d = 0;
10657 unsigned int quoted = 0x0, escaped = 0x0;
10658
10659 for(c = 0; c < len; c++)
10660 {
10661 char ch = string[c];
10662
10663 if(escaped)
10664 {
10665 switch(ch)
10666 {
10667 case 'n':
10668 output[d] = '\n';
10669 break;
10670 case 't':
10671 output[d] = '\t';
10672 break;
10673 case 'a':
10674 output[d] = '\a';
10675 break;
10676 case 'b':
10677 output[d] = '\b';
10678 break;
10679 case 'f':
10680 output[d] = '\f';
10681 break;
10682 case 'r':
10683 output[d] = '\r';
10684 break;
10685 case 'v':
10686 output[d] = '\v';
10687 break;
10688 case '\\':
10689 output[d] = '\\';
10690 break;
10691 case '\"':
10692 output[d] = '\"';
10693 break;
10694 case '\'':
10695 output[d] = '\'';
10696 break;
10697 default:
10698 output[d] = ch;
10699 }
10700 d++;
10701 escaped = 0x0;
10702 }
10703 else
10704 {
10705 if(ch == '\"')
10706 quoted ^= 0x1;
10707 else if(quoted)
10708 {
10709 if(ch == '\\')
10710 escaped = 0x1;
10711 else
10712 output[d++] = ch;
10713 }
10714 }
10715 }
10716 output[d] = '\0';
10717 }
10718
10719 int UnescapeString(char * d, char * s, int len)
10720 {
10721 int j = 0, k = 0;
10722 char ch;
10723
10724 while(j < len && (ch = s[j]))
10725 {
10726 switch(ch)
10727 {
10728 case '\\':
10729 switch((ch = s[++j]))
10730 {
10731 case 'n':
10732 d[k] = '\n';
10733 break;
10734 case 't':
10735 d[k] = '\t';
10736 break;
10737 case 'a':
10738 d[k] = '\a';
10739 break;
10740 case 'b':
10741 d[k] = '\b';
10742 break;
10743 case 'f':
10744 d[k] = '\f';
10745 break;
10746 case 'r':
10747 d[k] = '\r';
10748 break;
10749 case 'v':
10750 d[k] = '\v';
10751 break;
10752 case '\\':
10753 d[k] = '\\';
10754 break;
10755 case '\"':
10756 d[k] = '\"';
10757 break;
10758 case '\'':
10759 d[k] = '\'';
10760 break;
10761 default:
10762 d[k] = '\\';
10763 d[k] = ch;
10764 }
10765 break;
10766 default:
10767 d[k] = ch;
10768 }
10769 j++, k++;
10770 }
10771 d[k] = '\0';
10772 return k;
10773 }
10774
10775 char * OffsetEscapedString(char * s, int len, int offset)
10776 {
10777 char ch;
10778 int j = 0, k = 0;
10779
10780 while(j < len && k < offset && (ch = s[j]))
10781 {
10782 if(ch == '\\')
10783 ++j;
10784 j++, k++;
10785 }
10786 return (k == offset) ? s + j : (((void *)0));
10787 }
10788
10789 extern long long __ecereNameSpace__ecere__com___strtoi64(const char *  string, const char * *  endString, int base);
10790
10791 extern uint64 __ecereNameSpace__ecere__com___strtoui64(const char *  string, const char * *  endString, int base);
10792
10793 extern double strtod(const char * , char * * );
10794
10795 extern float (* __ecereMethod_float_inf)(void);
10796
10797 extern float (* __ecereMethod_float_nan)(void);
10798
10799 extern double (* __ecereMethod_double_inf)(void);
10800
10801 extern double (* __ecereMethod_double_nan)(void);
10802
10803 struct Operand GetOperand(struct Expression * exp)
10804 {
10805 struct Operand op =
10806 {
10807 0, 0, 0, .c = 0,
10808 {
10809 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10810 }
10811 };
10812 struct Type * type = exp->expType;
10813
10814 if(type)
10815 {
10816 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
10817 {
10818 if(!type->_class->registered->dataType)
10819 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
10820 type = type->_class->registered->dataType;
10821 }
10822 if(exp->type == 3 && op.kind == 13)
10823 {
10824 op.ui64 = (uint64)exp->string;
10825 op.kind = 13;
10826 op.ops = uint64Ops;
10827 }
10828 else if(exp->isConstant && exp->type == 2)
10829 {
10830 op.kind = type->kind;
10831 op.type = exp->expType;
10832 switch(op.kind)
10833 {
10834 case 24:
10835 case 1:
10836 {
10837 if(exp->constant[0] == '\'')
10838 {
10839 op.c = exp->constant[1];
10840 op.ops = charOps;
10841 }
10842 else if(type->isSigned)
10843 {
10844 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
10845 op.ops = charOps;
10846 }
10847 else
10848 {
10849 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
10850 op.ops = ucharOps;
10851 }
10852 break;
10853 }
10854 case 2:
10855 if(type->isSigned)
10856 {
10857 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
10858 op.ops = shortOps;
10859 }
10860 else
10861 {
10862 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
10863 op.ops = ushortOps;
10864 }
10865 break;
10866 case 3:
10867 case 5:
10868 if(type->isSigned)
10869 {
10870 op.i = strtol(exp->constant, (((void *)0)), 0);
10871 op.ops = intOps;
10872 }
10873 else
10874 {
10875 op.ui = strtoul(exp->constant, (((void *)0)), 0);
10876 op.ops = uintOps;
10877 }
10878 op.kind = 3;
10879 break;
10880 case 4:
10881 if(type->isSigned)
10882 {
10883 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
10884 op.ops = int64Ops;
10885 }
10886 else
10887 {
10888 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
10889 op.ops = uint64Ops;
10890 }
10891 op.kind = 4;
10892 break;
10893 case 22:
10894 if(type->isSigned)
10895 {
10896 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
10897 op.ops = int64Ops;
10898 }
10899 else
10900 {
10901 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
10902 op.ops = uint64Ops;
10903 }
10904 op.kind = 4;
10905 break;
10906 case 23:
10907 if(type->isSigned)
10908 {
10909 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
10910 op.ops = int64Ops;
10911 }
10912 else
10913 {
10914 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
10915 op.ops = uint64Ops;
10916 }
10917 op.kind = 4;
10918 break;
10919 case 6:
10920 if(!strcmp(exp->constant, "inf"))
10921 op.f = __ecereMethod_float_inf();
10922 else if(!strcmp(exp->constant, "-inf"))
10923 op.f = -__ecereMethod_float_inf();
10924 else if(!strcmp(exp->constant, "nan"))
10925 op.f = __ecereMethod_float_nan();
10926 else if(!strcmp(exp->constant, "-nan"))
10927 op.f = -__ecereMethod_float_nan();
10928 else
10929 op.f = (float)strtod(exp->constant, (((void *)0)));
10930 op.ops = floatOps;
10931 break;
10932 case 7:
10933 if(!strcmp(exp->constant, "inf"))
10934 op.d = __ecereMethod_double_inf();
10935 else if(!strcmp(exp->constant, "-inf"))
10936 op.d = -__ecereMethod_double_inf();
10937 else if(!strcmp(exp->constant, "nan"))
10938 op.d = __ecereMethod_double_nan();
10939 else if(!strcmp(exp->constant, "-nan"))
10940 op.d = -__ecereMethod_double_nan();
10941 else
10942 op.d = (double)strtod(exp->constant, (((void *)0)));
10943 op.ops = doubleOps;
10944 break;
10945 case 12:
10946 case 13:
10947 case 8:
10948 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
10949 op.kind = 13;
10950 op.ops = uint64Ops;
10951 break;
10952 }
10953 }
10954 }
10955 return op;
10956 }
10957
10958 int __ecereVMethodID_class_OnGetString;
10959
10960 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
10961
10962 static __attribute__((unused)) void UnusedFunction()
10963 {
10964 int a;
10965
10966 ((const char *  (*)(struct __ecereNameSpace__ecere__com__Class *, const void *, char *  tempString, void *  fieldData, unsigned int *  needClass))__ecereClass_int->_vTbl[__ecereVMethodID_class_OnGetString])(__ecereClass_int, &a, 0, 0, 0);
10967 }
10968
10969 extern int __ecereVMethodID_class_OnGetString;
10970
10971 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
10972 {
10973 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
10974
10975 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
10976 {
10977 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
10978 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
10979 else
10980 {
10981 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10982 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
10983 struct Type * type;
10984 void * ptr = inst->data + dataMember->offset + offset;
10985 char * result = (((void *)0));
10986
10987 exp->loc = member->loc = inst->loc;
10988 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
10989 if(!dataMember->dataType)
10990 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
10991 type = dataMember->dataType;
10992 if(type->kind == 8)
10993 {
10994 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10995
10996 if(_class->type == 4)
10997 {
10998 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
10999
11000 if(enumClass)
11001 {
11002 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
11003 struct __ecereNameSpace__ecere__sys__NamedLink * item;
11004
11005 for(item = e->values.first; item; item = item->next)
11006 {
11007 if((int)item->data == *(int *)ptr)
11008 {
11009 result = item->name;
11010 break;
11011 }
11012 }
11013 if(result)
11014 {
11015 exp->identifier = MkIdentifier(result);
11016 exp->type = 0;
11017 exp->destType = MkClassType(_class->fullName);
11018 ProcessExpressionType(exp);
11019 }
11020 }
11021 }
11022 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
11023 {
11024 if(!_class->dataType)
11025 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
11026 type = _class->dataType;
11027 }
11028 }
11029 if(!result)
11030 {
11031 switch(type->kind)
11032 {
11033 case 6:
11034 {
11035 FreeExpContents(exp);
11036 exp->constant = PrintFloat(*(float *)ptr);
11037 exp->type = 2;
11038 break;
11039 }
11040 case 7:
11041 {
11042 FreeExpContents(exp);
11043 exp->constant = PrintDouble(*(double *)ptr);
11044 exp->type = 2;
11045 break;
11046 }
11047 case 3:
11048 {
11049 FreeExpContents(exp);
11050 exp->constant = PrintInt(*(int *)ptr);
11051 exp->type = 2;
11052 break;
11053 }
11054 case 4:
11055 {
11056 FreeExpContents(exp);
11057 exp->constant = PrintInt64(*(long long *)ptr);
11058 exp->type = 2;
11059 break;
11060 }
11061 case 22:
11062 {
11063 FreeExpContents(exp);
11064 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
11065 exp->type = 2;
11066 break;
11067 }
11068 case 23:
11069 {
11070 FreeExpContents(exp);
11071 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
11072 exp->type = 2;
11073 break;
11074 }
11075 default:
11076 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Unhandled type populating instance\n", (((void *)0))));
11077 }
11078 }
11079 ListAdd(memberList, member);
11080 }
11081 if(parentDataMember->type == 1)
11082 break;
11083 }
11084 }
11085
11086 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
11087
11088 void PopulateInstance(struct Instantiation * inst)
11089 {
11090 struct Symbol * classSym = inst->_class->symbol;
11091 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
11092 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
11093 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
11094
11095 if(!inst->members)
11096 inst->members = MkListOne(MkMembersInitList(memberList));
11097 else
11098 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*inst->members), MkMembersInitList(memberList));
11099 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
11100 {
11101 if(!dataMember->isProperty)
11102 {
11103 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
11104 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
11105 else
11106 {
11107 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11108 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
11109 struct Type * type;
11110 void * ptr = inst->data + dataMember->offset;
11111 char * result = (((void *)0));
11112
11113 exp->loc = member->loc = inst->loc;
11114 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
11115 if(!dataMember->dataType)
11116 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
11117 type = dataMember->dataType;
11118 if(type->kind == 8)
11119 {
11120 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11121
11122 if(_class->type == 4)
11123 {
11124 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11125
11126 if(enumClass)
11127 {
11128 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
11129 struct __ecereNameSpace__ecere__sys__NamedLink * item;
11130
11131 for(item = e->values.first; item; item = item->next)
11132 {
11133 if((int)item->data == *(int *)ptr)
11134 {
11135 result = item->name;
11136 break;
11137 }
11138 }
11139 }
11140 if(result)
11141 {
11142 exp->identifier = MkIdentifier(result);
11143 exp->type = 0;
11144 exp->destType = MkClassType(_class->fullName);
11145 ProcessExpressionType(exp);
11146 }
11147 }
11148 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
11149 {
11150 if(!_class->dataType)
11151 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
11152 type = _class->dataType;
11153 }
11154 }
11155 if(!result)
11156 {
11157 switch(type->kind)
11158 {
11159 case 6:
11160 {
11161 exp->constant = PrintFloat(*(float *)ptr);
11162 exp->type = 2;
11163 break;
11164 }
11165 case 7:
11166 {
11167 exp->constant = PrintDouble(*(double *)ptr);
11168 exp->type = 2;
11169 break;
11170 }
11171 case 3:
11172 {
11173 exp->constant = PrintInt(*(int *)ptr);
11174 exp->type = 2;
11175 break;
11176 }
11177 case 4:
11178 {
11179 exp->constant = PrintInt64(*(long long *)ptr);
11180 exp->type = 2;
11181 break;
11182 }
11183 case 22:
11184 {
11185 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
11186 exp->type = 2;
11187 break;
11188 }
11189 default:
11190 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Unhandled type populating instance\n", (((void *)0))));
11191 }
11192 }
11193 ListAdd(memberList, member);
11194 }
11195 }
11196 }
11197 }
11198
11199 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, unsigned int *  offset, struct __ecereNameSpace__ecere__com__Instance * module, struct __ecereNameSpace__ecere__com__DataMember **  subMemberStack, int *  subMemberStackPos);
11200
11201 extern void FreeInstance(struct Instantiation * inst);
11202
11203 void ComputeInstantiation(struct Expression * exp)
11204 {
11205 struct Instantiation * inst = exp->instance;
11206 struct MembersInit * members;
11207 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
11208 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
11209 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
11210 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
11211 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
11212 int subMemberStackPos = 0;
11213 uint64 bits = 0;
11214
11215 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
11216 {
11217 if(inst->data)
11218 return ;
11219 if(_class->type == 0 || _class->type == 5)
11220 {
11221 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
11222 if(_class->type == 0)
11223 ((struct __ecereNameSpace__ecere__com__Instance *)(char *)((struct __ecereNameSpace__ecere__com__Instance *)inst->data))->_refCount++;
11224 }
11225 else
11226 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
11227 }
11228 if(inst->members)
11229 {
11230 for(members = (*inst->members).first; members; members = members->next)
11231 {
11232 switch(members->type)
11233 {
11234 case 0:
11235 {
11236 if(members->dataMembers)
11237 {
11238 struct MemberInit * member;
11239
11240 for(member = (*members->dataMembers).first; member; member = member->next)
11241 {
11242 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
11243 unsigned int found = 0x0;
11244 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11245 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
11246 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11247 unsigned int dataMemberOffset;
11248
11249 if(!ident)
11250 {
11251 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
11252 if(curMember)
11253 {
11254 if(curMember->isProperty)
11255 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
11256 else
11257 {
11258 dataMember = curMember;
11259 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
11260 if(_class->type == 0)
11261 dataMemberOffset += _class->base->structSize;
11262 }
11263 found = 0x1;
11264 }
11265 }
11266 else
11267 {
11268 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
11269 if(prop)
11270 {
11271 found = 0x1;
11272 if(prop->memberAccess == 1)
11273 {
11274 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
11275 curClass = prop->_class;
11276 }
11277 }
11278 else
11279 {
11280 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
11281 int _subMemberStackPos = 0;
11282
11283 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
11284 if(dataMember)
11285 {
11286 found = 0x1;
11287 if(dataMember->memberAccess == 1)
11288 {
11289 curMember = dataMember;
11290 curClass = dataMember->_class;
11291 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
11292 subMemberStackPos = _subMemberStackPos;
11293 }
11294 }
11295 }
11296 }
11297 if(found && member->initializer && member->initializer->type == 0)
11298 {
11299 struct Expression * value = member->initializer->exp;
11300 struct Type * type = (((void *)0));
11301 unsigned int deepMember = 0x0;
11302
11303 if(prop)
11304 {
11305 type = prop->dataType;
11306 }
11307 else if(dataMember)
11308 {
11309 if(!dataMember->dataType)
11310 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
11311 type = dataMember->dataType;
11312 }
11313 if(ident && ident->next)
11314 {
11315 deepMember = 0x1;
11316 for(ident = ident->next; ident && type; ident = ident->next)
11317 {
11318 if(type->kind == 8)
11319 {
11320 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
11321 if(prop)
11322 type = prop->dataType;
11323 else
11324 {
11325 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
11326 if(dataMember)
11327 type = dataMember->dataType;
11328 }
11329 }
11330 else if(type->kind == 9 || type->kind == 10)
11331 {
11332 struct Type * memberType;
11333
11334 for(memberType = type->members.first; memberType; memberType = memberType->next)
11335 {
11336 if(!strcmp(memberType->name, ident->string))
11337 {
11338 type = memberType;
11339 break;
11340 }
11341 }
11342 }
11343 }
11344 }
11345 if(value)
11346 {
11347 FreeType(value->destType);
11348 value->destType = type;
11349 if(type)
11350 type->refCount++;
11351 ComputeExpression(value);
11352 }
11353 if(!deepMember && type && value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
11354 {
11355 if(type->kind == 8)
11356 {
11357 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11358
11359 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
11360 {
11361 if(!_class->dataType)
11362 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
11363 type = _class->dataType;
11364 }
11365 }
11366 if(dataMember)
11367 {
11368 void * ptr = inst->data + dataMemberOffset;
11369
11370 if(value->type == 2)
11371 {
11372 switch(type->kind)
11373 {
11374 case 3:
11375 {
11376 GetInt(value, (int *)ptr);
11377 break;
11378 }
11379 case 4:
11380 {
11381 GetInt64(value, (long long *)ptr);
11382 break;
11383 }
11384 case 22:
11385 {
11386 GetIntPtr(value, (intptr_t *)ptr);
11387 break;
11388 }
11389 case 23:
11390 {
11391 GetIntSize(value, (ssize_t *)ptr);
11392 break;
11393 }
11394 case 6:
11395 {
11396 GetFloat(value, (float *)ptr);
11397 break;
11398 }
11399 case 7:
11400 {
11401 GetDouble(value, (double *)ptr);
11402 break;
11403 }
11404 }
11405 }
11406 else if(value->type == 1)
11407 {
11408 if(type->kind == 8)
11409 {
11410 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11411
11412 if(_class->type == 1)
11413 {
11414 ComputeTypeSize(type);
11415 if(value->instance->data)
11416 memcpy(ptr, value->instance->data, type->size);
11417 }
11418 }
11419 }
11420 }
11421 else if(prop)
11422 {
11423 if(value->type == 1 && value->instance->data)
11424 {
11425 if(type->kind == 8)
11426 {
11427 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11428
11429 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)))
11430 {
11431 void (* Set)(void *, void *) = (void *)prop->Set;
11432
11433 Set(inst->data, value->instance->data);
11434 PopulateInstance(inst);
11435 }
11436 }
11437 }
11438 else if(value->type == 2)
11439 {
11440 switch(type->kind)
11441 {
11442 case 7:
11443 {
11444 void (* Set)(void *, double) = (void *)prop->Set;
11445
11446 Set(inst->data, strtod(value->constant, (((void *)0))));
11447 break;
11448 }
11449 case 6:
11450 {
11451 void (* Set)(void *, float) = (void *)prop->Set;
11452
11453 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
11454 break;
11455 }
11456 case 3:
11457 {
11458 void (* Set)(void *, int) = (void *)prop->Set;
11459
11460 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
11461 break;
11462 }
11463 case 4:
11464 {
11465 void (* Set)(void *, long long) = (void *)prop->Set;
11466
11467 Set(inst->data, __ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
11468 break;
11469 }
11470 case 22:
11471 {
11472 void (* Set)(void *, intptr_t) = (void *)prop->Set;
11473
11474 Set(inst->data, (intptr_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
11475 break;
11476 }
11477 case 23:
11478 {
11479 void (* Set)(void *, ssize_t) = (void *)prop->Set;
11480
11481 Set(inst->data, (ssize_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
11482 break;
11483 }
11484 }
11485 }
11486 else if(value->type == 3)
11487 {
11488 char temp[1024];
11489
11490 ReadString(temp, value->string);
11491 ((void (*)(void *, void *))(void *)prop->Set)(inst->data, temp);
11492 }
11493 }
11494 }
11495 else if(!deepMember && type && _class->type == 3)
11496 {
11497 if(prop)
11498 {
11499 if(value->type == 2)
11500 {
11501 if(type->kind == 8)
11502 {
11503 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11504
11505 if(_class->type == 3)
11506 {
11507 if(!_class->dataType)
11508 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
11509 type = _class->dataType;
11510 }
11511 }
11512 switch(type->kind)
11513 {
11514 case 6:
11515 {
11516 float fValue;
11517 float (* Set)(float) = (void *)prop->Set;
11518
11519 GetFloat(member->initializer->exp, &fValue);
11520 exp->constant = PrintFloat(Set(fValue));
11521 exp->type = 2;
11522 break;
11523 }
11524 case 7:
11525 {
11526 double dValue;
11527 double (* Set)(double) = (void *)prop->Set;
11528
11529 GetDouble(member->initializer->exp, &dValue);
11530 exp->constant = PrintDouble(Set(dValue));
11531 exp->type = 2;
11532 break;
11533 }
11534 }
11535 }
11536 }
11537 }
11538 else if(!deepMember && type && _class->type == 2)
11539 {
11540 if(prop)
11541 {
11542 if(value->type == 1 && value->instance->data)
11543 {
11544 unsigned int (* Set)(void *) = (void *)prop->Set;
11545
11546 bits = Set(value->instance->data);
11547 }
11548 else if(value->type == 2)
11549 {
11550 }
11551 }
11552 else if(dataMember)
11553 {
11554 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
11555 struct Type * type;
11556 uint64 part;
11557
11558 bits = (bits & ~bitMember->mask);
11559 if(!bitMember->dataType)
11560 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
11561 type = bitMember->dataType;
11562 if(type->kind == 8 && type->_class && type->_class->registered)
11563 {
11564 if(!type->_class->registered->dataType)
11565 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11566 type = type->_class->registered->dataType;
11567 }
11568 switch(type->kind)
11569 {
11570 case 24:
11571 case 1:
11572 {
11573 unsigned char v;
11574
11575 type->isSigned ? GetChar(value, (char *)&v) : GetUChar(value, &v);
11576 part = (uint64)v;
11577 break;
11578 }
11579 case 2:
11580 {
11581 unsigned short v;
11582
11583 type->isSigned ? GetShort(value, &v) : GetUShort(value, &v);
11584 part = (uint64)v;
11585 break;
11586 }
11587 case 3:
11588 case 5:
11589 {
11590 unsigned int v;
11591
11592 type->isSigned ? GetInt(value, &v) : GetUInt(value, &v);
11593 part = (uint64)v;
11594 break;
11595 }
11596 case 4:
11597 {
11598 uint64 v;
11599
11600 type->isSigned ? GetInt64(value, &v) : GetUInt64(value, &v);
11601 part = v;
11602 break;
11603 }
11604 case 22:
11605 {
11606 uintptr_t v;
11607
11608 type->isSigned ? GetIntPtr(value, &v) : GetUIntPtr(value, &v);
11609 part = (uint64)v;
11610 break;
11611 }
11612 case 23:
11613 {
11614 size_t v;
11615
11616 type->isSigned ? GetIntSize(value, &v) : GetUIntSize(value, &v);
11617 part = (uint64)v;
11618 break;
11619 }
11620 }
11621 bits |= part << bitMember->pos;
11622 }
11623 }
11624 }
11625 else
11626 {
11627 if(_class && _class->type == 3)
11628 {
11629 ComputeExpression(member->initializer->exp);
11630 exp->constant = member->initializer->exp->constant;
11631 exp->type = 2;
11632 member->initializer->exp->constant = (((void *)0));
11633 }
11634 }
11635 }
11636 }
11637 break;
11638 }
11639 }
11640 }
11641 }
11642 if(_class && _class->type == 2)
11643 {
11644 exp->constant = PrintHexUInt(bits);
11645 exp->type = 2;
11646 }
11647 if(exp->type != 1)
11648 {
11649 FreeInstance(inst);
11650 }
11651 }
11652
11653 static unsigned int Promote(struct Operand * op, int kind, unsigned int isSigned)
11654 {
11655 unsigned int result = 0x0;
11656
11657 switch(kind)
11658 {
11659 case 2:
11660 if(op->kind == 1 || op->kind == 15 || op->kind == 24)
11661 result = isSigned ? GetOpShort(op, &op->s) : GetOpUShort(op, &op->us);
11662 break;
11663 case 3:
11664 case 5:
11665 if(op->kind == 1 || op->kind == 2 || op->kind == 15 || op->kind == 24)
11666 result = isSigned ? GetOpInt(op, &op->i) : GetOpUInt(op, &op->ui);
11667 break;
11668 case 4:
11669 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)
11670 result = isSigned ? GetOpInt64(op, &op->i64) : GetOpUInt64(op, &op->ui64);
11671 break;
11672 case 6:
11673 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)
11674 result = GetOpFloat(op, &op->f);
11675 break;
11676 case 7:
11677 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)
11678 result = GetOpDouble(op, &op->d);
11679 break;
11680 case 13:
11681 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)
11682 result = GetOpUIntPtr(op, &op->ui64);
11683 break;
11684 case 15:
11685 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)
11686 result = isSigned ? GetOpInt(op, &op->i) : GetOpUInt(op, &op->ui);
11687 break;
11688 case 22:
11689 if(op->kind == 1 || op->kind == 2 || op->kind == 3 || op->kind == 5 || op->kind == 15 || op->kind == 24)
11690 result = isSigned ? GetOpIntPtr(op, &op->i64) : GetOpUIntPtr(op, &op->i64);
11691 break;
11692 case 23:
11693 if(op->kind == 1 || op->kind == 2 || op->kind == 3 || op->kind == 5 || op->kind == 15 || op->kind == 24)
11694 result = isSigned ? GetOpIntSize(op, &op->ui64) : GetOpUIntSize(op, &op->ui64);
11695 break;
11696 }
11697 return result;
11698 }
11699
11700 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
11701 {
11702 if(exp->op.op == SIZEOF)
11703 {
11704 FreeExpContents(exp);
11705 exp->type = 2;
11706 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
11707 }
11708 else
11709 {
11710 if(!exp->op.exp1)
11711 {
11712 switch(exp->op.op)
11713 {
11714 case '+':
11715 {
11716 struct Expression * exp2 = exp->op.exp2;
11717
11718 exp->op.exp2 = (((void *)0));
11719 FreeExpContents(exp);
11720 FreeType(exp->expType);
11721 FreeType(exp->destType);
11722 *exp = *exp2;
11723 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
11724 break;
11725 }
11726 case '-':
11727 if(op1->ops.Neg)
11728 {
11729 FreeExpContents(exp);
11730 op1->ops.Neg(exp, op1);
11731 }
11732 break;
11733 case '~':
11734 if(op1->ops.BitNot)
11735 {
11736 FreeExpContents(exp);
11737 op1->ops.BitNot(exp, op1);
11738 }
11739 break;
11740 case '!':
11741 if(op1->ops.Not)
11742 {
11743 FreeExpContents(exp);
11744 op1->ops.Not(exp, op1);
11745 }
11746 break;
11747 }
11748 }
11749 else
11750 {
11751 if(op1 && op2 && op1->type && op2->type && op1->kind != op2->kind)
11752 {
11753 if(Promote(op2, op1->kind, op1->type->isSigned))
11754 op2->kind = op1->kind, op2->ops = op1->ops;
11755 else if(Promote(op1, op2->kind, op2->type->isSigned))
11756 op1->kind = op2->kind, op1->ops = op2->ops;
11757 }
11758 switch(exp->op.op)
11759 {
11760 case '+':
11761 if(op1->ops.Add)
11762 {
11763 FreeExpContents(exp);
11764 op1->ops.Add(exp, op1, op2);
11765 }
11766 break;
11767 case '-':
11768 if(op1->ops.Sub)
11769 {
11770 FreeExpContents(exp);
11771 op1->ops.Sub(exp, op1, op2);
11772 }
11773 break;
11774 case '*':
11775 if(op1->ops.Mul)
11776 {
11777 FreeExpContents(exp);
11778 op1->ops.Mul(exp, op1, op2);
11779 }
11780 break;
11781 case '/':
11782 if(op1->ops.Div)
11783 {
11784 FreeExpContents(exp);
11785 op1->ops.Div(exp, op1, op2);
11786 }
11787 break;
11788 case '%':
11789 if(op1->ops.Mod)
11790 {
11791 FreeExpContents(exp);
11792 op1->ops.Mod(exp, op1, op2);
11793 }
11794 break;
11795 case '&':
11796 if(exp->op.exp2)
11797 {
11798 if(op1->ops.BitAnd)
11799 {
11800 FreeExpContents(exp);
11801 op1->ops.BitAnd(exp, op1, op2);
11802 }
11803 }
11804 break;
11805 case '|':
11806 if(op1->ops.BitOr)
11807 {
11808 FreeExpContents(exp);
11809 op1->ops.BitOr(exp, op1, op2);
11810 }
11811 break;
11812 case '^':
11813 if(op1->ops.BitXor)
11814 {
11815 FreeExpContents(exp);
11816 op1->ops.BitXor(exp, op1, op2);
11817 }
11818 break;
11819 case LEFT_OP:
11820 if(op1->ops.LShift)
11821 {
11822 FreeExpContents(exp);
11823 op1->ops.LShift(exp, op1, op2);
11824 }
11825 break;
11826 case RIGHT_OP:
11827 if(op1->ops.RShift)
11828 {
11829 FreeExpContents(exp);
11830 op1->ops.RShift(exp, op1, op2);
11831 }
11832 break;
11833 case EQ_OP:
11834 if(op1->ops.Equ)
11835 {
11836 FreeExpContents(exp);
11837 op1->ops.Equ(exp, op1, op2);
11838 }
11839 break;
11840 case NE_OP:
11841 if(op1->ops.Nqu)
11842 {
11843 FreeExpContents(exp);
11844 op1->ops.Nqu(exp, op1, op2);
11845 }
11846 break;
11847 case AND_OP:
11848 if(op1->ops.And)
11849 {
11850 FreeExpContents(exp);
11851 op1->ops.And(exp, op1, op2);
11852 }
11853 break;
11854 case OR_OP:
11855 if(op1->ops.Or)
11856 {
11857 FreeExpContents(exp);
11858 op1->ops.Or(exp, op1, op2);
11859 }
11860 break;
11861 case '>':
11862 if(op1->ops.Grt)
11863 {
11864 FreeExpContents(exp);
11865 op1->ops.Grt(exp, op1, op2);
11866 }
11867 break;
11868 case '<':
11869 if(op1->ops.Sma)
11870 {
11871 FreeExpContents(exp);
11872 op1->ops.Sma(exp, op1, op2);
11873 }
11874 break;
11875 case GE_OP:
11876 if(op1->ops.GrtEqu)
11877 {
11878 FreeExpContents(exp);
11879 op1->ops.GrtEqu(exp, op1, op2);
11880 }
11881 break;
11882 case LE_OP:
11883 if(op1->ops.SmaEqu)
11884 {
11885 FreeExpContents(exp);
11886 op1->ops.SmaEqu(exp, op1, op2);
11887 }
11888 break;
11889 }
11890 }
11891 }
11892 }
11893
11894 void PrintTypeNoConst(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
11895
11896 extern struct Expression * MkExpIdentifier(struct Identifier * id);
11897
11898 void ComputeExpression(struct Expression * exp)
11899 {
11900 char expString[10240];
11901
11902 expString[0] = '\0';
11903 switch(exp->type)
11904 {
11905 case 1:
11906 {
11907 ComputeInstantiation(exp);
11908 break;
11909 }
11910 case 4:
11911 {
11912 struct Expression * exp1, * exp2 = (((void *)0));
11913 struct Operand op1 =
11914 {
11915 0, 0, 0, .c = 0,
11916 {
11917 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11918 }
11919 };
11920 struct Operand op2 =
11921 {
11922 0, 0, 0, .c = 0,
11923 {
11924 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11925 }
11926 };
11927
11928 if(exp->op.exp2)
11929 {
11930 struct Expression * e = exp->op.exp2;
11931
11932 while((e->type == 5 || e->type == 32 || e->type == 23) && e->list)
11933 {
11934 if(e->type == 5 || e->type == 32 || e->type == 23)
11935 {
11936 if(e->type == 23)
11937 e = (*((struct Statement *)(*e->compound->compound.statements).last)->expressions).last;
11938 else
11939 e = (*e->list).last;
11940 }
11941 }
11942 if(exp->op.op == 261 && e && e->expType)
11943 {
11944 if(e->type == 3 && e->string)
11945 {
11946 char * string = e->string;
11947 int len = strlen(string);
11948 char * tmp = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (len - 2 + 1));
11949
11950 len = UnescapeString(tmp, string + 1, len - 2);
11951 (__ecereNameSpace__ecere__com__eSystem_Delete(tmp), tmp = 0);
11952 FreeExpContents(exp);
11953 exp->type = 2;
11954 exp->constant = PrintUInt(len + 1);
11955 }
11956 else
11957 {
11958 struct Type * type = e->expType;
11959
11960 type->refCount++;
11961 FreeExpContents(exp);
11962 exp->type = 2;
11963 exp->constant = PrintUInt(ComputeTypeSize(type));
11964 FreeType(type);
11965 }
11966 break;
11967 }
11968 else
11969 ComputeExpression(exp->op.exp2);
11970 }
11971 if(exp->op.exp1)
11972 {
11973 ComputeExpression(exp->op.exp1);
11974 exp1 = exp->op.exp1;
11975 exp2 = exp->op.exp2;
11976 op1 = GetOperand(exp1);
11977 if(op1.type)
11978 op1.type->refCount++;
11979 if(exp2)
11980 {
11981 op2 = GetOperand(exp2);
11982 if(op2.type)
11983 op2.type->refCount++;
11984 }
11985 }
11986 else
11987 {
11988 exp1 = exp->op.exp2;
11989 op1 = GetOperand(exp1);
11990 if(op1.type)
11991 op1.type->refCount++;
11992 }
11993 CallOperator(exp, exp1, exp2, &op1, &op2);
11994 if(op1.type)
11995 FreeType(op1.type);
11996 if(op2.type)
11997 FreeType(op2.type);
11998 break;
11999 }
12000 case 5:
12001 case 32:
12002 {
12003 struct Expression * e, * n;
12004
12005 for(e = (*exp->list).first; e; e = n)
12006 {
12007 n = e->next;
12008 if(!n)
12009 {
12010 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
12011 struct Expression * prev = exp->prev;
12012 struct Expression * next = exp->next;
12013
12014 ComputeExpression(e);
12015 FreeType(exp->expType);
12016 FreeType(exp->destType);
12017 *exp = *e;
12018 exp->prev = prev;
12019 exp->next = next;
12020 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
12021 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
12022 }
12023 else
12024 {
12025 FreeExpression(e);
12026 }
12027 }
12028 break;
12029 }
12030 case 8:
12031 {
12032 struct Expression * memberExp = exp->member.exp;
12033 struct Identifier * memberID = exp->member.member;
12034 struct Type * type;
12035
12036 ComputeExpression(exp->member.exp);
12037 type = exp->member.exp->expType;
12038 if(type)
12039 {
12040 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)));
12041 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
12042 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
12043 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
12044
12045 if(type->kind == 19 && exp->member.exp->type == 24)
12046 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
12047 if(!_class)
12048 {
12049 char string[256];
12050 struct Symbol * classSym;
12051
12052 string[0] = '\0';
12053 PrintTypeNoConst(type, string, 0x0, 0x1);
12054 classSym = FindClass(string);
12055 _class = classSym ? classSym->registered : (((void *)0));
12056 }
12057 if(exp->member.member)
12058 {
12059 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
12060 if(!prop)
12061 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
12062 }
12063 if(!prop && !member && _class && exp->member.member)
12064 {
12065 struct Symbol * classSym = FindClass(exp->member.member->string);
12066
12067 convertTo = _class;
12068 _class = classSym ? classSym->registered : (((void *)0));
12069 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
12070 }
12071 if(prop)
12072 {
12073 if(prop->compiled)
12074 {
12075 struct Type * type = prop->dataType;
12076
12077 if(_class->type == 3)
12078 {
12079 if(type->kind == 8)
12080 {
12081 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
12082
12083 if(_class->type == 3)
12084 {
12085 if(!_class->dataType)
12086 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
12087 type = _class->dataType;
12088 }
12089 }
12090 switch(type->kind)
12091 {
12092 case 6:
12093 {
12094 float value;
12095 float (* Get)(float) = (void *)prop->Get;
12096
12097 GetFloat(exp->member.exp, &value);
12098 exp->constant = PrintFloat(Get ? Get(value) : value);
12099 exp->type = 2;
12100 break;
12101 }
12102 case 7:
12103 {
12104 double value;
12105 double (* Get)(double);
12106
12107 GetDouble(exp->member.exp, &value);
12108 if(convertTo)
12109 Get = (void *)prop->Set;
12110 else
12111 Get = (void *)prop->Get;
12112 exp->constant = PrintDouble(Get ? Get(value) : value);
12113 exp->type = 2;
12114 break;
12115 }
12116 }
12117 }
12118 else
12119 {
12120 if(convertTo)
12121 {
12122 struct Expression * value = exp->member.exp;
12123 struct Type * type;
12124
12125 if(!prop->dataType)
12126 ProcessPropertyType(prop);
12127 type = prop->dataType;
12128 if(!type)
12129 {
12130 }
12131 else if(_class->type == 1)
12132 {
12133 switch(type->kind)
12134 {
12135 case 8:
12136 {
12137 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
12138
12139 if(propertyClass->type == 1 && value->type == 1)
12140 {
12141 void (* Set)(void *, void *) = (void *)prop->Set;
12142
12143 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12144 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12145 exp->instance->_class = MkSpecifierName(_class->fullName);
12146 exp->instance->loc = exp->loc;
12147 exp->type = 1;
12148 Set(exp->instance->data, value->instance->data);
12149 PopulateInstance(exp->instance);
12150 }
12151 break;
12152 }
12153 case 3:
12154 {
12155 int intValue;
12156 void (* Set)(void *, int) = (void *)prop->Set;
12157
12158 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12159 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12160 exp->instance->_class = MkSpecifierName(_class->fullName);
12161 exp->instance->loc = exp->loc;
12162 exp->type = 1;
12163 GetInt(value, &intValue);
12164 Set(exp->instance->data, intValue);
12165 PopulateInstance(exp->instance);
12166 break;
12167 }
12168 case 4:
12169 {
12170 long long intValue;
12171 void (* Set)(void *, long long) = (void *)prop->Set;
12172
12173 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12174 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12175 exp->instance->_class = MkSpecifierName(_class->fullName);
12176 exp->instance->loc = exp->loc;
12177 exp->type = 1;
12178 GetInt64(value, &intValue);
12179 Set(exp->instance->data, intValue);
12180 PopulateInstance(exp->instance);
12181 break;
12182 }
12183 case 22:
12184 {
12185 intptr_t intValue;
12186 void (* Set)(void *, intptr_t) = (void *)prop->Set;
12187
12188 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12189 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12190 exp->instance->_class = MkSpecifierName(_class->fullName);
12191 exp->instance->loc = exp->loc;
12192 exp->type = 1;
12193 GetIntPtr(value, &intValue);
12194 Set(exp->instance->data, intValue);
12195 PopulateInstance(exp->instance);
12196 break;
12197 }
12198 case 23:
12199 {
12200 ssize_t intValue;
12201 void (* Set)(void *, ssize_t) = (void *)prop->Set;
12202
12203 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12204 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12205 exp->instance->_class = MkSpecifierName(_class->fullName);
12206 exp->instance->loc = exp->loc;
12207 exp->type = 1;
12208 GetIntSize(value, &intValue);
12209 Set(exp->instance->data, intValue);
12210 PopulateInstance(exp->instance);
12211 break;
12212 }
12213 case 6:
12214 {
12215 float floatValue;
12216 void (* Set)(void *, float) = (void *)prop->Set;
12217
12218 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12219 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12220 exp->instance->_class = MkSpecifierName(_class->fullName);
12221 exp->instance->loc = exp->loc;
12222 exp->type = 1;
12223 GetFloat(value, &floatValue);
12224 Set(exp->instance->data, floatValue);
12225 PopulateInstance(exp->instance);
12226 break;
12227 }
12228 case 7:
12229 {
12230 double doubleValue;
12231 void (* Set)(void *, double) = (void *)prop->Set;
12232
12233 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12234 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12235 exp->instance->_class = MkSpecifierName(_class->fullName);
12236 exp->instance->loc = exp->loc;
12237 exp->type = 1;
12238 GetDouble(value, &doubleValue);
12239 Set(exp->instance->data, doubleValue);
12240 PopulateInstance(exp->instance);
12241 break;
12242 }
12243 }
12244 }
12245 else if(_class->type == 2)
12246 {
12247 switch(type->kind)
12248 {
12249 case 8:
12250 {
12251 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
12252
12253 if(propertyClass->type == 1 && value->instance->data)
12254 {
12255 unsigned int (* Set)(void *) = (void *)prop->Set;
12256 unsigned int bits = Set(value->instance->data);
12257
12258 exp->constant = PrintHexUInt(bits);
12259 exp->type = 2;
12260 break;
12261 }
12262 else if(_class->type == 2)
12263 {
12264 unsigned int value;
12265 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
12266 unsigned int bits;
12267
12268 GetUInt(exp->member.exp, &value);
12269 bits = Set(value);
12270 exp->constant = PrintHexUInt(bits);
12271 exp->type = 2;
12272 }
12273 }
12274 }
12275 }
12276 }
12277 else
12278 {
12279 if(_class->type == 2)
12280 {
12281 unsigned int value;
12282
12283 GetUInt(exp->member.exp, &value);
12284 switch(type->kind)
12285 {
12286 case 8:
12287 {
12288 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
12289
12290 if(_class->type == 1)
12291 {
12292 void (* Get)(unsigned int, void *) = (void *)prop->Get;
12293
12294 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12295 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12296 exp->instance->_class = MkSpecifierName(_class->fullName);
12297 exp->instance->loc = exp->loc;
12298 exp->type = 1;
12299 Get(value, exp->instance->data);
12300 PopulateInstance(exp->instance);
12301 }
12302 else if(_class->type == 2)
12303 {
12304 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
12305 uint64 bits = Get(value);
12306
12307 exp->constant = PrintHexUInt64(bits);
12308 exp->type = 2;
12309 }
12310 break;
12311 }
12312 }
12313 }
12314 else if(_class->type == 1)
12315 {
12316 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
12317
12318 switch(type->kind)
12319 {
12320 case 8:
12321 {
12322 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
12323
12324 if(_class->type == 1 && value)
12325 {
12326 void (* Get)(void *, void *) = (void *)prop->Get;
12327
12328 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12329 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12330 exp->instance->_class = MkSpecifierName(_class->fullName);
12331 exp->instance->loc = exp->loc;
12332 exp->type = 1;
12333 Get(value, exp->instance->data);
12334 PopulateInstance(exp->instance);
12335 }
12336 break;
12337 }
12338 }
12339 }
12340 }
12341 }
12342 }
12343 else
12344 {
12345 exp->isConstant = 0x0;
12346 }
12347 }
12348 else if(member)
12349 {
12350 }
12351 }
12352 if(exp->type != 8)
12353 {
12354 FreeExpression(memberExp);
12355 FreeIdentifier(memberID);
12356 }
12357 break;
12358 }
12359 case 10:
12360 {
12361 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
12362
12363 FreeExpContents(exp);
12364 exp->constant = PrintUInt(ComputeTypeSize(type));
12365 exp->type = 2;
12366 FreeType(type);
12367 break;
12368 }
12369 case 15:
12370 {
12371 struct Symbol * classSym = exp->_class->symbol;
12372
12373 if(classSym && classSym->registered)
12374 {
12375 if(classSym->registered->fixed)
12376 {
12377 FreeSpecifier(exp->_class);
12378 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
12379 exp->type = 2;
12380 }
12381 else
12382 {
12383 char className[1024];
12384
12385 strcpy(className, "__ecereClass_");
12386 FullClassNameCat(className, classSym->string, 0x1);
12387 MangleClassName(className);
12388 DeclareClass(classSym, className);
12389 FreeExpContents(exp);
12390 exp->type = 9;
12391 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
12392 exp->member.member = MkIdentifier("structSize");
12393 }
12394 }
12395 break;
12396 }
12397 case 11:
12398 {
12399 struct Type * type;
12400 struct Expression * e = exp;
12401
12402 if(exp->type == 11)
12403 {
12404 if(exp->cast.exp)
12405 ComputeExpression(exp->cast.exp);
12406 e = exp->cast.exp;
12407 }
12408 if(e && exp->expType)
12409 {
12410 type = exp->expType;
12411 if(type->kind == 8)
12412 {
12413 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
12414
12415 if(_class && (_class->type == 3 || _class->type == 2))
12416 {
12417 if(!_class->dataType)
12418 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
12419 type = _class->dataType;
12420 }
12421 }
12422 switch(type->kind)
12423 {
12424 case 24:
12425 case 1:
12426 if(type->isSigned)
12427 {
12428 char value = (char)0;
12429
12430 if(GetChar(e, &value))
12431 {
12432 FreeExpContents(exp);
12433 exp->constant = PrintChar(value);
12434 exp->type = 2;
12435 }
12436 }
12437 else
12438 {
12439 unsigned char value = (unsigned char)0;
12440
12441 if(GetUChar(e, &value))
12442 {
12443 FreeExpContents(exp);
12444 exp->constant = PrintUChar(value);
12445 exp->type = 2;
12446 }
12447 }
12448 break;
12449 case 2:
12450 if(type->isSigned)
12451 {
12452 short value = (short)0;
12453
12454 if(GetShort(e, &value))
12455 {
12456 FreeExpContents(exp);
12457 exp->constant = PrintShort(value);
12458 exp->type = 2;
12459 }
12460 }
12461 else
12462 {
12463 unsigned short value = (unsigned short)0;
12464
12465 if(GetUShort(e, &value))
12466 {
12467 FreeExpContents(exp);
12468 exp->constant = PrintUShort(value);
12469 exp->type = 2;
12470 }
12471 }
12472 break;
12473 case 3:
12474 if(type->isSigned)
12475 {
12476 int value = 0;
12477
12478 if(GetInt(e, &value))
12479 {
12480 FreeExpContents(exp);
12481 exp->constant = PrintInt(value);
12482 exp->type = 2;
12483 }
12484 }
12485 else
12486 {
12487 unsigned int value = 0;
12488
12489 if(GetUInt(e, &value))
12490 {
12491 FreeExpContents(exp);
12492 exp->constant = PrintUInt(value);
12493 exp->type = 2;
12494 }
12495 }
12496 break;
12497 case 4:
12498 if(type->isSigned)
12499 {
12500 long long value = 0;
12501
12502 if(GetInt64(e, &value))
12503 {
12504 FreeExpContents(exp);
12505 exp->constant = PrintInt64(value);
12506 exp->type = 2;
12507 }
12508 }
12509 else
12510 {
12511 uint64 value = 0;
12512
12513 if(GetUInt64(e, &value))
12514 {
12515 FreeExpContents(exp);
12516 exp->constant = PrintUInt64(value);
12517 exp->type = 2;
12518 }
12519 }
12520 break;
12521 case 22:
12522 if(type->isSigned)
12523 {
12524 intptr_t value = 0;
12525
12526 if(GetIntPtr(e, &value))
12527 {
12528 FreeExpContents(exp);
12529 exp->constant = PrintInt64((long long)value);
12530 exp->type = 2;
12531 }
12532 }
12533 else
12534 {
12535 uintptr_t value = 0;
12536
12537 if(GetUIntPtr(e, &value))
12538 {
12539 FreeExpContents(exp);
12540 exp->constant = PrintUInt64((uint64)value);
12541 exp->type = 2;
12542 }
12543 }
12544 break;
12545 case 23:
12546 if(type->isSigned)
12547 {
12548 ssize_t value = 0;
12549
12550 if(GetIntSize(e, &value))
12551 {
12552 FreeExpContents(exp);
12553 exp->constant = PrintInt64((long long)value);
12554 exp->type = 2;
12555 }
12556 }
12557 else
12558 {
12559 size_t value = 0;
12560
12561 if(GetUIntSize(e, &value))
12562 {
12563 FreeExpContents(exp);
12564 exp->constant = PrintUInt64((uint64)value);
12565 exp->type = 2;
12566 }
12567 }
12568 break;
12569 case 6:
12570 {
12571 float value = 0;
12572
12573 if(GetFloat(e, &value))
12574 {
12575 FreeExpContents(exp);
12576 exp->constant = PrintFloat(value);
12577 exp->type = 2;
12578 }
12579 break;
12580 }
12581 case 7:
12582 {
12583 double value = 0;
12584
12585 if(GetDouble(e, &value))
12586 {
12587 FreeExpContents(exp);
12588 exp->constant = PrintDouble(value);
12589 exp->type = 2;
12590 }
12591 break;
12592 }
12593 }
12594 }
12595 break;
12596 }
12597 case 12:
12598 {
12599 struct Operand op1 =
12600 {
12601 0, 0, 0, .c = 0,
12602 {
12603 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
12604 }
12605 };
12606 struct Operand op2 =
12607 {
12608 0, 0, 0, .c = 0,
12609 {
12610 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
12611 }
12612 };
12613 struct Operand op3 =
12614 {
12615 0, 0, 0, .c = 0,
12616 {
12617 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
12618 }
12619 };
12620
12621 if(exp->cond.exp)
12622 ComputeExpression((*exp->cond.exp).last);
12623 if(exp->cond.elseExp)
12624 ComputeExpression(exp->cond.elseExp);
12625 if(exp->cond.cond)
12626 ComputeExpression(exp->cond.cond);
12627 op1 = GetOperand(exp->cond.cond);
12628 if(op1.type)
12629 op1.type->refCount++;
12630 op2 = GetOperand((*exp->cond.exp).last);
12631 if(op2.type)
12632 op2.type->refCount++;
12633 op3 = GetOperand(exp->cond.elseExp);
12634 if(op3.type)
12635 op3.type->refCount++;
12636 if(op1.ops.Cond)
12637 {
12638 FreeExpContents(exp);
12639 op1.ops.Cond(exp, &op1, &op2, &op3);
12640 }
12641 if(op1.type)
12642 FreeType(op1.type);
12643 if(op2.type)
12644 FreeType(op2.type);
12645 if(op3.type)
12646 FreeType(op3.type);
12647 break;
12648 }
12649 }
12650 }
12651
12652 void ApplyAnyObjectLogic(struct Expression * e);
12653
12654 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla, unsigned int warnConst)
12655 {
12656 unsigned int result = 0x1;
12657
12658 if(destType)
12659 {
12660 struct __ecereNameSpace__ecere__sys__OldList converts =
12661 {
12662 0, 0, 0, 0, 0
12663 };
12664 struct Conversion * convert;
12665
12666 if(destType->kind == 0)
12667 return 0x0;
12668 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla, warnConst))
12669 result = 0x0;
12670 if(converts.count)
12671 {
12672 for(convert = converts.first; convert; convert = convert->next)
12673 {
12674 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
12675
12676 if(!empty)
12677 {
12678 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12679 int objectType = exp->expType ? exp->expType->classObjectType : 0;
12680
12681 *newExp = *exp;
12682 newExp->prev = (((void *)0));
12683 newExp->next = (((void *)0));
12684 newExp->destType = (((void *)0));
12685 if(convert->isGet)
12686 {
12687 exp->type = 8;
12688 exp->addedThis = 0x1;
12689 exp->member.exp = newExp;
12690 FreeType(exp->member.exp->expType);
12691 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
12692 exp->member.exp->expType->classObjectType = objectType;
12693 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
12694 exp->member.memberType = 1;
12695 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
12696 exp->needCast = 0x1;
12697 if(exp->expType)
12698 exp->expType->refCount++;
12699 ApplyAnyObjectLogic(exp->member.exp);
12700 }
12701 else
12702 {
12703 {
12704 exp->type = 8;
12705 exp->addedThis = 0x1;
12706 exp->member.exp = newExp;
12707 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
12708 {
12709 newExp->byReference = 0x1;
12710 }
12711 FreeType(exp->member.exp->expType);
12712 exp->member.exp->expType = (((void *)0));
12713 if(convert->convert->dataType)
12714 {
12715 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12716 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
12717 exp->member.exp->expType->refCount = 1;
12718 exp->member.exp->expType->classObjectType = objectType;
12719 ApplyAnyObjectLogic(exp->member.exp);
12720 }
12721 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
12722 exp->member.memberType = 4;
12723 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
12724 exp->needCast = 0x1;
12725 if(convert->resultType)
12726 convert->resultType->refCount++;
12727 }
12728 }
12729 }
12730 else
12731 {
12732 FreeType(exp->expType);
12733 if(convert->isGet)
12734 {
12735 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
12736 exp->needCast = 0x1;
12737 if(exp->expType)
12738 exp->expType->refCount++;
12739 }
12740 else
12741 {
12742 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
12743 exp->needCast = 0x1;
12744 if(convert->resultType)
12745 convert->resultType->refCount++;
12746 }
12747 }
12748 }
12749 if(exp->isConstant && inCompiler)
12750 ComputeExpression(exp);
12751 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
12752 }
12753 if(!result && exp->expType && converts.count)
12754 {
12755 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0, warnConst);
12756 }
12757 if(!result && exp->expType && exp->destType)
12758 {
12759 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))
12760 result = 0x1;
12761 }
12762 }
12763 return result;
12764 }
12765
12766 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
12767
12768 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
12769
12770 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
12771
12772 void CheckTemplateTypes(struct Expression * exp)
12773 {
12774 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
12775 {
12776 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12777 struct Context * context;
12778
12779 *newExp = *exp;
12780 if(exp->destType)
12781 exp->destType->refCount++;
12782 if(exp->expType)
12783 exp->expType->refCount++;
12784 newExp->prev = (((void *)0));
12785 newExp->next = (((void *)0));
12786 switch(exp->expType->kind)
12787 {
12788 case 7:
12789 if(exp->destType->classObjectType)
12790 {
12791 if(exp->destType)
12792 exp->destType->refCount--;
12793 if(exp->expType)
12794 exp->expType->refCount--;
12795 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12796 }
12797 else
12798 {
12799 struct __ecereNameSpace__ecere__sys__OldList * specs;
12800 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
12801 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
12802
12803 context = PushContext();
12804 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
12805 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
12806 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
12807 exp->type = 23;
12808 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
12809 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
12810 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
12811 exp->compound->compound.context = context;
12812 PopContext(context);
12813 }
12814 break;
12815 default:
12816 exp->type = 11;
12817 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
12818 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
12819 break;
12820 }
12821 }
12822 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
12823 {
12824 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12825 struct Statement * compound;
12826 struct Context * context;
12827
12828 *newExp = *exp;
12829 if(exp->destType)
12830 exp->destType->refCount++;
12831 if(exp->expType)
12832 exp->expType->refCount++;
12833 newExp->prev = (((void *)0));
12834 newExp->next = (((void *)0));
12835 switch(exp->expType->kind)
12836 {
12837 case 7:
12838 if(exp->destType->classObjectType)
12839 {
12840 if(exp->destType)
12841 exp->destType->refCount--;
12842 if(exp->expType)
12843 exp->expType->refCount--;
12844 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12845 }
12846 else
12847 {
12848 struct __ecereNameSpace__ecere__sys__OldList * specs;
12849 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
12850 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
12851
12852 context = PushContext();
12853 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
12854 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
12855 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
12856 exp->type = 23;
12857 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
12858 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
12859 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
12860 exp->compound->compound.context = context;
12861 PopContext(context);
12862 }
12863 break;
12864 case 8:
12865 {
12866 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
12867 {
12868 exp->type = 5;
12869 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
12870 ProcessExpressionType((*exp->list).first);
12871 break;
12872 }
12873 else
12874 {
12875 exp->type = 5;
12876 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
12877 newExp->needCast = 0x1;
12878 ProcessExpressionType((*exp->list).first);
12879 break;
12880 }
12881 }
12882 default:
12883 {
12884 if(exp->expType->kind == 20)
12885 {
12886 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
12887
12888 if(type)
12889 {
12890 FreeType(exp->destType);
12891 FreeType(exp->expType);
12892 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12893 break;
12894 }
12895 }
12896 if(newExp->type == 8 && newExp->member.memberType == 3)
12897 {
12898 exp->type = 4;
12899 exp->op.op = '*';
12900 exp->op.exp1 = (((void *)0));
12901 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
12902 }
12903 else
12904 {
12905 char typeString[1024];
12906 struct Declarator * decl;
12907 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12908
12909 typeString[0] = '\0';
12910 PrintType(exp->expType, typeString, 0x0, 0x0);
12911 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12912 exp->type = 11;
12913 exp->cast.typeName = MkTypeName(specs, decl);
12914 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
12915 exp->cast.exp->needCast = 0x1;
12916 }
12917 break;
12918 }
12919 }
12920 }
12921 }
12922
12923 extern int strncmp(const char * , const char * , size_t n);
12924
12925 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, const char *  key);
12926
12927 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, const char * nameSpace, const char * name)
12928 {
12929 int nsLen = strlen(nameSpace);
12930 struct Symbol * symbol;
12931
12932 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)))
12933 {
12934 char * s = symbol->string;
12935
12936 if(!strncmp(s, nameSpace, nsLen))
12937 {
12938 int c;
12939 char * namePart;
12940
12941 for(c = strlen(s) - 1; c >= 0; c--)
12942 if(s[c] == ':')
12943 break;
12944 namePart = s + c + 1;
12945 if(!strcmp(namePart, name))
12946 {
12947 return symbol;
12948 }
12949 }
12950 else
12951 break;
12952 }
12953 return (((void *)0));
12954 }
12955
12956 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, const char * name)
12957 {
12958 int c;
12959 char nameSpace[1024];
12960 const char * namePart;
12961 unsigned int gotColon = 0x0;
12962
12963 nameSpace[0] = '\0';
12964 for(c = strlen(name) - 1; c >= 0; c--)
12965 if(name[c] == ':')
12966 {
12967 gotColon = 0x1;
12968 break;
12969 }
12970 namePart = name + c + 1;
12971 while(c >= 0 && name[c] == ':')
12972 c--;
12973 if(c >= 0)
12974 {
12975 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
12976
12977 if(symbol)
12978 return symbol;
12979 memcpy(nameSpace, name, c + 1);
12980 nameSpace[c + 1] = (char)0;
12981 return ScanWithNameSpace(tree, nameSpace, namePart);
12982 }
12983 else if(gotColon)
12984 {
12985 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
12986
12987 return symbol;
12988 }
12989 else
12990 {
12991 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
12992
12993 if(symbol)
12994 return symbol;
12995 return ScanWithNameSpace(tree, "", namePart);
12996 }
12997 return (((void *)0));
12998 }
12999
13000 static void ProcessDeclaration(struct Declaration * decl);
13001
13002 struct Symbol * FindSymbol(const char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
13003 {
13004 struct Context * ctx;
13005 struct Symbol * symbol = (((void *)0));
13006
13007 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
13008 {
13009 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
13010 {
13011 symbol = (((void *)0));
13012 if(thisNameSpace)
13013 {
13014 char curName[1024];
13015
13016 strcpy(curName, thisNameSpace);
13017 strcat(curName, "::");
13018 strcat(curName, name);
13019 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
13020 }
13021 if(!symbol)
13022 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
13023 }
13024 else
13025 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
13026 if(symbol || ctx == endContext)
13027 break;
13028 }
13029 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
13030 {
13031 if(symbol->pointerExternal->type == 0)
13032 {
13033 struct FunctionDefinition * function = symbol->pointerExternal->function;
13034 struct Context * tmpContext = curContext;
13035
13036 curContext = (((void *)0));
13037 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
13038 curContext = tmpContext;
13039 symbol->pointerExternal->symbol = symbol;
13040 DeclareType(symbol->type, 0x1, 0x1);
13041 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
13042 symbol->id = curExternal->symbol->idCode;
13043 }
13044 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
13045 {
13046 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
13047 symbol->id = curExternal->symbol->idCode;
13048 }
13049 }
13050 return symbol;
13051 }
13052
13053 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
13054 {
13055 if(!type->isSigned && type->kind != 22 && type->kind != 23)
13056 ListAdd(specs, MkSpecifier(UNSIGNED));
13057 switch(type->kind)
13058 {
13059 case 8:
13060 {
13061 if(type->_class->registered)
13062 {
13063 if(!type->_class->registered->dataType)
13064 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
13065 GetTypeSpecs(type->_class->registered->dataType, specs);
13066 }
13067 break;
13068 }
13069 case 7:
13070 ListAdd(specs, MkSpecifier(DOUBLE));
13071 break;
13072 case 6:
13073 ListAdd(specs, MkSpecifier(FLOAT));
13074 break;
13075 case 1:
13076 ListAdd(specs, MkSpecifier(CHAR));
13077 break;
13078 case 24:
13079 ListAdd(specs, MkSpecifier(_BOOL));
13080 break;
13081 case 2:
13082 ListAdd(specs, MkSpecifier(SHORT));
13083 break;
13084 case 4:
13085 ListAdd(specs, MkSpecifier(INT64));
13086 break;
13087 case 22:
13088 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
13089 break;
13090 case 23:
13091 ListAdd(specs, MkSpecifierName(type->isSigned ? "intsize" : "uintsize"));
13092 break;
13093 case 3:
13094 default:
13095 ListAdd(specs, MkSpecifier(INT));
13096 break;
13097 }
13098 }
13099
13100 static void PrintArraySize(struct Type * arrayType, char * string)
13101 {
13102 char size[256];
13103
13104 size[0] = '\0';
13105 strcat(size, "[");
13106 if(arrayType->enumClass)
13107 strcat(size, arrayType->enumClass->string);
13108 else if(arrayType->arraySizeExp)
13109 PrintExpression(arrayType->arraySizeExp, size);
13110 strcat(size, "]");
13111 strcat(string, size);
13112 }
13113
13114 static void PrintTypeSpecs(struct Type * type, char * string, unsigned int fullName, unsigned int printConst)
13115 {
13116 if(type)
13117 {
13118 if(printConst && type->constant)
13119 strcat(string, "const ");
13120 switch(type->kind)
13121 {
13122 case 8:
13123 {
13124 struct Symbol * c = type->_class;
13125
13126 if(type->classObjectType == 2)
13127 strcat(string, "typed_object");
13128 else if(type->classObjectType == 3)
13129 strcat(string, "any_object");
13130 else
13131 {
13132 if(c && c->string)
13133 strcat(string, (fullName || !c->registered) ? c->string : c->registered->name);
13134 }
13135 if(type->byReference)
13136 strcat(string, " &");
13137 break;
13138 }
13139 case 0:
13140 strcat(string, "void");
13141 break;
13142 case 3:
13143 strcat(string, type->isSigned ? "int" : "uint");
13144 break;
13145 case 4:
13146 strcat(string, type->isSigned ? "int64" : "uint64");
13147 break;
13148 case 22:
13149 strcat(string, type->isSigned ? "intptr" : "uintptr");
13150 break;
13151 case 23:
13152 strcat(string, type->isSigned ? "intsize" : "uintsize");
13153 break;
13154 case 1:
13155 strcat(string, type->isSigned ? "char" : "byte");
13156 break;
13157 case 24:
13158 strcat(string, "_Bool");
13159 break;
13160 case 2:
13161 strcat(string, type->isSigned ? "short" : "uint16");
13162 break;
13163 case 6:
13164 strcat(string, "float");
13165 break;
13166 case 7:
13167 strcat(string, "double");
13168 break;
13169 case 9:
13170 if(type->enumName)
13171 {
13172 strcat(string, "struct ");
13173 strcat(string, type->enumName);
13174 }
13175 else if(type->typeName)
13176 strcat(string, type->typeName);
13177 else
13178 {
13179 struct Type * member;
13180
13181 strcat(string, "struct { ");
13182 for(member = type->members.first; member; member = member->next)
13183 {
13184 PrintType(member, string, 0x1, fullName);
13185 strcat(string, "; ");
13186 }
13187 strcat(string, "}");
13188 }
13189 break;
13190 case 10:
13191 if(type->enumName)
13192 {
13193 strcat(string, "union ");
13194 strcat(string, type->enumName);
13195 }
13196 else if(type->typeName)
13197 strcat(string, type->typeName);
13198 else
13199 {
13200 strcat(string, "union ");
13201 strcat(string, "(unnamed)");
13202 }
13203 break;
13204 case 15:
13205 if(type->enumName)
13206 {
13207 strcat(string, "enum ");
13208 strcat(string, type->enumName);
13209 }
13210 else if(type->typeName)
13211 strcat(string, type->typeName);
13212 else
13213 strcat(string, "int");
13214 break;
13215 case 14:
13216 strcat(string, "...");
13217 break;
13218 case 19:
13219 strcat(string, "subclass(");
13220 strcat(string, type->_class ? type->_class->string : "int");
13221 strcat(string, ")");
13222 break;
13223 case 20:
13224 strcat(string, type->templateParameter->identifier->string);
13225 break;
13226 case 21:
13227 strcat(string, "thisclass");
13228 break;
13229 case 17:
13230 strcat(string, "__builtin_va_list");
13231 break;
13232 }
13233 }
13234 }
13235
13236 extern char *  __ecereNameSpace__ecere__sys__RSearchString(const char *  buffer, const char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
13237
13238 static void PrintName(struct Type * type, char * string, unsigned int fullName)
13239 {
13240 if(type->name && type->name[0])
13241 {
13242 if(fullName)
13243 strcat(string, type->name);
13244 else
13245 {
13246 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
13247
13248 if(name)
13249 name += 2;
13250 else
13251 name = type->name;
13252 strcat(string, name);
13253 }
13254 }
13255 }
13256
13257 static void PrintAttribs(struct Type * type, char * string)
13258 {
13259 if(type)
13260 {
13261 if(type->dllExport)
13262 strcat(string, "dllexport ");
13263 if(type->attrStdcall)
13264 strcat(string, "stdcall ");
13265 }
13266 }
13267
13268 static void PrePrintType(struct Type * type, char * string, unsigned int fullName, struct Type * parentType, unsigned int printConst)
13269 {
13270 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
13271 {
13272 struct Type * attrType = (((void *)0));
13273
13274 if((type->kind == 11 || type->kind == 16) && (!parentType || parentType->kind != 13))
13275 PrintAttribs(type, string);
13276 if(printConst && type->constant && (type->kind == 11 || type->kind == 16))
13277 strcat(string, " const");
13278 PrePrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName, type, printConst);
13279 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
13280 strcat(string, " (");
13281 if(type->kind == 13)
13282 {
13283 if(type->type->kind == 11 || type->type->kind == 16)
13284 PrintAttribs(type->type, string);
13285 }
13286 if(type->kind == 13)
13287 {
13288 if(type->type->kind == 11 || type->type->kind == 16 || type->type->kind == 12)
13289 strcat(string, "*");
13290 else
13291 strcat(string, " *");
13292 }
13293 if(printConst && type->constant && type->kind == 13)
13294 strcat(string, " const");
13295 }
13296 else
13297 PrintTypeSpecs(type, string, fullName, printConst);
13298 }
13299
13300 static void PostPrintType(struct Type * type, char * string, unsigned int fullName)
13301 {
13302 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
13303 strcat(string, ")");
13304 if(type->kind == 12)
13305 PrintArraySize(type, string);
13306 else if(type->kind == 11)
13307 {
13308 struct Type * param;
13309
13310 strcat(string, "(");
13311 for(param = type->params.first; param; param = param->next)
13312 {
13313 PrintType(param, string, 0x1, fullName);
13314 if(param->next)
13315 strcat(string, ", ");
13316 }
13317 strcat(string, ")");
13318 }
13319 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
13320 PostPrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName);
13321 }
13322
13323 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName, unsigned int printConst)
13324 {
13325 PrePrintType(type, string, fullName, (((void *)0)), printConst);
13326 if(type->thisClass || (printName && type->name && type->name[0]))
13327 strcat(string, " ");
13328 if((type->thisClass || type->staticMethod))
13329 {
13330 struct Symbol * _class = type->thisClass;
13331
13332 if((type->classObjectType == 2 || type->classObjectType == 1) || (_class && !strcmp(_class->string, "class")))
13333 {
13334 if(type->classObjectType == 1)
13335 strcat(string, "class");
13336 else
13337 strcat(string, type->byReference ? "typed_object&" : "typed_object");
13338 }
13339 else if(_class && _class->string)
13340 {
13341 char * s = _class->string;
13342
13343 if(fullName)
13344 strcat(string, s);
13345 else
13346 {
13347 char * name = __ecereNameSpace__ecere__sys__RSearchString(s, "::", strlen(s), 0x1, 0x0);
13348
13349 if(name)
13350 name += 2;
13351 else
13352 name = s;
13353 strcat(string, name);
13354 }
13355 }
13356 strcat(string, "::");
13357 }
13358 if(printName && type->name)
13359 PrintName(type, string, fullName);
13360 PostPrintType(type, string, fullName);
13361 if(type->bitFieldCount)
13362 {
13363 char count[100];
13364
13365 sprintf(count, ":%d", type->bitFieldCount);
13366 strcat(string, count);
13367 }
13368 }
13369
13370 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
13371 {
13372 _PrintType(type, string, printName, fullName, 0x1);
13373 }
13374
13375 void PrintTypeNoConst(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
13376 {
13377 _PrintType(type, string, printName, fullName, 0x0);
13378 }
13379
13380 static struct Type * FindMember(struct Type * type, char * string)
13381 {
13382 struct Type * memberType;
13383
13384 for(memberType = type->members.first; memberType; memberType = memberType->next)
13385 {
13386 if(!memberType->name)
13387 {
13388 struct Type * subType = FindMember(memberType, string);
13389
13390 if(subType)
13391 return subType;
13392 }
13393 else if(!strcmp(memberType->name, string))
13394 return memberType;
13395 }
13396 return (((void *)0));
13397 }
13398
13399 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
13400 {
13401 struct Type * memberType;
13402
13403 for(memberType = type->members.first; memberType; memberType = memberType->next)
13404 {
13405 if(!memberType->name)
13406 {
13407 struct Type * subType = FindMember(memberType, string);
13408
13409 if(subType)
13410 {
13411 *offset += memberType->offset;
13412 return subType;
13413 }
13414 }
13415 else if(!strcmp(memberType->name, string))
13416 {
13417 *offset += memberType->offset;
13418 return memberType;
13419 }
13420 }
13421 return (((void *)0));
13422 }
13423
13424 extern unsigned int parseError;
13425
13426 unsigned int GetParseError()
13427 {
13428 return parseError;
13429 }
13430
13431 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
13432
13433 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
13434
13435 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__File;
13436
13437 struct Expression * ParseExpressionString(char * expression)
13438 {
13439 parseError = 0x0;
13440 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
13441 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, const void *  buffer, unsigned int size, unsigned int count))__extension__ ({
13442 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
13443
13444 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
13445 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, expression, 1, strlen(expression));
13446 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
13447 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
13448
13449 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
13450 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
13451 echoOn = 0x0;
13452 parsedExpression = (((void *)0));
13453 resetScanner();
13454 expression_yyparse();
13455 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
13456 return parsedExpression;
13457 }
13458
13459 extern char *  QMkString(const char *  source);
13460
13461 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
13462 {
13463 struct Identifier * id = exp->identifier;
13464 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
13465 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
13466 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
13467 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
13468
13469 if(_class && _class->type == 4)
13470 {
13471 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
13472 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
13473
13474 if(enumClass)
13475 {
13476 struct __ecereNameSpace__ecere__com__Class * baseClass;
13477
13478 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
13479 {
13480 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
13481
13482 for(value = e->values.first; value; value = value->next)
13483 {
13484 if(!strcmp(value->name, id->string))
13485 break;
13486 }
13487 if(value)
13488 {
13489 char constant[256];
13490
13491 FreeExpContents(exp);
13492 exp->type = 2;
13493 exp->isConstant = 0x1;
13494 if(!strcmp(baseClass->dataTypeString, "int"))
13495 sprintf(constant, "%d", (int)value->data);
13496 else
13497 sprintf(constant, "0x%X", (int)value->data);
13498 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
13499 exp->expType = MkClassType(baseClass->fullName);
13500 break;
13501 }
13502 }
13503 }
13504 if(value)
13505 return 0x1;
13506 }
13507 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
13508 {
13509 ProcessMethodType(method);
13510 exp->expType = __extension__ ({
13511 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13512
13513 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), __ecereInstance1;
13514 });
13515 return 0x1;
13516 }
13517 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
13518 {
13519 if(!prop->dataType)
13520 ProcessPropertyType(prop);
13521 exp->expType = prop->dataType;
13522 if(prop->dataType)
13523 prop->dataType->refCount++;
13524 return 0x1;
13525 }
13526 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
13527 {
13528 if(!member->dataType)
13529 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
13530 exp->expType = member->dataType;
13531 if(member->dataType)
13532 member->dataType->refCount++;
13533 return 0x1;
13534 }
13535 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
13536 {
13537 if(!classProp->dataType)
13538 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
13539 if(classProp->constant)
13540 {
13541 FreeExpContents(exp);
13542 exp->isConstant = 0x1;
13543 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
13544 {
13545 exp->type = 3;
13546 exp->constant = QMkString((char *)classProp->Get(_class));
13547 }
13548 else
13549 {
13550 char constant[256];
13551
13552 exp->type = 2;
13553 sprintf(constant, "%d", (int)classProp->Get(_class));
13554 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
13555 }
13556 }
13557 else
13558 {
13559 }
13560 exp->expType = classProp->dataType;
13561 if(classProp->dataType)
13562 classProp->dataType->refCount++;
13563 return 0x1;
13564 }
13565 return 0x0;
13566 }
13567
13568 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
13569 {
13570 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
13571 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
13572 struct __ecereNameSpace__ecere__com__NameSpace * child;
13573
13574 if(!data)
13575 {
13576 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)))
13577 {
13578 data = ScanGlobalData(child, name);
13579 if(data)
13580 break;
13581 }
13582 }
13583 return data;
13584 }
13585
13586 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
13587
13588 extern char *  strncpy(char * , const char * , size_t n);
13589
13590 static struct GlobalData * FindGlobalData(char * name)
13591 {
13592 int start = 0, c;
13593 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
13594
13595 nameSpace = globalData;
13596 for(c = 0; name[c]; c++)
13597 {
13598 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
13599 {
13600 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
13601 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
13602
13603 strncpy(spaceName, name + start, c - start);
13604 spaceName[c - start] = '\0';
13605 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
13606 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
13607 if(!newSpace)
13608 return (((void *)0));
13609 nameSpace = newSpace;
13610 if(name[c] == ':')
13611 c++;
13612 start = c + 1;
13613 }
13614 }
13615 if(c - start)
13616 {
13617 return ScanGlobalData(nameSpace, name + start);
13618 }
13619 return (((void *)0));
13620 }
13621
13622 static int definedExpStackPos;
13623
13624 static void * definedExpStack[512];
13625
13626 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
13627 {
13628 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
13629
13630 FreeExpContents(checkedExp);
13631 FreeType(checkedExp->expType);
13632 FreeType(checkedExp->destType);
13633 *checkedExp = *newExp;
13634 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
13635 checkedExp->prev = prev;
13636 checkedExp->next = next;
13637 }
13638
13639 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
13640
13641 extern int printf(const char * , ...);
13642
13643 void __ecereMethod_Expression_Clear();
13644
13645 void ApplyAnyObjectLogic(struct Expression * e)
13646 {
13647 struct Type * destType = e->destType;
13648
13649 if(destType && (destType->classObjectType == 3))
13650 {
13651 if(e && e->expType)
13652 {
13653 struct Type * type = e->expType;
13654 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
13655
13656 if(type->kind == 8 && type->_class && type->_class->registered)
13657 {
13658 _class = type->_class->registered;
13659 }
13660 else if(type->kind == 19)
13661 {
13662 _class = FindClass("ecere::com::Class")->registered;
13663 }
13664 else
13665 {
13666 char string[1024] = "";
13667 struct Symbol * classSym;
13668
13669 PrintTypeNoConst(type, string, 0x0, 0x1);
13670 classSym = FindClass(string);
13671 if(classSym)
13672 _class = classSym->registered;
13673 }
13674 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)))
13675 {
13676 if(!_class || strcmp(_class->fullName, "char *"))
13677 {
13678 struct Expression * checkedExp = e, * newExp;
13679
13680 while(((checkedExp->type == 5 || checkedExp->type == 32 || checkedExp->type == 23) && checkedExp->list) || checkedExp->type == 11)
13681 {
13682 if(checkedExp->type == 5 || checkedExp->type == 32 || checkedExp->type == 23)
13683 {
13684 if(checkedExp->type == 23)
13685 {
13686 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
13687 }
13688 else
13689 checkedExp = (*checkedExp->list).last;
13690 }
13691 else if(checkedExp->type == 11)
13692 checkedExp = checkedExp->cast.exp;
13693 }
13694 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
13695 {
13696 newExp = checkedExp->op.exp2;
13697 checkedExp->op.exp2 = (((void *)0));
13698 FreeExpContents(checkedExp);
13699 if(e->expType && e->expType->passAsTemplate)
13700 {
13701 char size[100];
13702
13703 ComputeTypeSize(e->expType);
13704 sprintf(size, "%d", e->expType->size);
13705 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))))));
13706 }
13707 ReplaceExpContents(checkedExp, newExp);
13708 e->byReference = 0x1;
13709 }
13710 else if(!e->byReference || (_class && _class->type == 5))
13711 {
13712 struct Expression * checkedExp;
13713
13714 {
13715 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;
13716
13717 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
13718 {
13719 struct Context * context = PushContext();
13720 struct Declarator * decl;
13721 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13722 char typeString[1024];
13723 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13724
13725 typeString[0] = '\0';
13726 *newExp = *e;
13727 newExp->prev = (((void *)0));
13728 newExp->next = (((void *)0));
13729 newExp->expType = (((void *)0));
13730 PrintTypeNoConst(e->expType, typeString, 0x0, 0x1);
13731 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13732 newExp->destType = ProcessType(specs, decl);
13733 curContext = context;
13734 if(curCompound)
13735 {
13736 char name[100];
13737 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
13738
13739 e->type = 23;
13740 sprintf(name, "__internalValue%03X", internalValueCounter++);
13741 if(!curCompound->compound.declarations)
13742 curCompound->compound.declarations = MkList();
13743 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
13744 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
13745 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
13746 e->compound = MkCompoundStmt((((void *)0)), stmts);
13747 }
13748 else
13749 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
13750 {
13751 struct Type * type = e->destType;
13752
13753 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13754 CopyTypeInto(e->destType, type);
13755 e->destType->refCount = 1;
13756 e->destType->classObjectType = 0;
13757 FreeType(type);
13758 }
13759 e->compound->compound.context = context;
13760 PopContext(context);
13761 curContext = context->parent;
13762 }
13763 }
13764 checkedExp = e;
13765 while(((checkedExp->type == 5 || checkedExp->type == 32 || checkedExp->type == 23) && checkedExp->list) || checkedExp->type == 11)
13766 {
13767 if(checkedExp->type == 5 || checkedExp->type == 32 || checkedExp->type == 23)
13768 {
13769 if(checkedExp->type == 23)
13770 {
13771 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
13772 }
13773 else
13774 checkedExp = (*checkedExp->list).last;
13775 }
13776 else if(checkedExp->type == 11)
13777 checkedExp = checkedExp->cast.exp;
13778 }
13779 {
13780 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13781
13782 *operand = *checkedExp;
13783 checkedExp->destType = (((void *)0));
13784 checkedExp->expType = (((void *)0));
13785 __ecereMethod_Expression_Clear(checkedExp);
13786 checkedExp->type = 4;
13787 checkedExp->op.op = '&';
13788 checkedExp->op.exp1 = (((void *)0));
13789 checkedExp->op.exp2 = operand;
13790 }
13791 }
13792 }
13793 }
13794 }
13795 }
13796 {
13797 }
13798 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))))
13799 {
13800 if(e->expType->classObjectType && destType && destType->classObjectType)
13801 {
13802 return ;
13803 }
13804 else
13805 {
13806 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13807
13808 *thisExp = *e;
13809 thisExp->prev = (((void *)0));
13810 thisExp->next = (((void *)0));
13811 __ecereMethod_Expression_Clear(e);
13812 e->type = 5;
13813 e->list = MkListOne(MkExpOp((((void *)0)), '*', thisExp->type == 0 ? thisExp : MkExpBrackets(MkListOne(thisExp))));
13814 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
13815 ((struct Expression *)(*e->list).first)->byReference = 0x1;
13816 {
13817 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13818 CopyTypeInto(e->expType, thisExp->expType);
13819 e->expType->byReference = 0x0;
13820 e->expType->refCount = 1;
13821 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))
13822 {
13823 e->expType->classObjectType = 0;
13824 }
13825 }
13826 }
13827 }
13828 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
13829 {
13830 if(destType->kind == 14)
13831 {
13832 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Unspecified type\n", (((void *)0))));
13833 }
13834 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
13835 {
13836 unsigned int byReference = e->expType->byReference;
13837 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13838 struct Declarator * decl;
13839 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13840 char typeString[1024];
13841 struct Type * type;
13842 int backupClassObjectType;
13843 unsigned int backupByReference;
13844
13845 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
13846 type = e->expType;
13847 else
13848 type = destType;
13849 backupClassObjectType = type->classObjectType;
13850 backupByReference = type->byReference;
13851 type->classObjectType = 0;
13852 type->byReference = 0x0;
13853 typeString[0] = '\0';
13854 PrintType(type, typeString, 0x0, 0x1);
13855 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13856 type->classObjectType = backupClassObjectType;
13857 type->byReference = backupByReference;
13858 *thisExp = *e;
13859 thisExp->prev = (((void *)0));
13860 thisExp->next = (((void *)0));
13861 __ecereMethod_Expression_Clear(e);
13862 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)))
13863 {
13864 e->type = 4;
13865 e->op.op = '*';
13866 e->op.exp1 = (((void *)0));
13867 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
13868 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13869 CopyTypeInto(e->expType, type);
13870 e->expType->byReference = 0x0;
13871 e->expType->refCount = 1;
13872 }
13873 else
13874 {
13875 e->type = 11;
13876 e->cast.typeName = MkTypeName(specs, decl);
13877 e->cast.exp = thisExp;
13878 e->byReference = 0x1;
13879 e->expType = type;
13880 type->refCount++;
13881 }
13882 e->destType = destType;
13883 destType->refCount++;
13884 }
13885 }
13886 }
13887
13888 void ApplyLocation(struct Expression * exp, struct Location * loc)
13889 {
13890 exp->loc = *loc;
13891 switch(exp->type)
13892 {
13893 case 4:
13894 if(exp->op.exp1)
13895 ApplyLocation(exp->op.exp1, loc);
13896 if(exp->op.exp2)
13897 ApplyLocation(exp->op.exp2, loc);
13898 break;
13899 case 5:
13900 if(exp->list)
13901 {
13902 struct Expression * e;
13903
13904 for(e = (*exp->list).first; e; e = e->next)
13905 ApplyLocation(e, loc);
13906 }
13907 break;
13908 case 6:
13909 if(exp->index.index)
13910 {
13911 struct Expression * e;
13912
13913 for(e = (*exp->index.index).first; e; e = e->next)
13914 ApplyLocation(e, loc);
13915 }
13916 if(exp->index.exp)
13917 ApplyLocation(exp->index.exp, loc);
13918 break;
13919 case 7:
13920 if(exp->call.arguments)
13921 {
13922 struct Expression * arg;
13923
13924 for(arg = (*exp->call.arguments).first; arg; arg = arg->next)
13925 ApplyLocation(arg, loc);
13926 }
13927 if(exp->call.exp)
13928 ApplyLocation(exp->call.exp, loc);
13929 break;
13930 case 8:
13931 case 9:
13932 if(exp->member.exp)
13933 ApplyLocation(exp->member.exp, loc);
13934 break;
13935 case 11:
13936 if(exp->cast.exp)
13937 ApplyLocation(exp->cast.exp, loc);
13938 break;
13939 case 12:
13940 if(exp->cond.exp)
13941 {
13942 struct Expression * e;
13943
13944 for(e = (*exp->cond.exp).first; e; e = e->next)
13945 ApplyLocation(e, loc);
13946 }
13947 if(exp->cond.cond)
13948 ApplyLocation(exp->cond.cond, loc);
13949 if(exp->cond.elseExp)
13950 ApplyLocation(exp->cond.elseExp, loc);
13951 break;
13952 case 34:
13953 if(exp->vaArg.exp)
13954 ApplyLocation(exp->vaArg.exp, loc);
13955 break;
13956 default:
13957 break;
13958 }
13959 }
13960
13961 extern char *  strstr(const char * , const char * );
13962
13963 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
13964
13965 struct __ecereNameSpace__ecere__com__DefinedExpression
13966 {
13967 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
13968 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
13969 const char *  name;
13970 const char *  value;
13971 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
13972 } __attribute__ ((gcc_struct));
13973
13974 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, const char *  name);
13975
13976 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, const char *  name);
13977
13978 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(const char *  string, int *  numBytes);
13979
13980 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
13981
13982 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
13983
13984 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
13985
13986 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
13987
13988 static void ProcessStatement(struct Statement * stmt);
13989
13990 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
13991
13992 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
13993
13994 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, const void * object, ...);
13995
13996 extern const char *  sourceFile;
13997
13998 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
13999
14000 void ProcessExpressionType(struct Expression * exp)
14001 {
14002 unsigned int unresolved = 0x0;
14003 struct Location oldyylloc = yylloc;
14004 unsigned int notByReference = 0x0;
14005
14006 if(!exp || exp->expType)
14007 return ;
14008 yylloc = exp->loc;
14009 switch(exp->type)
14010 {
14011 case 0:
14012 {
14013 struct Identifier * id = exp->identifier;
14014
14015 if(!id || !topContext)
14016 return ;
14017 if(id->_class && id->_class->name)
14018 {
14019 id->classSym = id->_class->symbol;
14020 }
14021 if(strstr(id->string, "__ecereClass") == id->string)
14022 {
14023 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
14024 break;
14025 }
14026 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
14027 {
14028 ReplaceClassMembers(exp, thisClass);
14029 if(exp->type != 0)
14030 {
14031 ProcessExpressionType(exp);
14032 break;
14033 }
14034 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
14035 break;
14036 }
14037 else
14038 {
14039 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
14040
14041 if(!symbol)
14042 {
14043 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0, 0x0))
14044 break;
14045 else
14046 {
14047 if(thisClass)
14048 {
14049 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
14050 if(exp->type != 0)
14051 {
14052 ProcessExpressionType(exp);
14053 break;
14054 }
14055 }
14056 else if(currentClass && !id->_class)
14057 {
14058 if(ResolveIdWithClass(exp, currentClass, 0x1))
14059 break;
14060 }
14061 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
14062 }
14063 }
14064 if(symbol)
14065 {
14066 struct Type * type = symbol->type;
14067 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
14068
14069 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
14070 {
14071 struct Context * context = SetupTemplatesContext(_class);
14072
14073 type = ReplaceThisClassType(_class);
14074 FinishTemplatesContext(context);
14075 if(type)
14076 type->refCount = 0;
14077 }
14078 FreeSpecifier(id->_class);
14079 id->_class = (((void *)0));
14080 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
14081 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
14082 id->classSym = (((void *)0));
14083 exp->expType = type;
14084 if(type)
14085 type->refCount++;
14086 if(type && (type->kind == 15))
14087 exp->isConstant = 0x1;
14088 if(symbol->isParam || !strcmp(id->string, "this"))
14089 {
14090 if(_class && _class->type == 1 && !type->declaredWithStruct)
14091 exp->byReference = 0x1;
14092 }
14093 if(symbol->isIterator)
14094 {
14095 if(symbol->isIterator == 3)
14096 {
14097 exp->type = 5;
14098 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
14099 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
14100 exp->expType = (((void *)0));
14101 ProcessExpressionType(exp);
14102 }
14103 else if(symbol->isIterator != 4)
14104 {
14105 exp->type = 8;
14106 exp->member.exp = MkExpIdentifier(exp->identifier);
14107 exp->member.exp->expType = exp->expType;
14108 exp->member.member = MkIdentifier("data");
14109 exp->expType = (((void *)0));
14110 ProcessExpressionType(exp);
14111 }
14112 }
14113 break;
14114 }
14115 else
14116 {
14117 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
14118
14119 if(thisNameSpace && !(id->_class && !id->_class->name))
14120 {
14121 char name[1024];
14122
14123 strcpy(name, thisNameSpace);
14124 strcat(name, "::");
14125 strcat(name, id->string);
14126 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
14127 }
14128 if(!definedExp)
14129 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
14130 if(definedExp)
14131 {
14132 int c;
14133
14134 for(c = 0; c < definedExpStackPos; c++)
14135 if(definedExpStack[c] == definedExp)
14136 break;
14137 if(c == definedExpStackPos && c < sizeof (definedExpStack) / sizeof(void *))
14138 {
14139 struct Location backupYylloc = yylloc;
14140 struct __ecereNameSpace__ecere__com__Instance * backInput = fileInput;
14141
14142 definedExpStack[definedExpStackPos++] = definedExp;
14143 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
14144 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, const void *  buffer, unsigned int size, unsigned int count))__extension__ ({
14145 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
14146
14147 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
14148 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, definedExp->value, 1, strlen(definedExp->value));
14149 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
14150 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
14151
14152 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
14153 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
14154 echoOn = 0x0;
14155 parsedExpression = (((void *)0));
14156 resetScanner();
14157 expression_yyparse();
14158 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
14159 if(backInput)
14160 fileInput = backInput;
14161 yylloc = backupYylloc;
14162 if(parsedExpression)
14163 {
14164 FreeIdentifier(id);
14165 exp->type = 5;
14166 exp->list = MkListOne(parsedExpression);
14167 ApplyLocation(parsedExpression, &yylloc);
14168 ProcessExpressionType(exp);
14169 definedExpStackPos--;
14170 return ;
14171 }
14172 definedExpStackPos--;
14173 }
14174 else
14175 {
14176 if(inCompiler)
14177 {
14178 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Recursion in defined expression %s\n", (((void *)0))), id->string);
14179 }
14180 }
14181 }
14182 else
14183 {
14184 struct GlobalData * data = (((void *)0));
14185
14186 if(thisNameSpace && !(id->_class && !id->_class->name))
14187 {
14188 char name[1024];
14189
14190 strcpy(name, thisNameSpace);
14191 strcat(name, "::");
14192 strcat(name, id->string);
14193 data = FindGlobalData(name);
14194 }
14195 if(!data)
14196 data = FindGlobalData(id->string);
14197 if(data)
14198 {
14199 DeclareGlobalData(data);
14200 exp->expType = data->dataType;
14201 if(data->dataType)
14202 data->dataType->refCount++;
14203 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
14204 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
14205 FreeSpecifier(id->_class);
14206 id->_class = (((void *)0));
14207 break;
14208 }
14209 else
14210 {
14211 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
14212
14213 if(thisNameSpace && !(id->_class && !id->_class->name))
14214 {
14215 char name[1024];
14216
14217 strcpy(name, thisNameSpace);
14218 strcat(name, "::");
14219 strcat(name, id->string);
14220 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
14221 }
14222 if(!function)
14223 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
14224 if(function)
14225 {
14226 char name[1024];
14227
14228 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
14229 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
14230 name[0] = (char)0;
14231 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
14232 strcpy(name, "__ecereFunction_");
14233 FullClassNameCat(name, id->string, 0x0);
14234 if(DeclareFunction(function, name))
14235 {
14236 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
14237 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
14238 }
14239 exp->expType = function->dataType;
14240 if(function->dataType)
14241 function->dataType->refCount++;
14242 FreeSpecifier(id->_class);
14243 id->_class = (((void *)0));
14244 break;
14245 }
14246 }
14247 }
14248 }
14249 }
14250 unresolved = 0x1;
14251 break;
14252 }
14253 case 1:
14254 {
14255 struct __ecereNameSpace__ecere__com__Class * _class;
14256
14257 if(!exp->instance->_class)
14258 {
14259 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
14260 {
14261 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
14262 }
14263 }
14264 ProcessInstantiationType(exp->instance);
14265 exp->isConstant = exp->instance->isConstant;
14266 if(exp->instance->_class)
14267 {
14268 exp->expType = MkClassType(exp->instance->_class->name);
14269 }
14270 break;
14271 }
14272 case 2:
14273 {
14274 if(!exp->expType)
14275 {
14276 char * constant = exp->constant;
14277 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
14278
14279 exp->expType = type;
14280 if(constant[0] == '\'')
14281 {
14282 if((int)((unsigned char *)constant)[1] > 127)
14283 {
14284 int nb;
14285 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(constant + 1, &nb);
14286
14287 if(nb < 2)
14288 ch = constant[1];
14289 (__ecereNameSpace__ecere__com__eSystem_Delete(constant), constant = 0);
14290 exp->constant = PrintUInt(ch);
14291 type->kind = 8;
14292 type->_class = FindClass("unichar");
14293 type->isSigned = 0x0;
14294 }
14295 else
14296 {
14297 type->kind = 1;
14298 type->isSigned = 0x1;
14299 }
14300 }
14301 else
14302 {
14303 char * dot = strchr(constant, '.');
14304 unsigned int isHex = (constant[0] == '0' && (constant[1] == 'x' || constant[1] == 'X'));
14305 char * exponent;
14306
14307 if(isHex)
14308 {
14309 exponent = strchr(constant, 'p');
14310 if(!exponent)
14311 exponent = strchr(constant, 'P');
14312 }
14313 else
14314 {
14315 exponent = strchr(constant, 'e');
14316 if(!exponent)
14317 exponent = strchr(constant, 'E');
14318 }
14319 if(dot || exponent)
14320 {
14321 if(strchr(constant, 'f') || strchr(constant, 'F'))
14322 type->kind = 6;
14323 else
14324 type->kind = 7;
14325 type->isSigned = 0x1;
14326 }
14327 else
14328 {
14329 unsigned int isSigned = constant[0] == '-';
14330 char * endP = (((void *)0));
14331 long long i64 = strtoll(constant, &endP, 0);
14332 uint64 ui64 = strtoull(constant, &endP, 0);
14333 unsigned int is64Bit = endP && (!strcmp(endP, "LL") || !strcmp(endP, "ll"));
14334
14335 if(isSigned)
14336 {
14337 if(i64 < (((int)0x80000000)))
14338 is64Bit = 0x1;
14339 }
14340 else
14341 {
14342 if(ui64 > (((int)0x7fffffff)))
14343 {
14344 if(ui64 > (0xffffffff))
14345 {
14346 is64Bit = 0x1;
14347 if(ui64 <= (((long long)0x7fffffffffffffffLL)) && (constant[0] != '0' || !constant[1]))
14348 isSigned = 0x1;
14349 }
14350 }
14351 else if(constant[0] != '0' || !constant[1])
14352 isSigned = 0x1;
14353 }
14354 type->kind = is64Bit ? 4 : 3;
14355 type->isSigned = isSigned;
14356 }
14357 }
14358 exp->isConstant = 0x1;
14359 if(exp->destType && exp->destType->kind == 7)
14360 type->kind = 7;
14361 else if(exp->destType && exp->destType->kind == 6)
14362 type->kind = 6;
14363 else if(exp->destType && exp->destType->kind == 4)
14364 type->kind = 4;
14365 }
14366 break;
14367 }
14368 case 3:
14369 {
14370 exp->isConstant = 0x1;
14371 exp->expType = __extension__ ({
14372 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14373
14374 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
14375 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14376
14377 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 1, __ecereInstance1->constant = 0x1, __ecereInstance1->isSigned = 0x1, __ecereInstance1;
14378 }), __ecereInstance2;
14379 });
14380 break;
14381 }
14382 case 13:
14383 case 26:
14384 ProcessExpressionType(exp->_new.size);
14385 exp->expType = __extension__ ({
14386 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14387
14388 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_new.typeName->qualifiers, exp->_new.typeName->declarator), __ecereInstance1;
14389 });
14390 DeclareType(exp->expType->type, 0x0, 0x0);
14391 break;
14392 case 14:
14393 case 27:
14394 ProcessExpressionType(exp->_renew.size);
14395 ProcessExpressionType(exp->_renew.exp);
14396 exp->expType = __extension__ ({
14397 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14398
14399 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), __ecereInstance1;
14400 });
14401 DeclareType(exp->expType->type, 0x0, 0x0);
14402 break;
14403 case 4:
14404 {
14405 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
14406 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
14407 unsigned int useDestType = 0x0, useSideType = 0x0;
14408 struct Location oldyylloc = yylloc;
14409 unsigned int useSideUnit = 0x0;
14410 struct __ecereNameSpace__ecere__com__Class * destClass = (exp->destType && exp->destType->kind == 8 && exp->destType->_class) ? exp->destType->_class->registered : (((void *)0));
14411 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
14412
14413 switch(exp->op.op)
14414 {
14415 case '=':
14416 case MUL_ASSIGN:
14417 case DIV_ASSIGN:
14418 case MOD_ASSIGN:
14419 case ADD_ASSIGN:
14420 case SUB_ASSIGN:
14421 case LEFT_ASSIGN:
14422 case RIGHT_ASSIGN:
14423 case AND_ASSIGN:
14424 case XOR_ASSIGN:
14425 case OR_ASSIGN:
14426 assign = 0x1;
14427 break;
14428 case '!':
14429 break;
14430 case AND_OP:
14431 case OR_OP:
14432 boolOps = 0x1;
14433 boolResult = 0x1;
14434 break;
14435 case EQ_OP:
14436 case '<':
14437 case '>':
14438 case LE_OP:
14439 case GE_OP:
14440 case NE_OP:
14441 boolResult = 0x1;
14442 useSideType = 0x1;
14443 break;
14444 case '+':
14445 case '-':
14446 useSideUnit = 0x1;
14447 useSideType = 0x1;
14448 useDestType = 0x1;
14449 break;
14450 case LEFT_OP:
14451 case RIGHT_OP:
14452 useSideType = 0x1;
14453 useDestType = 0x1;
14454 break;
14455 case '|':
14456 case '^':
14457 useSideType = 0x1;
14458 useDestType = 0x1;
14459 break;
14460 case '/':
14461 case '%':
14462 useSideType = 0x1;
14463 useDestType = 0x1;
14464 break;
14465 case '&':
14466 case '*':
14467 if(exp->op.exp1)
14468 {
14469 useSideType = 0x1;
14470 useDestType = 0x1;
14471 }
14472 break;
14473 }
14474 if(exp->op.op == '&')
14475 {
14476 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
14477 {
14478 struct Identifier * id = exp->op.exp2->identifier;
14479 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
14480
14481 if(symbol && symbol->isIterator == 2)
14482 {
14483 exp->type = 8;
14484 exp->member.exp = exp->op.exp2;
14485 exp->member.member = MkIdentifier("key");
14486 exp->expType = (((void *)0));
14487 exp->op.exp2->expType = symbol->type;
14488 symbol->type->refCount++;
14489 ProcessExpressionType(exp);
14490 FreeType(dummy);
14491 break;
14492 }
14493 }
14494 }
14495 if(exp->op.exp1)
14496 {
14497 if(exp->op.exp2 && useSideUnit && useDestType && destClass && destClass->type == 3 && destClass->base->type != 3)
14498 useDestType = 0x0;
14499 if(destClass && useDestType && ((destClass->type == 3 && useSideUnit) || destClass->type == 4 || destClass->type == 2))
14500 {
14501 if(exp->op.exp1->destType)
14502 FreeType(exp->op.exp1->destType);
14503 exp->op.exp1->destType = exp->destType;
14504 exp->op.exp1->opDestType = 0x1;
14505 if(exp->destType)
14506 exp->destType->refCount++;
14507 }
14508 else if(!assign)
14509 {
14510 if(exp->op.exp1->destType)
14511 FreeType(exp->op.exp1->destType);
14512 exp->op.exp1->destType = dummy;
14513 dummy->refCount++;
14514 }
14515 if(exp->op.exp1->destType && exp->op.op != '=')
14516 exp->op.exp1->destType->count++;
14517 ProcessExpressionType(exp->op.exp1);
14518 if(exp->op.exp1->destType && exp->op.op != '=')
14519 exp->op.exp1->destType->count--;
14520 exp->op.exp1->opDestType = 0x0;
14521 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)
14522 {
14523 exp->op.exp2 = MkExpConstant("1");
14524 exp->op.op = exp->op.op == INC_OP ? ADD_ASSIGN : SUB_ASSIGN;
14525 assign = 0x1;
14526 }
14527 if(exp->op.exp1->destType == dummy)
14528 {
14529 FreeType(dummy);
14530 exp->op.exp1->destType = (((void *)0));
14531 }
14532 type1 = exp->op.exp1->expType;
14533 }
14534 if(exp->op.exp2)
14535 {
14536 char expString[10240];
14537
14538 expString[0] = '\0';
14539 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
14540 {
14541 if(exp->op.exp1)
14542 {
14543 exp->op.exp2->destType = exp->op.exp1->expType;
14544 if(exp->op.exp1->expType)
14545 exp->op.exp1->expType->refCount++;
14546 }
14547 else
14548 {
14549 exp->op.exp2->destType = exp->destType;
14550 if(!exp->op.exp1 || exp->op.op != '&')
14551 exp->op.exp2->opDestType = 0x1;
14552 if(exp->destType)
14553 exp->destType->refCount++;
14554 }
14555 if(type1)
14556 type1->refCount++;
14557 exp->expType = type1;
14558 }
14559 else if(assign)
14560 {
14561 if(inCompiler)
14562 PrintExpression(exp->op.exp2, expString);
14563 if(type1 && type1->kind == 13)
14564 {
14565 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)
14566 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
14567 else if(exp->op.op == '=')
14568 {
14569 if(exp->op.exp2->destType)
14570 FreeType(exp->op.exp2->destType);
14571 exp->op.exp2->destType = type1;
14572 if(type1)
14573 type1->refCount++;
14574 }
14575 }
14576 else
14577 {
14578 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)
14579 ;
14580 else
14581 {
14582 if(exp->op.exp2->destType)
14583 FreeType(exp->op.exp2->destType);
14584 exp->op.exp2->destType = type1;
14585 if(type1)
14586 type1->refCount++;
14587 }
14588 }
14589 if(type1)
14590 type1->refCount++;
14591 exp->expType = type1;
14592 }
14593 else if(destClass && ((destClass->type == 3 && useDestType && useSideUnit) || (destClass->type == 4 && useDestType)))
14594 {
14595 if(exp->op.exp2->destType)
14596 FreeType(exp->op.exp2->destType);
14597 exp->op.exp2->destType = exp->destType;
14598 if(exp->op.op != '&')
14599 exp->op.exp2->opDestType = 0x1;
14600 if(exp->destType)
14601 exp->destType->refCount++;
14602 }
14603 else
14604 {
14605 if(exp->op.exp2->destType)
14606 FreeType(exp->op.exp2->destType);
14607 exp->op.exp2->destType = dummy;
14608 dummy->refCount++;
14609 }
14610 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
14611 {
14612 FreeType(exp->op.exp2->destType);
14613 exp->op.exp2->destType = type1;
14614 type1->refCount++;
14615 }
14616 if(exp->op.exp2->destType && exp->op.op != '=')
14617 exp->op.exp2->destType->count++;
14618 if(exp->op.op == SIZEOF)
14619 {
14620 struct Expression * e = exp->op.exp2;
14621
14622 while((e->type == 5 || e->type == 32 || e->type == 23) && e->list)
14623 {
14624 if(e->type == 5 || e->type == 32 || e->type == 23)
14625 {
14626 if(e->type == 23)
14627 e = (*((struct Statement *)(*e->compound->compound.statements).last)->expressions).last;
14628 else
14629 e = (*e->list).last;
14630 }
14631 }
14632 if(e->type == 11 && e->cast.exp)
14633 e->cast.exp->needCast = 0x1;
14634 }
14635 ProcessExpressionType(exp->op.exp2);
14636 exp->op.exp2->opDestType = 0x0;
14637 if(exp->op.exp2->destType && exp->op.op != '=')
14638 exp->op.exp2->destType->count--;
14639 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
14640 {
14641 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)
14642 {
14643 if(exp->op.op != '=' && type1->type->kind == 0)
14644 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "void *: unknown size\n", (((void *)0))));
14645 }
14646 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)))
14647 {
14648 if(exp->op.op == ADD_ASSIGN)
14649 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "cannot add two pointers\n", (((void *)0))));
14650 }
14651 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))
14652 {
14653 if(exp->op.op == ADD_ASSIGN)
14654 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "cannot add two pointers\n", (((void *)0))));
14655 }
14656 else if(inCompiler)
14657 {
14658 char type1String[1024];
14659 char type2String[1024];
14660
14661 type1String[0] = '\0';
14662 type2String[0] = '\0';
14663 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
14664 PrintType(type1, type2String, 0x0, 0x1);
14665 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14666 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
14667 }
14668 }
14669 if(exp->op.exp2->destType == dummy)
14670 {
14671 FreeType(dummy);
14672 exp->op.exp2->destType = (((void *)0));
14673 }
14674 if(exp->op.op == '-' && !exp->op.exp1 && exp->op.exp2->expType && !exp->op.exp2->expType->isSigned)
14675 {
14676 type2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14677 type2->refCount = 1;
14678 CopyTypeInto(type2, exp->op.exp2->expType);
14679 type2->isSigned = 0x1;
14680 }
14681 else if(exp->op.op == '~' && !exp->op.exp1 && exp->op.exp2->expType && (!exp->op.exp2->expType->isSigned || exp->op.exp2->expType->kind != 3))
14682 {
14683 type2 = __extension__ ({
14684 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14685
14686 __ecereInstance1->kind = 3, __ecereInstance1;
14687 });
14688 type2->refCount = 1;
14689 type2->isSigned = 0x1;
14690 }
14691 else
14692 {
14693 type2 = exp->op.exp2->expType;
14694 if(type2)
14695 type2->refCount++;
14696 }
14697 }
14698 dummy->kind = 0;
14699 if(exp->op.op == SIZEOF)
14700 {
14701 exp->expType = __extension__ ({
14702 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14703
14704 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 23, __ecereInstance1;
14705 });
14706 exp->isConstant = 0x1;
14707 }
14708 else if(exp->op.op == '*' && !exp->op.exp1)
14709 {
14710 exp->expType = Dereference(type2);
14711 if(type2 && type2->kind == 8)
14712 notByReference = 0x1;
14713 }
14714 else if(exp->op.op == '&' && !exp->op.exp1)
14715 exp->expType = Reference(type2);
14716 else if(!assign)
14717 {
14718 if(boolOps)
14719 {
14720 if(exp->op.exp1)
14721 {
14722 if(exp->op.exp1->destType)
14723 FreeType(exp->op.exp1->destType);
14724 exp->op.exp1->destType = MkClassType("bool");
14725 exp->op.exp1->destType->truth = 0x1;
14726 if(!exp->op.exp1->expType)
14727 ProcessExpressionType(exp->op.exp1);
14728 else
14729 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0, 0x0);
14730 FreeType(exp->op.exp1->expType);
14731 exp->op.exp1->expType = MkClassType("bool");
14732 exp->op.exp1->expType->truth = 0x1;
14733 }
14734 if(exp->op.exp2)
14735 {
14736 if(exp->op.exp2->destType)
14737 FreeType(exp->op.exp2->destType);
14738 exp->op.exp2->destType = MkClassType("bool");
14739 exp->op.exp2->destType->truth = 0x1;
14740 if(!exp->op.exp2->expType)
14741 ProcessExpressionType(exp->op.exp2);
14742 else
14743 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0, 0x0);
14744 FreeType(exp->op.exp2->expType);
14745 exp->op.exp2->expType = MkClassType("bool");
14746 exp->op.exp2->expType->truth = 0x1;
14747 }
14748 }
14749 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")))))
14750 {
14751 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
14752 {
14753 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)))
14754 {
14755 struct Type * intType;
14756
14757 if(!type1->_class->registered->dataType)
14758 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
14759 if(!type2->_class->registered->dataType)
14760 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
14761 intType = ProcessTypeString((type1->_class->registered->dataType->kind == 4 || type2->_class->registered->dataType->kind == 4) ? "int64" : "int", 0x0);
14762 if(exp->op.exp1->destType)
14763 FreeType(exp->op.exp1->destType);
14764 if(exp->op.exp2->destType)
14765 FreeType(exp->op.exp2->destType);
14766 exp->op.exp1->destType = intType;
14767 exp->op.exp2->destType = intType;
14768 intType->refCount++;
14769 }
14770 else
14771 {
14772 if(exp->op.exp2->destType)
14773 FreeType(exp->op.exp2->destType);
14774 exp->op.exp2->destType = type1;
14775 type1->refCount++;
14776 if(exp->op.exp1->destType)
14777 FreeType(exp->op.exp1->destType);
14778 exp->op.exp1->destType = type2;
14779 type2->refCount++;
14780 }
14781 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)
14782 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);
14783 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
14784 {
14785 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
14786
14787 if(argExp)
14788 {
14789 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
14790
14791 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
14792 ProcessExpressionType(exp->op.exp1);
14793 if(type2->kind != 13)
14794 {
14795 ProcessExpressionType(classExp);
14796 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"))))))));
14797 if(!exp->op.exp2->expType)
14798 {
14799 if(type2)
14800 FreeType(type2);
14801 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
14802 type2->refCount++;
14803 }
14804 ProcessExpressionType(exp->op.exp2);
14805 }
14806 }
14807 }
14808 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)))
14809 {
14810 if(type1->kind != 8 && type1->type->kind == 0)
14811 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "void *: unknown size\n", (((void *)0))));
14812 exp->expType = type1;
14813 if(type1)
14814 type1->refCount++;
14815 }
14816 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)))
14817 {
14818 if(type2->kind != 8 && type2->type->kind == 0)
14819 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "void *: unknown size\n", (((void *)0))));
14820 exp->expType = type2;
14821 if(type2)
14822 type2->refCount++;
14823 }
14824 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))
14825 {
14826 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "different levels of indirection\n", (((void *)0))));
14827 }
14828 else
14829 {
14830 unsigned int success = 0x0;
14831
14832 if(type1->kind == 13 && type2->kind == 13)
14833 {
14834 if(exp->op.op == '+')
14835 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "cannot add two pointers\n", (((void *)0))));
14836 else if(exp->op.op == '-')
14837 {
14838 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0, 0x0))
14839 {
14840 exp->expType = __extension__ ({
14841 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14842
14843 __ecereInstance1->kind = 3, __ecereInstance1->refCount = 1, __ecereInstance1;
14844 });
14845 success = 0x1;
14846 if(type1->type->kind == 20)
14847 {
14848 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
14849
14850 if(argExp)
14851 {
14852 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
14853
14854 ProcessExpressionType(classExp);
14855 exp->type = 5;
14856 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")))))));
14857 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
14858 FreeType(dummy);
14859 return ;
14860 }
14861 }
14862 }
14863 }
14864 }
14865 if(!success && exp->op.exp1->type == 2)
14866 {
14867 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0, 0x0))
14868 {
14869 if(exp->expType)
14870 FreeType(exp->expType);
14871 exp->expType = exp->op.exp1->destType;
14872 if(exp->op.exp1->destType)
14873 exp->op.exp1->destType->refCount++;
14874 success = 0x1;
14875 }
14876 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0, 0x0))
14877 {
14878 if(exp->expType)
14879 FreeType(exp->expType);
14880 exp->expType = exp->op.exp2->destType;
14881 if(exp->op.exp2->destType)
14882 exp->op.exp2->destType->refCount++;
14883 success = 0x1;
14884 }
14885 }
14886 else if(!success)
14887 {
14888 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0, 0x0))
14889 {
14890 if(exp->expType)
14891 FreeType(exp->expType);
14892 exp->expType = exp->op.exp2->destType;
14893 if(exp->op.exp2->destType)
14894 exp->op.exp2->destType->refCount++;
14895 success = 0x1;
14896 }
14897 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0, 0x0))
14898 {
14899 if(exp->expType)
14900 FreeType(exp->expType);
14901 exp->expType = exp->op.exp1->destType;
14902 if(exp->op.exp1->destType)
14903 exp->op.exp1->destType->refCount++;
14904 success = 0x1;
14905 }
14906 }
14907 if(!success)
14908 {
14909 char expString1[10240];
14910 char expString2[10240];
14911 char type1[1024];
14912 char type2[1024];
14913
14914 expString1[0] = '\0';
14915 expString2[0] = '\0';
14916 type1[0] = '\0';
14917 type2[0] = '\0';
14918 if(inCompiler)
14919 {
14920 PrintExpression(exp->op.exp1, expString1);
14921 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
14922 PrintExpression(exp->op.exp2, expString2);
14923 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
14924 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
14925 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
14926 }
14927 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
14928 }
14929 }
14930 }
14931 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
14932 {
14933 if(exp->op.exp1->destType)
14934 FreeType(exp->op.exp1->destType);
14935 exp->op.exp1->destType = type2->_class->registered->dataType;
14936 if(type2->_class->registered->dataType)
14937 type2->_class->registered->dataType->refCount++;
14938 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0, 0x0);
14939 exp->expType = type2;
14940 if(type2)
14941 type2->refCount++;
14942 }
14943 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
14944 {
14945 if(exp->op.exp2->destType)
14946 FreeType(exp->op.exp2->destType);
14947 exp->op.exp2->destType = type1->_class->registered->dataType;
14948 if(type1->_class->registered->dataType)
14949 type1->_class->registered->dataType->refCount++;
14950 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0, 0x0);
14951 exp->expType = type1;
14952 if(type1)
14953 type1->refCount++;
14954 }
14955 else if(type1)
14956 {
14957 unsigned int valid = 0x0;
14958
14959 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
14960 {
14961 if(exp->op.exp2->destType)
14962 FreeType(exp->op.exp2->destType);
14963 if(!type1->_class->registered->dataType)
14964 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
14965 exp->op.exp2->destType = type1->_class->registered->dataType;
14966 exp->op.exp2->destType->refCount++;
14967 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0, 0x0);
14968 if(type2)
14969 FreeType(type2);
14970 type2 = exp->op.exp2->destType;
14971 if(type2)
14972 type2->refCount++;
14973 exp->expType = type2;
14974 type2->refCount++;
14975 }
14976 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
14977 {
14978 if(exp->op.exp1->destType)
14979 FreeType(exp->op.exp1->destType);
14980 if(!type2->_class->registered->dataType)
14981 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
14982 exp->op.exp1->destType = type2->_class->registered->dataType;
14983 exp->op.exp1->destType->refCount++;
14984 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0, 0x0);
14985 type1 = exp->op.exp1->destType;
14986 exp->expType = type1;
14987 type1->refCount++;
14988 }
14989 if(!boolResult || exp->op.op == '>' || exp->op.op == '<' || exp->op.op == GE_OP || exp->op.op == LE_OP)
14990 {
14991 unsigned int op1IsEnum = type1 && type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4;
14992 unsigned int op2IsEnum = type2 && type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4;
14993
14994 if(exp->op.op == '*' || exp->op.op == '/' || exp->op.op == '-' || exp->op.op == '|' || exp->op.op == '^')
14995 {
14996 if(op1IsEnum && exp->op.exp2->expType)
14997 {
14998 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0, 0x0))
14999 {
15000 if(exp->expType)
15001 FreeType(exp->expType);
15002 exp->expType = exp->op.exp2->expType;
15003 if(exp->op.exp2->expType)
15004 exp->op.exp2->expType->refCount++;
15005 valid = 0x1;
15006 }
15007 }
15008 else if(op2IsEnum && exp->op.exp1->expType)
15009 {
15010 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0, 0x0))
15011 {
15012 if(exp->expType)
15013 FreeType(exp->expType);
15014 exp->expType = exp->op.exp1->expType;
15015 if(exp->op.exp1->expType)
15016 exp->op.exp1->expType->refCount++;
15017 valid = 0x1;
15018 }
15019 }
15020 }
15021 else
15022 {
15023 if(op1IsEnum && exp->op.exp2->expType)
15024 {
15025 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0, 0x0))
15026 {
15027 if(exp->expType)
15028 FreeType(exp->expType);
15029 exp->expType = exp->op.exp1->expType;
15030 if(exp->op.exp1->expType)
15031 exp->op.exp1->expType->refCount++;
15032 valid = 0x1;
15033 }
15034 }
15035 else if(op2IsEnum && exp->op.exp1->expType)
15036 {
15037 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0, 0x0))
15038 {
15039 if(exp->expType)
15040 FreeType(exp->expType);
15041 exp->expType = exp->op.exp2->expType;
15042 if(exp->op.exp2->expType)
15043 exp->op.exp2->expType->refCount++;
15044 valid = 0x1;
15045 }
15046 }
15047 }
15048 }
15049 if(!valid)
15050 {
15051 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))
15052 {
15053 if(exp->op.exp1->destType)
15054 FreeType(exp->op.exp1->destType);
15055 exp->op.exp1->destType = type2;
15056 type2->refCount++;
15057 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0, 0x0))
15058 {
15059 if(exp->expType)
15060 FreeType(exp->expType);
15061 exp->expType = exp->op.exp1->destType;
15062 if(exp->op.exp1->destType)
15063 exp->op.exp1->destType->refCount++;
15064 }
15065 }
15066 else
15067 {
15068 if(exp->op.exp2->destType)
15069 FreeType(exp->op.exp2->destType);
15070 exp->op.exp2->destType = type1;
15071 type1->refCount++;
15072 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0, 0x0))
15073 {
15074 if(exp->expType)
15075 FreeType(exp->expType);
15076 exp->expType = exp->op.exp2->destType;
15077 if(exp->op.exp2->destType)
15078 exp->op.exp2->destType->refCount++;
15079 }
15080 else if(type1 && type2)
15081 {
15082 char expString1[10240];
15083 char expString2[10240];
15084 char type1String[1024];
15085 char type2String[1024];
15086
15087 expString1[0] = '\0';
15088 expString2[0] = '\0';
15089 type1String[0] = '\0';
15090 type2String[0] = '\0';
15091 if(inCompiler)
15092 {
15093 PrintExpression(exp->op.exp1, expString1);
15094 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
15095 PrintExpression(exp->op.exp2, expString2);
15096 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
15097 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
15098 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
15099 }
15100 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
15101 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
15102 {
15103 exp->expType = exp->op.exp1->expType;
15104 if(exp->op.exp1->expType)
15105 exp->op.exp1->expType->refCount++;
15106 }
15107 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
15108 {
15109 exp->expType = exp->op.exp2->expType;
15110 if(exp->op.exp2->expType)
15111 exp->op.exp2->expType->refCount++;
15112 }
15113 }
15114 }
15115 }
15116 }
15117 else if(type2)
15118 {
15119 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
15120 {
15121 struct Type * oldType = exp->op.exp1->expType;
15122
15123 exp->op.exp1->expType = (((void *)0));
15124 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0, 0x0))
15125 FreeType(oldType);
15126 else
15127 exp->op.exp1->expType = oldType;
15128 }
15129 if(exp->op.exp1->destType)
15130 FreeType(exp->op.exp1->destType);
15131 exp->op.exp1->destType = type2;
15132 type2->refCount++;
15133 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0, 0x0))
15134 {
15135 if(exp->expType)
15136 FreeType(exp->expType);
15137 exp->expType = exp->op.exp1->destType;
15138 if(exp->op.exp1->destType)
15139 exp->op.exp1->destType->refCount++;
15140 }
15141 }
15142 }
15143 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
15144 {
15145 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
15146 {
15147 if(exp->op.exp1->destType)
15148 FreeType(exp->op.exp1->destType);
15149 exp->op.exp1->destType = type2->_class->registered->dataType;
15150 if(type2->_class->registered->dataType)
15151 type2->_class->registered->dataType->refCount++;
15152 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0, 0x0);
15153 }
15154 if(exp->op.op == '!')
15155 {
15156 exp->expType = MkClassType("bool");
15157 exp->expType->truth = 0x1;
15158 }
15159 else
15160 {
15161 exp->expType = type2;
15162 if(type2)
15163 type2->refCount++;
15164 }
15165 }
15166 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
15167 {
15168 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
15169 {
15170 if(exp->op.exp2->destType)
15171 FreeType(exp->op.exp2->destType);
15172 exp->op.exp2->destType = type1->_class->registered->dataType;
15173 if(type1->_class->registered->dataType)
15174 type1->_class->registered->dataType->refCount++;
15175 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0, 0x0);
15176 }
15177 exp->expType = type1;
15178 if(type1)
15179 type1->refCount++;
15180 }
15181 }
15182 yylloc = exp->loc;
15183 if(exp->op.exp1 && !exp->op.exp1->expType)
15184 {
15185 char expString[10000];
15186
15187 expString[0] = '\0';
15188 if(inCompiler)
15189 {
15190 PrintExpression(exp->op.exp1, expString);
15191 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15192 }
15193 if(expString[0])
15194 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s\n", (((void *)0))), expString);
15195 }
15196 if(exp->op.exp2 && !exp->op.exp2->expType)
15197 {
15198 char expString[10240];
15199
15200 expString[0] = '\0';
15201 if(inCompiler)
15202 {
15203 PrintExpression(exp->op.exp2, expString);
15204 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15205 }
15206 if(expString[0])
15207 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s\n", (((void *)0))), expString);
15208 }
15209 if(boolResult)
15210 {
15211 FreeType(exp->expType);
15212 exp->expType = MkClassType("bool");
15213 exp->expType->truth = 0x1;
15214 }
15215 if(exp->op.op != SIZEOF)
15216 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
15217 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
15218 {
15219 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
15220 }
15221 yylloc = oldyylloc;
15222 FreeType(dummy);
15223 if(type2)
15224 FreeType(type2);
15225 break;
15226 }
15227 case 5:
15228 case 32:
15229 {
15230 struct Expression * e;
15231
15232 exp->isConstant = 0x1;
15233 for(e = (*exp->list).first; e; e = e->next)
15234 {
15235 unsigned int inced = 0x0;
15236
15237 if(!e->next)
15238 {
15239 FreeType(e->destType);
15240 e->opDestType = exp->opDestType;
15241 e->destType = exp->destType;
15242 if(e->destType)
15243 {
15244 exp->destType->refCount++;
15245 e->destType->count++;
15246 inced = 0x1;
15247 }
15248 }
15249 ProcessExpressionType(e);
15250 if(inced)
15251 exp->destType->count--;
15252 if(!exp->expType && !e->next)
15253 {
15254 exp->expType = e->expType;
15255 if(e->expType)
15256 e->expType->refCount++;
15257 }
15258 if(!e->isConstant)
15259 exp->isConstant = 0x0;
15260 }
15261 e = (*exp->list).first;
15262 if(!e->next && e->type == 8)
15263 {
15264 struct Expression * next = exp->next, * prev = exp->prev;
15265
15266 FreeType(exp->expType);
15267 FreeType(exp->destType);
15268 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
15269 *exp = *e;
15270 exp->prev = prev;
15271 exp->next = next;
15272 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
15273 ProcessExpressionType(exp);
15274 }
15275 break;
15276 }
15277 case 6:
15278 {
15279 struct Expression * e;
15280
15281 exp->isConstant = 0x1;
15282 ProcessExpressionType(exp->index.exp);
15283 if(!exp->index.exp->isConstant)
15284 exp->isConstant = 0x0;
15285 if(exp->index.exp->expType)
15286 {
15287 struct Type * source = exp->index.exp->expType;
15288
15289 if(source->kind == 8 && source->_class && source->_class->registered)
15290 {
15291 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
15292 struct __ecereNameSpace__ecere__com__Class * c = _class->templateClass ? _class->templateClass : _class;
15293
15294 if(_class != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(c, containerClass) && _class->templateArgs)
15295 {
15296 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
15297 if(exp->index.index && (*exp->index.index).last)
15298 {
15299 struct Type * type = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
15300
15301 if(type->kind == 8)
15302 type->constant = 0x1;
15303 else if(type->kind == 13)
15304 {
15305 struct Type * t = type;
15306
15307 while(t->kind == 13)
15308 t = t->type;
15309 t->constant = 0x1;
15310 }
15311 ((struct Expression *)(*exp->index.index).last)->destType = type;
15312 }
15313 }
15314 }
15315 }
15316 for(e = (*exp->index.index).first; e; e = e->next)
15317 {
15318 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
15319 {
15320 if(e->destType)
15321 FreeType(e->destType);
15322 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
15323 }
15324 ProcessExpressionType(e);
15325 if(!e->next)
15326 {
15327 }
15328 if(!e->isConstant)
15329 exp->isConstant = 0x0;
15330 }
15331 if(!exp->expType)
15332 exp->expType = Dereference(exp->index.exp->expType);
15333 if(exp->expType)
15334 DeclareType(exp->expType, 0x0, 0x0);
15335 break;
15336 }
15337 case 7:
15338 {
15339 struct Expression * e;
15340 struct Type * functionType;
15341 struct Type * methodType = (((void *)0));
15342 char name[1024];
15343
15344 name[0] = '\0';
15345 if(inCompiler)
15346 {
15347 PrintExpression(exp->call.exp, name);
15348 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
15349 {
15350 PrintExpression(exp->call.exp, name);
15351 }
15352 }
15353 if(exp->call.exp->type == 0)
15354 {
15355 struct Expression * idExp = exp->call.exp;
15356 struct Identifier * id = idExp->identifier;
15357
15358 if(!strcmp(id->string, "__builtin_frame_address"))
15359 {
15360 exp->expType = ProcessTypeString("void *", 0x1);
15361 if(exp->call.arguments && (*exp->call.arguments).first)
15362 ProcessExpressionType((*exp->call.arguments).first);
15363 break;
15364 }
15365 else if(!strcmp(id->string, "__ENDIAN_PAD"))
15366 {
15367 exp->expType = ProcessTypeString("int", 0x1);
15368 if(exp->call.arguments && (*exp->call.arguments).first)
15369 ProcessExpressionType((*exp->call.arguments).first);
15370 break;
15371 }
15372 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
15373 {
15374 struct Expression * a = (((void *)0));
15375 struct Expression * b = (((void *)0));
15376 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
15377
15378 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
15379 {
15380 a = (*exp->call.arguments).first;
15381 b = (*exp->call.arguments).last;
15382 tempExp1 = a;
15383 tempExp2 = b;
15384 }
15385 else if((*exp->call.arguments).count == 1)
15386 {
15387 a = (*exp->call.arguments).first;
15388 tempExp1 = a;
15389 }
15390 if(a)
15391 {
15392 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
15393 idExp->identifier = (((void *)0));
15394 FreeExpContents(exp);
15395 ProcessExpressionType(a);
15396 if(b)
15397 ProcessExpressionType(b);
15398 exp->type = 5;
15399 exp->list = MkList();
15400 if(a->expType && (!b || b->expType))
15401 {
15402 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
15403 {
15404 if(inCompiler)
15405 {
15406 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15407 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
15408 struct Declaration * decl;
15409 char temp1[1024], temp2[1024];
15410
15411 GetTypeSpecs(a->expType, specs);
15412 if(a && !a->isConstant && a->type != 0)
15413 {
15414 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
15415 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
15416 tempExp1 = QMkExpId(temp1);
15417 tempExp1->expType = a->expType;
15418 if(a->expType)
15419 a->expType->refCount++;
15420 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
15421 }
15422 if(b && !b->isConstant && b->type != 0)
15423 {
15424 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
15425 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
15426 tempExp2 = QMkExpId(temp2);
15427 tempExp2->expType = b->expType;
15428 if(b->expType)
15429 b->expType->refCount++;
15430 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
15431 }
15432 decl = MkDeclaration(specs, decls);
15433 if(!curCompound->compound.declarations)
15434 curCompound->compound.declarations = MkList();
15435 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
15436 }
15437 }
15438 }
15439 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
15440 {
15441 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
15442
15443 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
15444 exp->expType = a->expType;
15445 if(a->expType)
15446 a->expType->refCount++;
15447 }
15448 else if(!strcmp(id->string, "Abs"))
15449 {
15450 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
15451 exp->expType = a->expType;
15452 if(a->expType)
15453 a->expType->refCount++;
15454 }
15455 else if(!strcmp(id->string, "Sgn"))
15456 {
15457 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"))))));
15458 exp->expType = ProcessTypeString("int", 0x0);
15459 }
15460 FreeExpression(tempExp1);
15461 if(tempExp2)
15462 FreeExpression(tempExp2);
15463 FreeIdentifier(id);
15464 break;
15465 }
15466 }
15467 }
15468 {
15469 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
15470
15471 if(!exp->call.exp->destType)
15472 {
15473 exp->call.exp->destType = dummy;
15474 dummy->refCount++;
15475 }
15476 ProcessExpressionType(exp->call.exp);
15477 if(exp->call.exp->destType == dummy)
15478 {
15479 FreeType(dummy);
15480 exp->call.exp->destType = (((void *)0));
15481 }
15482 FreeType(dummy);
15483 }
15484 functionType = exp->call.exp->expType;
15485 if(functionType && functionType->kind == 16)
15486 {
15487 methodType = functionType;
15488 functionType = methodType->method->dataType;
15489 if(exp->call.exp->expType->usedClass)
15490 {
15491 char typeString[1024];
15492
15493 typeString[0] = '\0';
15494 {
15495 struct Symbol * back = functionType->thisClass;
15496
15497 functionType->thisClass = (((void *)0));
15498 PrintType(functionType, typeString, 0x1, 0x1);
15499 functionType->thisClass = back;
15500 }
15501 if(strstr(typeString, "thisclass"))
15502 {
15503 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15504 struct Declarator * decl;
15505
15506 {
15507 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
15508
15509 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
15510 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
15511 thisClassParams = 0x0;
15512 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
15513 {
15514 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
15515
15516 thisClass = exp->call.exp->expType->usedClass;
15517 ProcessDeclarator(decl);
15518 thisClass = backupThisClass;
15519 }
15520 thisClassParams = 0x1;
15521 functionType = ProcessType(specs, decl);
15522 functionType->refCount = 0;
15523 FinishTemplatesContext(context);
15524 }
15525 FreeList(specs, FreeSpecifier);
15526 FreeDeclarator(decl);
15527 }
15528 }
15529 }
15530 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
15531 {
15532 struct Type * type = functionType->type;
15533
15534 if(!functionType->refCount)
15535 {
15536 functionType->type = (((void *)0));
15537 FreeType(functionType);
15538 }
15539 functionType = type;
15540 }
15541 if(functionType && functionType->kind != 11)
15542 {
15543 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "called object %s is not a function\n", (((void *)0))), name);
15544 }
15545 else if(functionType)
15546 {
15547 unsigned int emptyParams = 0x0, noParams = 0x0;
15548 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
15549 struct Type * type = functionType->params.first;
15550 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
15551 int extra = 0;
15552 struct Location oldyylloc = yylloc;
15553
15554 if(!type)
15555 emptyParams = 0x1;
15556 if(functionType->extraParam && e && functionType->thisClass)
15557 {
15558 e->destType = MkClassType(functionType->thisClass->string);
15559 e = e->next;
15560 }
15561 if(!functionType->staticMethod && !functionType->extraParam)
15562 {
15563 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
15564 {
15565 type = MkClassType(memberExp->member.exp->expType->_class->string);
15566 if(e)
15567 {
15568 e->destType = type;
15569 e = e->next;
15570 type = functionType->params.first;
15571 }
15572 else
15573 type->refCount = 0;
15574 }
15575 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
15576 {
15577 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
15578 type->byReference = functionType->byReference;
15579 type->typedByReference = functionType->typedByReference;
15580 if(e)
15581 {
15582 if(e->next && type->kind == 8 && (functionType && functionType->thisClass) && functionType->classObjectType == 2)
15583 e = e->next;
15584 e->destType = type;
15585 e = e->next;
15586 type = functionType->params.first;
15587 }
15588 else
15589 type->refCount = 0;
15590 }
15591 }
15592 if(type && type->kind == 0)
15593 {
15594 noParams = 0x1;
15595 if(!type->refCount)
15596 FreeType(type);
15597 type = (((void *)0));
15598 }
15599 for(; e; e = e->next)
15600 {
15601 if(!type && !emptyParams)
15602 {
15603 yylloc = e->loc;
15604 if(methodType && methodType->methodClass)
15605 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);
15606 else
15607 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);
15608 break;
15609 }
15610 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
15611 {
15612 struct Type * templatedType = (((void *)0));
15613 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
15614 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
15615 int id = 0;
15616
15617 if(_class && _class->templateArgs)
15618 {
15619 struct __ecereNameSpace__ecere__com__Class * sClass;
15620
15621 for(sClass = _class; sClass; sClass = sClass->base)
15622 {
15623 if(sClass->templateClass)
15624 sClass = sClass->templateClass;
15625 id = 0;
15626 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
15627 {
15628 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
15629 {
15630 struct __ecereNameSpace__ecere__com__Class * nextClass;
15631
15632 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
15633 {
15634 if(nextClass->templateClass)
15635 nextClass = nextClass->templateClass;
15636 id += nextClass->templateParams.count;
15637 }
15638 break;
15639 }
15640 id++;
15641 }
15642 if(curParam)
15643 break;
15644 }
15645 }
15646 if(curParam && _class->templateArgs[id].dataTypeString)
15647 {
15648 unsigned int constant = type->constant;
15649 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
15650
15651 {
15652 struct Context * context = SetupTemplatesContext(_class);
15653
15654 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
15655 FinishTemplatesContext(context);
15656 }
15657 if(templatedType->kind == 8 && constant)
15658 templatedType->constant = 0x1;
15659 else if(templatedType->kind == 13)
15660 {
15661 struct Type * t = templatedType->type;
15662
15663 while(t->kind == 13)
15664 t = t->type;
15665 if(constant)
15666 t->constant = constant;
15667 }
15668 e->destType = templatedType;
15669 if(templatedType)
15670 {
15671 templatedType->passAsTemplate = 0x1;
15672 }
15673 }
15674 else
15675 {
15676 e->destType = type;
15677 if(type)
15678 type->refCount++;
15679 }
15680 }
15681 else
15682 {
15683 if(type && type->kind == 14 && type->prev && type->prev->kind == 8 && type->prev->classObjectType)
15684 {
15685 e->destType = type->prev;
15686 e->destType->refCount++;
15687 }
15688 else
15689 {
15690 e->destType = type;
15691 if(type)
15692 type->refCount++;
15693 }
15694 }
15695 if(type && type->kind != 14)
15696 {
15697 struct Type * next = type->next;
15698
15699 if(!type->refCount)
15700 FreeType(type);
15701 type = next;
15702 }
15703 }
15704 if(type && type->kind != 14)
15705 {
15706 if(methodType && methodType->methodClass)
15707 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);
15708 else
15709 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);
15710 }
15711 yylloc = oldyylloc;
15712 if(type && !type->refCount)
15713 FreeType(type);
15714 }
15715 else
15716 {
15717 functionType = __extension__ ({
15718 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
15719
15720 __ecereInstance1->refCount = 0, __ecereInstance1->kind = 11, __ecereInstance1;
15721 });
15722 if(exp->call.exp->type == 0)
15723 {
15724 char * string = exp->call.exp->identifier->string;
15725
15726 if(inCompiler)
15727 {
15728 struct Symbol * symbol;
15729 struct Location oldyylloc = yylloc;
15730
15731 yylloc = exp->call.exp->identifier->loc;
15732 if(strstr(string, "__builtin_") == string)
15733 {
15734 if(exp->destType)
15735 {
15736 functionType->returnType = exp->destType;
15737 exp->destType->refCount++;
15738 }
15739 }
15740 else
15741 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "%s undefined; assuming extern returning int\n", (((void *)0))), string);
15742 symbol = __extension__ ({
15743 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
15744
15745 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString(string), __ecereInstance1->type = ProcessTypeString("int()", 0x1), __ecereInstance1;
15746 });
15747 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
15748 if(strstr(symbol->string, "::"))
15749 globalContext->hasNameSpace = 0x1;
15750 yylloc = oldyylloc;
15751 }
15752 }
15753 else if(exp->call.exp->type == 8)
15754 {
15755 }
15756 else
15757 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "callable object undefined; extern assuming returning int\n", (((void *)0))));
15758 if(!functionType->returnType)
15759 {
15760 functionType->returnType = __extension__ ({
15761 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
15762
15763 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
15764 });
15765 }
15766 }
15767 if(functionType && functionType->kind == 11)
15768 {
15769 exp->expType = functionType->returnType;
15770 if(functionType->returnType)
15771 functionType->returnType->refCount++;
15772 if(!functionType->refCount)
15773 FreeType(functionType);
15774 }
15775 if(exp->call.arguments)
15776 {
15777 for(e = (*exp->call.arguments).first; e; e = e->next)
15778 {
15779 struct Type * destType = e->destType;
15780
15781 ProcessExpressionType(e);
15782 }
15783 }
15784 break;
15785 }
15786 case 8:
15787 {
15788 struct Type * type;
15789 struct Location oldyylloc = yylloc;
15790 unsigned int thisPtr;
15791 struct Expression * checkExp = exp->member.exp;
15792
15793 while(checkExp)
15794 {
15795 if(checkExp->type == 11)
15796 checkExp = checkExp->cast.exp;
15797 else if(checkExp->type == 5)
15798 checkExp = checkExp->list ? (*checkExp->list).first : (((void *)0));
15799 else
15800 break;
15801 }
15802 thisPtr = (checkExp && checkExp->type == 0 && !strcmp(checkExp->identifier->string, "this"));
15803 exp->thisPtr = thisPtr;
15804 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
15805 {
15806 exp->member.member->classSym = exp->member.member->_class->symbol;
15807 }
15808 ProcessExpressionType(exp->member.exp);
15809 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)
15810 {
15811 exp->isConstant = 0x0;
15812 }
15813 else
15814 exp->isConstant = exp->member.exp->isConstant;
15815 type = exp->member.exp->expType;
15816 yylloc = exp->loc;
15817 if(type && (type->kind == 20))
15818 {
15819 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
15820 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
15821
15822 if(_class)
15823 {
15824 for(param = _class->templateParams.first; param; param = param->next)
15825 {
15826 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
15827 break;
15828 }
15829 }
15830 if(param && param->defaultArg.member)
15831 {
15832 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
15833
15834 if(argExp)
15835 {
15836 struct Expression * expMember = exp->member.exp;
15837 struct Declarator * decl;
15838 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15839 char thisClassTypeString[1024];
15840
15841 FreeIdentifier(exp->member.member);
15842 ProcessExpressionType(argExp);
15843 {
15844 char * colon = strstr(param->defaultArg.memberString, "::");
15845
15846 if(colon)
15847 {
15848 char className[1024];
15849 struct __ecereNameSpace__ecere__com__Class * sClass;
15850
15851 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
15852 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
15853 }
15854 else
15855 strcpy(thisClassTypeString, _class->fullName);
15856 }
15857 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
15858 exp->expType = ProcessType(specs, decl);
15859 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
15860 {
15861 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
15862 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
15863 int c;
15864 int paramCount = 0;
15865 int lastParam = -1;
15866 char templateString[1024];
15867 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
15868
15869 sprintf(templateString, "%s<", expClass->templateClass->fullName);
15870 for(cClass = expClass; cClass; cClass = cClass->base)
15871 {
15872 int p = 0;
15873
15874 for(param = cClass->templateParams.first; param; param = param->next)
15875 {
15876 int id = p;
15877 struct __ecereNameSpace__ecere__com__Class * sClass;
15878 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
15879
15880 for(sClass = cClass->base; sClass; sClass = sClass->base)
15881 id += sClass->templateParams.count;
15882 arg = expClass->templateArgs[id];
15883 for(sClass = _class; sClass; sClass = sClass->base)
15884 {
15885 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
15886 int p = 0;
15887 struct __ecereNameSpace__ecere__com__Class * nextClass;
15888
15889 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
15890 p += nextClass->templateParams.count;
15891 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
15892 {
15893 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
15894 {
15895 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
15896 {
15897 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
15898 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
15899 break;
15900 }
15901 }
15902 }
15903 }
15904 {
15905 char argument[256];
15906
15907 argument[0] = '\0';
15908 switch(param->type)
15909 {
15910 case 2:
15911 {
15912 char expString[1024];
15913 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15914 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
15915 struct Expression * exp;
15916 char * string = PrintHexUInt64(arg.expression.ui64);
15917
15918 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
15919 (__ecereNameSpace__ecere__com__eSystem_Delete(string), string = 0);
15920 ProcessExpressionType(exp);
15921 ComputeExpression(exp);
15922 expString[0] = '\0';
15923 PrintExpression(exp, expString);
15924 strcat(argument, expString);
15925 FreeExpression(exp);
15926 break;
15927 }
15928 case 1:
15929 {
15930 strcat(argument, arg.member->name);
15931 break;
15932 }
15933 case 0:
15934 {
15935 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
15936 {
15937 if(!strcmp(arg.dataTypeString, "thisclass"))
15938 strcat(argument, thisClassTypeString);
15939 else
15940 strcat(argument, arg.dataTypeString);
15941 }
15942 break;
15943 }
15944 }
15945 if(argument[0])
15946 {
15947 if(paramCount)
15948 strcat(templateString, ", ");
15949 if(lastParam != p - 1)
15950 {
15951 strcat(templateString, param->name);
15952 strcat(templateString, " = ");
15953 }
15954 strcat(templateString, argument);
15955 paramCount++;
15956 lastParam = p;
15957 }
15958 p++;
15959 }
15960 }
15961 }
15962 {
15963 int len = strlen(templateString);
15964
15965 if(templateString[len - 1] == '>')
15966 templateString[len++] = ' ';
15967 templateString[len++] = '>';
15968 templateString[len++] = '\0';
15969 }
15970 {
15971 struct Context * context = SetupTemplatesContext(_class);
15972
15973 FreeType(exp->expType);
15974 exp->expType = ProcessTypeString(templateString, 0x0);
15975 FinishTemplatesContext(context);
15976 }
15977 }
15978 exp->type = 5;
15979 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")))))))));
15980 }
15981 }
15982 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
15983 {
15984 type = ProcessTemplateParameterType(type->templateParameter);
15985 }
15986 }
15987 if(type && (type->kind == 20))
15988 ;
15989 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)))
15990 {
15991 struct Identifier * id = exp->member.member;
15992 int typeKind = type->kind;
15993 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));
15994
15995 if(typeKind == 19 && exp->member.exp->type == 24)
15996 {
15997 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
15998 typeKind = 8;
15999 }
16000 if(id)
16001 {
16002 if(typeKind == 3 || typeKind == 15)
16003 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
16004 else if(!_class)
16005 {
16006 if(type->kind == 8 && type->_class && type->_class->registered)
16007 {
16008 _class = type->_class->registered;
16009 }
16010 else if((type->kind == 12 || type->kind == 13) && type->type && type->type->kind == 1)
16011 {
16012 _class = FindClass("char *")->registered;
16013 }
16014 else if(type->kind == 13)
16015 {
16016 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "uintptr");
16017 FreeType(exp->expType);
16018 exp->expType = ProcessTypeString("uintptr", 0x0);
16019 exp->byReference = 0x1;
16020 }
16021 else
16022 {
16023 char string[1024] = "";
16024 struct Symbol * classSym;
16025
16026 PrintTypeNoConst(type, string, 0x0, 0x1);
16027 classSym = FindClass(string);
16028 if(classSym)
16029 _class = classSym->registered;
16030 }
16031 }
16032 }
16033 if(_class && id)
16034 {
16035 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
16036 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
16037 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
16038 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
16039 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
16040
16041 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
16042 exp->member.memberType = 1;
16043 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
16044 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
16045 if(typeKind != 19)
16046 {
16047 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
16048 {
16049 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
16050 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
16051 {
16052 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
16053 if(prop)
16054 member = (((void *)0));
16055 }
16056 if(!member && !prop)
16057 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
16058 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
16059 exp->member.thisPtr = 0x1;
16060 }
16061 else
16062 {
16063 unsigned int useMemberForNonConst = 0x0;
16064
16065 if(!id->classSym)
16066 {
16067 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
16068 useMemberForNonConst = prop && exp->destType && ((exp->destType->kind == 8 && !exp->destType->constant) || ((exp->destType->kind == 13 || exp->destType->kind == 12) && exp->destType->type && !exp->destType->type->constant)) && !strncmp(prop->dataTypeString, "const ", 6);
16069 if(useMemberForNonConst || !id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
16070 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
16071 }
16072 if((!prop || useMemberForNonConst) && !member)
16073 {
16074 method = useMemberForNonConst ? (((void *)0)) : __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
16075 if(!method)
16076 {
16077 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
16078 useMemberForNonConst |= prop && exp->destType && ((exp->destType->kind == 8 && !exp->destType->constant) || ((exp->destType->kind == 13 || exp->destType->kind == 12) && exp->destType->type && !exp->destType->type->constant)) && !strncmp(prop->dataTypeString, "const ", 6);
16079 if(useMemberForNonConst || !id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
16080 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
16081 }
16082 }
16083 if(member && prop)
16084 {
16085 if(useMemberForNonConst || (member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class)))
16086 prop = (((void *)0));
16087 else
16088 member = (((void *)0));
16089 }
16090 }
16091 }
16092 if(!prop && !member && !method)
16093 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
16094 if(!prop && !member && !method)
16095 {
16096 if(typeKind == 19)
16097 {
16098 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
16099 if(classProp)
16100 {
16101 exp->member.memberType = 5;
16102 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
16103 }
16104 else
16105 {
16106 char structName[1024];
16107 struct Identifier * id = exp->member.member;
16108 struct Expression * classExp = exp->member.exp;
16109
16110 type->refCount++;
16111 FreeType(classExp->expType);
16112 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
16113 strcpy(structName, "__ecereClassData_");
16114 FullClassNameCat(structName, type->_class->string, 0x0);
16115 exp->type = 9;
16116 exp->member.member = id;
16117 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"))))))));
16118 FreeType(type);
16119 ProcessExpressionType(exp);
16120 return ;
16121 }
16122 }
16123 else
16124 {
16125 struct Symbol * classSym = FindClass(id->string);
16126
16127 if(classSym)
16128 {
16129 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
16130
16131 if(convertClass)
16132 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
16133 }
16134 }
16135 }
16136 if(prop)
16137 {
16138 exp->member.memberType = 1;
16139 if(!prop->dataType)
16140 ProcessPropertyType(prop);
16141 exp->expType = prop->dataType;
16142 if(prop->dataType)
16143 prop->dataType->refCount++;
16144 }
16145 else if(member)
16146 {
16147 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
16148 {
16149 FreeExpContents(exp);
16150 exp->type = 0;
16151 exp->identifier = MkIdentifier("class");
16152 ProcessExpressionType(exp);
16153 return ;
16154 }
16155 exp->member.memberType = 3;
16156 DeclareStruct(_class->fullName, 0x0);
16157 if(!member->dataType)
16158 {
16159 struct Context * context = SetupTemplatesContext(_class);
16160
16161 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
16162 FinishTemplatesContext(context);
16163 }
16164 exp->expType = member->dataType;
16165 if(member->dataType)
16166 member->dataType->refCount++;
16167 }
16168 else if(revConvert)
16169 {
16170 exp->member.memberType = 4;
16171 exp->expType = MkClassType(revConvert->_class->fullName);
16172 }
16173 else if(method)
16174 {
16175 {
16176 exp->member.memberType = 2;
16177 }
16178 if(!method->dataType)
16179 ProcessMethodType(method);
16180 exp->expType = __extension__ ({
16181 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16182
16183 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1;
16184 });
16185 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
16186 exp->expType->usedClass = _class;
16187 }
16188 else if(!classProp)
16189 {
16190 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
16191 {
16192 FreeExpContents(exp);
16193 exp->type = 0;
16194 exp->identifier = MkIdentifier("class");
16195 FreeType(exp->expType);
16196 exp->expType = MkClassType("ecere::com::Class");
16197 return ;
16198 }
16199 yylloc = exp->member.member->loc;
16200 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
16201 if(inCompiler)
16202 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
16203 }
16204 if(_class && exp->expType)
16205 {
16206 struct __ecereNameSpace__ecere__com__Class * tClass;
16207
16208 tClass = _class;
16209 while(tClass && !tClass->templateClass)
16210 tClass = tClass->base;
16211 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
16212 {
16213 int id = 0;
16214 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
16215 struct __ecereNameSpace__ecere__com__Class * sClass;
16216
16217 for(sClass = tClass; sClass; sClass = sClass->base)
16218 {
16219 id = 0;
16220 if(sClass->templateClass)
16221 sClass = sClass->templateClass;
16222 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
16223 {
16224 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
16225 {
16226 for(sClass = sClass->base; sClass; sClass = sClass->base)
16227 id += sClass->templateParams.count;
16228 break;
16229 }
16230 id++;
16231 }
16232 if(curParam)
16233 break;
16234 }
16235 if(curParam && tClass->templateArgs[id].dataTypeString)
16236 {
16237 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
16238 struct Context * context = SetupTemplatesContext(tClass);
16239 unsigned int constant = exp->expType->constant;
16240
16241 FreeType(exp->expType);
16242 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
16243 if(exp->expType->kind == 8 && constant)
16244 exp->expType->constant = 0x1;
16245 else if(exp->expType->kind == 13)
16246 {
16247 struct Type * t = exp->expType->type;
16248
16249 while(t->kind == 13)
16250 t = t->type;
16251 if(constant)
16252 t->constant = constant;
16253 }
16254 if(exp->expType)
16255 {
16256 if(exp->expType->kind == 21)
16257 {
16258 FreeType(exp->expType);
16259 exp->expType = ReplaceThisClassType(_class);
16260 }
16261 if(tClass->templateClass)
16262 exp->expType->passAsTemplate = 0x1;
16263 if(!exp->destType)
16264 {
16265 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
16266 if(exp->destType->kind == 8 && constant)
16267 exp->destType->constant = 0x1;
16268 else if(exp->destType->kind == 13)
16269 {
16270 struct Type * t = exp->destType->type;
16271
16272 while(t->kind == 13)
16273 t = t->type;
16274 if(constant)
16275 t->constant = constant;
16276 }
16277 if(exp->destType->kind == 21)
16278 {
16279 FreeType(exp->destType);
16280 exp->destType = ReplaceThisClassType(_class);
16281 }
16282 }
16283 }
16284 FinishTemplatesContext(context);
16285 }
16286 }
16287 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
16288 {
16289 int id = 0;
16290 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
16291 struct __ecereNameSpace__ecere__com__Class * sClass;
16292
16293 for(sClass = tClass; sClass; sClass = sClass->base)
16294 {
16295 id = 0;
16296 if(sClass->templateClass)
16297 sClass = sClass->templateClass;
16298 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
16299 {
16300 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
16301 {
16302 for(sClass = sClass->base; sClass; sClass = sClass->base)
16303 id += sClass->templateParams.count;
16304 break;
16305 }
16306 id++;
16307 }
16308 if(curParam)
16309 break;
16310 }
16311 if(curParam)
16312 {
16313 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
16314 struct Context * context = SetupTemplatesContext(tClass);
16315 struct Type * basicType;
16316
16317 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
16318 if(basicType)
16319 {
16320 if(basicType->kind == 21)
16321 {
16322 FreeType(basicType);
16323 basicType = ReplaceThisClassType(_class);
16324 }
16325 FreeType(exp->expType);
16326 exp->expType = __extension__ ({
16327 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16328
16329 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = basicType, __ecereInstance1;
16330 });
16331 if(!exp->destType)
16332 {
16333 exp->destType = exp->expType;
16334 exp->destType->refCount++;
16335 }
16336 {
16337 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
16338 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16339 struct Declarator * decl;
16340
16341 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
16342 *newExp = *exp;
16343 if(exp->destType)
16344 exp->destType->refCount++;
16345 if(exp->expType)
16346 exp->expType->refCount++;
16347 exp->type = 11;
16348 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
16349 exp->cast.exp = newExp;
16350 }
16351 }
16352 FinishTemplatesContext(context);
16353 }
16354 }
16355 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
16356 {
16357 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
16358
16359 if(expClass)
16360 {
16361 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
16362 int c;
16363 int p = 0;
16364 int paramCount = 0;
16365 int lastParam = -1;
16366 char templateString[1024];
16367 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
16368
16369 sprintf(templateString, "%s<", expClass->templateClass->fullName);
16370 while(cClass != expClass)
16371 {
16372 struct __ecereNameSpace__ecere__com__Class * sClass;
16373
16374 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
16375 ;
16376 cClass = sClass;
16377 for(param = cClass->templateParams.first; param; param = param->next)
16378 {
16379 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
16380 int c;
16381 int cp = 0;
16382 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
16383 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
16384
16385 while(cClassCur != tClass && !paramCur)
16386 {
16387 struct __ecereNameSpace__ecere__com__Class * sClassCur;
16388
16389 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
16390 ;
16391 cClassCur = sClassCur;
16392 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
16393 {
16394 if(!strcmp(paramCur->name, param->name))
16395 {
16396 break;
16397 }
16398 cp++;
16399 }
16400 }
16401 if(paramCur && paramCur->type == 0)
16402 arg = tClass->templateArgs[cp];
16403 else
16404 arg = expClass->templateArgs[p];
16405 {
16406 char argument[256];
16407
16408 argument[0] = '\0';
16409 switch(param->type)
16410 {
16411 case 2:
16412 {
16413 char expString[1024];
16414 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16415 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
16416 struct Expression * exp;
16417 char * string = PrintHexUInt64(arg.expression.ui64);
16418
16419 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
16420 (__ecereNameSpace__ecere__com__eSystem_Delete(string), string = 0);
16421 ProcessExpressionType(exp);
16422 ComputeExpression(exp);
16423 expString[0] = '\0';
16424 PrintExpression(exp, expString);
16425 strcat(argument, expString);
16426 FreeExpression(exp);
16427 break;
16428 }
16429 case 1:
16430 {
16431 strcat(argument, arg.member->name);
16432 break;
16433 }
16434 case 0:
16435 {
16436 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
16437 strcat(argument, arg.dataTypeString);
16438 break;
16439 }
16440 }
16441 if(argument[0])
16442 {
16443 if(paramCount)
16444 strcat(templateString, ", ");
16445 if(lastParam != p - 1)
16446 {
16447 strcat(templateString, param->name);
16448 strcat(templateString, " = ");
16449 }
16450 strcat(templateString, argument);
16451 paramCount++;
16452 lastParam = p;
16453 }
16454 }
16455 p++;
16456 }
16457 }
16458 {
16459 int len = strlen(templateString);
16460
16461 if(templateString[len - 1] == '>')
16462 templateString[len++] = ' ';
16463 templateString[len++] = '>';
16464 templateString[len++] = '\0';
16465 }
16466 FreeType(exp->expType);
16467 {
16468 struct Context * context = SetupTemplatesContext(tClass);
16469
16470 exp->expType = ProcessTypeString(templateString, 0x0);
16471 FinishTemplatesContext(context);
16472 }
16473 }
16474 }
16475 }
16476 }
16477 else
16478 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)");
16479 }
16480 else if(type && (type->kind == 9 || type->kind == 10))
16481 {
16482 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
16483
16484 if(memberType)
16485 {
16486 exp->expType = memberType;
16487 if(memberType)
16488 memberType->refCount++;
16489 }
16490 }
16491 else
16492 {
16493 char expString[10240];
16494
16495 expString[0] = '\0';
16496 if(inCompiler)
16497 {
16498 PrintExpression(exp, expString);
16499 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16500 }
16501 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "member operator on non-structure type expression %s\n", (((void *)0))), expString);
16502 }
16503 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
16504 {
16505 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
16506 {
16507 struct Identifier * id = exp->member.member;
16508 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));
16509
16510 if(_class)
16511 {
16512 FreeType(exp->expType);
16513 exp->expType = ReplaceThisClassType(_class);
16514 }
16515 }
16516 }
16517 yylloc = oldyylloc;
16518 break;
16519 }
16520 case 9:
16521 {
16522 struct Type * destType = exp->destType;
16523
16524 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
16525 {
16526 exp->member.member->classSym = exp->member.member->_class->symbol;
16527 }
16528 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
16529 exp->type = 8;
16530 if(destType)
16531 destType->count++;
16532 ProcessExpressionType(exp);
16533 if(destType)
16534 destType->count--;
16535 break;
16536 }
16537 case 15:
16538 {
16539 struct Symbol * classSym = exp->_class->symbol;
16540
16541 if(classSym && classSym->registered)
16542 {
16543 if(classSym->registered->type == 5)
16544 {
16545 char name[1024];
16546
16547 name[0] = '\0';
16548 DeclareStruct(classSym->string, 0x0);
16549 FreeSpecifier(exp->_class);
16550 exp->type = 10;
16551 FullClassNameCat(name, classSym->string, 0x0);
16552 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
16553 }
16554 else
16555 {
16556 if(classSym->registered->fixed)
16557 {
16558 FreeSpecifier(exp->_class);
16559 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
16560 exp->type = 2;
16561 }
16562 else
16563 {
16564 char className[1024];
16565
16566 strcpy(className, "__ecereClass_");
16567 FullClassNameCat(className, classSym->string, 0x1);
16568 MangleClassName(className);
16569 DeclareClass(classSym, className);
16570 FreeExpContents(exp);
16571 exp->type = 9;
16572 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
16573 exp->member.member = MkIdentifier("structSize");
16574 }
16575 }
16576 }
16577 exp->expType = __extension__ ({
16578 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16579
16580 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 23, __ecereInstance1;
16581 });
16582 break;
16583 }
16584 case 10:
16585 {
16586 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
16587
16588 exp->expType = __extension__ ({
16589 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16590
16591 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 23, __ecereInstance1;
16592 });
16593 exp->isConstant = 0x1;
16594 DeclareType(type, 0x0, 0x0);
16595 FreeType(type);
16596 break;
16597 }
16598 case 11:
16599 {
16600 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
16601
16602 type->count = 1;
16603 FreeType(exp->cast.exp->destType);
16604 exp->cast.exp->destType = type;
16605 type->refCount++;
16606 type->casted = 0x1;
16607 ProcessExpressionType(exp->cast.exp);
16608 type->casted = 0x0;
16609 type->count = 0;
16610 exp->expType = type;
16611 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
16612 {
16613 void * prev = exp->prev, * next = exp->next;
16614 struct Type * expType = exp->cast.exp->destType;
16615 struct Expression * castExp = exp->cast.exp;
16616 struct Type * destType = exp->destType;
16617
16618 if(expType)
16619 expType->refCount++;
16620 FreeType(exp->expType);
16621 FreeTypeName(exp->cast.typeName);
16622 *exp = *castExp;
16623 FreeType(exp->expType);
16624 FreeType(exp->destType);
16625 exp->expType = expType;
16626 exp->destType = destType;
16627 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
16628 exp->prev = prev;
16629 exp->next = next;
16630 }
16631 else
16632 {
16633 exp->isConstant = exp->cast.exp->isConstant;
16634 }
16635 break;
16636 }
16637 case 33:
16638 {
16639 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
16640
16641 exp->expType = type;
16642 break;
16643 }
16644 case 34:
16645 {
16646 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
16647
16648 ProcessExpressionType(exp->vaArg.exp);
16649 exp->expType = type;
16650 break;
16651 }
16652 case 12:
16653 {
16654 struct Expression * e;
16655
16656 exp->isConstant = 0x1;
16657 FreeType(exp->cond.cond->destType);
16658 exp->cond.cond->destType = MkClassType("bool");
16659 exp->cond.cond->destType->truth = 0x1;
16660 ProcessExpressionType(exp->cond.cond);
16661 if(!exp->cond.cond->isConstant)
16662 exp->isConstant = 0x0;
16663 for(e = (*exp->cond.exp).first; e; e = e->next)
16664 {
16665 if(!e->next)
16666 {
16667 FreeType(e->destType);
16668 e->destType = exp->destType;
16669 if(e->destType)
16670 e->destType->refCount++;
16671 }
16672 ProcessExpressionType(e);
16673 if(!e->next)
16674 {
16675 exp->expType = e->expType;
16676 if(e->expType)
16677 e->expType->refCount++;
16678 }
16679 if(!e->isConstant)
16680 exp->isConstant = 0x0;
16681 }
16682 FreeType(exp->cond.elseExp->destType);
16683 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
16684 if(exp->cond.elseExp->destType)
16685 exp->cond.elseExp->destType->refCount++;
16686 ProcessExpressionType(exp->cond.elseExp);
16687 if(!exp->cond.elseExp->isConstant)
16688 exp->isConstant = 0x0;
16689 break;
16690 }
16691 case 23:
16692 {
16693 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
16694 {
16695 struct Statement * last = (*exp->compound->compound.statements).last;
16696
16697 if(last->type == 3 && last->expressions && (*last->expressions).last)
16698 {
16699 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
16700 if(exp->destType)
16701 exp->destType->refCount++;
16702 }
16703 ProcessStatement(exp->compound);
16704 exp->expType = (last->expressions && (*last->expressions).last) ? ((struct Expression *)(*last->expressions).last)->expType : (((void *)0));
16705 if(exp->expType)
16706 exp->expType->refCount++;
16707 }
16708 break;
16709 }
16710 case 24:
16711 {
16712 struct Specifier * spec = (*exp->_classExp.specifiers).first;
16713
16714 if(spec && spec->type == 1)
16715 {
16716 exp->expType = MkClassType(spec->name);
16717 exp->expType->kind = 19;
16718 exp->byReference = 0x1;
16719 }
16720 else
16721 {
16722 exp->expType = MkClassType("ecere::com::Class");
16723 exp->byReference = 0x1;
16724 }
16725 break;
16726 }
16727 case 25:
16728 {
16729 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
16730
16731 if(_class)
16732 {
16733 struct Identifier * id = exp->classData.id;
16734 char structName[1024];
16735 struct Expression * classExp;
16736
16737 strcpy(structName, "__ecereClassData_");
16738 FullClassNameCat(structName, _class->fullName, 0x0);
16739 exp->type = 9;
16740 exp->member.member = id;
16741 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
16742 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
16743 else
16744 classExp = MkExpIdentifier(MkIdentifier("class"));
16745 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"))))))));
16746 ProcessExpressionType(exp);
16747 return ;
16748 }
16749 break;
16750 }
16751 case 35:
16752 {
16753 struct Type * type = (((void *)0));
16754 const char * typeString = (((void *)0));
16755 char typeStringBuf[1024];
16756
16757 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))
16758 {
16759 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
16760
16761 typeString = templateClass->templateArgs[2].dataTypeString;
16762 }
16763 else if(exp->list)
16764 {
16765 struct Expression * e;
16766
16767 for(e = (*exp->list).first; e; e = e->next)
16768 {
16769 ProcessExpressionType(e);
16770 if(e->expType)
16771 {
16772 if(!type)
16773 {
16774 type = e->expType;
16775 type->refCount++;
16776 }
16777 else
16778 {
16779 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0, 0x1))
16780 {
16781 FreeType(type);
16782 type = e->expType;
16783 e->expType = (((void *)0));
16784 e = (*exp->list).first;
16785 ProcessExpressionType(e);
16786 if(e->expType)
16787 {
16788 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0, 0x1))
16789 {
16790 FreeType(e->expType);
16791 e->expType = (((void *)0));
16792 FreeType(type);
16793 type = (((void *)0));
16794 break;
16795 }
16796 }
16797 }
16798 }
16799 if(e->expType)
16800 {
16801 FreeType(e->expType);
16802 e->expType = (((void *)0));
16803 }
16804 }
16805 }
16806 if(type)
16807 {
16808 typeStringBuf[0] = '\0';
16809 PrintTypeNoConst(type, typeStringBuf, 0x0, 0x1);
16810 typeString = typeStringBuf;
16811 FreeType(type);
16812 type = (((void *)0));
16813 }
16814 }
16815 if(typeString)
16816 {
16817 char templateString[1024];
16818 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
16819 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
16820 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16821 struct Expression * expExt;
16822 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
16823
16824 sprintf(templateString, "Container<%s>", typeString);
16825 if(exp->list)
16826 {
16827 struct Expression * e;
16828
16829 type = ProcessTypeString(typeString, 0x0);
16830 while(e = (*exp->list).first)
16831 {
16832 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
16833 e->destType = type;
16834 type->refCount++;
16835 ProcessExpressionType(e);
16836 ListAdd(initializers, MkInitializerAssignment(e));
16837 }
16838 FreeType(type);
16839 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
16840 }
16841 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
16842 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
16843 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16844 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
16845 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16846 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
16847 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16848 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
16849 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16850 ListAdd(structInitializers, MkInitializerAssignment(__extension__ ({
16851 struct Expression * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
16852
16853 __ecereInstance1->type = 2, __ecereInstance1->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, (void *)0), __ecereInstance1;
16854 })));
16855 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16856 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
16857 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16858 exp->expType = ProcessTypeString(templateString, 0x0);
16859 exp->type = 5;
16860 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
16861 ProcessExpressionType(expExt);
16862 }
16863 else
16864 {
16865 exp->expType = ProcessTypeString("Container", 0x0);
16866 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Couldn't determine type of array elements\n", (((void *)0))));
16867 }
16868 break;
16869 }
16870 }
16871 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
16872 {
16873 FreeType(exp->expType);
16874 exp->expType = ReplaceThisClassType(thisClass);
16875 }
16876 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
16877 {
16878 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
16879
16880 if(symbol)
16881 {
16882 if(exp->expType->kind != 15)
16883 {
16884 struct Type * member;
16885 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
16886
16887 FreeType(exp->expType);
16888 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16889 exp->expType->kind = symbol->type->kind;
16890 exp->expType->refCount++;
16891 exp->expType->enumName = enumName;
16892 exp->expType->members = symbol->type->members;
16893 for(member = symbol->type->members.first; member; member = member->next)
16894 member->refCount++;
16895 }
16896 else
16897 {
16898 struct __ecereNameSpace__ecere__sys__NamedLink * member;
16899
16900 for(member = symbol->type->members.first; member; member = member->next)
16901 {
16902 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(structSize_NamedLink), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
16903
16904 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
16905 }
16906 }
16907 }
16908 }
16909 yylloc = exp->loc;
16910 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
16911 ;
16912 else if(exp->destType && !exp->destType->keepCast)
16913 {
16914 if(!CheckExpressionType(exp, exp->destType, 0x0, !exp->destType->casted))
16915 {
16916 if(!exp->destType->count || unresolved)
16917 {
16918 if(!exp->expType)
16919 {
16920 yylloc = exp->loc;
16921 if(exp->destType->kind != 14)
16922 {
16923 char type2[1024];
16924
16925 type2[0] = '\0';
16926 if(inCompiler)
16927 {
16928 char expString[10240];
16929
16930 expString[0] = '\0';
16931 PrintType(exp->destType, type2, 0x0, 0x1);
16932 if(inCompiler)
16933 {
16934 PrintExpression(exp, expString);
16935 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16936 }
16937 if(unresolved)
16938 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
16939 else if(exp->type != 16)
16940 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
16941 }
16942 }
16943 else
16944 {
16945 char expString[10240];
16946
16947 expString[0] = '\0';
16948 if(inCompiler)
16949 {
16950 PrintExpression(exp, expString);
16951 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16952 }
16953 if(unresolved)
16954 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved identifier %s\n", (((void *)0))), expString);
16955 else if(exp->type != 16)
16956 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s\n", (((void *)0))), expString);
16957 }
16958 }
16959 else
16960 {
16961 char type1[1024];
16962 char type2[1024];
16963
16964 type1[0] = '\0';
16965 type2[0] = '\0';
16966 if(inCompiler)
16967 {
16968 PrintType(exp->expType, type1, 0x0, 0x1);
16969 PrintType(exp->destType, type2, 0x0, 0x1);
16970 }
16971 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)))
16972 ;
16973 else
16974 {
16975 char expString[10240];
16976
16977 expString[0] = '\0';
16978 if(inCompiler)
16979 {
16980 PrintExpression(exp, expString);
16981 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16982 }
16983 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
16984 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
16985 FreeType(exp->expType);
16986 exp->destType->refCount++;
16987 exp->expType = exp->destType;
16988 }
16989 }
16990 }
16991 }
16992 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
16993 {
16994 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
16995 char typeString[1024];
16996 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16997 struct Declarator * decl;
16998
16999 typeString[0] = '\0';
17000 *newExp = *exp;
17001 if(exp->expType)
17002 exp->expType->refCount++;
17003 if(exp->expType)
17004 exp->expType->refCount++;
17005 exp->type = 11;
17006 newExp->destType = exp->expType;
17007 PrintType(exp->expType, typeString, 0x0, 0x0);
17008 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
17009 exp->cast.typeName = MkTypeName(specs, decl);
17010 exp->cast.exp = newExp;
17011 }
17012 }
17013 else if(unresolved)
17014 {
17015 if(exp->identifier->_class && exp->identifier->_class->name)
17016 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
17017 else if(exp->identifier->string && exp->identifier->string[0])
17018 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
17019 }
17020 else if(!exp->expType && exp->type != 16)
17021 {
17022 char expString[10240];
17023
17024 expString[0] = '\0';
17025 if(inCompiler)
17026 {
17027 PrintExpression(exp, expString);
17028 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
17029 }
17030 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s\n", (((void *)0))), expString);
17031 }
17032 if(inCompiler)
17033 ApplyAnyObjectLogic(exp);
17034 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)))
17035 {
17036 exp->byReference = 0x1;
17037 }
17038 yylloc = oldyylloc;
17039 }
17040
17041 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)
17042 {
17043 if(*curMember)
17044 {
17045 *curMember = (*curMember)->next;
17046 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
17047 {
17048 *curMember = subMemberStack[--(*subMemberStackPos)];
17049 *curMember = (*curMember)->next;
17050 }
17051 while((*curMember) && (*curMember)->isProperty)
17052 *curMember = (*curMember)->next;
17053 if(subMemberStackPos)
17054 {
17055 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
17056 {
17057 subMemberStack[(*subMemberStackPos)++] = *curMember;
17058 *curMember = (*curMember)->members.first;
17059 while(*curMember && (*curMember)->isProperty)
17060 *curMember = (*curMember)->next;
17061 }
17062 }
17063 }
17064 while(!*curMember)
17065 {
17066 if(!*curMember)
17067 {
17068 if(subMemberStackPos && *subMemberStackPos)
17069 {
17070 *curMember = subMemberStack[--(*subMemberStackPos)];
17071 *curMember = (*curMember)->next;
17072 }
17073 else
17074 {
17075 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
17076
17077 if(*curClass == _class)
17078 break;
17079 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
17080 ;
17081 *curMember = (*curClass)->membersAndProperties.first;
17082 }
17083 while((*curMember) && (*curMember)->isProperty)
17084 *curMember = (*curMember)->next;
17085 if(subMemberStackPos)
17086 {
17087 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
17088 {
17089 subMemberStack[(*subMemberStackPos)++] = *curMember;
17090 *curMember = (*curMember)->members.first;
17091 while(*curMember && (*curMember)->isProperty)
17092 *curMember = (*curMember)->next;
17093 }
17094 }
17095 }
17096 }
17097 }
17098
17099 static void ProcessInitializer(struct Initializer * init, struct Type * type)
17100 {
17101 switch(init->type)
17102 {
17103 case 0:
17104 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
17105 {
17106 if(init->exp && !init->exp->destType)
17107 {
17108 FreeType(init->exp->destType);
17109 init->exp->destType = type;
17110 if(type)
17111 type->refCount++;
17112 }
17113 if(init->exp)
17114 {
17115 ProcessExpressionType(init->exp);
17116 init->isConstant = init->exp->isConstant;
17117 }
17118 break;
17119 }
17120 else
17121 {
17122 struct Expression * exp = init->exp;
17123 struct Instantiation * inst = exp->instance;
17124 struct MembersInit * members;
17125
17126 init->type = 1;
17127 init->list = MkList();
17128 if(inst->members)
17129 {
17130 for(members = (*inst->members).first; members; members = members->next)
17131 {
17132 if(members->type == 0)
17133 {
17134 struct MemberInit * member;
17135
17136 for(member = (*members->dataMembers).first; member; member = member->next)
17137 {
17138 ListAdd(init->list, member->initializer);
17139 member->initializer = (((void *)0));
17140 }
17141 }
17142 }
17143 }
17144 FreeExpression(exp);
17145 }
17146 case 1:
17147 {
17148 struct Initializer * i;
17149 struct Type * initializerType = (((void *)0));
17150 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
17151 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
17152 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
17153 int subMemberStackPos = 0;
17154
17155 if(type && type->kind == 12)
17156 initializerType = Dereference(type);
17157 else if(type && (type->kind == 9 || type->kind == 10))
17158 initializerType = type->members.first;
17159 for(i = (*init->list).first; i; i = i->next)
17160 {
17161 if(type && type->kind == 8 && type->_class && type->_class->registered)
17162 {
17163 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
17164 if(curMember)
17165 {
17166 if(!curMember->dataType)
17167 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
17168 initializerType = curMember->dataType;
17169 }
17170 }
17171 ProcessInitializer(i, initializerType);
17172 if(initializerType && type && (type->kind == 9 || type->kind == 10))
17173 initializerType = initializerType->next;
17174 if(!i->isConstant)
17175 init->isConstant = 0x0;
17176 }
17177 if(type && type->kind == 12)
17178 FreeType(initializerType);
17179 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
17180 {
17181 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Assigning list initializer to non list\n", (((void *)0))));
17182 }
17183 break;
17184 }
17185 }
17186 }
17187
17188 extern struct Symbol * FindType(struct Context * ctx, const char *  name);
17189
17190 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
17191
17192 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
17193 {
17194 switch(spec->type)
17195 {
17196 case 0:
17197 {
17198 if(spec->specifier == THISCLASS)
17199 {
17200 if(thisClass)
17201 {
17202 spec->type = 1;
17203 spec->name = ReplaceThisClass(thisClass);
17204 spec->symbol = FindClass(spec->name);
17205 ProcessSpecifier(spec, declareStruct);
17206 }
17207 }
17208 break;
17209 }
17210 case 1:
17211 {
17212 struct Symbol * symbol = FindType(curContext, spec->name);
17213
17214 if(symbol)
17215 DeclareType(symbol->type, 0x1, 0x1);
17216 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
17217 DeclareStruct(spec->name, 0x0);
17218 break;
17219 }
17220 case 2:
17221 {
17222 struct Enumerator * e;
17223
17224 if(spec->list)
17225 {
17226 for(e = (*spec->list).first; e; e = e->next)
17227 {
17228 if(e->exp)
17229 ProcessExpressionType(e->exp);
17230 }
17231 }
17232 break;
17233 }
17234 case 3:
17235 case 4:
17236 {
17237 if(spec->definitions)
17238 {
17239 struct ClassDef * def;
17240 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
17241
17242 ProcessClass(spec->definitions, symbol);
17243 }
17244 break;
17245 }
17246 }
17247 }
17248
17249 static void ProcessDeclarator(struct Declarator * decl)
17250 {
17251 switch(decl->type)
17252 {
17253 case 1:
17254 if(decl->identifier->classSym)
17255 {
17256 FreeSpecifier(decl->identifier->_class);
17257 decl->identifier->_class = (((void *)0));
17258 }
17259 break;
17260 case 3:
17261 if(decl->array.exp)
17262 ProcessExpressionType(decl->array.exp);
17263 case 0:
17264 case 2:
17265 case 4:
17266 case 5:
17267 case 6:
17268 case 7:
17269 if(decl->declarator)
17270 ProcessDeclarator(decl->declarator);
17271 if(decl->type == 4)
17272 {
17273 struct Identifier * id = GetDeclId(decl);
17274
17275 if(id && id->_class)
17276 {
17277 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
17278
17279 if(!decl->function.parameters)
17280 decl->function.parameters = MkList();
17281 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
17282 id->_class = (((void *)0));
17283 }
17284 if(decl->function.parameters)
17285 {
17286 struct TypeName * param;
17287
17288 for(param = (*decl->function.parameters).first; param; param = param->next)
17289 {
17290 if(param->qualifiers && (*param->qualifiers).first)
17291 {
17292 struct Specifier * spec = (*param->qualifiers).first;
17293
17294 if(spec && spec->specifier == TYPED_OBJECT)
17295 {
17296 struct Declarator * d = param->declarator;
17297 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);
17298
17299 if(d->type != 5)
17300 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*newParam->qualifiers), (((void *)0)), MkSpecifier(CONST));
17301 FreeList(param->qualifiers, FreeSpecifier);
17302 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
17303 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
17304 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
17305 param = newParam;
17306 }
17307 else if(spec && spec->specifier == ANY_OBJECT)
17308 {
17309 struct Declarator * d = param->declarator;
17310
17311 FreeList(param->qualifiers, FreeSpecifier);
17312 param->qualifiers = MkListOne(MkSpecifier(VOID));
17313 if(d->type != 5)
17314 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*param->qualifiers), (((void *)0)), MkSpecifier(CONST));
17315 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
17316 }
17317 else if(spec->specifier == THISCLASS)
17318 {
17319 if(thisClass)
17320 {
17321 spec->type = 1;
17322 spec->name = ReplaceThisClass(thisClass);
17323 spec->symbol = FindClass(spec->name);
17324 ProcessSpecifier(spec, 0x0);
17325 }
17326 }
17327 }
17328 if(param->declarator)
17329 ProcessDeclarator(param->declarator);
17330 }
17331 }
17332 }
17333 break;
17334 }
17335 }
17336
17337 extern struct Identifier * CopyIdentifier(struct Identifier * id);
17338
17339 extern void FreeInitDeclarator(struct InitDeclarator * decl);
17340
17341 static void ProcessDeclaration(struct Declaration * decl)
17342 {
17343 yylloc = decl->loc;
17344 switch(decl->type)
17345 {
17346 case 1:
17347 {
17348 unsigned int declareStruct = 0x0;
17349
17350 if(decl->declarators)
17351 {
17352 struct InitDeclarator * d;
17353
17354 for(d = (*decl->declarators).first; d; d = d->next)
17355 {
17356 struct Type * type, * subType;
17357
17358 ProcessDeclarator(d->declarator);
17359 type = ProcessType(decl->specifiers, d->declarator);
17360 if(d->initializer)
17361 {
17362 ProcessInitializer(d->initializer, type);
17363 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
17364 {
17365 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
17366 {
17367 struct Instantiation * inst = d->initializer->exp->instance;
17368
17369 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
17370 d->initializer->exp->instance = (((void *)0));
17371 if(decl->specifiers)
17372 FreeList(decl->specifiers, FreeSpecifier);
17373 FreeList(decl->declarators, FreeInitDeclarator);
17374 d = (((void *)0));
17375 decl->type = 2;
17376 decl->inst = inst;
17377 }
17378 }
17379 }
17380 for(subType = type; subType; )
17381 {
17382 if(subType->kind == 8)
17383 {
17384 declareStruct = 0x1;
17385 break;
17386 }
17387 else if(subType->kind == 13)
17388 break;
17389 else if(subType->kind == 12)
17390 subType = subType->arrayType;
17391 else
17392 break;
17393 }
17394 FreeType(type);
17395 if(!d)
17396 break;
17397 }
17398 }
17399 if(decl->specifiers)
17400 {
17401 struct Specifier * s;
17402
17403 for(s = (*decl->specifiers).first; s; s = s->next)
17404 {
17405 ProcessSpecifier(s, declareStruct);
17406 }
17407 }
17408 break;
17409 }
17410 case 2:
17411 {
17412 ProcessInstantiationType(decl->inst);
17413 break;
17414 }
17415 case 0:
17416 {
17417 struct Specifier * spec;
17418 struct Declarator * d;
17419 unsigned int declareStruct = 0x0;
17420
17421 if(decl->declarators)
17422 {
17423 for(d = (*decl->declarators).first; d; d = d->next)
17424 {
17425 struct Type * type = ProcessType(decl->specifiers, d->declarator);
17426 struct Type * subType;
17427
17428 ProcessDeclarator(d);
17429 for(subType = type; subType; )
17430 {
17431 if(subType->kind == 8)
17432 {
17433 declareStruct = 0x1;
17434 break;
17435 }
17436 else if(subType->kind == 13)
17437 break;
17438 else if(subType->kind == 12)
17439 subType = subType->arrayType;
17440 else
17441 break;
17442 }
17443 FreeType(type);
17444 }
17445 }
17446 if(decl->specifiers)
17447 {
17448 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
17449 ProcessSpecifier(spec, declareStruct);
17450 }
17451 break;
17452 }
17453 }
17454 }
17455
17456 static struct FunctionDefinition * curFunction;
17457
17458 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
17459 {
17460 char propName[1024], propNameM[1024];
17461 char getName[1024], setName[1024];
17462 struct __ecereNameSpace__ecere__sys__OldList * args;
17463
17464 DeclareProperty(prop, setName, getName);
17465 strcpy(propName, "__ecereProp_");
17466 FullClassNameCat(propName, prop->_class->fullName, 0x0);
17467 strcat(propName, "_");
17468 FullClassNameCat(propName, prop->name, 0x1);
17469 MangleClassName(propName);
17470 strcpy(propNameM, "__ecerePropM_");
17471 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
17472 strcat(propNameM, "_");
17473 FullClassNameCat(propNameM, prop->name, 0x1);
17474 MangleClassName(propNameM);
17475 if(prop->isWatchable)
17476 {
17477 args = MkList();
17478 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
17479 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
17480 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
17481 args = MkList();
17482 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
17483 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
17484 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
17485 }
17486 {
17487 args = MkList();
17488 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
17489 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
17490 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
17491 args = MkList();
17492 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
17493 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
17494 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
17495 }
17496 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
17497 curFunction->propSet->fireWatchersDone = 0x1;
17498 }
17499
17500 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
17501
17502 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
17503
17504 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
17505
17506 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
17507
17508 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
17509
17510 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
17511
17512 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
17513
17514 extern void FreePropertyWatch(struct PropertyWatch * watcher);
17515
17516 static void ProcessStatement(struct Statement * stmt)
17517 {
17518 yylloc = stmt->loc;
17519 switch(stmt->type)
17520 {
17521 case 0:
17522 ProcessStatement(stmt->labeled.stmt);
17523 break;
17524 case 1:
17525 if(stmt->caseStmt.exp)
17526 {
17527 FreeType(stmt->caseStmt.exp->destType);
17528 stmt->caseStmt.exp->destType = curSwitchType;
17529 if(curSwitchType)
17530 curSwitchType->refCount++;
17531 ProcessExpressionType(stmt->caseStmt.exp);
17532 ComputeExpression(stmt->caseStmt.exp);
17533 }
17534 if(stmt->caseStmt.stmt)
17535 ProcessStatement(stmt->caseStmt.stmt);
17536 break;
17537 case 2:
17538 {
17539 if(stmt->compound.context)
17540 {
17541 struct Declaration * decl;
17542 struct Statement * s;
17543 struct Statement * prevCompound = curCompound;
17544 struct Context * prevContext = curContext;
17545
17546 if(!stmt->compound.isSwitch)
17547 curCompound = stmt;
17548 curContext = stmt->compound.context;
17549 if(stmt->compound.declarations)
17550 {
17551 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
17552 ProcessDeclaration(decl);
17553 }
17554 if(stmt->compound.statements)
17555 {
17556 for(s = (*stmt->compound.statements).first; s; s = s->next)
17557 ProcessStatement(s);
17558 }
17559 curContext = prevContext;
17560 curCompound = prevCompound;
17561 }
17562 break;
17563 }
17564 case 3:
17565 {
17566 struct Expression * exp;
17567
17568 if(stmt->expressions)
17569 {
17570 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
17571 ProcessExpressionType(exp);
17572 }
17573 break;
17574 }
17575 case 4:
17576 {
17577 struct Expression * exp;
17578
17579 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
17580 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
17581 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
17582 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
17583 {
17584 ProcessExpressionType(exp);
17585 }
17586 if(stmt->ifStmt.stmt)
17587 ProcessStatement(stmt->ifStmt.stmt);
17588 if(stmt->ifStmt.elseStmt)
17589 ProcessStatement(stmt->ifStmt.elseStmt);
17590 break;
17591 }
17592 case 5:
17593 {
17594 struct Type * oldSwitchType = curSwitchType;
17595
17596 if(stmt->switchStmt.exp)
17597 {
17598 struct Expression * exp;
17599
17600 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
17601 {
17602 if(!exp->next)
17603 {
17604 ProcessExpressionType(exp);
17605 }
17606 if(!exp->next)
17607 curSwitchType = exp->expType;
17608 }
17609 }
17610 ProcessStatement(stmt->switchStmt.stmt);
17611 curSwitchType = oldSwitchType;
17612 break;
17613 }
17614 case 6:
17615 {
17616 if(stmt->whileStmt.exp)
17617 {
17618 struct Expression * exp;
17619
17620 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
17621 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
17622 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
17623 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
17624 {
17625 ProcessExpressionType(exp);
17626 }
17627 }
17628 if(stmt->whileStmt.stmt)
17629 ProcessStatement(stmt->whileStmt.stmt);
17630 break;
17631 }
17632 case 7:
17633 {
17634 if(stmt->doWhile.exp)
17635 {
17636 struct Expression * exp;
17637
17638 if((*stmt->doWhile.exp).last)
17639 {
17640 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
17641 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
17642 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
17643 }
17644 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
17645 {
17646 ProcessExpressionType(exp);
17647 }
17648 }
17649 if(stmt->doWhile.stmt)
17650 ProcessStatement(stmt->doWhile.stmt);
17651 break;
17652 }
17653 case 8:
17654 {
17655 struct Expression * exp;
17656
17657 if(stmt->forStmt.init)
17658 ProcessStatement(stmt->forStmt.init);
17659 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
17660 {
17661 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
17662 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
17663 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
17664 }
17665 if(stmt->forStmt.check)
17666 ProcessStatement(stmt->forStmt.check);
17667 if(stmt->forStmt.increment)
17668 {
17669 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
17670 ProcessExpressionType(exp);
17671 }
17672 if(stmt->forStmt.stmt)
17673 ProcessStatement(stmt->forStmt.stmt);
17674 break;
17675 }
17676 case 18:
17677 {
17678 struct Identifier * id = stmt->forEachStmt.id;
17679 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
17680 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
17681 struct Statement * block = stmt->forEachStmt.stmt;
17682 char iteratorType[1024];
17683 struct Type * source;
17684 struct Expression * e;
17685 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));
17686 struct Expression * arrayExp;
17687 const char * typeString = (((void *)0));
17688 int builtinCount = 0;
17689
17690 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
17691 {
17692 if(!e->next)
17693 {
17694 FreeType(e->destType);
17695 e->destType = ProcessTypeString("Container", 0x0);
17696 }
17697 if(!isBuiltin || e->next)
17698 ProcessExpressionType(e);
17699 }
17700 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
17701 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
17702 {
17703 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
17704 struct Symbol * symbol;
17705 struct Expression * expIt = (((void *)0));
17706 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0;
17707 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
17708 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
17709 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
17710
17711 stmt->type = 2;
17712 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
17713 stmt->compound.context->parent = curContext;
17714 curContext = stmt->compound.context;
17715 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
17716 {
17717 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
17718
17719 isCustomAVLTree = 0x1;
17720 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
17721 isMap = 0x1;
17722 }
17723 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
17724 isArray = 0x1;
17725 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
17726 {
17727 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
17728
17729 isLinkList = 0x1;
17730 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
17731 }
17732 if(isArray)
17733 {
17734 struct Declarator * decl;
17735 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
17736
17737 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
17738 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
17739 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
17740 }
17741 else if(isBuiltin)
17742 {
17743 struct Type * type = (((void *)0));
17744 char typeStringBuf[1024];
17745
17746 arrayExp = (((struct Expression *)(*exp).last)->type == 35) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
17747 if(((struct Expression *)(*exp).last)->type == 11)
17748 {
17749 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
17750
17751 if(typeName)
17752 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
17753 }
17754 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)
17755 {
17756 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
17757
17758 typeString = templateClass->templateArgs[2].dataTypeString;
17759 }
17760 else if(arrayExp->list)
17761 {
17762 struct Expression * e;
17763
17764 for(e = (*arrayExp->list).first; e; e = e->next)
17765 {
17766 ProcessExpressionType(e);
17767 if(e->expType)
17768 {
17769 if(!type)
17770 {
17771 type = e->expType;
17772 type->refCount++;
17773 }
17774 else
17775 {
17776 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0, 0x1))
17777 {
17778 FreeType(type);
17779 type = e->expType;
17780 e->expType = (((void *)0));
17781 e = (*arrayExp->list).first;
17782 ProcessExpressionType(e);
17783 if(e->expType)
17784 {
17785 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0, 0x1))
17786 {
17787 FreeType(e->expType);
17788 e->expType = (((void *)0));
17789 FreeType(type);
17790 type = (((void *)0));
17791 break;
17792 }
17793 }
17794 }
17795 }
17796 if(e->expType)
17797 {
17798 FreeType(e->expType);
17799 e->expType = (((void *)0));
17800 }
17801 }
17802 }
17803 if(type)
17804 {
17805 typeStringBuf[0] = '\0';
17806 PrintType(type, typeStringBuf, 0x0, 0x1);
17807 typeString = typeStringBuf;
17808 FreeType(type);
17809 }
17810 }
17811 if(typeString)
17812 {
17813 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
17814 struct Declarator * decl;
17815 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
17816
17817 if(arrayExp->list)
17818 {
17819 struct Expression * e;
17820
17821 builtinCount = (*arrayExp->list).count;
17822 type = ProcessTypeString(typeString, 0x0);
17823 while(e = (*arrayExp->list).first)
17824 {
17825 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
17826 e->destType = type;
17827 type->refCount++;
17828 ProcessExpressionType(e);
17829 ListAdd(initializers, MkInitializerAssignment(e));
17830 }
17831 FreeType(type);
17832 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
17833 }
17834 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
17835 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
17836 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(PlugDeclarator(decl, MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), (((void *)0)))), MkInitializerList(initializers)))));
17837 FreeList(exp, FreeExpression);
17838 }
17839 else
17840 {
17841 arrayExp->expType = ProcessTypeString("Container", 0x0);
17842 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Couldn't determine type of array elements\n", (((void *)0))));
17843 }
17844 }
17845 else if(isLinkList && !isList)
17846 {
17847 struct Declarator * decl;
17848 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
17849
17850 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
17851 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
17852 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
17853 }
17854 else if(_class->templateArgs)
17855 {
17856 if(isMap)
17857 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
17858 else
17859 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
17860 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
17861 }
17862 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
17863 if(block)
17864 {
17865 switch(block->type)
17866 {
17867 case 2:
17868 if(block->compound.context)
17869 block->compound.context->parent = stmt->compound.context;
17870 break;
17871 case 4:
17872 if(block->ifStmt.stmt && block->ifStmt.stmt->type == 2 && block->ifStmt.stmt->compound.context)
17873 block->ifStmt.stmt->compound.context->parent = stmt->compound.context;
17874 if(block->ifStmt.elseStmt && block->ifStmt.elseStmt->type == 2 && block->ifStmt.elseStmt->compound.context)
17875 block->ifStmt.elseStmt->compound.context->parent = stmt->compound.context;
17876 break;
17877 case 5:
17878 if(block->switchStmt.stmt && block->switchStmt.stmt->type == 2 && block->switchStmt.stmt->compound.context)
17879 block->switchStmt.stmt->compound.context->parent = stmt->compound.context;
17880 break;
17881 case 6:
17882 if(block->whileStmt.stmt && block->whileStmt.stmt->type == 2 && block->whileStmt.stmt->compound.context)
17883 block->whileStmt.stmt->compound.context->parent = stmt->compound.context;
17884 break;
17885 case 7:
17886 if(block->doWhile.stmt && block->doWhile.stmt->type == 2 && block->doWhile.stmt->compound.context)
17887 block->doWhile.stmt->compound.context->parent = stmt->compound.context;
17888 break;
17889 case 8:
17890 if(block->forStmt.stmt && block->forStmt.stmt->type == 2 && block->forStmt.stmt->compound.context)
17891 block->forStmt.stmt->compound.context->parent = stmt->compound.context;
17892 break;
17893 case 18:
17894 if(block->forEachStmt.stmt && block->forEachStmt.stmt->type == 2 && block->forEachStmt.stmt->compound.context)
17895 block->forEachStmt.stmt->compound.context->parent = stmt->compound.context;
17896 break;
17897 }
17898 }
17899 if(filter)
17900 {
17901 block = MkIfStmt(filter, block, (((void *)0)));
17902 }
17903 if(isArray)
17904 {
17905 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));
17906 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
17907 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
17908 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
17909 }
17910 else if(isBuiltin)
17911 {
17912 char count[128];
17913
17914 sprintf(count, "%d", builtinCount);
17915 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));
17916 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
17917 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
17918 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
17919 }
17920 else if(isLinkList && !isList)
17921 {
17922 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
17923 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
17924
17925 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
17926 {
17927 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));
17928 }
17929 else
17930 {
17931 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
17932 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
17933
17934 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));
17935 }
17936 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
17937 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
17938 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
17939 }
17940 else
17941 {
17942 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
17943 }
17944 ProcessExpressionType(expIt);
17945 if((*stmt->compound.declarations).first)
17946 ProcessDeclaration((*stmt->compound.declarations).first);
17947 if(symbol)
17948 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
17949 ProcessStatement(stmt);
17950 curContext = stmt->compound.context->parent;
17951 break;
17952 }
17953 else
17954 {
17955 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Expression is not a container\n", (((void *)0))));
17956 }
17957 break;
17958 }
17959 case 9:
17960 break;
17961 case 10:
17962 break;
17963 case 11:
17964 break;
17965 case 12:
17966 {
17967 struct Expression * exp;
17968
17969 if(stmt->expressions)
17970 {
17971 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
17972 {
17973 if(!exp->next)
17974 {
17975 if(curFunction && !curFunction->type)
17976 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
17977 FreeType(exp->destType);
17978 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
17979 if(exp->destType)
17980 exp->destType->refCount++;
17981 }
17982 ProcessExpressionType(exp);
17983 }
17984 }
17985 break;
17986 }
17987 case 14:
17988 {
17989 ProcessDeclaration(stmt->decl);
17990 break;
17991 }
17992 case 13:
17993 {
17994 struct AsmField * field;
17995
17996 if(stmt->asmStmt.inputFields)
17997 {
17998 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
17999 if(field->expression)
18000 ProcessExpressionType(field->expression);
18001 }
18002 if(stmt->asmStmt.outputFields)
18003 {
18004 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
18005 if(field->expression)
18006 ProcessExpressionType(field->expression);
18007 }
18008 if(stmt->asmStmt.clobberedFields)
18009 {
18010 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
18011 {
18012 if(field->expression)
18013 ProcessExpressionType(field->expression);
18014 }
18015 }
18016 break;
18017 }
18018 case 17:
18019 {
18020 struct PropertyWatch * propWatch;
18021 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
18022 struct Expression * object = stmt->_watch.object;
18023 struct Expression * watcher = stmt->_watch.watcher;
18024
18025 if(watcher)
18026 ProcessExpressionType(watcher);
18027 if(object)
18028 ProcessExpressionType(object);
18029 if(inCompiler)
18030 {
18031 if(watcher || thisClass)
18032 {
18033 struct External * external = curExternal;
18034 struct Context * context = curContext;
18035
18036 stmt->type = 3;
18037 stmt->expressions = MkList();
18038 curExternal = external->prev;
18039 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
18040 {
18041 struct ClassFunction * func;
18042 char watcherName[1024];
18043 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
18044 struct External * createdExternal;
18045 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
18046
18047 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
18048 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
18049 if(propWatch->deleteWatch)
18050 strcat(watcherName, "_delete");
18051 else
18052 {
18053 struct Identifier * propID;
18054
18055 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
18056 {
18057 strcat(watcherName, "_");
18058 strcat(watcherName, propID->string);
18059 }
18060 }
18061 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
18062 {
18063 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
18064 ProcessClassFunctionBody(func, propWatch->compound);
18065 propWatch->compound = (((void *)0));
18066 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
18067 createdExternal->symbol->idCode = external->symbol->idCode;
18068 curExternal = createdExternal;
18069 ProcessFunction(createdExternal->function);
18070 {
18071 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
18072
18073 externalDecl->declaration = decl;
18074 if(decl->symbol && !decl->symbol->pointerExternal)
18075 decl->symbol->pointerExternal = externalDecl;
18076 }
18077 if(propWatch->deleteWatch)
18078 {
18079 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
18080
18081 ListAdd(args, CopyExpression(object));
18082 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
18083 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
18084 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
18085 }
18086 else
18087 {
18088 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
18089 struct Identifier * propID;
18090
18091 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
18092 {
18093 char propName[1024];
18094 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
18095
18096 if(prop)
18097 {
18098 char getName[1024], setName[1024];
18099 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
18100
18101 DeclareProperty(prop, setName, getName);
18102 strcpy(propName, "__ecereProp_");
18103 FullClassNameCat(propName, prop->_class->fullName, 0x0);
18104 strcat(propName, "_");
18105 FullClassNameCat(propName, prop->name, 0x1);
18106 ListAdd(args, CopyExpression(object));
18107 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
18108 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
18109 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
18110 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
18111 }
18112 else
18113 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
18114 }
18115 }
18116 }
18117 else
18118 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Invalid watched object\n", (((void *)0))));
18119 }
18120 curExternal = external;
18121 curContext = context;
18122 if(watcher)
18123 FreeExpression(watcher);
18124 if(object)
18125 FreeExpression(object);
18126 FreeList(watches, FreePropertyWatch);
18127 }
18128 else
18129 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "No observer specified and not inside a _class\n", (((void *)0))));
18130 }
18131 else
18132 {
18133 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
18134 {
18135 ProcessStatement(propWatch->compound);
18136 }
18137 }
18138 break;
18139 }
18140 case 15:
18141 {
18142 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
18143 struct Expression * object = stmt->_watch.object;
18144 struct __ecereNameSpace__ecere__com__Class * _class;
18145
18146 if(object)
18147 ProcessExpressionType(object);
18148 if(inCompiler)
18149 {
18150 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
18151 if(_class)
18152 {
18153 struct Identifier * propID;
18154
18155 stmt->type = 3;
18156 stmt->expressions = MkList();
18157 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
18158 {
18159 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
18160 }
18161 else if(!watches)
18162 {
18163 }
18164 if(watches)
18165 {
18166 for(propID = (*watches).first; propID; propID = propID->next)
18167 {
18168 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
18169
18170 if(prop)
18171 {
18172 CreateFireWatcher(prop, object, stmt);
18173 }
18174 else
18175 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
18176 }
18177 }
18178 else
18179 {
18180 struct __ecereNameSpace__ecere__com__Property * prop;
18181 struct __ecereNameSpace__ecere__com__Class * base;
18182
18183 for(base = _class; base; base = base->base)
18184 {
18185 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
18186 {
18187 if(prop->isProperty && prop->isWatchable)
18188 {
18189 CreateFireWatcher(prop, object, stmt);
18190 }
18191 }
18192 }
18193 }
18194 if(object)
18195 FreeExpression(object);
18196 FreeList(watches, FreeIdentifier);
18197 }
18198 else
18199 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Invalid object specified and not inside a class\n", (((void *)0))));
18200 }
18201 break;
18202 }
18203 case 16:
18204 {
18205 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
18206 struct Expression * object = stmt->_watch.object;
18207 struct Expression * watcher = stmt->_watch.watcher;
18208 struct __ecereNameSpace__ecere__com__Class * _class;
18209
18210 if(object)
18211 ProcessExpressionType(object);
18212 if(watcher)
18213 ProcessExpressionType(watcher);
18214 if(inCompiler)
18215 {
18216 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
18217 if(watcher || thisClass)
18218 {
18219 if(_class)
18220 {
18221 struct Identifier * propID;
18222
18223 stmt->type = 3;
18224 stmt->expressions = MkList();
18225 if(!watches)
18226 {
18227 struct __ecereNameSpace__ecere__sys__OldList * args;
18228
18229 args = MkList();
18230 ListAdd(args, CopyExpression(object));
18231 ListAdd(args, MkExpConstant("0"));
18232 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
18233 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
18234 }
18235 else
18236 {
18237 for(propID = (*watches).first; propID; propID = propID->next)
18238 {
18239 char propName[1024];
18240 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
18241
18242 if(prop)
18243 {
18244 char getName[1024], setName[1024];
18245 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
18246
18247 DeclareProperty(prop, setName, getName);
18248 strcpy(propName, "__ecereProp_");
18249 FullClassNameCat(propName, prop->_class->fullName, 0x0);
18250 strcat(propName, "_");
18251 FullClassNameCat(propName, prop->name, 0x1);
18252 MangleClassName(propName);
18253 ListAdd(args, CopyExpression(object));
18254 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
18255 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
18256 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
18257 }
18258 else
18259 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
18260 }
18261 }
18262 if(object)
18263 FreeExpression(object);
18264 if(watcher)
18265 FreeExpression(watcher);
18266 FreeList(watches, FreeIdentifier);
18267 }
18268 else
18269 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Invalid object specified and not inside a class\n", (((void *)0))));
18270 }
18271 else
18272 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "No observer specified and not inside a class\n", (((void *)0))));
18273 }
18274 break;
18275 }
18276 }
18277 }
18278
18279 extern struct Expression * QBrackets(struct Expression * exp);
18280
18281 extern struct TypeName * QMkType(const char *  spec, struct Declarator * decl);
18282
18283 extern struct Declarator * QMkPtrDecl(const char *  id);
18284
18285 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
18286
18287 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
18288
18289 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
18290
18291 static void ProcessFunction(struct FunctionDefinition * function)
18292 {
18293 struct Identifier * id = GetDeclId(function->declarator);
18294 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
18295 struct Type * type = symbol ? symbol->type : (((void *)0));
18296 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
18297 struct Context * oldTopContext = topContext;
18298
18299 yylloc = function->loc;
18300 if(type && type->thisClass)
18301 {
18302 struct Symbol * classSym = type->thisClass;
18303 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
18304 char className[1024];
18305 char structName[1024];
18306 struct Declarator * funcDecl;
18307 struct Symbol * thisSymbol;
18308 unsigned int typedObject = 0x0;
18309
18310 if(_class && !_class->base)
18311 {
18312 _class = currentClass;
18313 if(_class && !_class->symbol)
18314 _class->symbol = FindClass(_class->fullName);
18315 classSym = _class ? _class->symbol : (((void *)0));
18316 typedObject = 0x1;
18317 }
18318 thisClass = _class;
18319 if(inCompiler && _class)
18320 {
18321 if(type->kind == 11)
18322 {
18323 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
18324 {
18325 struct Type * param = symbol->type->params.first;
18326
18327 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
18328 FreeType(param);
18329 }
18330 if(type->classObjectType != 1)
18331 {
18332 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
18333 symbol->type->staticMethod = 0x1;
18334 symbol->type->thisClass = (((void *)0));
18335 symbol->type->extraParam = 0x0;
18336 }
18337 }
18338 strcpy(className, "__ecereClass_");
18339 FullClassNameCat(className, _class->fullName, 0x1);
18340 MangleClassName(className);
18341 structName[0] = (char)0;
18342 FullClassNameCat(structName, _class->fullName, 0x0);
18343 funcDecl = GetFuncDecl(function->declarator);
18344 if(funcDecl)
18345 {
18346 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
18347 {
18348 struct TypeName * param = (*funcDecl->function.parameters).first;
18349
18350 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
18351 {
18352 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
18353 FreeTypeName(param);
18354 }
18355 }
18356 if(!function->propertyNoThis)
18357 {
18358 struct TypeName * thisParam;
18359
18360 if(type->classObjectType != 1)
18361 {
18362 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
18363 if(!funcDecl->function.parameters)
18364 funcDecl->function.parameters = MkList();
18365 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
18366 }
18367 if(typedObject)
18368 {
18369 if(type->classObjectType != 1)
18370 {
18371 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
18372 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
18373 }
18374 thisParam = __extension__ ({
18375 struct TypeName * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName);
18376
18377 __ecereInstance1->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), __ecereInstance1->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), __ecereInstance1;
18378 });
18379 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
18380 }
18381 }
18382 }
18383 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
18384 {
18385 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
18386
18387 funcDecl = GetFuncDecl(initDecl->declarator);
18388 if(funcDecl)
18389 {
18390 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
18391 {
18392 struct TypeName * param = (*funcDecl->function.parameters).first;
18393
18394 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
18395 {
18396 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
18397 FreeTypeName(param);
18398 }
18399 }
18400 if(type->classObjectType != 1)
18401 {
18402 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
18403 {
18404 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
18405
18406 if(!funcDecl->function.parameters)
18407 funcDecl->function.parameters = MkList();
18408 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
18409 }
18410 }
18411 }
18412 }
18413 }
18414 if(function->body)
18415 {
18416 if(type->classObjectType != 1)
18417 {
18418 thisSymbol = __extension__ ({
18419 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
18420
18421 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("this"), __ecereInstance1->type = classSym ? MkClassType(classSym->string) : (((void *)0)), __ecereInstance1;
18422 });
18423 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18424 if(typedObject && thisSymbol->type)
18425 {
18426 thisSymbol->type->classObjectType = 2;
18427 thisSymbol->type->byReference = type->byReference;
18428 thisSymbol->type->typedByReference = type->byReference;
18429 }
18430 }
18431 }
18432 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
18433 {
18434 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
18435
18436 {
18437 struct __ecereNameSpace__ecere__com__Class * base;
18438
18439 for(base = _class; base && base->type != 1000; base = base->next)
18440 {
18441 for(member = base->membersAndProperties.first; member; member = member->next)
18442 if(!member->isProperty)
18443 break;
18444 if(member)
18445 break;
18446 }
18447 }
18448 for(member = _class->membersAndProperties.first; member; member = member->next)
18449 if(!member->isProperty)
18450 break;
18451 if(member)
18452 {
18453 char pointerName[1024];
18454 struct Declaration * decl;
18455 struct Initializer * initializer;
18456 struct Expression * exp, * bytePtr;
18457
18458 strcpy(pointerName, "__ecerePointer_");
18459 FullClassNameCat(pointerName, _class->fullName, 0x0);
18460 {
18461 char className[1024];
18462
18463 strcpy(className, "__ecereClass_");
18464 FullClassNameCat(className, classSym->string, 0x1);
18465 MangleClassName(className);
18466 DeclareClass(classSym, className);
18467 }
18468 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
18469 if(_class->fixed)
18470 {
18471 char string[256];
18472
18473 sprintf(string, "%d", _class->offset);
18474 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
18475 }
18476 else
18477 {
18478 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
18479 }
18480 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
18481 exp->expType = __extension__ ({
18482 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
18483
18484 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
18485 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
18486
18487 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 0, __ecereInstance1;
18488 }), __ecereInstance2;
18489 });
18490 if(function->body)
18491 {
18492 yylloc = function->body->loc;
18493 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
18494 {
18495 struct Context * prevContext = curContext;
18496
18497 curContext = function->body->compound.context;
18498 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
18499 curContext = prevContext;
18500 }
18501 decl->symbol = (((void *)0));
18502 if(!function->body->compound.declarations)
18503 function->body->compound.declarations = MkList();
18504 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
18505 }
18506 }
18507 }
18508 }
18509 else
18510 thisClass = (((void *)0));
18511 if(id)
18512 {
18513 FreeSpecifier(id->_class);
18514 id->_class = (((void *)0));
18515 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
18516 {
18517 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
18518
18519 id = GetDeclId(initDecl->declarator);
18520 FreeSpecifier(id->_class);
18521 id->_class = (((void *)0));
18522 }
18523 }
18524 if(function->body)
18525 topContext = function->body->compound.context;
18526 {
18527 struct FunctionDefinition * oldFunction = curFunction;
18528
18529 curFunction = function;
18530 if(function->body)
18531 ProcessStatement(function->body);
18532 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
18533 {
18534 struct Statement * prevCompound = curCompound;
18535 struct Context * prevContext = curContext;
18536 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
18537
18538 if(!function->body->compound.statements)
18539 function->body->compound.statements = MkList();
18540 ListAdd(function->body->compound.statements, fireWatchers);
18541 curCompound = function->body;
18542 curContext = function->body->compound.context;
18543 ProcessStatement(fireWatchers);
18544 curContext = prevContext;
18545 curCompound = prevCompound;
18546 }
18547 curFunction = oldFunction;
18548 }
18549 if(function->declarator)
18550 {
18551 ProcessDeclarator(function->declarator);
18552 }
18553 topContext = oldTopContext;
18554 thisClass = oldThisClass;
18555 }
18556
18557 extern void FreeSymbol(struct Symbol * symbol);
18558
18559 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
18560
18561 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
18562 {
18563 struct ClassDef * def;
18564 struct External * external = curExternal;
18565 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
18566
18567 for(def = definitions->first; def; def = def->next)
18568 {
18569 if(def->type == 0)
18570 {
18571 if(def->function->declarator)
18572 curExternal = def->function->declarator->symbol->pointerExternal;
18573 else
18574 curExternal = external;
18575 ProcessFunction((struct FunctionDefinition *)def->function);
18576 }
18577 else if(def->type == 2)
18578 {
18579 if(def->decl->type == 2)
18580 {
18581 thisClass = regClass;
18582 ProcessInstantiationType(def->decl->inst);
18583 thisClass = (((void *)0));
18584 }
18585 else
18586 {
18587 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
18588
18589 if(regClass)
18590 thisClass = regClass;
18591 ProcessDeclaration(def->decl);
18592 thisClass = backThisClass;
18593 }
18594 }
18595 else if(def->type == 1 && def->defProperties)
18596 {
18597 struct MemberInit * defProperty;
18598 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);
18599
18600 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18601 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
18602 {
18603 thisClass = regClass;
18604 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
18605 thisClass = (((void *)0));
18606 }
18607 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18608 FreeSymbol(thisSymbol);
18609 }
18610 else if(def->type == 3 && def->propertyDef)
18611 {
18612 struct PropertyDef * prop = def->propertyDef;
18613
18614 thisClass = regClass;
18615 if(prop->setStmt)
18616 {
18617 if(regClass)
18618 {
18619 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
18620
18621 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18622 }
18623 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
18624 ProcessStatement(prop->setStmt);
18625 }
18626 if(prop->getStmt)
18627 {
18628 if(regClass)
18629 {
18630 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
18631
18632 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18633 }
18634 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
18635 ProcessStatement(prop->getStmt);
18636 }
18637 if(prop->issetStmt)
18638 {
18639 if(regClass)
18640 {
18641 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
18642
18643 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18644 }
18645 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
18646 ProcessStatement(prop->issetStmt);
18647 }
18648 thisClass = (((void *)0));
18649 }
18650 else if(def->type == 4 && def->propertyWatch)
18651 {
18652 struct PropertyWatch * propertyWatch = def->propertyWatch;
18653
18654 thisClass = regClass;
18655 if(propertyWatch->compound)
18656 {
18657 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);
18658
18659 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18660 curExternal = (((void *)0));
18661 ProcessStatement(propertyWatch->compound);
18662 }
18663 thisClass = (((void *)0));
18664 }
18665 }
18666 }
18667
18668 void DeclareFunctionUtil(const char * s)
18669 {
18670 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
18671
18672 if(function)
18673 {
18674 char name[1024];
18675
18676 name[0] = (char)0;
18677 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
18678 strcpy(name, "__ecereFunction_");
18679 FullClassNameCat(name, s, 0x0);
18680 DeclareFunction(function, name);
18681 }
18682 }
18683
18684 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
18685
18686 void ComputeDataTypes()
18687 {
18688 struct External * external;
18689 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
18690 struct External * after = (((void *)0));
18691
18692 currentClass = (((void *)0));
18693 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
18694 for(external = (*ast).first; external; external = external->next)
18695 {
18696 if(external->type == 1)
18697 {
18698 struct Declaration * decl = external->declaration;
18699
18700 if(decl)
18701 {
18702 struct __ecereNameSpace__ecere__sys__OldList * decls = decl->declarators;
18703
18704 if(decls)
18705 {
18706 struct InitDeclarator * initDecl = (*decls).first;
18707
18708 if(initDecl)
18709 {
18710 struct Declarator * declarator = initDecl->declarator;
18711
18712 if(declarator && declarator->type == 1)
18713 {
18714 struct Identifier * id = declarator->identifier;
18715
18716 if(id && id->string)
18717 {
18718 if(!strcmp(id->string, "uintptr_t") || !strcmp(id->string, "intptr_t") || !strcmp(id->string, "size_t") || !strcmp(id->string, "ssize_t"))
18719 {
18720 external->symbol->id = -1001, external->symbol->idCode = -1001;
18721 after = external;
18722 }
18723 }
18724 }
18725 }
18726 }
18727 }
18728 }
18729 }
18730 temp->symbol = __extension__ ({
18731 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
18732
18733 __ecereInstance1->id = -1000, __ecereInstance1->idCode = -1000, __ecereInstance1;
18734 });
18735 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), after, temp);
18736 curExternal = temp;
18737 DeclareFunctionUtil("eSystem_New");
18738 DeclareFunctionUtil("eSystem_New0");
18739 DeclareFunctionUtil("eSystem_Renew");
18740 DeclareFunctionUtil("eSystem_Renew0");
18741 DeclareFunctionUtil("eSystem_Delete");
18742 DeclareFunctionUtil("eClass_GetProperty");
18743 DeclareFunctionUtil("eClass_SetProperty");
18744 DeclareFunctionUtil("eInstance_FireSelfWatchers");
18745 DeclareFunctionUtil("eInstance_SetMethod");
18746 DeclareFunctionUtil("eInstance_IncRef");
18747 DeclareFunctionUtil("eInstance_StopWatching");
18748 DeclareFunctionUtil("eInstance_Watch");
18749 DeclareFunctionUtil("eInstance_FireWatchers");
18750 DeclareStruct("ecere::com::Class", 0x0);
18751 DeclareStruct("ecere::com::Instance", 0x0);
18752 DeclareStruct("ecere::com::Property", 0x0);
18753 DeclareStruct("ecere::com::DataMember", 0x0);
18754 DeclareStruct("ecere::com::Method", 0x0);
18755 DeclareStruct("ecere::com::SerialBuffer", 0x0);
18756 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
18757 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
18758 for(external = (*ast).first; external; external = external->next)
18759 {
18760 afterExternal = curExternal = external;
18761 if(external->type == 0)
18762 {
18763 currentClass = external->function->_class;
18764 ProcessFunction(external->function);
18765 }
18766 else if(external->type == 1)
18767 {
18768 currentClass = (((void *)0));
18769 if(external->declaration)
18770 ProcessDeclaration(external->declaration);
18771 }
18772 else if(external->type == 2)
18773 {
18774 struct ClassDefinition * _class = external->_class;
18775
18776 currentClass = external->symbol->registered;
18777 if(_class->definitions)
18778 {
18779 ProcessClass(_class->definitions, _class->symbol);
18780 }
18781 if(inCompiler)
18782 {
18783 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
18784 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor((void *)external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
18785 }
18786 }
18787 else if(external->type == 4)
18788 {
18789 thisNameSpace = external->id->string;
18790 }
18791 }
18792 currentClass = (((void *)0));
18793 thisNameSpace = (((void *)0));
18794 curExternal = (((void *)0));
18795 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor((void *)temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
18796 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor((void *)temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
18797 }
18798
18799 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_RegisterFunction(const char *  name, const char *  type, void *  func, struct __ecereNameSpace__ecere__com__Instance * module, int declMode);
18800
18801 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, const char *  name, const char *  baseName, int size, int sizeClass, unsigned int (*  Constructor)(void * ), void (*  Destructor)(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
18802
18803 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
18804
18805 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
18806 {
18807 struct __ecereNameSpace__ecere__com__Class * class;
18808
18809 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
18810 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
18811 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
18812 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
18813 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
18814 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
18815 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
18816 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
18817 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
18818 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
18819 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
18820 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
18821 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
18822 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
18823 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
18824 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
18825 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
18826 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
18827 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpInt", "bool GetOpInt(Operand op2, int * value2)", GetOpInt, module, 1);
18828 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
18829 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUInt", "bool GetOpUInt(Operand op2, uint * value2)", GetOpUInt, module, 1);
18830 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
18831 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpInt64", "bool GetOpInt64(Operand op2, int64 * value2)", GetOpInt64, module, 1);
18832 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
18833 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUInt64", "bool GetOpUInt64(Operand op2, uint64 * value2)", GetOpUInt64, module, 1);
18834 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
18835 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpIntPtr", "bool GetOpIntPtr(Operand op2, intptr * value2)", GetOpIntPtr, module, 1);
18836 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
18837 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUIntPtr", "bool GetOpUIntPtr(Operand op2, uintptr * value2)", GetOpUIntPtr, module, 1);
18838 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
18839 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpIntSize", "bool GetOpIntSize(Operand op2, intsize * value2)", GetOpIntSize, module, 1);
18840 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntSize", "bool GetIntSize(Expression exp, intsize * value2)", GetIntSize, module, 1);
18841 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUIntSize", "bool GetOpUIntSize(Operand op2, uintsize * value2)", GetOpUIntSize, module, 1);
18842 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntSize", "bool GetUIntSize(Expression exp, uintsize * value2)", GetUIntSize, module, 1);
18843 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpShort", "bool GetOpShort(Operand op2, short * value2)", GetOpShort, module, 1);
18844 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
18845 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUShort", "bool GetOpUShort(Operand op2, uint16 * value2)", GetOpUShort, module, 1);
18846 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
18847 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpChar", "bool GetOpChar(Operand op2, char * value2)", GetOpChar, module, 1);
18848 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
18849 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUChar", "bool GetOpUChar(Operand op2, byte * value2)", GetOpUChar, module, 1);
18850 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
18851 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpFloat", "bool GetOpFloat(Operand op2, float * value2)", GetOpFloat, module, 1);
18852 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
18853 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpDouble", "bool GetOpDouble(Operand op2, double * value2)", GetOpDouble, module, 1);
18854 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
18855 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
18856 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
18857 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
18858 __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);
18859 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(const char * name, bool skipNoHead)", DeclareStruct, module, 2);
18860 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
18861 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
18862 __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);
18863 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
18864 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
18865 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
18866 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
18867 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
18868 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
18869 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, const char * name)", DeclareMethod, module, 1);
18870 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
18871 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
18872 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
18873 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
18874 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
18875 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
18876 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
18877 __ecereClass_Conversion = class;
18878 __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, bool warnConst)", MatchTypes, module, 1);
18879 __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);
18880 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
18881 __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);
18882 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla, bool warnConst)", MatchTypeExpression, module, 2);
18883 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
18884 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("UnescapeString", "int UnescapeString(char * d, char * s, int len)", UnescapeString, module, 1);
18885 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("OffsetEscapedString", "char * OffsetEscapedString(char * s, int len, int offset)", OffsetEscapedString, module, 1);
18886 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
18887 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
18888 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
18889 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
18890 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
18891 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
18892 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(const char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
18893 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
18894 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintTypeNoConst", "void PrintTypeNoConst(Type type, char * string, bool printName, bool fullName)", PrintTypeNoConst, module, 1);
18895 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
18896 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetParseError", "bool GetParseError(void)", GetParseError, module, 1);
18897 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
18898 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
18899 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
18900 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyLocation", "void ApplyLocation(Expression exp, Location loc)", ApplyLocation, module, 1);
18901 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
18902 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(const String s)", DeclareFunctionUtil, module, 1);
18903 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
18904 }
18905
18906 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
18907 {
18908
18909 }
18910