539f7db693166658c4e19419e1dfdbc77709f334
[sdk] / compiler / bootstrap / libec / bootstrap / pass15.c
1 /* Code generated from eC source file: pass15.ec */
2 #if defined(__GNUC__)
3 typedef long long int64;
4 typedef unsigned long long uint64;
5 #ifndef _WIN32
6 #define __declspec(x)
7 #endif
8 #elif defined(__TINYC__)
9 #include <stdarg.h>
10 #define __builtin_va_list va_list
11 #define __builtin_va_start va_start
12 #define __builtin_va_end va_end
13 #ifdef _WIN32
14 #define strcasecmp stricmp
15 #define strncasecmp strnicmp
16 #define __declspec(x) __attribute__((x))
17 #else
18 #define __declspec(x)
19 #endif
20 typedef long long int64;
21 typedef unsigned long long uint64;
22 #else
23 typedef __int64 int64;
24 typedef unsigned __int64 uint64;
25 #endif
26 #ifdef __BIG_ENDIAN__
27 #define __ENDIAN_PAD(x) (8 - (x))
28 #else
29 #define __ENDIAN_PAD(x) 0
30 #endif
31 #include <stdint.h>
32 #include <sys/types.h>
33
34 #if /*defined(_W64) || */(defined(__WORDSIZE) && __WORDSIZE == 8) || defined(__x86_64__)
35 #define _64BIT 1
36 #else
37 #define _64BIT 0
38 #endif
39
40 #define arch_PointerSize                  sizeof(void *)
41 #define structSize_Instance               (_64BIT ? 24 : 12)
42 #define structSize_Module                 (_64BIT ? 560 : 300)
43 #define structSize_NamedLink              (_64BIT ? 32 : 16)
44
45 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
46
47 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
48
49 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
50
51 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
52
53 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
54
55 struct __ecereNameSpace__ecere__sys__BTNode;
56
57 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;
58
59 struct __ecereNameSpace__ecere__sys__BinaryTree
60 {
61 struct __ecereNameSpace__ecere__sys__BTNode * root;
62 int count;
63 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
64 void (*  FreeKey)(void *  key);
65 } __attribute__ ((gcc_struct));
66
67 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;
68
69 struct __ecereNameSpace__ecere__sys__OldList
70 {
71 void *  first;
72 void *  last;
73 int count;
74 unsigned int offset;
75 unsigned int circ;
76 } __attribute__ ((gcc_struct));
77
78 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;
79
80 struct __ecereNameSpace__ecere__com__Method
81 {
82 char *  name;
83 struct __ecereNameSpace__ecere__com__Method * parent;
84 struct __ecereNameSpace__ecere__com__Method * left;
85 struct __ecereNameSpace__ecere__com__Method * right;
86 int depth;
87 int (*  function)();
88 int vid;
89 int type;
90 struct __ecereNameSpace__ecere__com__Class * _class;
91 void *  symbol;
92 char *  dataTypeString;
93 struct Type * dataType;
94 int memberAccess;
95 } __attribute__ ((gcc_struct));
96
97 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;
98
99 struct __ecereNameSpace__ecere__com__Property
100 {
101 struct __ecereNameSpace__ecere__com__Property * prev;
102 struct __ecereNameSpace__ecere__com__Property * next;
103 char *  name;
104 unsigned int isProperty;
105 int memberAccess;
106 int id;
107 struct __ecereNameSpace__ecere__com__Class * _class;
108 char *  dataTypeString;
109 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
110 struct Type * dataType;
111 void (*  Set)(void * , int);
112 int (*  Get)(void * );
113 unsigned int (*  IsSet)(void * );
114 void *  data;
115 void *  symbol;
116 int vid;
117 unsigned int conversion;
118 unsigned int watcherOffset;
119 char *  category;
120 unsigned int compiled;
121 unsigned int selfWatchable;
122 unsigned int isWatchable;
123 } __attribute__ ((gcc_struct));
124
125 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
126
127 struct CodePosition
128 {
129 int line;
130 int charPos;
131 int pos;
132 int included;
133 } __attribute__ ((gcc_struct));
134
135 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
136
137 struct Location
138 {
139 struct CodePosition start;
140 struct CodePosition end;
141 } __attribute__ ((gcc_struct));
142
143 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attrib;
144
145 struct Attrib;
146
147 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ExtDecl;
148
149 struct ExtDecl
150 {
151 struct Location loc;
152 int type;
153 union
154 {
155 char * s;
156 struct Attrib * attr;
157 } __attribute__ ((gcc_struct));
158 } __attribute__ ((gcc_struct));
159
160 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
161
162 struct ClassDefinition
163 {
164 struct ClassDefinition * prev;
165 struct ClassDefinition * next;
166 struct Location loc;
167 struct Specifier * _class;
168 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
169 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
170 struct Symbol * symbol;
171 struct Location blockStart;
172 struct Location nameLoc;
173 int endid;
174 int declMode;
175 unsigned int deleteWatchable;
176 } __attribute__ ((gcc_struct));
177
178 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
179
180 struct Context
181 {
182 struct Context * parent;
183 struct __ecereNameSpace__ecere__sys__BinaryTree types;
184 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
185 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
186 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
187 int nextID;
188 int simpleID;
189 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
190 struct ClassDefinition * classDef;
191 unsigned int templateTypesOnly;
192 unsigned int hasNameSpace;
193 } __attribute__ ((gcc_struct));
194
195 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
196
197 struct Instantiation
198 {
199 struct Instantiation * prev;
200 struct Instantiation * next;
201 struct Location loc;
202 struct Specifier * _class;
203 struct Expression * exp;
204 struct __ecereNameSpace__ecere__sys__OldList *  members;
205 struct Symbol * symbol;
206 unsigned int fullSet;
207 unsigned int isConstant;
208 unsigned char *  data;
209 struct Location nameLoc;
210 struct Location insideLoc;
211 unsigned int built;
212 } __attribute__ ((gcc_struct));
213
214 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
215
216 struct Declaration
217 {
218 struct Declaration * prev;
219 struct Declaration * next;
220 struct Location loc;
221 int type;
222 union
223 {
224 struct
225 {
226 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
227 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
228 } __attribute__ ((gcc_struct));
229 struct Instantiation * inst;
230 struct
231 {
232 struct Identifier * id;
233 struct Expression * exp;
234 } __attribute__ ((gcc_struct));
235 } __attribute__ ((gcc_struct));
236 struct Specifier * extStorage;
237 struct Symbol * symbol;
238 int declMode;
239 } __attribute__ ((gcc_struct));
240
241 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
242
243 struct Statement
244 {
245 struct Statement * prev;
246 struct Statement * next;
247 struct Location loc;
248 int type;
249 union
250 {
251 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
252 struct
253 {
254 struct Identifier * id;
255 struct Statement * stmt;
256 } __attribute__ ((gcc_struct)) labeled;
257 struct
258 {
259 struct Expression * exp;
260 struct Statement * stmt;
261 } __attribute__ ((gcc_struct)) caseStmt;
262 struct
263 {
264 struct __ecereNameSpace__ecere__sys__OldList * declarations;
265 struct __ecereNameSpace__ecere__sys__OldList * statements;
266 struct Context * context;
267 unsigned int isSwitch;
268 } __attribute__ ((gcc_struct)) compound;
269 struct
270 {
271 struct __ecereNameSpace__ecere__sys__OldList * exp;
272 struct Statement * stmt;
273 struct Statement * elseStmt;
274 } __attribute__ ((gcc_struct)) ifStmt;
275 struct
276 {
277 struct __ecereNameSpace__ecere__sys__OldList * exp;
278 struct Statement * stmt;
279 } __attribute__ ((gcc_struct)) switchStmt;
280 struct
281 {
282 struct __ecereNameSpace__ecere__sys__OldList * exp;
283 struct Statement * stmt;
284 } __attribute__ ((gcc_struct)) whileStmt;
285 struct
286 {
287 struct __ecereNameSpace__ecere__sys__OldList * exp;
288 struct Statement * stmt;
289 } __attribute__ ((gcc_struct)) doWhile;
290 struct
291 {
292 struct Statement * init;
293 struct Statement * check;
294 struct __ecereNameSpace__ecere__sys__OldList * increment;
295 struct Statement * stmt;
296 } __attribute__ ((gcc_struct)) forStmt;
297 struct
298 {
299 struct Identifier * id;
300 } __attribute__ ((gcc_struct)) gotoStmt;
301 struct
302 {
303 struct Specifier * spec;
304 char * statements;
305 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
306 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
307 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
308 } __attribute__ ((gcc_struct)) asmStmt;
309 struct
310 {
311 struct Expression * watcher;
312 struct Expression * object;
313 struct __ecereNameSpace__ecere__sys__OldList * watches;
314 } __attribute__ ((gcc_struct)) _watch;
315 struct
316 {
317 struct Identifier * id;
318 struct __ecereNameSpace__ecere__sys__OldList * exp;
319 struct __ecereNameSpace__ecere__sys__OldList * filter;
320 struct Statement * stmt;
321 } __attribute__ ((gcc_struct)) forEachStmt;
322 struct Declaration * decl;
323 } __attribute__ ((gcc_struct));
324 } __attribute__ ((gcc_struct));
325
326 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
327
328 struct TypeName
329 {
330 struct TypeName * prev;
331 struct TypeName * next;
332 struct Location loc;
333 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
334 struct Declarator * declarator;
335 int classObjectType;
336 struct Expression * bitCount;
337 } __attribute__ ((gcc_struct));
338
339 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
340
341 struct Initializer
342 {
343 struct Initializer * prev;
344 struct Initializer * next;
345 struct Location loc;
346 int type;
347 union
348 {
349 struct Expression * exp;
350 struct __ecereNameSpace__ecere__sys__OldList *  list;
351 } __attribute__ ((gcc_struct));
352 unsigned int isConstant;
353 } __attribute__ ((gcc_struct));
354
355 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
356
357 struct __ecereNameSpace__ecere__com__DataValue
358 {
359 union
360 {
361 char c;
362 unsigned char uc;
363 short s;
364 unsigned short us;
365 int i;
366 unsigned int ui;
367 void *  p;
368 float f;
369 double d;
370 long long i64;
371 uint64 ui64;
372 } __attribute__ ((gcc_struct));
373 } __attribute__ ((gcc_struct));
374
375 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
376
377 struct Expression
378 {
379 struct Expression * prev;
380 struct Expression * next;
381 struct Location loc;
382 int type;
383 union
384 {
385 struct
386 {
387 char *  constant;
388 struct Identifier * identifier;
389 } __attribute__ ((gcc_struct));
390 struct Statement * compound;
391 struct Instantiation * instance;
392 char *  string;
393 struct __ecereNameSpace__ecere__sys__OldList *  list;
394 struct
395 {
396 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
397 struct Declarator * decl;
398 } __attribute__ ((gcc_struct)) _classExp;
399 struct
400 {
401 struct Identifier * id;
402 } __attribute__ ((gcc_struct)) classData;
403 struct
404 {
405 struct Expression * exp;
406 struct __ecereNameSpace__ecere__sys__OldList * arguments;
407 struct Location argLoc;
408 } __attribute__ ((gcc_struct)) call;
409 struct
410 {
411 struct Expression * exp;
412 struct __ecereNameSpace__ecere__sys__OldList * index;
413 } __attribute__ ((gcc_struct)) index;
414 struct
415 {
416 struct Expression * exp;
417 struct Identifier * member;
418 int memberType;
419 unsigned int thisPtr;
420 } __attribute__ ((gcc_struct)) member;
421 struct
422 {
423 int op;
424 struct Expression * exp1;
425 struct Expression * exp2;
426 } __attribute__ ((gcc_struct)) op;
427 struct TypeName * typeName;
428 struct Specifier * _class;
429 struct
430 {
431 struct TypeName * typeName;
432 struct Expression * exp;
433 } __attribute__ ((gcc_struct)) cast;
434 struct
435 {
436 struct Expression * cond;
437 struct __ecereNameSpace__ecere__sys__OldList * exp;
438 struct Expression * elseExp;
439 } __attribute__ ((gcc_struct)) cond;
440 struct
441 {
442 struct TypeName * typeName;
443 struct Expression * size;
444 } __attribute__ ((gcc_struct)) _new;
445 struct
446 {
447 struct TypeName * typeName;
448 struct Expression * size;
449 struct Expression * exp;
450 } __attribute__ ((gcc_struct)) _renew;
451 struct
452 {
453 char * table;
454 struct Identifier * id;
455 } __attribute__ ((gcc_struct)) db;
456 struct
457 {
458 struct Expression * ds;
459 struct Expression * name;
460 } __attribute__ ((gcc_struct)) dbopen;
461 struct
462 {
463 struct TypeName * typeName;
464 struct Initializer * initializer;
465 } __attribute__ ((gcc_struct)) initializer;
466 struct
467 {
468 struct Expression * exp;
469 struct TypeName * typeName;
470 } __attribute__ ((gcc_struct)) vaArg;
471 } __attribute__ ((gcc_struct));
472 unsigned int debugValue;
473 struct __ecereNameSpace__ecere__com__DataValue val;
474 uint64 address;
475 unsigned int hasAddress;
476 struct Type * expType;
477 struct Type * destType;
478 unsigned int usage;
479 int tempCount;
480 unsigned int byReference;
481 unsigned int isConstant;
482 unsigned int addedThis;
483 unsigned int needCast;
484 unsigned int thisPtr;
485 } __attribute__ ((gcc_struct));
486
487 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
488
489 struct TemplateDatatype
490 {
491 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
492 struct Declarator * decl;
493 } __attribute__ ((gcc_struct));
494
495 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
496
497 struct TemplateArgument;
498
499 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
500
501 struct TemplateParameter
502 {
503 struct TemplateParameter * prev;
504 struct TemplateParameter * next;
505 struct Location loc;
506 int type;
507 struct Identifier * identifier;
508 union
509 {
510 struct TemplateDatatype * dataType;
511 int memberType;
512 } __attribute__ ((gcc_struct));
513 struct TemplateArgument * defaultArgument;
514 char *  dataTypeString;
515 struct Type * baseType;
516 } __attribute__ ((gcc_struct));
517
518 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
519
520 struct Specifier
521 {
522 struct Specifier * prev;
523 struct Specifier * next;
524 struct Location loc;
525 int type;
526 union
527 {
528 int specifier;
529 struct
530 {
531 struct ExtDecl * extDecl;
532 char *  name;
533 struct Symbol * symbol;
534 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
535 } __attribute__ ((gcc_struct));
536 struct
537 {
538 struct Identifier * id;
539 struct __ecereNameSpace__ecere__sys__OldList *  list;
540 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
541 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
542 unsigned int addNameSpace;
543 struct Context * ctx;
544 struct ExtDecl * extDeclStruct;
545 } __attribute__ ((gcc_struct));
546 struct Expression * expression;
547 struct Specifier * _class;
548 struct TemplateParameter * templateParameter;
549 } __attribute__ ((gcc_struct));
550 } __attribute__ ((gcc_struct));
551
552 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
553
554 struct Identifier
555 {
556 struct Identifier * prev;
557 struct Identifier * next;
558 struct Location loc;
559 struct Symbol * classSym;
560 struct Specifier * _class;
561 char *  string;
562 struct Identifier * badID;
563 } __attribute__ ((gcc_struct));
564
565 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
566
567 struct Pointer;
568
569 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
570
571 struct Declarator
572 {
573 struct Declarator * prev;
574 struct Declarator * next;
575 struct Location loc;
576 int type;
577 struct Symbol * symbol;
578 struct Declarator * declarator;
579 union
580 {
581 struct Identifier * identifier;
582 struct
583 {
584 struct Expression * exp;
585 struct Expression * posExp;
586 struct Attrib * attrib;
587 } __attribute__ ((gcc_struct)) structDecl;
588 struct
589 {
590 struct Expression * exp;
591 struct Specifier * enumClass;
592 } __attribute__ ((gcc_struct)) array;
593 struct
594 {
595 struct __ecereNameSpace__ecere__sys__OldList * parameters;
596 } __attribute__ ((gcc_struct)) function;
597 struct
598 {
599 struct Pointer * pointer;
600 } __attribute__ ((gcc_struct)) pointer;
601 struct
602 {
603 struct ExtDecl * extended;
604 } __attribute__ ((gcc_struct)) extended;
605 } __attribute__ ((gcc_struct));
606 } __attribute__ ((gcc_struct));
607
608 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
609
610 struct FunctionDefinition
611 {
612 struct FunctionDefinition * prev;
613 struct FunctionDefinition * next;
614 struct Location loc;
615 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
616 struct Declarator * declarator;
617 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
618 struct Statement * body;
619 struct __ecereNameSpace__ecere__com__Class * _class;
620 struct __ecereNameSpace__ecere__sys__OldList attached;
621 int declMode;
622 struct Type * type;
623 struct Symbol * propSet;
624 int tempCount;
625 unsigned int propertyNoThis;
626 } __attribute__ ((gcc_struct));
627
628 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
629
630 struct DBTableDef;
631
632 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
633
634 struct External
635 {
636 struct External * prev;
637 struct External * next;
638 struct Location loc;
639 int type;
640 struct Symbol * symbol;
641 union
642 {
643 struct FunctionDefinition * function;
644 struct ClassDefinition * _class;
645 struct Declaration * declaration;
646 char *  importString;
647 struct Identifier * id;
648 struct DBTableDef * table;
649 } __attribute__ ((gcc_struct));
650 int importType;
651 } __attribute__ ((gcc_struct));
652
653 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
654
655 struct ModuleImport
656 {
657 struct ModuleImport * prev;
658 struct ModuleImport * next;
659 char *  name;
660 struct __ecereNameSpace__ecere__sys__OldList classes;
661 struct __ecereNameSpace__ecere__sys__OldList functions;
662 int importType;
663 int importAccess;
664 } __attribute__ ((gcc_struct));
665
666 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
667
668 struct ClassImport
669 {
670 struct ClassImport * prev;
671 struct ClassImport * next;
672 char *  name;
673 struct __ecereNameSpace__ecere__sys__OldList methods;
674 struct __ecereNameSpace__ecere__sys__OldList properties;
675 unsigned int itself;
676 unsigned int isRemote;
677 } __attribute__ ((gcc_struct));
678
679 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
680
681 struct Symbol
682 {
683 char *  string;
684 struct Symbol * parent;
685 struct Symbol * left;
686 struct Symbol * right;
687 int depth;
688 struct Type * type;
689 union
690 {
691 struct __ecereNameSpace__ecere__com__Method * method;
692 struct __ecereNameSpace__ecere__com__Property * _property;
693 struct __ecereNameSpace__ecere__com__Class * registered;
694 } __attribute__ ((gcc_struct));
695 int id;
696 int idCode;
697 union
698 {
699 struct
700 {
701 struct External * pointerExternal;
702 struct External * structExternal;
703 } __attribute__ ((gcc_struct));
704 struct
705 {
706 struct External * externalGet;
707 struct External * externalSet;
708 struct External * externalPtr;
709 struct External * externalIsSet;
710 } __attribute__ ((gcc_struct));
711 struct
712 {
713 struct External * methodExternal;
714 struct External * methodCodeExternal;
715 } __attribute__ ((gcc_struct));
716 } __attribute__ ((gcc_struct));
717 unsigned int imported;
718 unsigned int declaredStructSym;
719 struct __ecereNameSpace__ecere__com__Class * _class;
720 unsigned int declaredStruct;
721 unsigned int needConstructor;
722 unsigned int needDestructor;
723 char *  constructorName;
724 char *  structName;
725 char *  className;
726 char *  destructorName;
727 struct ModuleImport * module;
728 struct ClassImport * _import;
729 struct Location nameLoc;
730 unsigned int isParam;
731 unsigned int isRemote;
732 unsigned int isStruct;
733 unsigned int fireWatchersDone;
734 int declaring;
735 unsigned int classData;
736 unsigned int isStatic;
737 char *  shortName;
738 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
739 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
740 struct Context * ctx;
741 int isIterator;
742 struct Expression * propCategory;
743 } __attribute__ ((gcc_struct));
744
745 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
746
747 struct Type
748 {
749 struct Type * prev;
750 struct Type * next;
751 int refCount;
752 union
753 {
754 struct Symbol * _class;
755 struct
756 {
757 struct __ecereNameSpace__ecere__sys__OldList members;
758 char *  enumName;
759 } __attribute__ ((gcc_struct));
760 struct
761 {
762 struct Type * returnType;
763 struct __ecereNameSpace__ecere__sys__OldList params;
764 struct Symbol * thisClass;
765 unsigned int staticMethod;
766 struct TemplateParameter * thisClassTemplate;
767 } __attribute__ ((gcc_struct));
768 struct
769 {
770 struct __ecereNameSpace__ecere__com__Method * method;
771 struct __ecereNameSpace__ecere__com__Class * methodClass;
772 struct __ecereNameSpace__ecere__com__Class * usedClass;
773 } __attribute__ ((gcc_struct));
774 struct
775 {
776 struct Type * arrayType;
777 int arraySize;
778 struct Expression * arraySizeExp;
779 unsigned int freeExp;
780 struct Symbol * enumClass;
781 } __attribute__ ((gcc_struct));
782 struct Type * type;
783 struct TemplateParameter * templateParameter;
784 } __attribute__ ((gcc_struct));
785 int kind;
786 unsigned int size;
787 char *  name;
788 char *  typeName;
789 int classObjectType;
790 int alignment;
791 unsigned int offset;
792 int bitFieldCount;
793 int count;
794 unsigned int isSigned : 1;
795 unsigned int constant : 1;
796 unsigned int truth : 1;
797 unsigned int byReference : 1;
798 unsigned int extraParam : 1;
799 unsigned int directClassAccess : 1;
800 unsigned int computing : 1;
801 unsigned int keepCast : 1;
802 unsigned int passAsTemplate : 1;
803 unsigned int dllExport : 1;
804 unsigned int attrStdcall : 1;
805 unsigned int declaredWithStruct : 1;
806 unsigned int typedByReference : 1;
807 } __attribute__ ((gcc_struct));
808
809 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
810
811 struct __ecereNameSpace__ecere__com__Class
812 {
813 struct __ecereNameSpace__ecere__com__Class * prev;
814 struct __ecereNameSpace__ecere__com__Class * next;
815 char *  name;
816 int offset;
817 int structSize;
818 int (* *  _vTbl)();
819 int vTblSize;
820 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
821 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
822 int offsetClass;
823 int sizeClass;
824 struct __ecereNameSpace__ecere__com__Class * base;
825 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
826 struct __ecereNameSpace__ecere__sys__BinaryTree members;
827 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
828 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
829 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
830 struct __ecereNameSpace__ecere__sys__OldList derivatives;
831 int memberID;
832 int startMemberID;
833 int type;
834 struct __ecereNameSpace__ecere__com__Instance * module;
835 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
836 char *  dataTypeString;
837 struct Type * dataType;
838 int typeSize;
839 int defaultAlignment;
840 void (*  Initialize)();
841 int memberOffset;
842 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
843 char *  designerClass;
844 unsigned int noExpansion;
845 char *  defaultProperty;
846 unsigned int comRedefinition;
847 int count;
848 unsigned int isRemote;
849 unsigned int internalDecl;
850 void *  data;
851 unsigned int computeSize;
852 int structAlignment;
853 int destructionWatchOffset;
854 unsigned int fixed;
855 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
856 int inheritanceAccess;
857 char *  fullName;
858 void *  symbol;
859 struct __ecereNameSpace__ecere__sys__OldList conversions;
860 struct __ecereNameSpace__ecere__sys__OldList templateParams;
861 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
862 struct __ecereNameSpace__ecere__com__Class * templateClass;
863 struct __ecereNameSpace__ecere__sys__OldList templatized;
864 int numParams;
865 unsigned int isInstanceClass;
866 unsigned int byValueSystemClass;
867 } __attribute__ ((gcc_struct));
868
869 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
870
871 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
872
873 struct __ecereNameSpace__ecere__com__Instance
874 {
875 int (* *  _vTbl)();
876 struct __ecereNameSpace__ecere__com__Class * _class;
877 int _refCount;
878 } __attribute__ ((gcc_struct));
879
880 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
881
882 struct __ecereNameSpace__ecere__com__DataMember
883 {
884 struct __ecereNameSpace__ecere__com__DataMember * prev;
885 struct __ecereNameSpace__ecere__com__DataMember * next;
886 char *  name;
887 unsigned int isProperty;
888 int memberAccess;
889 int id;
890 struct __ecereNameSpace__ecere__com__Class * _class;
891 char *  dataTypeString;
892 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
893 struct Type * dataType;
894 int type;
895 int offset;
896 int memberID;
897 struct __ecereNameSpace__ecere__sys__OldList members;
898 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
899 int memberOffset;
900 int structAlignment;
901 } __attribute__ ((gcc_struct));
902
903 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
904
905 struct __ecereNameSpace__ecere__com__SerialBuffer
906 {
907 unsigned char *  _buffer;
908 unsigned int count;
909 unsigned int _size;
910 unsigned int pos;
911 } __attribute__ ((gcc_struct));
912
913 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
914
915 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
916 {
917 union
918 {
919 struct
920 {
921 char *  dataTypeString;
922 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
923 } __attribute__ ((gcc_struct));
924 struct __ecereNameSpace__ecere__com__DataValue expression;
925 struct
926 {
927 char *  memberString;
928 union
929 {
930 struct __ecereNameSpace__ecere__com__DataMember * member;
931 struct __ecereNameSpace__ecere__com__Property * prop;
932 struct __ecereNameSpace__ecere__com__Method * method;
933 } __attribute__ ((gcc_struct));
934 } __attribute__ ((gcc_struct));
935 } __attribute__ ((gcc_struct));
936 } __attribute__ ((gcc_struct));
937
938 void exit(int status);
939
940 void * calloc(size_t nmemb, size_t size);
941
942 void free(void * ptr);
943
944 void * malloc(size_t size);
945
946 void * realloc(void * ptr, size_t size);
947
948 long int strtol(const char * nptr, char ** endptr, int base);
949
950 long long int strtoll(const char * nptr, char ** endptr, int base);
951
952 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
953
954 enum yytokentype
955 {
956 IDENTIFIER = 258, CONSTANT = 259, STRING_LITERAL = 260, SIZEOF = 261, PTR_OP = 262, INC_OP = 263, DEC_OP = 264, LEFT_OP = 265, RIGHT_OP = 266, LE_OP = 267, GE_OP = 268, EQ_OP = 269, NE_OP = 270, AND_OP = 271, OR_OP = 272, MUL_ASSIGN = 273, DIV_ASSIGN = 274, MOD_ASSIGN = 275, ADD_ASSIGN = 276, SUB_ASSIGN = 277, LEFT_ASSIGN = 278, RIGHT_ASSIGN = 279, AND_ASSIGN = 280, XOR_ASSIGN = 281, OR_ASSIGN = 282, TYPE_NAME = 283, TYPEDEF = 284, EXTERN = 285, STATIC = 286, AUTO = 287, REGISTER = 288, CHAR = 289, SHORT = 290, INT = 291, UINT = 292, INT64 = 293, LONG = 294, SIGNED = 295, UNSIGNED = 296, FLOAT = 297, DOUBLE = 298, CONST = 299, VOLATILE = 300, VOID = 301, VALIST = 302, STRUCT = 303, UNION = 304, ENUM = 305, ELLIPSIS = 306, CASE = 307, DEFAULT = 308, IF = 309, SWITCH = 310, WHILE = 311, DO = 312, FOR = 313, GOTO = 314, CONTINUE = 315, BREAK = 316, RETURN = 317, IFX = 318, ELSE = 319, CLASS = 320, THISCLASS = 321, CLASS_NAME = 322, PROPERTY = 323, SETPROP = 324, GETPROP = 325, NEWOP = 326, RENEW = 327, DELETE = 328, EXT_DECL = 329, EXT_STORAGE = 330, IMPORT = 331, DEFINE = 332, VIRTUAL = 333, ATTRIB = 334, PUBLIC = 335, PRIVATE = 336, TYPED_OBJECT = 337, ANY_OBJECT = 338, _INCREF = 339, EXTENSION = 340, ASM = 341, TYPEOF = 342, WATCH = 343, STOPWATCHING = 344, FIREWATCHERS = 345, WATCHABLE = 346, CLASS_DESIGNER = 347, CLASS_NO_EXPANSION = 348, CLASS_FIXED = 349, ISPROPSET = 350, CLASS_DEFAULT_PROPERTY = 351, PROPERTY_CATEGORY = 352, CLASS_DATA = 353, CLASS_PROPERTY = 354, SUBCLASS = 355, NAMESPACE = 356, NEW0OP = 357, RENEW0 = 358, VAARG = 359, DBTABLE = 360, DBFIELD = 361, DBINDEX = 362, DATABASE_OPEN = 363, ALIGNOF = 364, ATTRIB_DEP = 365, __ATTRIB = 366, BOOL = 367, _BOOL = 368, _COMPLEX = 369, _IMAGINARY = 370, RESTRICT = 371
957 };
958
959 typedef union YYSTYPE
960 {
961 int specifierType;
962 int i;
963 int declMode;
964 struct Identifier * id;
965 struct Expression * exp;
966 struct Specifier * specifier;
967 struct __ecereNameSpace__ecere__sys__OldList * list;
968 struct Enumerator * enumerator;
969 struct Declarator * declarator;
970 struct Pointer * pointer;
971 struct Initializer * initializer;
972 struct InitDeclarator * initDeclarator;
973 struct TypeName * typeName;
974 struct Declaration * declaration;
975 struct Statement * stmt;
976 struct FunctionDefinition * function;
977 struct External * external;
978 struct Context * context;
979 struct AsmField * asmField;
980 struct Attrib * attrib;
981 struct ExtDecl * extDecl;
982 struct Attribute * attribute;
983 struct Instantiation * instance;
984 struct MembersInit * membersInit;
985 struct MemberInit * memberInit;
986 struct ClassFunction * classFunction;
987 struct ClassDefinition * _class;
988 struct ClassDef * classDef;
989 struct PropertyDef * prop;
990 char * string;
991 struct Symbol * symbol;
992 struct PropertyWatch * propertyWatch;
993 struct TemplateParameter * templateParameter;
994 struct TemplateArgument * templateArgument;
995 struct TemplateDatatype * templateDatatype;
996 struct DBTableEntry * dbtableEntry;
997 struct DBIndexItem * dbindexItem;
998 struct DBTableDef * dbtableDef;
999 } __attribute__ ((gcc_struct)) YYSTYPE;
1000
1001 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
1002
1003 struct Enumerator
1004 {
1005 struct Enumerator * prev;
1006 struct Enumerator * next;
1007 struct Location loc;
1008 struct Identifier * id;
1009 struct Expression * exp;
1010 } __attribute__ ((gcc_struct));
1011
1012 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
1013
1014 struct InitDeclarator
1015 {
1016 struct InitDeclarator * prev;
1017 struct InitDeclarator * next;
1018 struct Location loc;
1019 struct Declarator * declarator;
1020 struct Initializer * initializer;
1021 } __attribute__ ((gcc_struct));
1022
1023 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
1024
1025 struct AsmField
1026 {
1027 struct AsmField * prev;
1028 struct AsmField * next;
1029 struct Location loc;
1030 char *  command;
1031 struct Expression * expression;
1032 } __attribute__ ((gcc_struct));
1033
1034 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
1035
1036 struct Attribute;
1037
1038 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
1039
1040 struct ClassFunction
1041 {
1042 struct ClassFunction * prev;
1043 struct ClassFunction * next;
1044 struct Location loc;
1045 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1046 struct Declarator * declarator;
1047 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1048 struct Statement * body;
1049 struct __ecereNameSpace__ecere__com__Class * _class;
1050 struct __ecereNameSpace__ecere__sys__OldList attached;
1051 int declMode;
1052 struct Type * type;
1053 struct Symbol * propSet;
1054 unsigned int isVirtual;
1055 unsigned int isConstructor;
1056 unsigned int isDestructor;
1057 unsigned int dontMangle;
1058 int id;
1059 int idCode;
1060 } __attribute__ ((gcc_struct));
1061
1062 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1063
1064 struct MembersInit
1065 {
1066 struct MembersInit * prev;
1067 struct MembersInit * next;
1068 struct Location loc;
1069 int type;
1070 union
1071 {
1072 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1073 struct ClassFunction * function;
1074 } __attribute__ ((gcc_struct));
1075 } __attribute__ ((gcc_struct));
1076
1077 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1078
1079 struct MemberInit
1080 {
1081 struct MemberInit * prev;
1082 struct MemberInit * next;
1083 struct Location loc;
1084 struct Location realLoc;
1085 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1086 struct Initializer * initializer;
1087 unsigned int used;
1088 unsigned int variable;
1089 unsigned int takeOutExp;
1090 } __attribute__ ((gcc_struct));
1091
1092 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1093
1094 struct PropertyDef
1095 {
1096 struct PropertyDef * prev;
1097 struct PropertyDef * next;
1098 struct Location loc;
1099 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1100 struct Declarator * declarator;
1101 struct Identifier * id;
1102 struct Statement * getStmt;
1103 struct Statement * setStmt;
1104 struct Statement * issetStmt;
1105 struct Symbol * symbol;
1106 unsigned int conversion;
1107 unsigned int isWatchable;
1108 struct Expression * category;
1109 } __attribute__ ((gcc_struct));
1110
1111 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1112
1113 struct PropertyWatch
1114 {
1115 struct PropertyWatch * prev;
1116 struct PropertyWatch * next;
1117 struct Location loc;
1118 struct Statement * compound;
1119 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1120 unsigned int deleteWatch;
1121 } __attribute__ ((gcc_struct));
1122
1123 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1124
1125 struct ClassDef
1126 {
1127 struct ClassDef * prev;
1128 struct ClassDef * next;
1129 struct Location loc;
1130 int type;
1131 union
1132 {
1133 struct Declaration * decl;
1134 struct ClassFunction * function;
1135 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1136 struct PropertyDef * propertyDef;
1137 struct PropertyWatch * propertyWatch;
1138 char *  designer;
1139 struct Identifier * defaultProperty;
1140 struct
1141 {
1142 struct Identifier * id;
1143 struct Initializer * initializer;
1144 } __attribute__ ((gcc_struct));
1145 } __attribute__ ((gcc_struct));
1146 int memberAccess;
1147 void *  object;
1148 } __attribute__ ((gcc_struct));
1149
1150 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1151
1152 struct DBTableEntry;
1153
1154 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1155
1156 struct DBIndexItem;
1157
1158 extern YYSTYPE yylval;
1159
1160 extern struct Location yylloc;
1161
1162 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1163
1164 extern int returnCode;
1165
1166 extern struct Expression * parsedExpression;
1167
1168 extern unsigned int yydebug;
1169
1170 void SetYydebug(unsigned int b)
1171 {
1172 yydebug = b;
1173 }
1174
1175 extern unsigned int echoOn;
1176
1177 void resetScanner();
1178
1179 int propWatcherID;
1180
1181 int expression_yyparse();
1182
1183 static struct Statement * curCompound;
1184
1185 struct External * curExternal, * afterExternal;
1186
1187 static struct Type * curSwitchType;
1188
1189 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1190
1191 struct __ecereNameSpace__ecere__com__Class * thisClass;
1192
1193 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1194 {
1195 thisClass = c;
1196 }
1197
1198 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1199 {
1200 return thisClass;
1201 }
1202
1203 static char * thisNameSpace;
1204
1205 struct __ecereNameSpace__ecere__com__Class * containerClass;
1206
1207 unsigned int thisClassParams = 0x1;
1208
1209 unsigned int internalValueCounter;
1210
1211 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1212
1213 extern size_t strlen(const char * );
1214
1215 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1216
1217 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1218
1219 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1220
1221 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1222
1223 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1224
1225 void PrintExpression(struct Expression * exp, char * string)
1226 {
1227 {
1228 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1229 int count;
1230
1231 if(exp)
1232 OutputExpression(exp, f);
1233 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
1234 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = f;
1235
1236 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1237 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1238 count = strlen(string);
1239 count += ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
1240 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = f;
1241
1242 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1243 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Read])(f, string + count, 1, 1023);
1244 string[count] = '\0';
1245 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1246 }
1247 }
1248
1249 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1250
1251 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1252
1253 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1254 {
1255 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1256 {
1257 if(!param->baseType)
1258 {
1259 if(param->dataTypeString)
1260 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1261 else
1262 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1263 }
1264 return param->baseType;
1265 }
1266 return (((void *)0));
1267 }
1268
1269 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1270 {
1271 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1272 return 0x1;
1273 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1274 {
1275 return 0x0;
1276 }
1277 if(type1->kind == type2->kind)
1278 {
1279 switch(type1->kind)
1280 {
1281 case 24:
1282 case 1:
1283 case 2:
1284 case 3:
1285 case 4:
1286 case 22:
1287 case 23:
1288 if(type1->passAsTemplate && !type2->passAsTemplate)
1289 return 0x1;
1290 return type1->isSigned != type2->isSigned;
1291 case 8:
1292 return type1->_class != type2->_class;
1293 case 13:
1294 return NeedCast(type1->type, type2->type);
1295 default:
1296 return 0x1;
1297 }
1298 }
1299 return 0x1;
1300 }
1301
1302 extern int strcmp(const char * , const char * );
1303
1304 extern struct Context * curContext;
1305
1306 extern struct Context * topContext;
1307
1308 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1309
1310 extern struct __ecereNameSpace__ecere__com__Property * __ecereNameSpace__ecere__com__eClass_FindProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, struct __ecereNameSpace__ecere__com__Instance * module);
1311
1312 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1313
1314 extern struct __ecereNameSpace__ecere__com__Method * __ecereNameSpace__ecere__com__eClass_FindMethod(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, struct __ecereNameSpace__ecere__com__Instance * module);
1315
1316 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_FindDataMember(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, struct __ecereNameSpace__ecere__com__Instance * module, struct __ecereNameSpace__ecere__com__DataMember **  subMemberStack, int *  subMemberStackPos);
1317
1318 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1319
1320 struct __ecereNameSpace__ecere__com__ClassProperty
1321 {
1322 char *  name;
1323 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1324 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1325 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1326 int depth;
1327 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, long long);
1328 long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1329 char *  dataTypeString;
1330 struct Type * dataType;
1331 unsigned int constant;
1332 } __attribute__ ((gcc_struct));
1333
1334 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1335
1336 extern struct Expression * QMkExpId(char *  id);
1337
1338 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1339
1340 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1341 {
1342 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1343 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1344 char *  name;
1345 int type;
1346 union
1347 {
1348 char *  dataTypeString;
1349 int memberType;
1350 } __attribute__ ((gcc_struct));
1351 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1352 void *  param;
1353 } __attribute__ ((gcc_struct));
1354
1355 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1356
1357 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1358
1359 extern void FreeIdentifier(struct Identifier * id);
1360
1361 void ProcessExpressionType(struct Expression * exp);
1362
1363 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1364
1365 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1366
1367 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1368
1369 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1370
1371 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1372
1373 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1374
1375 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1376
1377 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1378
1379 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1380 {
1381 if(exp->type == 0 && exp->identifier)
1382 {
1383 struct Identifier * id = exp->identifier;
1384 struct Context * ctx;
1385 struct Symbol * symbol = (((void *)0));
1386
1387 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1388 {
1389 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1390 {
1391 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1392 if(symbol)
1393 break;
1394 }
1395 }
1396 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1397 {
1398 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1399 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1400 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1401 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
1402
1403 if(!prop)
1404 {
1405 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1406 }
1407 if(!prop && !method)
1408 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1409 if(!prop && !method && !member)
1410 {
1411 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1412 }
1413 if(prop || method || member || classProp)
1414 {
1415 exp->type = 8;
1416 exp->member.member = id;
1417 exp->member.memberType = 0;
1418 exp->member.exp = QMkExpId("this");
1419 exp->addedThis = 0x1;
1420 }
1421 else if(_class && _class->templateParams.first)
1422 {
1423 struct __ecereNameSpace__ecere__com__Class * sClass;
1424
1425 for(sClass = _class; sClass; sClass = sClass->base)
1426 {
1427 if(sClass->templateParams.first)
1428 {
1429 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1430
1431 for(param = sClass->templateParams.first; param; param = param->next)
1432 {
1433 if(param->type == 2 && !strcmp(param->name, id->string))
1434 {
1435 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1436
1437 if(argExp)
1438 {
1439 struct Declarator * decl;
1440 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1441
1442 FreeIdentifier(exp->member.member);
1443 ProcessExpressionType(argExp);
1444 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1445 exp->expType = ProcessType(specs, decl);
1446 exp->type = 5;
1447 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1448 }
1449 }
1450 }
1451 }
1452 }
1453 }
1454 }
1455 }
1456 }
1457
1458 extern int sprintf(char * , char * , ...);
1459
1460 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1461
1462 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1463
1464 char * PrintInt(long long result)
1465 {
1466 char temp[100];
1467
1468 if(result > (((long long)0x7fffffffffffffffLL)))
1469 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1470 else
1471 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1472 return __ecereNameSpace__ecere__sys__CopyString(temp);
1473 }
1474
1475 char * PrintUInt(uint64 result)
1476 {
1477 char temp[100];
1478
1479 if(result > (0xffffffff))
1480 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1481 else if(result > (((int)0x7fffffff)))
1482 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1483 else
1484 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1485 return __ecereNameSpace__ecere__sys__CopyString(temp);
1486 }
1487
1488 char * PrintInt64(long long result)
1489 {
1490 char temp[100];
1491
1492 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1493 return __ecereNameSpace__ecere__sys__CopyString(temp);
1494 }
1495
1496 char * PrintUInt64(uint64 result)
1497 {
1498 char temp[100];
1499
1500 if(result > (((long long)0x7fffffffffffffffLL)))
1501 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1502 else
1503 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1504 return __ecereNameSpace__ecere__sys__CopyString(temp);
1505 }
1506
1507 char * PrintHexUInt(uint64 result)
1508 {
1509 char temp[100];
1510
1511 if(result > (0xffffffff))
1512 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1513 else
1514 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1515 return __ecereNameSpace__ecere__sys__CopyString(temp);
1516 }
1517
1518 char * PrintHexUInt64(uint64 result)
1519 {
1520 char temp[100];
1521
1522 if(result > (0xffffffff))
1523 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1524 else
1525 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1526 return __ecereNameSpace__ecere__sys__CopyString(temp);
1527 }
1528
1529 char * PrintShort(short result)
1530 {
1531 char temp[100];
1532
1533 sprintf(temp, "%d", (unsigned short)result);
1534 return __ecereNameSpace__ecere__sys__CopyString(temp);
1535 }
1536
1537 char * PrintUShort(unsigned short result)
1538 {
1539 char temp[100];
1540
1541 if(result > (unsigned short)32767)
1542 sprintf(temp, "0x%X", (int)result);
1543 else
1544 sprintf(temp, "%d", (int)result);
1545 return __ecereNameSpace__ecere__sys__CopyString(temp);
1546 }
1547
1548 extern int isprint(int c);
1549
1550 char * PrintChar(char result)
1551 {
1552 char temp[100];
1553
1554 if(result > (char)0 && isprint(result))
1555 sprintf(temp, "'%c'", result);
1556 else if(result < (char)0)
1557 sprintf(temp, "%d", (int)result);
1558 else
1559 sprintf(temp, "0x%X", (unsigned char)result);
1560 return __ecereNameSpace__ecere__sys__CopyString(temp);
1561 }
1562
1563 char * PrintUChar(unsigned char result)
1564 {
1565 char temp[100];
1566
1567 sprintf(temp, "0x%X", result);
1568 return __ecereNameSpace__ecere__sys__CopyString(temp);
1569 }
1570
1571 char * PrintFloat(float result)
1572 {
1573 char temp[350];
1574
1575 sprintf(temp, "%.16ff", result);
1576 return __ecereNameSpace__ecere__sys__CopyString(temp);
1577 }
1578
1579 char * PrintDouble(double result)
1580 {
1581 char temp[350];
1582
1583 sprintf(temp, "%.16f", result);
1584 return __ecereNameSpace__ecere__sys__CopyString(temp);
1585 }
1586
1587 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1588
1589 struct OpTable
1590 {
1591 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1592 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1593 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1594 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1595 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1596 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1597 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1598 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1599 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1600 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1601 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1602 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1603 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1604 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1605 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1606 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1607 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1608 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1609 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1610 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1611 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1612 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1613 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1614 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1615 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1616 unsigned int (*  Not)(struct Expression *, struct Operand *);
1617 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1618 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1619 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1620 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1621 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1622 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1623 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1624 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1625 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1626 } __attribute__ ((gcc_struct));
1627
1628 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1629
1630 struct Operand
1631 {
1632 int kind;
1633 struct Type * type;
1634 unsigned int ptrSize;
1635 union
1636 {
1637 char c;
1638 unsigned char uc;
1639 short s;
1640 unsigned short us;
1641 int i;
1642 unsigned int ui;
1643 float f;
1644 double d;
1645 long long i64;
1646 uint64 ui64;
1647 } __attribute__ ((gcc_struct));
1648 struct OpTable ops;
1649 } __attribute__ ((gcc_struct));
1650
1651 struct Operand GetOperand(struct Expression * exp);
1652
1653 unsigned int GetInt(struct Expression * exp, int * value2)
1654 {
1655 struct Operand op2 = GetOperand(exp);
1656
1657 if(op2.kind == 3 && op2.type->isSigned)
1658 *value2 = op2.i;
1659 else if(op2.kind == 3)
1660 *value2 = (int)op2.ui;
1661 else if(op2.kind == 4 && op2.type->isSigned)
1662 *value2 = (int)op2.i64;
1663 else if(op2.kind == 4)
1664 *value2 = (int)op2.ui64;
1665 else if(op2.kind == 23 && op2.type->isSigned)
1666 *value2 = (int)op2.i64;
1667 else if(op2.kind == 23)
1668 *value2 = (int)op2.ui64;
1669 else if(op2.kind == 22 && op2.type->isSigned)
1670 *value2 = (int)op2.i64;
1671 else if(op2.kind == 22)
1672 *value2 = (int)op2.ui64;
1673 else if(op2.kind == 2 && op2.type->isSigned)
1674 *value2 = (int)op2.s;
1675 else if(op2.kind == 2)
1676 *value2 = (int)op2.us;
1677 else if(op2.kind == 1 && op2.type->isSigned)
1678 *value2 = (int)op2.c;
1679 else if(op2.kind == 24 || op2.kind == 1)
1680 *value2 = (int)op2.uc;
1681 else if(op2.kind == 6)
1682 *value2 = (int)op2.f;
1683 else if(op2.kind == 7)
1684 *value2 = (int)op2.d;
1685 else if(op2.kind == 13)
1686 *value2 = (int)op2.ui64;
1687 else
1688 return 0x0;
1689 return 0x1;
1690 }
1691
1692 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1693 {
1694 struct Operand op2 = GetOperand(exp);
1695
1696 if(op2.kind == 3 && op2.type->isSigned)
1697 *value2 = (unsigned int)op2.i;
1698 else if(op2.kind == 3)
1699 *value2 = op2.ui;
1700 else if(op2.kind == 4 && op2.type->isSigned)
1701 *value2 = (unsigned int)op2.i64;
1702 else if(op2.kind == 4)
1703 *value2 = (unsigned int)op2.ui64;
1704 else if(op2.kind == 23 && op2.type->isSigned)
1705 *value2 = (unsigned int)op2.i64;
1706 else if(op2.kind == 23)
1707 *value2 = (unsigned int)op2.ui64;
1708 else if(op2.kind == 22 && op2.type->isSigned)
1709 *value2 = (unsigned int)op2.i64;
1710 else if(op2.kind == 22)
1711 *value2 = (unsigned int)op2.ui64;
1712 else if(op2.kind == 2 && op2.type->isSigned)
1713 *value2 = (unsigned int)op2.s;
1714 else if(op2.kind == 2)
1715 *value2 = (unsigned int)op2.us;
1716 else if(op2.kind == 1 && op2.type->isSigned)
1717 *value2 = (unsigned int)op2.c;
1718 else if(op2.kind == 24 || op2.kind == 1)
1719 *value2 = (unsigned int)op2.uc;
1720 else if(op2.kind == 6)
1721 *value2 = (unsigned int)op2.f;
1722 else if(op2.kind == 7)
1723 *value2 = (unsigned int)op2.d;
1724 else if(op2.kind == 13)
1725 *value2 = (unsigned int)op2.ui64;
1726 else
1727 return 0x0;
1728 return 0x1;
1729 }
1730
1731 unsigned int GetInt64(struct Expression * exp, long long * value2)
1732 {
1733 struct Operand op2 = GetOperand(exp);
1734
1735 if(op2.kind == 3 && op2.type->isSigned)
1736 *value2 = (long long)op2.i;
1737 else if(op2.kind == 3)
1738 *value2 = (long long)op2.ui;
1739 else if(op2.kind == 4 && op2.type->isSigned)
1740 *value2 = op2.i64;
1741 else if(op2.kind == 4)
1742 *value2 = (long long)op2.ui64;
1743 else if(op2.kind == 23 && op2.type->isSigned)
1744 *value2 = op2.i64;
1745 else if(op2.kind == 23)
1746 *value2 = (long long)op2.ui64;
1747 else if(op2.kind == 22 && op2.type->isSigned)
1748 *value2 = op2.i64;
1749 else if(op2.kind == 22)
1750 *value2 = (long long)op2.ui64;
1751 else if(op2.kind == 2 && op2.type->isSigned)
1752 *value2 = (long long)op2.s;
1753 else if(op2.kind == 2)
1754 *value2 = (long long)op2.us;
1755 else if(op2.kind == 1 && op2.type->isSigned)
1756 *value2 = (long long)op2.c;
1757 else if(op2.kind == 24 || op2.kind == 1)
1758 *value2 = (long long)op2.uc;
1759 else if(op2.kind == 6)
1760 *value2 = (long long)op2.f;
1761 else if(op2.kind == 7)
1762 *value2 = (long long)op2.d;
1763 else if(op2.kind == 13)
1764 *value2 = (long long)op2.ui64;
1765 else
1766 return 0x0;
1767 return 0x1;
1768 }
1769
1770 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1771 {
1772 struct Operand op2 = GetOperand(exp);
1773
1774 if(op2.kind == 3 && op2.type->isSigned)
1775 *value2 = (uint64)op2.i;
1776 else if(op2.kind == 3)
1777 *value2 = (uint64)op2.ui;
1778 else if(op2.kind == 4 && op2.type->isSigned)
1779 *value2 = (uint64)op2.i64;
1780 else if(op2.kind == 4)
1781 *value2 = op2.ui64;
1782 else if(op2.kind == 23 && op2.type->isSigned)
1783 *value2 = (uint64)op2.i64;
1784 else if(op2.kind == 23)
1785 *value2 = op2.ui64;
1786 else if(op2.kind == 22 && op2.type->isSigned)
1787 *value2 = (uint64)op2.i64;
1788 else if(op2.kind == 22)
1789 *value2 = op2.ui64;
1790 else if(op2.kind == 2 && op2.type->isSigned)
1791 *value2 = (uint64)op2.s;
1792 else if(op2.kind == 2)
1793 *value2 = (uint64)op2.us;
1794 else if(op2.kind == 1 && op2.type->isSigned)
1795 *value2 = (uint64)op2.c;
1796 else if(op2.kind == 24 || op2.kind == 1)
1797 *value2 = (uint64)op2.uc;
1798 else if(op2.kind == 6)
1799 *value2 = (uint64)op2.f;
1800 else if(op2.kind == 7)
1801 *value2 = (uint64)op2.d;
1802 else if(op2.kind == 13)
1803 *value2 = op2.ui64;
1804 else
1805 return 0x0;
1806 return 0x1;
1807 }
1808
1809 unsigned int GetIntPtr(struct Expression * exp, intptr_t * value2)
1810 {
1811 struct Operand op2 = GetOperand(exp);
1812
1813 if(op2.kind == 3 && op2.type->isSigned)
1814 *value2 = (intptr_t)op2.i;
1815 else if(op2.kind == 3)
1816 *value2 = (intptr_t)op2.ui;
1817 else if(op2.kind == 4 && op2.type->isSigned)
1818 *value2 = (intptr_t)op2.i64;
1819 else if(op2.kind == 4)
1820 *value2 = (intptr_t)op2.ui64;
1821 else if(op2.kind == 23 && op2.type->isSigned)
1822 *value2 = (intptr_t)op2.i64;
1823 else if(op2.kind == 23)
1824 *value2 = (intptr_t)op2.ui64;
1825 else if(op2.kind == 22 && op2.type->isSigned)
1826 *value2 = (intptr_t)op2.i64;
1827 else if(op2.kind == 22)
1828 *value2 = (intptr_t)op2.ui64;
1829 else if(op2.kind == 2 && op2.type->isSigned)
1830 *value2 = (intptr_t)op2.s;
1831 else if(op2.kind == 2)
1832 *value2 = (intptr_t)op2.us;
1833 else if(op2.kind == 1 && op2.type->isSigned)
1834 *value2 = (intptr_t)op2.c;
1835 else if(op2.kind == 24 || op2.kind == 1)
1836 *value2 = (intptr_t)op2.uc;
1837 else if(op2.kind == 6)
1838 *value2 = (intptr_t)op2.f;
1839 else if(op2.kind == 7)
1840 *value2 = (intptr_t)op2.d;
1841 else if(op2.kind == 13)
1842 *value2 = (intptr_t)op2.ui64;
1843 else
1844 return 0x0;
1845 return 0x1;
1846 }
1847
1848 unsigned int GetUIntPtr(struct Expression * exp, uintptr_t * value2)
1849 {
1850 struct Operand op2 = GetOperand(exp);
1851
1852 if(op2.kind == 3 && op2.type->isSigned)
1853 *value2 = (uintptr_t)op2.i;
1854 else if(op2.kind == 3)
1855 *value2 = (uintptr_t)op2.ui;
1856 else if(op2.kind == 4 && op2.type->isSigned)
1857 *value2 = (uintptr_t)op2.i64;
1858 else if(op2.kind == 4)
1859 *value2 = (uintptr_t)op2.ui64;
1860 else if(op2.kind == 23 && op2.type->isSigned)
1861 *value2 = (uintptr_t)op2.i64;
1862 else if(op2.kind == 23)
1863 *value2 = (uintptr_t)op2.ui64;
1864 else if(op2.kind == 22 && op2.type->isSigned)
1865 *value2 = (uintptr_t)op2.i64;
1866 else if(op2.kind == 22)
1867 *value2 = (uintptr_t)op2.ui64;
1868 else if(op2.kind == 2 && op2.type->isSigned)
1869 *value2 = (uintptr_t)op2.s;
1870 else if(op2.kind == 2)
1871 *value2 = (uintptr_t)op2.us;
1872 else if(op2.kind == 1 && op2.type->isSigned)
1873 *value2 = (uintptr_t)op2.c;
1874 else if(op2.kind == 24 || op2.kind == 1)
1875 *value2 = (uintptr_t)op2.uc;
1876 else if(op2.kind == 6)
1877 *value2 = (uintptr_t)op2.f;
1878 else if(op2.kind == 7)
1879 *value2 = (uintptr_t)op2.d;
1880 else if(op2.kind == 13)
1881 *value2 = (uintptr_t)op2.ui64;
1882 else
1883 return 0x0;
1884 return 0x1;
1885 }
1886
1887 unsigned int GetIntSize(struct Expression * exp, ssize_t * value2)
1888 {
1889 struct Operand op2 = GetOperand(exp);
1890
1891 if(op2.kind == 3 && op2.type->isSigned)
1892 *value2 = (ssize_t)op2.i;
1893 else if(op2.kind == 3)
1894 *value2 = (ssize_t)op2.ui;
1895 else if(op2.kind == 4 && op2.type->isSigned)
1896 *value2 = (ssize_t)op2.i64;
1897 else if(op2.kind == 4)
1898 *value2 = (ssize_t)op2.ui64;
1899 else if(op2.kind == 23 && op2.type->isSigned)
1900 *value2 = (ssize_t)op2.i64;
1901 else if(op2.kind == 23)
1902 *value2 = (ssize_t)op2.ui64;
1903 else if(op2.kind == 22 && op2.type->isSigned)
1904 *value2 = (ssize_t)op2.i64;
1905 else if(op2.kind == 22)
1906 *value2 = (ssize_t)op2.ui64;
1907 else if(op2.kind == 2 && op2.type->isSigned)
1908 *value2 = (ssize_t)op2.s;
1909 else if(op2.kind == 2)
1910 *value2 = (ssize_t)op2.us;
1911 else if(op2.kind == 1 && op2.type->isSigned)
1912 *value2 = (ssize_t)op2.c;
1913 else if(op2.kind == 24 || op2.kind == 1)
1914 *value2 = (ssize_t)op2.uc;
1915 else if(op2.kind == 6)
1916 *value2 = (ssize_t)op2.f;
1917 else if(op2.kind == 7)
1918 *value2 = (ssize_t)op2.d;
1919 else if(op2.kind == 13)
1920 *value2 = (ssize_t)op2.ui64;
1921 else
1922 return 0x0;
1923 return 0x1;
1924 }
1925
1926 unsigned int GetUIntSize(struct Expression * exp, size_t * value2)
1927 {
1928 struct Operand op2 = GetOperand(exp);
1929
1930 if(op2.kind == 3 && op2.type->isSigned)
1931 *value2 = (size_t)op2.i;
1932 else if(op2.kind == 3)
1933 *value2 = (size_t)op2.ui;
1934 else if(op2.kind == 4 && op2.type->isSigned)
1935 *value2 = (size_t)op2.i64;
1936 else if(op2.kind == 4)
1937 *value2 = (size_t)op2.ui64;
1938 else if(op2.kind == 23 && op2.type->isSigned)
1939 *value2 = (size_t)op2.i64;
1940 else if(op2.kind == 23)
1941 *value2 = (size_t)op2.ui64;
1942 else if(op2.kind == 22 && op2.type->isSigned)
1943 *value2 = (size_t)op2.i64;
1944 else if(op2.kind == 22)
1945 *value2 = (size_t)op2.ui64;
1946 else if(op2.kind == 2 && op2.type->isSigned)
1947 *value2 = (size_t)op2.s;
1948 else if(op2.kind == 2)
1949 *value2 = (size_t)op2.us;
1950 else if(op2.kind == 1 && op2.type->isSigned)
1951 *value2 = (size_t)op2.c;
1952 else if(op2.kind == 24 || op2.kind == 1)
1953 *value2 = (size_t)op2.uc;
1954 else if(op2.kind == 6)
1955 *value2 = (size_t)op2.f;
1956 else if(op2.kind == 7)
1957 *value2 = (size_t)op2.d;
1958 else if(op2.kind == 13)
1959 *value2 = (size_t)op2.ui64;
1960 else
1961 return 0x0;
1962 return 0x1;
1963 }
1964
1965 unsigned int GetShort(struct Expression * exp, short * value2)
1966 {
1967 struct Operand op2 = GetOperand(exp);
1968
1969 if(op2.kind == 3 && op2.type->isSigned)
1970 *value2 = (short)op2.i;
1971 else if(op2.kind == 3)
1972 *value2 = (short)op2.ui;
1973 else if(op2.kind == 4 && op2.type->isSigned)
1974 *value2 = (short)op2.i64;
1975 else if(op2.kind == 4)
1976 *value2 = (short)op2.ui64;
1977 else if(op2.kind == 23 && op2.type->isSigned)
1978 *value2 = (short)op2.i64;
1979 else if(op2.kind == 23)
1980 *value2 = (short)op2.ui64;
1981 else if(op2.kind == 22 && op2.type->isSigned)
1982 *value2 = (short)op2.i64;
1983 else if(op2.kind == 22)
1984 *value2 = (short)op2.ui64;
1985 else if(op2.kind == 2 && op2.type->isSigned)
1986 *value2 = op2.s;
1987 else if(op2.kind == 2)
1988 *value2 = (short)op2.us;
1989 else if(op2.kind == 1 && op2.type->isSigned)
1990 *value2 = (short)op2.c;
1991 else if(op2.kind == 24 || op2.kind == 1)
1992 *value2 = (short)op2.uc;
1993 else if(op2.kind == 6)
1994 *value2 = (short)op2.f;
1995 else if(op2.kind == 7)
1996 *value2 = (short)op2.d;
1997 else if(op2.kind == 13)
1998 *value2 = (short)op2.ui64;
1999 else
2000 return 0x0;
2001 return 0x1;
2002 }
2003
2004 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
2005 {
2006 struct Operand op2 = GetOperand(exp);
2007
2008 if(op2.kind == 3 && op2.type->isSigned)
2009 *value2 = (unsigned short)op2.i;
2010 else if(op2.kind == 3)
2011 *value2 = (unsigned short)op2.ui;
2012 else if(op2.kind == 4 && op2.type->isSigned)
2013 *value2 = (unsigned short)op2.i64;
2014 else if(op2.kind == 4)
2015 *value2 = (unsigned short)op2.ui64;
2016 else if(op2.kind == 23 && op2.type->isSigned)
2017 *value2 = (unsigned short)op2.i64;
2018 else if(op2.kind == 23)
2019 *value2 = (unsigned short)op2.ui64;
2020 else if(op2.kind == 22 && op2.type->isSigned)
2021 *value2 = (unsigned short)op2.i64;
2022 else if(op2.kind == 22)
2023 *value2 = (unsigned short)op2.ui64;
2024 else if(op2.kind == 2 && op2.type->isSigned)
2025 *value2 = (unsigned short)op2.s;
2026 else if(op2.kind == 2)
2027 *value2 = op2.us;
2028 else if(op2.kind == 1 && op2.type->isSigned)
2029 *value2 = (unsigned short)op2.c;
2030 else if(op2.kind == 24 || op2.kind == 1)
2031 *value2 = (unsigned short)op2.uc;
2032 else if(op2.kind == 6)
2033 *value2 = (unsigned short)op2.f;
2034 else if(op2.kind == 7)
2035 *value2 = (unsigned short)op2.d;
2036 else if(op2.kind == 13)
2037 *value2 = (unsigned short)op2.ui64;
2038 else
2039 return 0x0;
2040 return 0x1;
2041 }
2042
2043 unsigned int GetChar(struct Expression * exp, char * value2)
2044 {
2045 struct Operand op2 = GetOperand(exp);
2046
2047 if(op2.kind == 3 && op2.type->isSigned)
2048 *value2 = (char)op2.i;
2049 else if(op2.kind == 3)
2050 *value2 = (char)op2.ui;
2051 else if(op2.kind == 4 && op2.type->isSigned)
2052 *value2 = (char)op2.i64;
2053 else if(op2.kind == 4)
2054 *value2 = (char)op2.ui64;
2055 else if(op2.kind == 23 && op2.type->isSigned)
2056 *value2 = (char)op2.i64;
2057 else if(op2.kind == 23)
2058 *value2 = (char)op2.ui64;
2059 else if(op2.kind == 22 && op2.type->isSigned)
2060 *value2 = (char)op2.i64;
2061 else if(op2.kind == 22)
2062 *value2 = (char)op2.ui64;
2063 else if(op2.kind == 2 && op2.type->isSigned)
2064 *value2 = (char)op2.s;
2065 else if(op2.kind == 2)
2066 *value2 = (char)op2.us;
2067 else if(op2.kind == 1 && op2.type->isSigned)
2068 *value2 = op2.c;
2069 else if(op2.kind == 24 || op2.kind == 1)
2070 *value2 = (char)op2.uc;
2071 else if(op2.kind == 6)
2072 *value2 = (char)op2.f;
2073 else if(op2.kind == 7)
2074 *value2 = (char)op2.d;
2075 else if(op2.kind == 13)
2076 *value2 = (char)op2.ui64;
2077 else
2078 return 0x0;
2079 return 0x1;
2080 }
2081
2082 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
2083 {
2084 struct Operand op2 = GetOperand(exp);
2085
2086 if(op2.kind == 3 && op2.type->isSigned)
2087 *value2 = (unsigned char)op2.i;
2088 else if(op2.kind == 3)
2089 *value2 = (unsigned char)op2.ui;
2090 else if(op2.kind == 4 && op2.type->isSigned)
2091 *value2 = (unsigned char)op2.i64;
2092 else if(op2.kind == 4)
2093 *value2 = (unsigned char)op2.ui64;
2094 else if(op2.kind == 23 && op2.type->isSigned)
2095 *value2 = (unsigned char)op2.i64;
2096 else if(op2.kind == 23)
2097 *value2 = (unsigned char)op2.ui64;
2098 else if(op2.kind == 22 && op2.type->isSigned)
2099 *value2 = (unsigned char)op2.i64;
2100 else if(op2.kind == 22)
2101 *value2 = (unsigned char)op2.ui64;
2102 else if(op2.kind == 2 && op2.type->isSigned)
2103 *value2 = (unsigned char)op2.s;
2104 else if(op2.kind == 2)
2105 *value2 = (unsigned char)op2.us;
2106 else if(op2.kind == 1 && op2.type->isSigned)
2107 *value2 = (unsigned char)op2.c;
2108 else if(op2.kind == 24 || op2.kind == 1)
2109 *value2 = op2.uc;
2110 else if(op2.kind == 6)
2111 *value2 = (unsigned char)op2.f;
2112 else if(op2.kind == 7)
2113 *value2 = (unsigned char)op2.d;
2114 else if(op2.kind == 13)
2115 *value2 = (unsigned char)op2.ui64;
2116 else
2117 return 0x0;
2118 return 0x1;
2119 }
2120
2121 unsigned int GetFloat(struct Expression * exp, float * value2)
2122 {
2123 struct Operand op2 = GetOperand(exp);
2124
2125 if(op2.kind == 3 && op2.type->isSigned)
2126 *value2 = (float)(float)op2.i;
2127 else if(op2.kind == 3)
2128 *value2 = (float)(float)op2.ui;
2129 else if(op2.kind == 4 && op2.type->isSigned)
2130 *value2 = (float)(float)op2.i64;
2131 else if(op2.kind == 4)
2132 *value2 = (float)(float)op2.ui64;
2133 else if(op2.kind == 23 && op2.type->isSigned)
2134 *value2 = (float)(float)op2.i64;
2135 else if(op2.kind == 23)
2136 *value2 = (float)(float)op2.ui64;
2137 else if(op2.kind == 22 && op2.type->isSigned)
2138 *value2 = (float)(float)op2.i64;
2139 else if(op2.kind == 22)
2140 *value2 = (float)(float)op2.ui64;
2141 else if(op2.kind == 2 && op2.type->isSigned)
2142 *value2 = (float)(float)op2.s;
2143 else if(op2.kind == 2)
2144 *value2 = (float)(float)op2.us;
2145 else if(op2.kind == 1 && op2.type->isSigned)
2146 *value2 = (float)(float)op2.c;
2147 else if(op2.kind == 24 || op2.kind == 1)
2148 *value2 = (float)(float)op2.uc;
2149 else if(op2.kind == 6)
2150 *value2 = (float)op2.f;
2151 else if(op2.kind == 7)
2152 *value2 = (float)op2.d;
2153 else if(op2.kind == 13)
2154 *value2 = (float)(float)op2.ui64;
2155 else
2156 return 0x0;
2157 return 0x1;
2158 }
2159
2160 unsigned int GetDouble(struct Expression * exp, double * value2)
2161 {
2162 struct Operand op2 = GetOperand(exp);
2163
2164 if(op2.kind == 3 && op2.type->isSigned)
2165 *value2 = (double)(double)op2.i;
2166 else if(op2.kind == 3)
2167 *value2 = (double)(double)op2.ui;
2168 else if(op2.kind == 4 && op2.type->isSigned)
2169 *value2 = (double)(double)op2.i64;
2170 else if(op2.kind == 4)
2171 *value2 = (double)(double)op2.ui64;
2172 else if(op2.kind == 23 && op2.type->isSigned)
2173 *value2 = (double)(double)op2.i64;
2174 else if(op2.kind == 23)
2175 *value2 = (double)(double)op2.ui64;
2176 else if(op2.kind == 22 && op2.type->isSigned)
2177 *value2 = (double)(double)op2.i64;
2178 else if(op2.kind == 22)
2179 *value2 = (double)(double)op2.ui64;
2180 else if(op2.kind == 2 && op2.type->isSigned)
2181 *value2 = (double)(double)op2.s;
2182 else if(op2.kind == 2)
2183 *value2 = (double)(double)op2.us;
2184 else if(op2.kind == 1 && op2.type->isSigned)
2185 *value2 = (double)(double)op2.c;
2186 else if(op2.kind == 24 || op2.kind == 1)
2187 *value2 = (double)(double)op2.uc;
2188 else if(op2.kind == 6)
2189 *value2 = (double)op2.f;
2190 else if(op2.kind == 7)
2191 *value2 = (double)op2.d;
2192 else if(op2.kind == 13)
2193 *value2 = (double)(double)op2.ui64;
2194 else
2195 return 0x0;
2196 return 0x1;
2197 }
2198
2199 void ComputeExpression(struct Expression * exp);
2200
2201 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2202
2203 extern int targetBits;
2204
2205 int ComputeTypeSize(struct Type * type);
2206
2207 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2208
2209 struct __ecereNameSpace__ecere__com__BitMember
2210 {
2211 struct __ecereNameSpace__ecere__com__BitMember * prev;
2212 struct __ecereNameSpace__ecere__com__BitMember * next;
2213 char *  name;
2214 unsigned int isProperty;
2215 int memberAccess;
2216 int id;
2217 struct __ecereNameSpace__ecere__com__Class * _class;
2218 char *  dataTypeString;
2219 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2220 struct Type * dataType;
2221 int type;
2222 int size;
2223 int pos;
2224 uint64 mask;
2225 } __attribute__ ((gcc_struct));
2226
2227 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2228
2229 struct __ecereNameSpace__ecere__sys__OldLink
2230 {
2231 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2232 struct __ecereNameSpace__ecere__sys__OldLink * next;
2233 void *  data;
2234 } __attribute__ ((gcc_struct));
2235
2236 void FinishTemplatesContext(struct Context * context);
2237
2238 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2239 {
2240 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2241 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2242
2243 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))
2244 {
2245 int c;
2246 int unionMemberOffset = 0;
2247 int bitFields = 0;
2248
2249 if(member)
2250 {
2251 member->memberOffset = 0;
2252 if(targetBits < sizeof(void *) * 8)
2253 member->structAlignment = 0;
2254 }
2255 else if(targetBits < sizeof(void *) * 8)
2256 _class->structAlignment = 0;
2257 if(!member && ((_class->type == 0 || _class->type == 5) || (_class->type == 1 && _class->memberOffset && _class->memberOffset > _class->base->structSize)))
2258 _class->memberOffset = (_class->base && _class->type == 1) ? _class->base->structSize : 0;
2259 if(!member && _class->destructionWatchOffset)
2260 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2261 {
2262 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2263
2264 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2265 {
2266 if(!dataMember->isProperty)
2267 {
2268 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2269 {
2270 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2271 }
2272 }
2273 }
2274 }
2275 {
2276 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2277
2278 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2279 {
2280 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2281 {
2282 if(!isMember && _class->type == 2 && dataMember->dataType)
2283 {
2284 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2285 uint64 mask = 0;
2286 int d;
2287
2288 ComputeTypeSize(dataMember->dataType);
2289 if(bitMember->pos == -1)
2290 bitMember->pos = _class->memberOffset;
2291 if(!bitMember->size)
2292 bitMember->size = dataMember->dataType->size * 8;
2293 _class->memberOffset = bitMember->pos + bitMember->size;
2294 for(d = 0; d < bitMember->size; d++)
2295 {
2296 if(d)
2297 mask <<= 1;
2298 mask |= 1;
2299 }
2300 bitMember->mask = mask << bitMember->pos;
2301 }
2302 else if(dataMember->type == 0 && dataMember->dataType)
2303 {
2304 int size;
2305 int alignment = 0;
2306
2307 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2308 ComputeTypeSize(dataMember->dataType);
2309 if(dataMember->dataType->bitFieldCount)
2310 {
2311 bitFields += dataMember->dataType->bitFieldCount;
2312 size = 0;
2313 }
2314 else
2315 {
2316 if(bitFields)
2317 {
2318 int size = (bitFields + 7) / 8;
2319
2320 if(isMember)
2321 {
2322 int __simpleStruct0;
2323
2324 if(alignment)
2325 {
2326 int __simpleStruct0;
2327
2328 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2329 if(member->memberOffset % alignment)
2330 member->memberOffset += alignment - (member->memberOffset % alignment);
2331 }
2332 dataMember->offset = member->memberOffset;
2333 if(member->type == 1)
2334 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2335 else
2336 {
2337 member->memberOffset += size;
2338 }
2339 }
2340 else
2341 {
2342 if(alignment)
2343 {
2344 int __simpleStruct0;
2345
2346 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2347 if(_class->memberOffset % alignment)
2348 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2349 }
2350 dataMember->offset = _class->memberOffset;
2351 _class->memberOffset += size;
2352 }
2353 bitFields = 0;
2354 }
2355 size = dataMember->dataType->size;
2356 alignment = dataMember->dataType->alignment;
2357 }
2358 if(isMember)
2359 {
2360 int __simpleStruct0;
2361
2362 if(alignment)
2363 {
2364 int __simpleStruct0;
2365
2366 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2367 if(member->memberOffset % alignment)
2368 member->memberOffset += alignment - (member->memberOffset % alignment);
2369 }
2370 dataMember->offset = member->memberOffset;
2371 if(member->type == 1)
2372 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2373 else
2374 {
2375 member->memberOffset += size;
2376 }
2377 }
2378 else
2379 {
2380 if(alignment)
2381 {
2382 int __simpleStruct0;
2383
2384 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2385 if(_class->memberOffset % alignment)
2386 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2387 }
2388 dataMember->offset = _class->memberOffset;
2389 _class->memberOffset += size;
2390 }
2391 }
2392 else
2393 {
2394 int alignment;
2395
2396 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2397 alignment = dataMember->structAlignment;
2398 if(isMember)
2399 {
2400 int __simpleStruct0;
2401
2402 if(alignment)
2403 {
2404 int __simpleStruct0;
2405
2406 if(member->memberOffset % alignment)
2407 member->memberOffset += alignment - (member->memberOffset % alignment);
2408 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2409 }
2410 dataMember->offset = member->memberOffset;
2411 if(member->type == 1)
2412 unionMemberOffset = (__simpleStruct0 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2413 else
2414 member->memberOffset += dataMember->memberOffset;
2415 }
2416 else
2417 {
2418 if(alignment)
2419 {
2420 int __simpleStruct0;
2421
2422 if(_class->memberOffset % alignment)
2423 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2424 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2425 }
2426 dataMember->offset = _class->memberOffset;
2427 _class->memberOffset += dataMember->memberOffset;
2428 }
2429 }
2430 }
2431 }
2432 if(bitFields)
2433 {
2434 int alignment = 0;
2435 int size = (bitFields + 7) / 8;
2436
2437 if(isMember)
2438 {
2439 int __simpleStruct0;
2440
2441 if(alignment)
2442 {
2443 int __simpleStruct0;
2444
2445 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2446 if(member->memberOffset % alignment)
2447 member->memberOffset += alignment - (member->memberOffset % alignment);
2448 }
2449 if(member->type == 1)
2450 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2451 else
2452 {
2453 member->memberOffset += size;
2454 }
2455 }
2456 else
2457 {
2458 if(alignment)
2459 {
2460 int __simpleStruct0;
2461
2462 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2463 if(_class->memberOffset % alignment)
2464 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2465 }
2466 _class->memberOffset += size;
2467 }
2468 bitFields = 0;
2469 }
2470 }
2471 if(member && member->type == 1)
2472 {
2473 member->memberOffset = unionMemberOffset;
2474 }
2475 if(!isMember)
2476 {
2477 if(_class->type != 2)
2478 {
2479 int extra = 0;
2480
2481 if(_class->structAlignment)
2482 {
2483 if(_class->memberOffset % _class->structAlignment)
2484 extra += _class->structAlignment - (_class->memberOffset % _class->structAlignment);
2485 }
2486 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset + extra;
2487 if(!member)
2488 {
2489 struct __ecereNameSpace__ecere__com__Property * prop;
2490
2491 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2492 {
2493 if(prop->isProperty && prop->isWatchable)
2494 {
2495 prop->watcherOffset = _class->structSize;
2496 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2497 }
2498 }
2499 }
2500 {
2501 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2502
2503 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2504 {
2505 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2506
2507 if(deriv->computeSize)
2508 {
2509 deriv->offset = _class->structSize;
2510 deriv->memberOffset = 0;
2511 deriv->structSize = deriv->offset;
2512 ComputeClassMembers(deriv, 0x0);
2513 }
2514 }
2515 }
2516 }
2517 }
2518 }
2519 if(context)
2520 FinishTemplatesContext(context);
2521 }
2522
2523 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2524
2525 struct __ecereNameSpace__ecere__com__NameSpace
2526 {
2527 char *  name;
2528 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2529 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2530 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2531 int depth;
2532 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2533 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2534 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2535 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2536 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2537 } __attribute__ ((gcc_struct));
2538
2539 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2540
2541 struct __ecereNameSpace__ecere__com__Module
2542 {
2543 struct __ecereNameSpace__ecere__com__Instance * application;
2544 struct __ecereNameSpace__ecere__sys__OldList classes;
2545 struct __ecereNameSpace__ecere__sys__OldList defines;
2546 struct __ecereNameSpace__ecere__sys__OldList functions;
2547 struct __ecereNameSpace__ecere__sys__OldList modules;
2548 struct __ecereNameSpace__ecere__com__Instance * prev;
2549 struct __ecereNameSpace__ecere__com__Instance * next;
2550 char *  name;
2551 void *  library;
2552 void *  Unload;
2553 int importType;
2554 int origImportType;
2555 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2556 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2557 } __attribute__ ((gcc_struct));
2558
2559 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2560 {
2561 struct __ecereNameSpace__ecere__com__Class * _class;
2562 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2563
2564 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
2565 ComputeModuleClasses(subModule->data);
2566 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->classes.first; _class; _class = _class->next)
2567 ComputeClassMembers(_class, 0x0);
2568 }
2569
2570 extern unsigned int inCompiler;
2571
2572 extern void Compiler_Error(char *  format, ...);
2573
2574 extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
2575
2576 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
2577
2578 int ComputeTypeSize(struct Type * type)
2579 {
2580 unsigned int size = type ? type->size : 0;
2581
2582 if(!size && type && !type->computing)
2583 {
2584 type->computing = 0x1;
2585 switch(type->kind)
2586 {
2587 case 24:
2588 type->alignment = size = sizeof(char);
2589 break;
2590 case 1:
2591 type->alignment = size = sizeof(char);
2592 break;
2593 case 3:
2594 type->alignment = size = sizeof(int);
2595 break;
2596 case 4:
2597 type->alignment = size = sizeof(long long);
2598 break;
2599 case 22:
2600 type->alignment = size = targetBits / 8;
2601 break;
2602 case 23:
2603 type->alignment = size = targetBits / 8;
2604 break;
2605 case 5:
2606 type->alignment = size = sizeof(long);
2607 break;
2608 case 2:
2609 type->alignment = size = sizeof(short);
2610 break;
2611 case 6:
2612 type->alignment = size = sizeof(float);
2613 break;
2614 case 7:
2615 type->alignment = size = sizeof(double);
2616 break;
2617 case 8:
2618 {
2619 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2620
2621 if(_class && _class->type == 1)
2622 {
2623 ComputeClassMembers(_class, 0x0);
2624 type->alignment = _class->structAlignment;
2625 size = _class->structSize;
2626 if(type->alignment && size % type->alignment)
2627 size += type->alignment - (size % type->alignment);
2628 }
2629 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2630 {
2631 if(!_class->dataType)
2632 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2633 size = type->alignment = ComputeTypeSize(_class->dataType);
2634 }
2635 else
2636 size = type->alignment = targetBits / 8;
2637 break;
2638 }
2639 case 13:
2640 case 19:
2641 size = type->alignment = targetBits / 8;
2642 break;
2643 case 12:
2644 if(type->arraySizeExp)
2645 {
2646 ProcessExpressionType(type->arraySizeExp);
2647 ComputeExpression(type->arraySizeExp);
2648 if(!type->arraySizeExp->isConstant || (type->arraySizeExp->expType->kind != 3 && type->arraySizeExp->expType->kind != 15 && (type->arraySizeExp->expType->kind != 8 || !type->arraySizeExp->expType->_class->registered || type->arraySizeExp->expType->_class->registered->type != 4)))
2649 {
2650 struct Location oldLoc = yylloc;
2651 char expression[10240];
2652
2653 expression[0] = '\0';
2654 type->arraySizeExp->expType = (((void *)0));
2655 yylloc = type->arraySizeExp->loc;
2656 if(inCompiler)
2657 PrintExpression(type->arraySizeExp, expression);
2658 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Array size not constant int (%s)\n", (((void *)0))), expression);
2659 yylloc = oldLoc;
2660 }
2661 GetInt(type->arraySizeExp, &type->arraySize);
2662 }
2663 else if(type->enumClass)
2664 {
2665 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2666 {
2667 type->arraySize = (int)__ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2668 }
2669 else
2670 type->arraySize = 0;
2671 }
2672 else
2673 {
2674 type->arraySize = 0;
2675 }
2676 size = ComputeTypeSize(type->type) * type->arraySize;
2677 if(type->type)
2678 type->alignment = type->type->alignment;
2679 break;
2680 case 9:
2681 {
2682 struct Type * member;
2683
2684 for(member = type->members.first; member; member = member->next)
2685 {
2686 int __simpleStruct0, __simpleStruct1;
2687 unsigned int addSize = ComputeTypeSize(member);
2688
2689 member->offset = size;
2690 if(member->alignment && size % member->alignment)
2691 member->offset += member->alignment - (size % member->alignment);
2692 size = member->offset;
2693 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2694 size += addSize;
2695 }
2696 if(type->alignment && size % type->alignment)
2697 size += type->alignment - (size % type->alignment);
2698 break;
2699 }
2700 case 10:
2701 {
2702 struct Type * member;
2703
2704 for(member = type->members.first; member; member = member->next)
2705 {
2706 int __simpleStruct0, __simpleStruct1;
2707 unsigned int addSize = ComputeTypeSize(member);
2708
2709 member->offset = size;
2710 if(member->alignment && size % member->alignment)
2711 member->offset += member->alignment - (size % member->alignment);
2712 size = member->offset;
2713 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2714 size = ((size > addSize) ? size : addSize);
2715 }
2716 if(type->alignment && size % type->alignment)
2717 size += type->alignment - (size % type->alignment);
2718 break;
2719 }
2720 case 20:
2721 {
2722 struct TemplateParameter * param = type->templateParameter;
2723 struct Type * baseType = ProcessTemplateParameterType(param);
2724
2725 if(baseType)
2726 {
2727 size = ComputeTypeSize(baseType);
2728 type->alignment = baseType->alignment;
2729 }
2730 else
2731 type->alignment = size = sizeof(uint64);
2732 break;
2733 }
2734 case 15:
2735 {
2736 type->alignment = size = sizeof(enum
2737 {
2738 test
2739 });
2740 break;
2741 }
2742 case 21:
2743 {
2744 type->alignment = size = targetBits / 8;
2745 break;
2746 }
2747 }
2748 type->size = size;
2749 type->computing = 0x0;
2750 }
2751 return size;
2752 }
2753
2754 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2755
2756 extern struct Identifier * MkIdentifier(char *  string);
2757
2758 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2759
2760 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2761
2762 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2763
2764 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2765
2766 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2767
2768 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2769
2770 extern void FreeType(struct Type * type);
2771
2772 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2773
2774 extern struct Specifier * MkSpecifier(int specifier);
2775
2776 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2777
2778 extern struct Expression * MkExpConstant(char *  string);
2779
2780 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)
2781 {
2782 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2783 unsigned int totalSize = 0;
2784 unsigned int maxSize = 0;
2785 int alignment, size;
2786 struct __ecereNameSpace__ecere__com__DataMember * member;
2787 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2788
2789 if(addedPadding)
2790 *addedPadding = 0x0;
2791 if(!isMember && _class->base)
2792 {
2793 maxSize = _class->structSize;
2794 {
2795 if(_class->type == 1 || _class->type == 5)
2796 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass, (((void *)0)));
2797 else
2798 {
2799 unsigned int baseSize = _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2800
2801 if(maxSize > baseSize)
2802 maxSize -= baseSize;
2803 else
2804 maxSize = 0;
2805 }
2806 }
2807 }
2808 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2809 {
2810 if(!member->isProperty)
2811 {
2812 switch(member->type)
2813 {
2814 case 0:
2815 {
2816 if(member->dataTypeString)
2817 {
2818 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2819 struct Declarator * decl;
2820
2821 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2822 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2823 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2824 if(!member->dataType)
2825 member->dataType = ProcessType(specs, decl);
2826 ReplaceThisClassSpecifiers(specs, topClass);
2827 {
2828 struct Type * type = ProcessType(specs, decl);
2829
2830 DeclareType(member->dataType, 0x0, 0x0);
2831 FreeType(type);
2832 }
2833 ComputeTypeSize(member->dataType);
2834 size = member->dataType->size;
2835 alignment = member->dataType->alignment;
2836 if(alignment)
2837 {
2838 if(totalSize % alignment)
2839 totalSize += alignment - (totalSize % alignment);
2840 }
2841 totalSize += size;
2842 }
2843 break;
2844 }
2845 case 1:
2846 case 2:
2847 {
2848 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2849
2850 size = 0;
2851 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass, (((void *)0)));
2852 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
2853 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
2854 alignment = member->structAlignment;
2855 if(alignment)
2856 {
2857 if(totalSize % alignment)
2858 totalSize += alignment - (totalSize % alignment);
2859 }
2860 totalSize += size;
2861 break;
2862 }
2863 }
2864 }
2865 }
2866 if(retSize)
2867 {
2868 unsigned int __simpleStruct0;
2869
2870 if(topMember && topMember->type == 1)
2871 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
2872 else
2873 *retSize += totalSize;
2874 }
2875 else if(totalSize < maxSize && _class->type != 1000)
2876 {
2877 int autoPadding = 0;
2878
2879 if(!isMember && _class->structAlignment && totalSize % _class->structAlignment)
2880 autoPadding = _class->structAlignment - (totalSize % _class->structAlignment);
2881 if(totalSize + autoPadding < maxSize)
2882 {
2883 char sizeString[50];
2884
2885 sprintf(sizeString, "%d", maxSize - totalSize);
2886 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
2887 if(addedPadding)
2888 *addedPadding = 0x1;
2889 }
2890 }
2891 if(context)
2892 FinishTemplatesContext(context);
2893 return topMember ? topMember->memberID : _class->memberID;
2894 }
2895
2896 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2897 {
2898 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2899 unsigned int totalSize = 0;
2900 struct __ecereNameSpace__ecere__com__DataMember * member;
2901 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2902
2903 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
2904 DeclareMembers(_class->base, 0x0);
2905 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2906 {
2907 if(!member->isProperty)
2908 {
2909 switch(member->type)
2910 {
2911 case 0:
2912 {
2913 if(!member->dataType && member->dataTypeString)
2914 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
2915 if(member->dataType)
2916 DeclareType(member->dataType, 0x0, 0x0);
2917 break;
2918 }
2919 case 1:
2920 case 2:
2921 {
2922 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
2923 break;
2924 }
2925 }
2926 }
2927 }
2928 if(context)
2929 FinishTemplatesContext(context);
2930 return topMember ? topMember->memberID : _class->memberID;
2931 }
2932
2933 extern struct Symbol * FindClass(char *  name);
2934
2935 extern char *  strchr(const char * , int);
2936
2937 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
2938
2939 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (*  FreeFunction)(void * ));
2940
2941 extern void FreeClassDef(struct ClassDef * def);
2942
2943 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
2944
2945 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
2946
2947 extern char *  strcpy(char * , const char * );
2948
2949 extern void MangleClassName(char *  className);
2950
2951 extern void DeclareClass(struct Symbol * classSym, char *  className);
2952
2953 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
2954
2955 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
2956
2957 void DeclareStruct(char * name, unsigned int skipNoHead)
2958 {
2959 struct External * external = (((void *)0));
2960 struct Symbol * classSym = FindClass(name);
2961
2962 if(!inCompiler || !classSym)
2963 return ;
2964 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
2965 return ;
2966 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
2967 {
2968 struct Declaration * decl;
2969 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2970 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
2971 char structName[1024];
2972
2973 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
2974 classSym->declaring++;
2975 if(strchr(classSym->string, '<'))
2976 {
2977 if(classSym->registered->templateClass)
2978 {
2979 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
2980 classSym->declaring--;
2981 }
2982 return ;
2983 }
2984 DeclareMembers(classSym->registered, 0x0);
2985 structName[0] = (char)0;
2986 FullClassNameCat(structName, name, 0x0);
2987 if(!skipNoHead)
2988 {
2989 unsigned int addedPadding = 0x0;
2990
2991 classSym->declaredStructSym = 0x1;
2992 declarations = MkList();
2993 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered, &addedPadding);
2994 if(!(*declarations).count || ((*declarations).count == 1 && addedPadding))
2995 {
2996 FreeList(declarations, FreeClassDef);
2997 declarations = (((void *)0));
2998 }
2999 }
3000 if(skipNoHead || declarations)
3001 {
3002 if(external && external->declaration)
3003 {
3004 ((struct Specifier *)(*external->declaration->specifiers).first)->definitions = declarations;
3005 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3006 {
3007 if(classSym->structExternal)
3008 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3009 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3010 classSym->id = curExternal->symbol->idCode;
3011 classSym->idCode = curExternal->symbol->idCode;
3012 }
3013 }
3014 else
3015 {
3016 if(!external)
3017 external = MkExternalDeclaration((((void *)0)));
3018 specifiers = MkList();
3019 declarators = MkList();
3020 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
3021 external->declaration = decl = MkDeclaration(specifiers, declarators);
3022 if(decl->symbol && !decl->symbol->pointerExternal)
3023 decl->symbol->pointerExternal = external;
3024 if(classSym->registered && classSym->registered->type == 1)
3025 {
3026 char className[1024];
3027
3028 strcpy(className, "__ecereClass_");
3029 FullClassNameCat(className, classSym->string, 0x1);
3030 MangleClassName(className);
3031 DeclareClass(classSym, className);
3032 external->symbol = classSym;
3033 classSym->pointerExternal = external;
3034 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3035 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3036 }
3037 else
3038 {
3039 char className[1024];
3040
3041 strcpy(className, "__ecereClass_");
3042 FullClassNameCat(className, classSym->string, 0x1);
3043 MangleClassName(className);
3044 classSym->structExternal = external;
3045 DeclareClass(classSym, className);
3046 external->symbol = classSym;
3047 }
3048 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
3049 }
3050 }
3051 classSym->declaring--;
3052 }
3053 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3054 {
3055 classSym->declaring++;
3056 {
3057 if(classSym->registered)
3058 DeclareMembers(classSym->registered, 0x0);
3059 }
3060 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
3061 {
3062 if(classSym->structExternal)
3063 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3064 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3065 classSym->id = curExternal->symbol->idCode;
3066 classSym->idCode = curExternal->symbol->idCode;
3067 }
3068 classSym->declaring--;
3069 }
3070 }
3071
3072 extern char *  strcat(char * , const char * );
3073
3074 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
3075
3076 extern struct ModuleImport * mainModule;
3077
3078 extern struct Specifier * MkSpecifierName(char *  name);
3079
3080 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
3081
3082 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
3083
3084 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
3085
3086 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
3087
3088 extern void FreeDeclarator(struct Declarator * decl);
3089
3090 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
3091
3092 struct PropertyImport
3093 {
3094 struct PropertyImport * prev;
3095 struct PropertyImport * next;
3096 char *  name;
3097 unsigned int isVirtual;
3098 unsigned int hasSet;
3099 unsigned int hasGet;
3100 } __attribute__ ((gcc_struct));
3101
3102 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3103
3104 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
3105 {
3106 struct Symbol * symbol = prop->symbol;
3107 char propName[1024];
3108
3109 strcpy(setName, "__ecereProp_");
3110 FullClassNameCat(setName, prop->_class->fullName, 0x0);
3111 strcat(setName, "_Set_");
3112 FullClassNameCat(setName, prop->name, 0x1);
3113 strcpy(getName, "__ecereProp_");
3114 FullClassNameCat(getName, prop->_class->fullName, 0x0);
3115 strcat(getName, "_Get_");
3116 FullClassNameCat(getName, prop->name, 0x1);
3117 strcpy(propName, "__ecereProp_");
3118 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3119 strcat(propName, "_");
3120 FullClassNameCat(propName, prop->name, 0x1);
3121 MangleClassName(getName);
3122 MangleClassName(setName);
3123 MangleClassName(propName);
3124 if(prop->_class->type == 1)
3125 DeclareStruct(prop->_class->fullName, 0x0);
3126 if(!symbol || curExternal->symbol->idCode < symbol->id)
3127 {
3128 unsigned int imported = 0x0;
3129 unsigned int dllImport = 0x0;
3130
3131 if(!symbol || symbol->_import)
3132 {
3133 if(!symbol)
3134 {
3135 struct Symbol * classSym;
3136
3137 if(!prop->_class->symbol)
3138 prop->_class->symbol = FindClass(prop->_class->fullName);
3139 classSym = prop->_class->symbol;
3140 if(classSym && !classSym->_import)
3141 {
3142 struct ModuleImport * module;
3143
3144 if(prop->_class->module)
3145 module = FindModule(prop->_class->module);
3146 else
3147 module = mainModule;
3148 classSym->_import = __extension__ ({
3149 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
3150
3151 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), __ecereInstance1->isRemote = prop->_class->isRemote, __ecereInstance1;
3152 });
3153 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3154 }
3155 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3156 symbol->_import = (struct ClassImport *)__extension__ ({
3157 struct PropertyImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport);
3158
3159 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), __ecereInstance1->isVirtual = 0x0, __ecereInstance1->hasSet = prop->Set ? 0x1 : 0x0, __ecereInstance1->hasGet = prop->Get ? 0x1 : 0x0, __ecereInstance1;
3160 });
3161 if(classSym)
3162 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
3163 }
3164 imported = 0x1;
3165 if(prop->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + structSize_Instance)))->importType != 1)
3166 dllImport = 0x1;
3167 }
3168 if(!symbol->type)
3169 {
3170 struct Context * context = SetupTemplatesContext(prop->_class);
3171
3172 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
3173 FinishTemplatesContext(context);
3174 }
3175 if(prop->Get)
3176 {
3177 if(!symbol->externalGet || symbol->externalGet->type == 0)
3178 {
3179 struct Declaration * decl;
3180 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3181 struct Declarator * d;
3182 struct __ecereNameSpace__ecere__sys__OldList * params;
3183 struct Specifier * spec;
3184 struct External * external;
3185 struct Declarator * typeDecl;
3186 unsigned int simple = 0x0;
3187
3188 specifiers = MkList();
3189 declarators = MkList();
3190 params = MkList();
3191 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3192 d = MkDeclaratorIdentifier(MkIdentifier(getName));
3193 if(dllImport)
3194 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3195 {
3196 struct Context * context = SetupTemplatesContext(prop->_class);
3197
3198 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
3199 FinishTemplatesContext(context);
3200 }
3201 for(spec = (*specifiers).first; spec; spec = spec->next)
3202 {
3203 if(spec->type == 1)
3204 {
3205 if((!typeDecl || typeDecl->type == 1))
3206 {
3207 struct Symbol * classSym = spec->symbol;
3208
3209 symbol->_class = classSym->registered;
3210 if(classSym->registered && classSym->registered->type == 1)
3211 {
3212 DeclareStruct(spec->name, 0x0);
3213 simple = 0x1;
3214 }
3215 }
3216 }
3217 }
3218 if(!simple)
3219 d = PlugDeclarator(typeDecl, d);
3220 else
3221 {
3222 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3223 specifiers = MkList();
3224 }
3225 d = MkDeclaratorFunction(d, params);
3226 if(dllImport)
3227 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3228 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3229 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3230 if(simple)
3231 ListAdd(specifiers, MkSpecifier(VOID));
3232 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3233 decl = MkDeclaration(specifiers, declarators);
3234 external = MkExternalDeclaration(decl);
3235 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3236 external->symbol = symbol;
3237 symbol->externalGet = external;
3238 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3239 if(typeDecl)
3240 FreeDeclarator(typeDecl);
3241 }
3242 else
3243 {
3244 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3245 }
3246 }
3247 if(prop->Set)
3248 {
3249 if(!symbol->externalSet || symbol->externalSet->type == 0)
3250 {
3251 struct Declaration * decl;
3252 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3253 struct Declarator * d;
3254 struct __ecereNameSpace__ecere__sys__OldList * params;
3255 struct Specifier * spec;
3256 struct External * external;
3257 struct Declarator * typeDecl;
3258
3259 declarators = MkList();
3260 params = MkList();
3261 if(!prop->conversion || prop->_class->type == 1)
3262 {
3263 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3264 }
3265 specifiers = MkList();
3266 {
3267 struct Context * context = SetupTemplatesContext(prop->_class);
3268
3269 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3270 FinishTemplatesContext(context);
3271 }
3272 ListAdd(params, MkTypeName(specifiers, d));
3273 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3274 if(dllImport)
3275 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3276 d = MkDeclaratorFunction(d, params);
3277 for(spec = (*specifiers).first; spec; spec = spec->next)
3278 {
3279 if(spec->type == 1)
3280 {
3281 if((!typeDecl || typeDecl->type == 1))
3282 {
3283 struct Symbol * classSym = spec->symbol;
3284
3285 symbol->_class = classSym->registered;
3286 if(classSym->registered && classSym->registered->type == 1)
3287 DeclareStruct(spec->name, 0x0);
3288 }
3289 }
3290 }
3291 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3292 specifiers = MkList();
3293 if(dllImport)
3294 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3295 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3296 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3297 if(!prop->conversion || prop->_class->type == 1)
3298 ListAdd(specifiers, MkSpecifier(VOID));
3299 else
3300 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3301 decl = MkDeclaration(specifiers, declarators);
3302 external = MkExternalDeclaration(decl);
3303 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3304 external->symbol = symbol;
3305 symbol->externalSet = external;
3306 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3307 }
3308 else
3309 {
3310 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3311 }
3312 }
3313 if(!symbol->externalPtr)
3314 {
3315 struct Declaration * decl;
3316 struct External * external;
3317 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3318
3319 if(imported)
3320 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3321 else
3322 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3323 ListAdd(specifiers, MkSpecifierName("Property"));
3324 {
3325 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3326
3327 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3328 if(!imported)
3329 {
3330 strcpy(propName, "__ecerePropM_");
3331 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3332 strcat(propName, "_");
3333 FullClassNameCat(propName, prop->name, 0x1);
3334 MangleClassName(propName);
3335 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3336 }
3337 decl = MkDeclaration(specifiers, list);
3338 }
3339 external = MkExternalDeclaration(decl);
3340 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3341 external->symbol = symbol;
3342 symbol->externalPtr = external;
3343 }
3344 else
3345 {
3346 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3347 }
3348 symbol->id = curExternal->symbol->idCode;
3349 }
3350 }
3351
3352 struct Type * Dereference(struct Type * source)
3353 {
3354 struct Type * type = (((void *)0));
3355
3356 if(source)
3357 {
3358 if(source->kind == 13 || source->kind == 12)
3359 {
3360 type = source->type;
3361 source->type->refCount++;
3362 }
3363 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3364 {
3365 type = __extension__ ({
3366 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3367
3368 __ecereInstance1->kind = 1, __ecereInstance1->refCount = 1, __ecereInstance1;
3369 });
3370 }
3371 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3372 {
3373 type = source;
3374 source->refCount++;
3375 }
3376 else
3377 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot dereference type\n", (((void *)0))));
3378 }
3379 return type;
3380 }
3381
3382 static struct Type * Reference(struct Type * source)
3383 {
3384 struct Type * type = (((void *)0));
3385
3386 if(source)
3387 {
3388 type = __extension__ ({
3389 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3390
3391 __ecereInstance1->kind = 13, __ecereInstance1->type = source, __ecereInstance1->refCount = 1, __ecereInstance1;
3392 });
3393 source->refCount++;
3394 }
3395 return type;
3396 }
3397
3398 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);
3399
3400 extern void *  memcpy(void * , const void * , size_t size);
3401
3402 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3403
3404 extern void FreeExpression(struct Expression * exp);
3405
3406 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3407
3408 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);
3409
3410 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3411
3412 extern struct Type * MkClassType(char *  name);
3413
3414 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_AddDataMember(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, char *  type, unsigned int size, unsigned int alignment, int declMode);
3415
3416 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)
3417 {
3418 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3419 unsigned int found = 0x0;
3420 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3421 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3422 unsigned int freeType = 0x0;
3423
3424 yylloc = member->loc;
3425 if(!ident)
3426 {
3427 if(curMember)
3428 {
3429 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3430 if(*curMember)
3431 {
3432 found = 0x1;
3433 dataMember = *curMember;
3434 }
3435 }
3436 }
3437 else
3438 {
3439 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3440 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3441 int _subMemberStackPos = 0;
3442
3443 if(!thisMember)
3444 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3445 if(thisMember)
3446 {
3447 dataMember = thisMember;
3448 if(curMember && thisMember->memberAccess == 1)
3449 {
3450 *curMember = thisMember;
3451 *curClass = thisMember->_class;
3452 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
3453 *subMemberStackPos = _subMemberStackPos;
3454 }
3455 found = 0x1;
3456 }
3457 else
3458 {
3459 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3460 if(method && method->type == 1)
3461 found = 0x1;
3462 else
3463 method = (((void *)0));
3464 }
3465 }
3466 if(found)
3467 {
3468 struct Type * type = (((void *)0));
3469
3470 if(dataMember)
3471 {
3472 if(!dataMember->dataType && dataMember->dataTypeString)
3473 {
3474 struct Context * context = SetupTemplatesContext(_class);
3475
3476 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3477 FinishTemplatesContext(context);
3478 }
3479 type = dataMember->dataType;
3480 }
3481 else if(method)
3482 {
3483 if(!method->dataType)
3484 ProcessMethodType(method);
3485 type = method->dataType;
3486 }
3487 if(ident && ident->next)
3488 {
3489 for(ident = ident->next; ident && type; ident = ident->next)
3490 {
3491 if(type->kind == 8)
3492 {
3493 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3494 if(!dataMember)
3495 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3496 if(dataMember)
3497 type = dataMember->dataType;
3498 }
3499 else if(type->kind == 9 || type->kind == 10)
3500 {
3501 struct Type * memberType;
3502
3503 for(memberType = type->members.first; memberType; memberType = memberType->next)
3504 {
3505 if(!strcmp(memberType->name, ident->string))
3506 {
3507 type = memberType;
3508 break;
3509 }
3510 }
3511 }
3512 }
3513 }
3514 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3515 {
3516 int id = 0;
3517 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3518 struct __ecereNameSpace__ecere__com__Class * sClass;
3519
3520 for(sClass = _class; sClass; sClass = sClass->base)
3521 {
3522 id = 0;
3523 if(sClass->templateClass)
3524 sClass = sClass->templateClass;
3525 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3526 {
3527 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3528 {
3529 for(sClass = sClass->base; sClass; sClass = sClass->base)
3530 {
3531 if(sClass->templateClass)
3532 sClass = sClass->templateClass;
3533 id += sClass->templateParams.count;
3534 }
3535 break;
3536 }
3537 id++;
3538 }
3539 if(curParam)
3540 break;
3541 }
3542 if(curParam)
3543 {
3544 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3545
3546 if(arg.dataTypeString)
3547 {
3548 type = ProcessTypeString(arg.dataTypeString, 0x0);
3549 freeType = 0x1;
3550 if(type && _class->templateClass)
3551 type->passAsTemplate = 0x1;
3552 if(type)
3553 {
3554 }
3555 }
3556 }
3557 }
3558 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3559 {
3560 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3561 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3562 int c;
3563 int paramCount = 0;
3564 int lastParam = -1;
3565 char templateString[1024];
3566 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3567
3568 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3569 for(cClass = expClass; cClass; cClass = cClass->base)
3570 {
3571 int p = 0;
3572
3573 if(cClass->templateClass)
3574 cClass = cClass->templateClass;
3575 for(param = cClass->templateParams.first; param; param = param->next)
3576 {
3577 int id = p;
3578 struct __ecereNameSpace__ecere__com__Class * sClass;
3579 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3580
3581 for(sClass = cClass->base; sClass; sClass = sClass->base)
3582 {
3583 if(sClass->templateClass)
3584 sClass = sClass->templateClass;
3585 id += sClass->templateParams.count;
3586 }
3587 arg = expClass->templateArgs[id];
3588 for(sClass = _class; sClass; sClass = sClass->base)
3589 {
3590 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3591 int p = 0;
3592 struct __ecereNameSpace__ecere__com__Class * nextClass;
3593
3594 if(sClass->templateClass)
3595 sClass = sClass->templateClass;
3596 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3597 {
3598 if(nextClass->templateClass)
3599 nextClass = nextClass->templateClass;
3600 p += nextClass->templateParams.count;
3601 }
3602 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3603 {
3604 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3605 {
3606 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3607 {
3608 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3609 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3610 break;
3611 }
3612 }
3613 }
3614 }
3615 {
3616 char argument[256];
3617
3618 argument[0] = '\0';
3619 switch(param->type)
3620 {
3621 case 2:
3622 {
3623 char expString[1024];
3624 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3625 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3626 struct Expression * exp;
3627 char * string = PrintHexUInt64(arg.expression.ui64);
3628
3629 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3630 ProcessExpressionType(exp);
3631 ComputeExpression(exp);
3632 expString[0] = '\0';
3633 PrintExpression(exp, expString);
3634 strcat(argument, expString);
3635 FreeExpression(exp);
3636 break;
3637 }
3638 case 1:
3639 {
3640 strcat(argument, arg.member->name);
3641 break;
3642 }
3643 case 0:
3644 {
3645 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3646 strcat(argument, arg.dataTypeString);
3647 break;
3648 }
3649 }
3650 if(argument[0])
3651 {
3652 if(paramCount)
3653 strcat(templateString, ", ");
3654 if(lastParam != p - 1)
3655 {
3656 strcat(templateString, param->name);
3657 strcat(templateString, " = ");
3658 }
3659 strcat(templateString, argument);
3660 paramCount++;
3661 lastParam = p;
3662 }
3663 p++;
3664 }
3665 }
3666 }
3667 {
3668 int len = strlen(templateString);
3669
3670 if(templateString[len - 1] == '<')
3671 len--;
3672 else
3673 {
3674 if(templateString[len - 1] == '>')
3675 templateString[len++] = ' ';
3676 templateString[len++] = '>';
3677 }
3678 templateString[len++] = '\0';
3679 }
3680 {
3681 struct Context * context = SetupTemplatesContext(_class);
3682
3683 if(freeType)
3684 FreeType(type);
3685 type = ProcessTypeString(templateString, 0x0);
3686 freeType = 0x1;
3687 FinishTemplatesContext(context);
3688 }
3689 }
3690 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3691 {
3692 ProcessExpressionType(member->initializer->exp);
3693 if(!member->initializer->exp->expType)
3694 {
3695 if(inCompiler)
3696 {
3697 char expString[10240];
3698
3699 expString[0] = '\0';
3700 PrintExpression(member->initializer->exp, expString);
3701 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3702 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3703 }
3704 }
3705 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3706 {
3707 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible instance method %s\n", (((void *)0))), ident->string);
3708 }
3709 }
3710 else if(member->initializer)
3711 {
3712 ProcessInitializer(member->initializer, type);
3713 }
3714 if(freeType)
3715 FreeType(type);
3716 }
3717 else
3718 {
3719 if(_class && _class->type == 3)
3720 {
3721 if(member->initializer)
3722 {
3723 struct Type * type = MkClassType(_class->fullName);
3724
3725 ProcessInitializer(member->initializer, type);
3726 FreeType(type);
3727 }
3728 }
3729 else
3730 {
3731 if(member->initializer)
3732 {
3733 ProcessInitializer(member->initializer, (((void *)0)));
3734 }
3735 if(ident)
3736 {
3737 if(method)
3738 {
3739 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3740 }
3741 else if(_class)
3742 {
3743 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3744 if(inCompiler)
3745 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3746 }
3747 }
3748 else if(_class)
3749 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3750 }
3751 }
3752 }
3753
3754 extern struct Identifier * GetDeclId(struct Declarator * decl);
3755
3756 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);
3757
3758 extern void FreeSpecifier(struct Specifier * spec);
3759
3760 static void ProcessFunction(struct FunctionDefinition * function);
3761
3762 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (*  CopyFunction)(void * ));
3763
3764 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3765
3766 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3767
3768 extern void FreeClassFunction(struct ClassFunction * func);
3769
3770 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3771
3772 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3773
3774 void ProcessInstantiationType(struct Instantiation * inst)
3775 {
3776 yylloc = inst->loc;
3777 if(inst->_class)
3778 {
3779 struct MembersInit * members;
3780 struct Symbol * classSym;
3781 struct __ecereNameSpace__ecere__com__Class * _class;
3782
3783 classSym = inst->_class->symbol;
3784 _class = classSym ? classSym->registered : (((void *)0));
3785 if(!_class || _class->type != 5)
3786 DeclareStruct(inst->_class->name, 0x0);
3787 afterExternal = afterExternal ? afterExternal : curExternal;
3788 if(inst->exp)
3789 ProcessExpressionType(inst->exp);
3790 inst->isConstant = 0x1;
3791 if(inst->members)
3792 {
3793 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3794 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3795 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3796 int subMemberStackPos = 0;
3797
3798 for(members = (*inst->members).first; members; members = members->next)
3799 {
3800 switch(members->type)
3801 {
3802 case 1:
3803 {
3804 char name[1024];
3805 static unsigned int instMethodID = 0;
3806 struct External * external = curExternal;
3807 struct Context * context = curContext;
3808 struct Declarator * declarator = members->function->declarator;
3809 struct Identifier * nameID = GetDeclId(declarator);
3810 char * unmangled = nameID ? nameID->string : (((void *)0));
3811 struct Expression * exp;
3812 struct External * createdExternal = (((void *)0));
3813
3814 if(inCompiler)
3815 {
3816 char number[16];
3817
3818 strcpy(name, "__ecereInstMeth_");
3819 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3820 strcat(name, "_");
3821 strcat(name, nameID->string);
3822 strcat(name, "_");
3823 sprintf(number, "_%08d", instMethodID++);
3824 strcat(name, number);
3825 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3826 }
3827 if(declarator)
3828 {
3829 struct Symbol * symbol = declarator->symbol;
3830 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3831
3832 if(method && method->type == 1)
3833 {
3834 symbol->method = method;
3835 ProcessMethodType(method);
3836 if(!symbol->type->thisClass)
3837 {
3838 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3839 {
3840 if(!currentClass->symbol)
3841 currentClass->symbol = FindClass(currentClass->fullName);
3842 symbol->type->thisClass = currentClass->symbol;
3843 }
3844 else
3845 {
3846 if(!_class->symbol)
3847 _class->symbol = FindClass(_class->fullName);
3848 symbol->type->thisClass = _class->symbol;
3849 }
3850 }
3851 DeclareType(symbol->type, 0x1, 0x1);
3852 }
3853 else if(classSym)
3854 {
3855 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
3856 }
3857 }
3858 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
3859 if(nameID)
3860 {
3861 FreeSpecifier(nameID->_class);
3862 nameID->_class = (((void *)0));
3863 }
3864 if(inCompiler)
3865 {
3866 struct Type * type = declarator->symbol->type;
3867 struct External * oldExternal = curExternal;
3868
3869 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
3870 {
3871 struct External * externalDecl;
3872
3873 externalDecl = MkExternalDeclaration((((void *)0)));
3874 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
3875 if(createdExternal->function)
3876 {
3877 ProcessFunction(createdExternal->function);
3878 {
3879 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
3880
3881 externalDecl->declaration = decl;
3882 if(decl->symbol && !decl->symbol->pointerExternal)
3883 decl->symbol->pointerExternal = externalDecl;
3884 declarator->symbol->pointerExternal = externalDecl;
3885 }
3886 }
3887 }
3888 }
3889 else if(declarator)
3890 {
3891 curExternal = declarator->symbol->pointerExternal;
3892 ProcessFunction((struct FunctionDefinition *)members->function);
3893 }
3894 curExternal = external;
3895 curContext = context;
3896 if(inCompiler)
3897 {
3898 FreeClassFunction(members->function);
3899 exp = QMkExpId(name);
3900 members->type = 0;
3901 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
3902 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
3903 }
3904 break;
3905 }
3906 case 0:
3907 {
3908 if(members->dataMembers && classSym)
3909 {
3910 struct MemberInit * member;
3911 struct Location oldyyloc = yylloc;
3912
3913 for(member = (*members->dataMembers).first; member; member = member->next)
3914 {
3915 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
3916 if(member->initializer && !member->initializer->isConstant)
3917 inst->isConstant = 0x0;
3918 }
3919 yylloc = oldyyloc;
3920 }
3921 break;
3922 }
3923 }
3924 }
3925 }
3926 }
3927 }
3928
3929 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
3930 {
3931 if(inCompiler)
3932 {
3933 if(type->kind == 11)
3934 {
3935 struct Type * param;
3936
3937 if(declareParams)
3938 {
3939 for(param = type->params.first; param; param = param->next)
3940 DeclareType(param, declarePointers, 0x1);
3941 }
3942 DeclareType(type->returnType, declarePointers, 0x1);
3943 }
3944 else if(type->kind == 13 && declarePointers)
3945 DeclareType(type->type, declarePointers, 0x0);
3946 else if(type->kind == 8)
3947 {
3948 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
3949 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
3950 }
3951 else if(type->kind == 9 || type->kind == 10)
3952 {
3953 struct Type * member;
3954
3955 for(member = type->members.first; member; member = member->next)
3956 DeclareType(member, 0x0, 0x0);
3957 }
3958 else if(type->kind == 12)
3959 DeclareType(type->arrayType, declarePointers, 0x0);
3960 }
3961 }
3962
3963 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
3964
3965 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
3966 {
3967 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
3968 int id = 0;
3969 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3970 struct __ecereNameSpace__ecere__com__Class * sClass;
3971
3972 for(sClass = _class; sClass; sClass = sClass->base)
3973 {
3974 id = 0;
3975 if(sClass->templateClass)
3976 sClass = sClass->templateClass;
3977 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3978 {
3979 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
3980 {
3981 for(sClass = sClass->base; sClass; sClass = sClass->base)
3982 {
3983 if(sClass->templateClass)
3984 sClass = sClass->templateClass;
3985 id += sClass->templateParams.count;
3986 }
3987 break;
3988 }
3989 id++;
3990 }
3991 if(curParam)
3992 break;
3993 }
3994 if(curParam)
3995 {
3996 arg = &_class->templateArgs[id];
3997 if(arg && param->type == 0)
3998 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
3999 }
4000 return arg;
4001 }
4002
4003 extern struct Context * PushContext(void);
4004
4005 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
4006
4007 struct TemplatedType
4008 {
4009 uintptr_t key;
4010 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4011 struct __ecereNameSpace__ecere__sys__BTNode * left;
4012 struct __ecereNameSpace__ecere__sys__BTNode * right;
4013 int depth;
4014 struct TemplateParameter * param;
4015 } __attribute__ ((gcc_struct));
4016
4017 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
4018
4019 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
4020 {
4021 struct Context * context = PushContext();
4022
4023 context->templateTypesOnly = 0x1;
4024 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
4025 {
4026 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
4027
4028 for(; param; param = param->next)
4029 {
4030 if(param->type == 0 && param->identifier)
4031 {
4032 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (uintptr_t)param->identifier->string, type->param = param, type);
4033
4034 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4035 }
4036 }
4037 }
4038 else if(_class)
4039 {
4040 struct __ecereNameSpace__ecere__com__Class * sClass;
4041
4042 for(sClass = _class; sClass; sClass = sClass->base)
4043 {
4044 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
4045
4046 for(p = sClass->templateParams.first; p; p = p->next)
4047 {
4048 if(p->type == 0)
4049 {
4050 struct TemplateParameter * param = p->param;
4051 struct TemplatedType * type;
4052
4053 if(!param)
4054 {
4055 p->param = param = __extension__ ({
4056 struct TemplateParameter * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter);
4057
4058 __ecereInstance1->identifier = MkIdentifier(p->name), __ecereInstance1->type = p->type, __ecereInstance1->dataTypeString = p->dataTypeString, __ecereInstance1;
4059 });
4060 }
4061 type = __extension__ ({
4062 struct TemplatedType * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType);
4063
4064 __ecereInstance1->key = (uintptr_t)p->name, __ecereInstance1->param = param, __ecereInstance1;
4065 });
4066 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4067 }
4068 }
4069 }
4070 }
4071 return context;
4072 }
4073
4074 extern void PopContext(struct Context * ctx);
4075
4076 extern void FreeContext(struct Context * context);
4077
4078 void FinishTemplatesContext(struct Context * context)
4079 {
4080 PopContext(context);
4081 FreeContext(context);
4082 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
4083 }
4084
4085 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
4086 {
4087 if(!method->dataType)
4088 {
4089 struct Context * context = SetupTemplatesContext(method->_class);
4090
4091 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4092 FinishTemplatesContext(context);
4093 if(method->type != 1 && method->dataType)
4094 {
4095 if(!method->dataType->thisClass && !method->dataType->staticMethod)
4096 {
4097 if(!method->_class->symbol)
4098 method->_class->symbol = FindClass(method->_class->fullName);
4099 method->dataType->thisClass = method->_class->symbol;
4100 }
4101 }
4102 }
4103 }
4104
4105 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
4106 {
4107 if(!prop->dataType)
4108 {
4109 struct Context * context = SetupTemplatesContext(prop->_class);
4110
4111 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
4112 FinishTemplatesContext(context);
4113 }
4114 }
4115
4116 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
4117
4118 extern void FreeTypeName(struct TypeName * typeName);
4119
4120 static void ProcessDeclarator(struct Declarator * decl);
4121
4122 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
4123
4124 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
4125
4126 struct MethodImport
4127 {
4128 struct MethodImport * prev;
4129 struct MethodImport * next;
4130 char *  name;
4131 unsigned int isVirtual;
4132 } __attribute__ ((gcc_struct));
4133
4134 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
4135
4136 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
4137 {
4138 struct Symbol * symbol = method->symbol;
4139
4140 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
4141 {
4142 unsigned int imported = 0x0;
4143 unsigned int dllImport = 0x0;
4144
4145 if(!method->dataType)
4146 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4147 if(!symbol || symbol->_import || method->type == 1)
4148 {
4149 if(!symbol || method->type == 1)
4150 {
4151 struct Symbol * classSym;
4152
4153 if(!method->_class->symbol)
4154 method->_class->symbol = FindClass(method->_class->fullName);
4155 classSym = method->_class->symbol;
4156 if(!classSym->_import)
4157 {
4158 struct ModuleImport * module;
4159
4160 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->name)
4161 module = FindModule(method->_class->module);
4162 else
4163 module = mainModule;
4164 classSym->_import = __extension__ ({
4165 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
4166
4167 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), __ecereInstance1->isRemote = method->_class->isRemote, __ecereInstance1;
4168 });
4169 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
4170 }
4171 if(!symbol)
4172 {
4173 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4174 }
4175 if(!symbol->_import)
4176 {
4177 symbol->_import = (struct ClassImport *)__extension__ ({
4178 struct MethodImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport);
4179
4180 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->name), __ecereInstance1->isVirtual = method->type == 1, __ecereInstance1;
4181 });
4182 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
4183 }
4184 if(!symbol)
4185 {
4186 symbol->type = method->dataType;
4187 if(symbol->type)
4188 symbol->type->refCount++;
4189 }
4190 }
4191 if(!method->dataType->dllExport)
4192 {
4193 imported = 0x1;
4194 if(method->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->importType != 1)
4195 dllImport = 0x1;
4196 }
4197 }
4198 if(method->type != 1 && method->dataType)
4199 DeclareType(method->dataType, 0x1, 0x1);
4200 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4201 {
4202 struct Declaration * decl;
4203 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4204 struct Declarator * d;
4205 struct Declarator * funcDecl;
4206 struct External * external;
4207
4208 specifiers = MkList();
4209 declarators = MkList();
4210 if(dllImport)
4211 ListAdd(specifiers, MkSpecifier(EXTERN));
4212 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
4213 ListAdd(specifiers, MkSpecifier(STATIC));
4214 if(method->type == 1)
4215 {
4216 ListAdd(specifiers, MkSpecifier(INT));
4217 d = MkDeclaratorIdentifier(MkIdentifier(name));
4218 }
4219 else
4220 {
4221 d = MkDeclaratorIdentifier(MkIdentifier(name));
4222 if(dllImport)
4223 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4224 {
4225 struct Context * context = SetupTemplatesContext(method->_class);
4226
4227 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
4228 FinishTemplatesContext(context);
4229 }
4230 funcDecl = GetFuncDecl(d);
4231 if(dllImport)
4232 {
4233 struct Specifier * spec, * next;
4234
4235 for(spec = (*specifiers).first; spec; spec = next)
4236 {
4237 next = spec->next;
4238 if(spec->type == 5)
4239 {
4240 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4241 FreeSpecifier(spec);
4242 }
4243 }
4244 }
4245 if(method->dataType && !method->dataType->staticMethod)
4246 {
4247 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4248 {
4249 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4250 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")));
4251 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4252 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4253
4254 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4255 {
4256 struct TypeName * param = (*funcDecl->function.parameters).first;
4257
4258 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4259 FreeTypeName(param);
4260 }
4261 if(!funcDecl->function.parameters)
4262 funcDecl->function.parameters = MkList();
4263 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4264 }
4265 }
4266 }
4267 ProcessDeclarator(d);
4268 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4269 decl = MkDeclaration(specifiers, declarators);
4270 ReplaceThisClassSpecifiers(specifiers, method->_class);
4271 if(symbol->pointerExternal)
4272 {
4273 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4274
4275 {
4276 *functionSymbol = *symbol;
4277 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4278 if(functionSymbol->type)
4279 functionSymbol->type->refCount++;
4280 }
4281 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4282 symbol->pointerExternal->symbol = functionSymbol;
4283 }
4284 external = MkExternalDeclaration(decl);
4285 if(curExternal)
4286 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4287 external->symbol = symbol;
4288 symbol->pointerExternal = external;
4289 }
4290 else if(ast)
4291 {
4292 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4293 }
4294 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4295 }
4296 }
4297
4298 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4299 {
4300 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4301 {
4302 unsigned int first = 0x1;
4303 int p = 0;
4304 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4305 int lastParam = -1;
4306 char className[1024];
4307
4308 strcpy(className, _class->fullName);
4309 for(param = _class->templateParams.first; param; param = param->next)
4310 {
4311 {
4312 if(first)
4313 strcat(className, "<");
4314 if(!first)
4315 strcat(className, ", ");
4316 if(lastParam + 1 != p)
4317 {
4318 strcat(className, param->name);
4319 strcat(className, " = ");
4320 }
4321 strcat(className, param->name);
4322 first = 0x0;
4323 lastParam = p;
4324 }
4325 p++;
4326 }
4327 if(!first)
4328 {
4329 int len = strlen(className);
4330
4331 if(className[len - 1] == '>')
4332 className[len++] = ' ';
4333 className[len++] = '>';
4334 className[len++] = '\0';
4335 }
4336 return __ecereNameSpace__ecere__sys__CopyString(className);
4337 }
4338 else
4339 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4340 }
4341
4342 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4343 {
4344 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4345 {
4346 unsigned int first = 0x1;
4347 int p = 0;
4348 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4349 int lastParam = -1;
4350 char className[1024];
4351
4352 strcpy(className, _class->fullName);
4353 for(param = _class->templateParams.first; param; param = param->next)
4354 {
4355 {
4356 if(first)
4357 strcat(className, "<");
4358 if(!first)
4359 strcat(className, ", ");
4360 if(lastParam + 1 != p)
4361 {
4362 strcat(className, param->name);
4363 strcat(className, " = ");
4364 }
4365 strcat(className, param->name);
4366 first = 0x0;
4367 lastParam = p;
4368 }
4369 p++;
4370 }
4371 if(!first)
4372 {
4373 int len = strlen(className);
4374
4375 if(className[len - 1] == '>')
4376 className[len++] = ' ';
4377 className[len++] = '>';
4378 className[len++] = '\0';
4379 }
4380 return MkClassType(className);
4381 }
4382 else
4383 {
4384 return MkClassType(_class->fullName);
4385 }
4386 }
4387
4388 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4389 {
4390 if(specs != (((void *)0)) && _class)
4391 {
4392 struct Specifier * spec;
4393
4394 for(spec = specs->first; spec; spec = spec->next)
4395 {
4396 if(spec->type == 0 && spec->specifier == THISCLASS)
4397 {
4398 spec->type = 1;
4399 spec->name = ReplaceThisClass(_class);
4400 spec->symbol = FindClass(spec->name);
4401 }
4402 }
4403 }
4404 }
4405
4406 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4407
4408 struct __ecereNameSpace__ecere__com__GlobalFunction
4409 {
4410 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4411 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4412 char *  name;
4413 int (*  function)();
4414 struct __ecereNameSpace__ecere__com__Instance * module;
4415 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4416 char *  dataTypeString;
4417 struct Type * dataType;
4418 void *  symbol;
4419 } __attribute__ ((gcc_struct));
4420
4421 extern struct Context * globalContext;
4422
4423 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4424
4425 struct FunctionImport
4426 {
4427 struct FunctionImport * prev;
4428 struct FunctionImport * next;
4429 char *  name;
4430 } __attribute__ ((gcc_struct));
4431
4432 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4433 {
4434 struct Symbol * symbol = function->symbol;
4435
4436 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4437 {
4438 unsigned int imported = 0x0;
4439 unsigned int dllImport = 0x0;
4440
4441 if(!function->dataType)
4442 {
4443 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4444 if(!function->dataType->thisClass)
4445 function->dataType->staticMethod = 0x1;
4446 }
4447 if(inCompiler)
4448 {
4449 if(!symbol)
4450 {
4451 struct ModuleImport * module = FindModule(function->module);
4452
4453 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4454 if(module->name)
4455 {
4456 if(!function->dataType->dllExport)
4457 {
4458 symbol->_import = (struct ClassImport *)__extension__ ({
4459 struct FunctionImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport);
4460
4461 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(function->name), __ecereInstance1;
4462 });
4463 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4464 }
4465 }
4466 {
4467 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4468 if(!symbol->type->thisClass)
4469 symbol->type->staticMethod = 0x1;
4470 }
4471 }
4472 imported = symbol->_import ? 0x1 : 0x0;
4473 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1)
4474 dllImport = 0x1;
4475 }
4476 DeclareType(function->dataType, 0x1, 0x1);
4477 if(inCompiler)
4478 {
4479 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4480 {
4481 struct Declaration * decl;
4482 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4483 struct Declarator * d;
4484 struct Declarator * funcDecl;
4485 struct External * external;
4486
4487 specifiers = MkList();
4488 declarators = MkList();
4489 ListAdd(specifiers, MkSpecifier(EXTERN));
4490 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4491 if(dllImport)
4492 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4493 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4494 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType == 1)
4495 {
4496 struct Specifier * spec;
4497
4498 for(spec = (*specifiers).first; spec; spec = spec->next)
4499 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4500 {
4501 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4502 FreeSpecifier(spec);
4503 break;
4504 }
4505 }
4506 funcDecl = GetFuncDecl(d);
4507 if(funcDecl && !funcDecl->function.parameters)
4508 {
4509 funcDecl->function.parameters = MkList();
4510 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4511 }
4512 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4513 {
4514 struct Context * oldCtx = curContext;
4515
4516 curContext = globalContext;
4517 decl = MkDeclaration(specifiers, declarators);
4518 curContext = oldCtx;
4519 }
4520 if(symbol->pointerExternal)
4521 {
4522 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4523
4524 {
4525 *functionSymbol = *symbol;
4526 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4527 if(functionSymbol->type)
4528 functionSymbol->type->refCount++;
4529 }
4530 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4531 symbol->pointerExternal->symbol = functionSymbol;
4532 }
4533 external = MkExternalDeclaration(decl);
4534 if(curExternal)
4535 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4536 external->symbol = symbol;
4537 symbol->pointerExternal = external;
4538 }
4539 else
4540 {
4541 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4542 }
4543 if(curExternal)
4544 symbol->id = curExternal->symbol->idCode;
4545 }
4546 }
4547 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1) ? 0x1 : 0x0;
4548 }
4549
4550 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4551
4552 struct GlobalData
4553 {
4554 uintptr_t key;
4555 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4556 struct __ecereNameSpace__ecere__sys__BTNode * left;
4557 struct __ecereNameSpace__ecere__sys__BTNode * right;
4558 int depth;
4559 struct __ecereNameSpace__ecere__com__Instance * module;
4560 char *  dataTypeString;
4561 struct Type * dataType;
4562 void *  symbol;
4563 char *  fullName;
4564 } __attribute__ ((gcc_struct));
4565
4566 void DeclareGlobalData(struct GlobalData * data)
4567 {
4568 struct Symbol * symbol = data->symbol;
4569
4570 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4571 {
4572 if(inCompiler)
4573 {
4574 if(!symbol)
4575 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4576 }
4577 if(!data->dataType)
4578 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4579 DeclareType(data->dataType, 0x1, 0x1);
4580 if(inCompiler)
4581 {
4582 if(!symbol->pointerExternal)
4583 {
4584 struct Declaration * decl;
4585 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4586 struct Declarator * d;
4587 struct External * external;
4588
4589 specifiers = MkList();
4590 declarators = MkList();
4591 ListAdd(specifiers, MkSpecifier(EXTERN));
4592 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4593 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4594 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4595 decl = MkDeclaration(specifiers, declarators);
4596 external = MkExternalDeclaration(decl);
4597 if(curExternal)
4598 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4599 external->symbol = symbol;
4600 symbol->pointerExternal = external;
4601 }
4602 else
4603 {
4604 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4605 }
4606 if(curExternal)
4607 symbol->id = curExternal->symbol->idCode;
4608 }
4609 }
4610 }
4611
4612 struct Conversion
4613 {
4614 struct Conversion * prev, * next;
4615 struct __ecereNameSpace__ecere__com__Property * convert;
4616 unsigned int isGet;
4617 struct Type * resultType;
4618 } __attribute__ ((gcc_struct));
4619
4620 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4621
4622 extern void Compiler_Warning(char *  format, ...);
4623
4624 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4625
4626 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)
4627 {
4628 if(source && dest)
4629 {
4630 if(source->kind == 20 && dest->kind != 20)
4631 {
4632 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4633
4634 if(type)
4635 source = type;
4636 }
4637 if(dest->kind == 20 && source->kind != 20)
4638 {
4639 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4640
4641 if(type)
4642 dest = type;
4643 }
4644 if(dest->classObjectType == 2)
4645 {
4646 if(source->classObjectType != 3)
4647 return 0x1;
4648 else
4649 {
4650 if((dest->_class && strcmp(dest->_class->string, "class")) || (source->_class && strcmp(source->_class->string, "class")))
4651 {
4652 return 0x1;
4653 }
4654 }
4655 }
4656 else
4657 {
4658 if(source->classObjectType == 3)
4659 return 0x1;
4660 if(dest->classObjectType == 3 && source->classObjectType != 2)
4661 return 0x1;
4662 }
4663 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4664 {
4665 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4666 return 0x1;
4667 }
4668 if(dest->kind == 14 && source->kind != 0)
4669 return 0x1;
4670 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))
4671 return 0x1;
4672 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))
4673 return 0x1;
4674 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4675 {
4676 if(source->_class->registered && source->_class->registered->type == 3)
4677 {
4678 if(conversions != (((void *)0)))
4679 {
4680 if(source->_class->registered == dest->_class->registered)
4681 return 0x1;
4682 }
4683 else
4684 {
4685 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4686
4687 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4688 ;
4689 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4690 ;
4691 if(sourceBase == destBase)
4692 return 0x1;
4693 }
4694 }
4695 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))
4696 return 0x1;
4697 else
4698 {
4699 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))
4700 {
4701 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4702 {
4703 return 0x1;
4704 }
4705 }
4706 }
4707 }
4708 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4709 return 0x1;
4710 if(doConversion)
4711 {
4712 if(source->kind == 8)
4713 {
4714 struct __ecereNameSpace__ecere__com__Class * _class;
4715
4716 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4717 {
4718 struct __ecereNameSpace__ecere__com__Property * convert;
4719
4720 for(convert = _class->conversions.first; convert; convert = convert->next)
4721 {
4722 if(convert->memberAccess == 1 || _class->module == privateModule)
4723 {
4724 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4725
4726 if(!convert->dataType)
4727 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4728 if(MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x0, 0x1, 0x0, 0x1))
4729 {
4730 if(!conversions && !convert->Get)
4731 return 0x1;
4732 else if(conversions != (((void *)0)))
4733 {
4734 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))
4735 return 0x1;
4736 else
4737 {
4738 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4739
4740 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4741 return 0x1;
4742 }
4743 }
4744 }
4745 }
4746 }
4747 }
4748 }
4749 if(dest->kind == 8)
4750 {
4751 struct __ecereNameSpace__ecere__com__Class * _class;
4752
4753 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4754 {
4755 struct __ecereNameSpace__ecere__com__Property * convert;
4756
4757 for(convert = _class->conversions.first; convert; convert = convert->next)
4758 {
4759 if(convert->memberAccess == 1 || _class->module == privateModule)
4760 {
4761 if(!convert->dataType)
4762 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4763 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4764 {
4765 if(!conversions && !convert->Set)
4766 return 0x1;
4767 else if(conversions != (((void *)0)))
4768 {
4769 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))
4770 return 0x1;
4771 else
4772 {
4773 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4774
4775 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4776 return 0x1;
4777 }
4778 }
4779 }
4780 }
4781 }
4782 }
4783 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4784 {
4785 if(!dest->_class->registered->dataType)
4786 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4787 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4788 {
4789 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4790 {
4791 return 0x1;
4792 }
4793 }
4794 }
4795 }
4796 if(source->kind == 8)
4797 {
4798 struct __ecereNameSpace__ecere__com__Class * _class;
4799
4800 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4801 {
4802 struct __ecereNameSpace__ecere__com__Property * convert;
4803
4804 for(convert = _class->conversions.first; convert; convert = convert->next)
4805 {
4806 if(convert->memberAccess == 1 || _class->module == privateModule)
4807 {
4808 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4809
4810 if(!convert->dataType)
4811 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4812 if(convert->dataType != source && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x1))
4813 {
4814 if(!conversions && !convert->Get)
4815 return 0x1;
4816 else if(conversions != (((void *)0)))
4817 {
4818 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))
4819 return 0x1;
4820 else
4821 {
4822 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4823
4824 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4825 return 0x1;
4826 }
4827 }
4828 }
4829 }
4830 }
4831 }
4832 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4833 {
4834 if(!source->_class->registered->dataType)
4835 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4836 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4837 {
4838 return 0x1;
4839 }
4840 }
4841 }
4842 }
4843 if(source->kind == 8 || source->kind == 19)
4844 ;
4845 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
4846 return 0x1;
4847 else if(dest->kind == 7 && source->kind == 6)
4848 return 0x1;
4849 else if(dest->kind == 2 && (source->kind == 1 || source->kind == 24))
4850 return 0x1;
4851 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 23))
4852 return 0x1;
4853 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 22 || source->kind == 23))
4854 return 0x1;
4855 else if(dest->kind == 22 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 23 || source->kind == 4))
4856 return 0x1;
4857 else if(dest->kind == 23 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 4 || source->kind == 22))
4858 return 0x1;
4859 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))
4860 return 0x1;
4861 else if(dest->kind == 15 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 5 || source->kind == 4 || source->kind == 22 || source->kind == 23))
4862 return 0x1;
4863 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)))
4864 {
4865 struct Type * paramSource, * paramDest;
4866
4867 if(dest->kind == 16)
4868 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
4869 if(source->kind == 16)
4870 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
4871 if(dest->kind == 13 && dest->type->kind == 11)
4872 dest = dest->type;
4873 if(source->kind == 13 && source->type->kind == 11)
4874 source = source->type;
4875 if(dest->kind == 16)
4876 dest = dest->method->dataType;
4877 if(source->kind == 16)
4878 source = source->method->dataType;
4879 paramSource = source->params.first;
4880 if(paramSource && paramSource->kind == 0)
4881 paramSource = (((void *)0));
4882 paramDest = dest->params.first;
4883 if(paramDest && paramDest->kind == 0)
4884 paramDest = (((void *)0));
4885 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
4886 {
4887 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))))
4888 {
4889 if(paramDest && paramDest->kind == 8)
4890 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
4891 else
4892 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class should not take an object\n", (((void *)0))));
4893 return 0x0;
4894 }
4895 paramDest = paramDest->next;
4896 }
4897 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
4898 {
4899 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
4900 {
4901 if(dest->thisClass)
4902 {
4903 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
4904 {
4905 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4906 return 0x0;
4907 }
4908 }
4909 else
4910 {
4911 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
4912 {
4913 if(owningClassDest)
4914 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
4915 else
4916 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "overriding class expected to be derived from method class\n", (((void *)0))));
4917 return 0x0;
4918 }
4919 }
4920 paramSource = paramSource->next;
4921 }
4922 else
4923 {
4924 if(dest->thisClass)
4925 {
4926 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
4927 {
4928 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4929 return 0x0;
4930 }
4931 }
4932 else
4933 {
4934 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
4935 {
4936 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
4937 return 0x0;
4938 }
4939 }
4940 }
4941 }
4942 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4943 {
4944 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible return type for function\n", (((void *)0))));
4945 return 0x0;
4946 }
4947 for(; paramDest; paramDest = paramDest->next)
4948 {
4949 if(!paramSource)
4950 {
4951 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough parameters\n", (((void *)0))));
4952 return 0x0;
4953 }
4954 {
4955 struct Type * paramDestType = paramDest;
4956 struct Type * paramSourceType = paramSource;
4957 struct Type * type = paramDestType;
4958
4959 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
4960 {
4961 int id = 0;
4962 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4963 struct __ecereNameSpace__ecere__com__Class * sClass;
4964
4965 for(sClass = owningClassSource; sClass; sClass = sClass->base)
4966 {
4967 id = 0;
4968 if(sClass->templateClass)
4969 sClass = sClass->templateClass;
4970 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4971 {
4972 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
4973 {
4974 for(sClass = sClass->base; sClass; sClass = sClass->base)
4975 {
4976 if(sClass->templateClass)
4977 sClass = sClass->templateClass;
4978 id += sClass->templateParams.count;
4979 }
4980 break;
4981 }
4982 id++;
4983 }
4984 if(curParam)
4985 break;
4986 }
4987 if(curParam)
4988 {
4989 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
4990
4991 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
4992 }
4993 }
4994 if(!MatchTypes(paramDestType, paramSourceType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0) && (!acceptReversedParams || !MatchTypes(paramSourceType, paramDestType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0)))
4995 {
4996 char type[1024];
4997
4998 type[0] = (char)0;
4999 PrintType(paramDest, type, 0x0, 0x1);
5000 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
5001 if(paramDestType != paramDest)
5002 FreeType(paramDestType);
5003 return 0x0;
5004 }
5005 if(paramDestType != paramDest)
5006 FreeType(paramDestType);
5007 }
5008 paramSource = paramSource->next;
5009 }
5010 if(paramSource)
5011 {
5012 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many parameters\n", (((void *)0))));
5013 return 0x0;
5014 }
5015 return 0x1;
5016 }
5017 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
5018 {
5019 return 0x1;
5020 }
5021 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
5022 {
5023 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5024 return 0x1;
5025 }
5026 }
5027 return 0x0;
5028 }
5029
5030 static void FreeConvert(struct Conversion * convert)
5031 {
5032 if(convert->resultType)
5033 FreeType(convert->resultType);
5034 }
5035
5036 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
5037
5038 struct __ecereNameSpace__ecere__com__BTNamedLink
5039 {
5040 char *  name;
5041 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
5042 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
5043 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
5044 int depth;
5045 void *  data;
5046 } __attribute__ ((gcc_struct));
5047
5048 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
5049
5050 struct __ecereNameSpace__ecere__com__EnumClassData
5051 {
5052 struct __ecereNameSpace__ecere__sys__OldList values;
5053 int largest;
5054 } __attribute__ ((gcc_struct));
5055
5056 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
5057
5058 struct __ecereNameSpace__ecere__sys__NamedLink
5059 {
5060 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
5061 struct __ecereNameSpace__ecere__sys__NamedLink * next;
5062 char *  name;
5063 void *  data;
5064 } __attribute__ ((gcc_struct));
5065
5066 extern void FreeExpContents(struct Expression * exp);
5067
5068 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
5069
5070 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
5071
5072 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
5073
5074 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
5075
5076 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
5077
5078 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5079 {
5080 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
5081
5082 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)))
5083 {
5084 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
5085
5086 if(_class->type == 4)
5087 {
5088 struct __ecereNameSpace__ecere__sys__OldList converts = 
5089 {
5090 0, 0, 0, 0, 0
5091 };
5092 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5093
5094 type->kind = 8;
5095 if(!_class->symbol)
5096 _class->symbol = FindClass(_class->fullName);
5097 type->_class = _class->symbol;
5098 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
5099 {
5100 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5101 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5102
5103 if(enumClass)
5104 {
5105 struct __ecereNameSpace__ecere__com__Class * baseClass;
5106
5107 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
5108 {
5109 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
5110
5111 for(value = e->values.first; value; value = value->next)
5112 {
5113 if(!strcmp(value->name, string))
5114 break;
5115 }
5116 if(value)
5117 {
5118 FreeExpContents(sourceExp);
5119 FreeType(sourceExp->expType);
5120 sourceExp->isConstant = 0x1;
5121 sourceExp->expType = MkClassType(baseClass->fullName);
5122 {
5123 char constant[256];
5124
5125 sourceExp->type = 2;
5126 if(!strcmp(baseClass->dataTypeString, "int"))
5127 sprintf(constant, "%d", (int)value->data);
5128 else
5129 sprintf(constant, "0x%X", (int)value->data);
5130 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5131 }
5132 while(converts.first)
5133 {
5134 struct Conversion * convert = converts.first;
5135
5136 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
5137 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
5138 }
5139 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5140 return 0x1;
5141 }
5142 }
5143 }
5144 }
5145 if(converts.first)
5146 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
5147 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5148 }
5149 }
5150 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)))
5151 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
5152 return 0x1;
5153 return 0x0;
5154 }
5155
5156 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
5157
5158 struct __ecereNameSpace__ecere__com__SubModule
5159 {
5160 struct __ecereNameSpace__ecere__com__SubModule * prev;
5161 struct __ecereNameSpace__ecere__com__SubModule * next;
5162 struct __ecereNameSpace__ecere__com__Instance * module;
5163 int importMode;
5164 } __attribute__ ((gcc_struct));
5165
5166 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
5167 {
5168 struct __ecereNameSpace__ecere__com__SubModule * subModule;
5169
5170 if(searchFor == searchIn)
5171 return 0x1;
5172 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
5173 {
5174 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->application)
5175 {
5176 if(ModuleVisibility(subModule->module, searchFor))
5177 return 0x1;
5178 }
5179 }
5180 return 0x0;
5181 }
5182
5183 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
5184
5185 struct __ecereNameSpace__ecere__com__Application
5186 {
5187 int argc;
5188 char * *  argv;
5189 int exitCode;
5190 unsigned int isGUIApp;
5191 struct __ecereNameSpace__ecere__sys__OldList allModules;
5192 char *  parsedCommand;
5193 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
5194 } __attribute__ ((gcc_struct));
5195
5196 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5197 {
5198 struct __ecereNameSpace__ecere__com__Instance * module;
5199
5200 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))
5201 return 0x1;
5202 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))
5203 return 0x1;
5204 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))
5205 return 0x1;
5206 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)
5207 {
5208 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5209 return 0x1;
5210 }
5211 return 0x0;
5212 }
5213
5214 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
5215
5216 void ReadString(char *  output, char *  string);
5217
5218 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
5219
5220 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
5221
5222 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
5223
5224 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
5225 {
5226 struct Type * source = sourceExp->expType;
5227 struct Type * realDest = dest;
5228 struct Type * backupSourceExpType = (((void *)0));
5229
5230 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5231 return 0x1;
5232 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5233 {
5234 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5235 {
5236 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5237
5238 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5239 ;
5240 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5241 ;
5242 if(sourceBase == destBase)
5243 return 0x1;
5244 }
5245 }
5246 if(source)
5247 {
5248 struct __ecereNameSpace__ecere__sys__OldList * specs;
5249 unsigned int flag = 0x0;
5250 long long value = (((int)0x7fffffff));
5251
5252 source->refCount++;
5253 dest->refCount++;
5254 if(sourceExp->type == 2)
5255 {
5256 if(source->isSigned)
5257 value = strtoll(sourceExp->constant, (((void *)0)), 0);
5258 else
5259 value = strtoull(sourceExp->constant, (((void *)0)), 0);
5260 }
5261 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
5262 {
5263 if(source->isSigned)
5264 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
5265 else
5266 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
5267 }
5268 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5269 {
5270 FreeType(source);
5271 source = __extension__ ({
5272 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5273
5274 __ecereInstance1->kind = 3, __ecereInstance1->isSigned = 0x0, __ecereInstance1->refCount = 1, __ecereInstance1;
5275 });
5276 }
5277 if(dest->kind == 8)
5278 {
5279 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5280
5281 if(_class && _class->type == 3)
5282 {
5283 if(source->kind != 8)
5284 {
5285 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5286 struct Type * tempDest, * tempSource;
5287
5288 for(; _class->base->type != 1000; _class = _class->base)
5289 ;
5290 tempSource = dest;
5291 tempDest = tempType;
5292 tempType->kind = 8;
5293 if(!_class->symbol)
5294 _class->symbol = FindClass(_class->fullName);
5295 tempType->_class = _class->symbol;
5296 tempType->truth = dest->truth;
5297 if(tempType->_class)
5298 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5299 backupSourceExpType = sourceExp->expType;
5300 sourceExp->expType = dest;
5301 dest->refCount++;
5302 flag = 0x1;
5303 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5304 }
5305 }
5306 if(_class && _class->type == 2 && source->kind != 8)
5307 {
5308 if(!dest->_class->registered->dataType)
5309 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5310 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5311 {
5312 FreeType(source);
5313 FreeType(sourceExp->expType);
5314 source = sourceExp->expType = MkClassType(dest->_class->string);
5315 source->refCount++;
5316 }
5317 }
5318 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5319 {
5320 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5321 struct Declarator * decl;
5322 char string[1024];
5323
5324 ReadString(string, sourceExp->string);
5325 decl = SpecDeclFromString(string, specs, (((void *)0)));
5326 FreeExpContents(sourceExp);
5327 FreeType(sourceExp->expType);
5328 sourceExp->type = 26;
5329 sourceExp->_classExp.specifiers = specs;
5330 sourceExp->_classExp.decl = decl;
5331 sourceExp->expType = dest;
5332 dest->refCount++;
5333 FreeType(source);
5334 FreeType(dest);
5335 if(backupSourceExpType)
5336 FreeType(backupSourceExpType);
5337 return 0x1;
5338 }
5339 }
5340 else if(source->kind == 8)
5341 {
5342 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5343
5344 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5345 {
5346 if(dest->kind != 8)
5347 {
5348 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5349 struct Type * tempDest, * tempSource;
5350
5351 if(!source->_class->registered->dataType)
5352 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5353 for(; _class->base->type != 1000; _class = _class->base)
5354 ;
5355 tempDest = source;
5356 tempSource = tempType;
5357 tempType->kind = 8;
5358 tempType->_class = FindClass(_class->fullName);
5359 tempType->truth = source->truth;
5360 tempType->classObjectType = source->classObjectType;
5361 if(tempType->_class)
5362 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5363 if(conversions->last)
5364 {
5365 ((struct Conversion *)conversions->last)->resultType = dest;
5366 dest->refCount++;
5367 }
5368 FreeType(sourceExp->expType);
5369 sourceExp->expType = MkClassType(_class->fullName);
5370 sourceExp->expType->truth = source->truth;
5371 sourceExp->expType->classObjectType = source->classObjectType;
5372 if(!sourceExp->destType)
5373 {
5374 FreeType(sourceExp->destType);
5375 sourceExp->destType = sourceExp->expType;
5376 if(sourceExp->expType)
5377 sourceExp->expType->refCount++;
5378 }
5379 if(!_class->dataType)
5380 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5381 FreeType(dest);
5382 dest = MkClassType(source->_class->string);
5383 dest->truth = source->truth;
5384 dest->classObjectType = source->classObjectType;
5385 FreeType(source);
5386 source = _class->dataType;
5387 source->refCount++;
5388 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5389 }
5390 }
5391 }
5392 if(!flag)
5393 {
5394 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5395 {
5396 FreeType(source);
5397 FreeType(dest);
5398 return 0x1;
5399 }
5400 }
5401 if(dest->kind == 8)
5402 {
5403 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5404
5405 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5406 {
5407 if(_class->type == 0 || _class->type == 5)
5408 {
5409 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5410
5411 *newExp = *sourceExp;
5412 if(sourceExp->destType)
5413 sourceExp->destType->refCount++;
5414 if(sourceExp->expType)
5415 sourceExp->expType->refCount++;
5416 sourceExp->type = 11;
5417 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5418 sourceExp->cast.exp = newExp;
5419 FreeType(sourceExp->expType);
5420 sourceExp->expType = (((void *)0));
5421 ProcessExpressionType(sourceExp);
5422 if(!inCompiler)
5423 {
5424 FreeType(sourceExp->expType);
5425 sourceExp->expType = dest;
5426 }
5427 FreeType(source);
5428 if(inCompiler)
5429 FreeType(dest);
5430 if(backupSourceExpType)
5431 FreeType(backupSourceExpType);
5432 return 0x1;
5433 }
5434 if(!_class->dataType)
5435 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5436 FreeType(dest);
5437 dest = _class->dataType;
5438 dest->refCount++;
5439 }
5440 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))
5441 {
5442 specs = MkListOne(MkSpecifier(DOUBLE));
5443 }
5444 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))
5445 {
5446 specs = MkListOne(MkSpecifier(FLOAT));
5447 }
5448 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))
5449 {
5450 specs = MkList();
5451 if(!dest->isSigned)
5452 ListAdd(specs, MkSpecifier(UNSIGNED));
5453 ListAdd(specs, MkSpecifier(INT64));
5454 }
5455 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 6 || source->kind == 7))
5456 {
5457 specs = MkList();
5458 if(!dest->isSigned)
5459 ListAdd(specs, MkSpecifier(UNSIGNED));
5460 ListAdd(specs, MkSpecifier(INT));
5461 }
5462 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5463 {
5464 specs = MkList();
5465 if(!dest->isSigned)
5466 ListAdd(specs, MkSpecifier(UNSIGNED));
5467 ListAdd(specs, MkSpecifier(SHORT));
5468 }
5469 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 24 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5470 {
5471 specs = MkList();
5472 if(!dest->isSigned)
5473 ListAdd(specs, MkSpecifier(UNSIGNED));
5474 ListAdd(specs, MkSpecifier(CHAR));
5475 }
5476 else
5477 {
5478 FreeType(source);
5479 FreeType(dest);
5480 if(backupSourceExpType)
5481 {
5482 if(sourceExp->expType)
5483 FreeType(sourceExp->expType);
5484 sourceExp->expType = backupSourceExpType;
5485 }
5486 return 0x0;
5487 }
5488 }
5489 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))
5490 {
5491 specs = MkListOne(MkSpecifier(DOUBLE));
5492 }
5493 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))
5494 {
5495 specs = MkListOne(MkSpecifier(FLOAT));
5496 }
5497 else if(dest->kind == 24 && (source->kind == 24 || source->kind == 1 || source->kind == 15 || source->kind == 2 || source->kind == 3) && (value == 1 || value == 0))
5498 {
5499 specs = MkList();
5500 ListAdd(specs, MkSpecifier(BOOL));
5501 }
5502 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)))
5503 {
5504 specs = MkList();
5505 if(!dest->isSigned)
5506 ListAdd(specs, MkSpecifier(UNSIGNED));
5507 ListAdd(specs, MkSpecifier(CHAR));
5508 }
5509 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)))))
5510 {
5511 specs = MkList();
5512 if(!dest->isSigned)
5513 ListAdd(specs, MkSpecifier(UNSIGNED));
5514 ListAdd(specs, MkSpecifier(SHORT));
5515 }
5516 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 24 || source->kind == 1 || source->kind == 3))
5517 {
5518 specs = MkList();
5519 if(!dest->isSigned)
5520 ListAdd(specs, MkSpecifier(UNSIGNED));
5521 ListAdd(specs, MkSpecifier(INT));
5522 }
5523 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 24 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5524 {
5525 specs = MkList();
5526 if(!dest->isSigned)
5527 ListAdd(specs, MkSpecifier(UNSIGNED));
5528 ListAdd(specs, MkSpecifier(INT64));
5529 }
5530 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 24 || source->kind == 1))
5531 {
5532 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5533 }
5534 else
5535 {
5536 FreeType(source);
5537 FreeType(dest);
5538 if(backupSourceExpType)
5539 {
5540 if(sourceExp->expType)
5541 FreeType(sourceExp->expType);
5542 sourceExp->expType = backupSourceExpType;
5543 }
5544 return 0x0;
5545 }
5546 if(!flag)
5547 {
5548 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5549
5550 *newExp = *sourceExp;
5551 newExp->prev = (((void *)0));
5552 newExp->next = (((void *)0));
5553 if(sourceExp->destType)
5554 sourceExp->destType->refCount++;
5555 if(sourceExp->expType)
5556 sourceExp->expType->refCount++;
5557 sourceExp->type = 11;
5558 if(realDest->kind == 8)
5559 {
5560 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5561 FreeList(specs, FreeSpecifier);
5562 }
5563 else
5564 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5565 if(newExp->type == 4)
5566 {
5567 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5568 }
5569 else
5570 sourceExp->cast.exp = newExp;
5571 FreeType(sourceExp->expType);
5572 sourceExp->expType = (((void *)0));
5573 ProcessExpressionType(sourceExp);
5574 }
5575 else
5576 FreeList(specs, FreeSpecifier);
5577 FreeType(dest);
5578 FreeType(source);
5579 if(backupSourceExpType)
5580 FreeType(backupSourceExpType);
5581 return 0x1;
5582 }
5583 else
5584 {
5585 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5586 sourceExp = (*sourceExp->list).last;
5587 if(sourceExp->type == 0)
5588 {
5589 struct Identifier * id = sourceExp->identifier;
5590
5591 if(dest->kind == 8)
5592 {
5593 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5594 {
5595 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5596 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5597
5598 if(enumClass)
5599 {
5600 for(; _class && _class->type == 4; _class = _class->base)
5601 {
5602 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5603 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5604
5605 for(value = e->values.first; value; value = value->next)
5606 {
5607 if(!strcmp(value->name, id->string))
5608 break;
5609 }
5610 if(value)
5611 {
5612 FreeExpContents(sourceExp);
5613 FreeType(sourceExp->expType);
5614 sourceExp->isConstant = 0x1;
5615 sourceExp->expType = MkClassType(_class->fullName);
5616 {
5617 char constant[256];
5618
5619 sourceExp->type = 2;
5620 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5621 sprintf(constant, "%d", (int)value->data);
5622 else
5623 sprintf(constant, "0x%X", (int)value->data);
5624 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5625 }
5626 return 0x1;
5627 }
5628 }
5629 }
5630 }
5631 }
5632 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5633 return 0x1;
5634 }
5635 }
5636 return 0x0;
5637 }
5638
5639 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5640 {
5641 int value2 = op2->i;
5642
5643 exp->type = 2;
5644 exp->string = PrintInt(op1->i + value2);
5645 if(!exp->expType)
5646 {
5647 exp->expType = op1->type;
5648 if(op1->type)
5649 op1->type->refCount++;
5650 }
5651 return 0x1;
5652 }
5653
5654 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5655 {
5656 unsigned int value2 = op2->ui;
5657
5658 exp->type = 2;
5659 exp->string = PrintUInt(op1->ui + value2);
5660 if(!exp->expType)
5661 {
5662 exp->expType = op1->type;
5663 if(op1->type)
5664 op1->type->refCount++;
5665 }
5666 return 0x1;
5667 }
5668
5669 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5670 {
5671 short value2 = op2->s;
5672
5673 exp->type = 2;
5674 exp->string = PrintShort(op1->s + value2);
5675 if(!exp->expType)
5676 {
5677 exp->expType = op1->type;
5678 if(op1->type)
5679 op1->type->refCount++;
5680 }
5681 return 0x1;
5682 }
5683
5684 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5685 {
5686 unsigned short value2 = op2->us;
5687
5688 exp->type = 2;
5689 exp->string = PrintUShort(op1->us + value2);
5690 if(!exp->expType)
5691 {
5692 exp->expType = op1->type;
5693 if(op1->type)
5694 op1->type->refCount++;
5695 }
5696 return 0x1;
5697 }
5698
5699 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5700 {
5701 char value2 = op2->c;
5702
5703 exp->type = 2;
5704 exp->string = PrintChar(op1->c + value2);
5705 if(!exp->expType)
5706 {
5707 exp->expType = op1->type;
5708 if(op1->type)
5709 op1->type->refCount++;
5710 }
5711 return 0x1;
5712 }
5713
5714 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5715 {
5716 unsigned char value2 = op2->uc;
5717
5718 exp->type = 2;
5719 exp->string = PrintUChar(op1->uc + value2);
5720 if(!exp->expType)
5721 {
5722 exp->expType = op1->type;
5723 if(op1->type)
5724 op1->type->refCount++;
5725 }
5726 return 0x1;
5727 }
5728
5729 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5730 {
5731 float value2 = op2->f;
5732
5733 exp->type = 2;
5734 exp->string = PrintFloat(op1->f + value2);
5735 if(!exp->expType)
5736 {
5737 exp->expType = op1->type;
5738 if(op1->type)
5739 op1->type->refCount++;
5740 }
5741 return 0x1;
5742 }
5743
5744 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5745 {
5746 double value2 = op2->d;
5747
5748 exp->type = 2;
5749 exp->string = PrintDouble(op1->d + value2);
5750 if(!exp->expType)
5751 {
5752 exp->expType = op1->type;
5753 if(op1->type)
5754 op1->type->refCount++;
5755 }
5756 return 0x1;
5757 }
5758
5759 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5760 {
5761 int value2 = op2->i;
5762
5763 exp->type = 2;
5764 exp->string = PrintInt(op1->i - value2);
5765 if(!exp->expType)
5766 {
5767 exp->expType = op1->type;
5768 if(op1->type)
5769 op1->type->refCount++;
5770 }
5771 return 0x1;
5772 }
5773
5774 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5775 {
5776 unsigned int value2 = op2->ui;
5777
5778 exp->type = 2;
5779 exp->string = PrintUInt(op1->ui - value2);
5780 if(!exp->expType)
5781 {
5782 exp->expType = op1->type;
5783 if(op1->type)
5784 op1->type->refCount++;
5785 }
5786 return 0x1;
5787 }
5788
5789 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5790 {
5791 short value2 = op2->s;
5792
5793 exp->type = 2;
5794 exp->string = PrintShort(op1->s - value2);
5795 if(!exp->expType)
5796 {
5797 exp->expType = op1->type;
5798 if(op1->type)
5799 op1->type->refCount++;
5800 }
5801 return 0x1;
5802 }
5803
5804 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5805 {
5806 unsigned short value2 = op2->us;
5807
5808 exp->type = 2;
5809 exp->string = PrintUShort(op1->us - value2);
5810 if(!exp->expType)
5811 {
5812 exp->expType = op1->type;
5813 if(op1->type)
5814 op1->type->refCount++;
5815 }
5816 return 0x1;
5817 }
5818
5819 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5820 {
5821 char value2 = op2->c;
5822
5823 exp->type = 2;
5824 exp->string = PrintChar(op1->c - value2);
5825 if(!exp->expType)
5826 {
5827 exp->expType = op1->type;
5828 if(op1->type)
5829 op1->type->refCount++;
5830 }
5831 return 0x1;
5832 }
5833
5834 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5835 {
5836 unsigned char value2 = op2->uc;
5837
5838 exp->type = 2;
5839 exp->string = PrintUChar(op1->uc - value2);
5840 if(!exp->expType)
5841 {
5842 exp->expType = op1->type;
5843 if(op1->type)
5844 op1->type->refCount++;
5845 }
5846 return 0x1;
5847 }
5848
5849 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5850 {
5851 float value2 = op2->f;
5852
5853 exp->type = 2;
5854 exp->string = PrintFloat(op1->f - value2);
5855 if(!exp->expType)
5856 {
5857 exp->expType = op1->type;
5858 if(op1->type)
5859 op1->type->refCount++;
5860 }
5861 return 0x1;
5862 }
5863
5864 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5865 {
5866 double value2 = op2->d;
5867
5868 exp->type = 2;
5869 exp->string = PrintDouble(op1->d - value2);
5870 if(!exp->expType)
5871 {
5872 exp->expType = op1->type;
5873 if(op1->type)
5874 op1->type->refCount++;
5875 }
5876 return 0x1;
5877 }
5878
5879 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5880 {
5881 int value2 = op2->i;
5882
5883 exp->type = 2;
5884 exp->string = PrintInt(op1->i * value2);
5885 if(!exp->expType)
5886 {
5887 exp->expType = op1->type;
5888 if(op1->type)
5889 op1->type->refCount++;
5890 }
5891 return 0x1;
5892 }
5893
5894 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5895 {
5896 unsigned int value2 = op2->ui;
5897
5898 exp->type = 2;
5899 exp->string = PrintUInt(op1->ui * value2);
5900 if(!exp->expType)
5901 {
5902 exp->expType = op1->type;
5903 if(op1->type)
5904 op1->type->refCount++;
5905 }
5906 return 0x1;
5907 }
5908
5909 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5910 {
5911 short value2 = op2->s;
5912
5913 exp->type = 2;
5914 exp->string = PrintShort(op1->s * value2);
5915 if(!exp->expType)
5916 {
5917 exp->expType = op1->type;
5918 if(op1->type)
5919 op1->type->refCount++;
5920 }
5921 return 0x1;
5922 }
5923
5924 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5925 {
5926 unsigned short value2 = op2->us;
5927
5928 exp->type = 2;
5929 exp->string = PrintUShort(op1->us * value2);
5930 if(!exp->expType)
5931 {
5932 exp->expType = op1->type;
5933 if(op1->type)
5934 op1->type->refCount++;
5935 }
5936 return 0x1;
5937 }
5938
5939 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5940 {
5941 char value2 = op2->c;
5942
5943 exp->type = 2;
5944 exp->string = PrintChar(op1->c * value2);
5945 if(!exp->expType)
5946 {
5947 exp->expType = op1->type;
5948 if(op1->type)
5949 op1->type->refCount++;
5950 }
5951 return 0x1;
5952 }
5953
5954 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5955 {
5956 unsigned char value2 = op2->uc;
5957
5958 exp->type = 2;
5959 exp->string = PrintUChar(op1->uc * value2);
5960 if(!exp->expType)
5961 {
5962 exp->expType = op1->type;
5963 if(op1->type)
5964 op1->type->refCount++;
5965 }
5966 return 0x1;
5967 }
5968
5969 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5970 {
5971 float value2 = op2->f;
5972
5973 exp->type = 2;
5974 exp->string = PrintFloat(op1->f * value2);
5975 if(!exp->expType)
5976 {
5977 exp->expType = op1->type;
5978 if(op1->type)
5979 op1->type->refCount++;
5980 }
5981 return 0x1;
5982 }
5983
5984 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5985 {
5986 double value2 = op2->d;
5987
5988 exp->type = 2;
5989 exp->string = PrintDouble(op1->d * value2);
5990 if(!exp->expType)
5991 {
5992 exp->expType = op1->type;
5993 if(op1->type)
5994 op1->type->refCount++;
5995 }
5996 return 0x1;
5997 }
5998
5999 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6000 {
6001 int value2 = op2->i;
6002
6003 exp->type = 2;
6004 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
6005 if(!exp->expType)
6006 {
6007 exp->expType = op1->type;
6008 if(op1->type)
6009 op1->type->refCount++;
6010 }
6011 return 0x1;
6012 }
6013
6014 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6015 {
6016 unsigned int value2 = op2->ui;
6017
6018 exp->type = 2;
6019 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
6020 if(!exp->expType)
6021 {
6022 exp->expType = op1->type;
6023 if(op1->type)
6024 op1->type->refCount++;
6025 }
6026 return 0x1;
6027 }
6028
6029 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6030 {
6031 short value2 = op2->s;
6032
6033 exp->type = 2;
6034 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
6035 if(!exp->expType)
6036 {
6037 exp->expType = op1->type;
6038 if(op1->type)
6039 op1->type->refCount++;
6040 }
6041 return 0x1;
6042 }
6043
6044 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6045 {
6046 unsigned short value2 = op2->us;
6047
6048 exp->type = 2;
6049 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
6050 if(!exp->expType)
6051 {
6052 exp->expType = op1->type;
6053 if(op1->type)
6054 op1->type->refCount++;
6055 }
6056 return 0x1;
6057 }
6058
6059 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6060 {
6061 char value2 = op2->c;
6062
6063 exp->type = 2;
6064 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
6065 if(!exp->expType)
6066 {
6067 exp->expType = op1->type;
6068 if(op1->type)
6069 op1->type->refCount++;
6070 }
6071 return 0x1;
6072 }
6073
6074 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6075 {
6076 unsigned char value2 = op2->uc;
6077
6078 exp->type = 2;
6079 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
6080 if(!exp->expType)
6081 {
6082 exp->expType = op1->type;
6083 if(op1->type)
6084 op1->type->refCount++;
6085 }
6086 return 0x1;
6087 }
6088
6089 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6090 {
6091 float value2 = op2->f;
6092
6093 exp->type = 2;
6094 exp->string = PrintFloat(value2 ? (op1->f / value2) : 0);
6095 if(!exp->expType)
6096 {
6097 exp->expType = op1->type;
6098 if(op1->type)
6099 op1->type->refCount++;
6100 }
6101 return 0x1;
6102 }
6103
6104 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6105 {
6106 double value2 = op2->d;
6107
6108 exp->type = 2;
6109 exp->string = PrintDouble(value2 ? (op1->d / value2) : 0);
6110 if(!exp->expType)
6111 {
6112 exp->expType = op1->type;
6113 if(op1->type)
6114 op1->type->refCount++;
6115 }
6116 return 0x1;
6117 }
6118
6119 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6120 {
6121 int value2 = op2->i;
6122
6123 exp->type = 2;
6124 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
6125 if(!exp->expType)
6126 {
6127 exp->expType = op1->type;
6128 if(op1->type)
6129 op1->type->refCount++;
6130 }
6131 return 0x1;
6132 }
6133
6134 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6135 {
6136 unsigned int value2 = op2->ui;
6137
6138 exp->type = 2;
6139 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
6140 if(!exp->expType)
6141 {
6142 exp->expType = op1->type;
6143 if(op1->type)
6144 op1->type->refCount++;
6145 }
6146 return 0x1;
6147 }
6148
6149 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6150 {
6151 short value2 = op2->s;
6152
6153 exp->type = 2;
6154 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
6155 if(!exp->expType)
6156 {
6157 exp->expType = op1->type;
6158 if(op1->type)
6159 op1->type->refCount++;
6160 }
6161 return 0x1;
6162 }
6163
6164 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6165 {
6166 unsigned short value2 = op2->us;
6167
6168 exp->type = 2;
6169 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
6170 if(!exp->expType)
6171 {
6172 exp->expType = op1->type;
6173 if(op1->type)
6174 op1->type->refCount++;
6175 }
6176 return 0x1;
6177 }
6178
6179 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6180 {
6181 char value2 = op2->c;
6182
6183 exp->type = 2;
6184 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
6185 if(!exp->expType)
6186 {
6187 exp->expType = op1->type;
6188 if(op1->type)
6189 op1->type->refCount++;
6190 }
6191 return 0x1;
6192 }
6193
6194 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6195 {
6196 unsigned char value2 = op2->uc;
6197
6198 exp->type = 2;
6199 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
6200 if(!exp->expType)
6201 {
6202 exp->expType = op1->type;
6203 if(op1->type)
6204 op1->type->refCount++;
6205 }
6206 return 0x1;
6207 }
6208
6209 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
6210 {
6211 exp->type = 2;
6212 exp->string = PrintInt((-op1->i));
6213 if(!exp->expType)
6214 {
6215 exp->expType = op1->type;
6216 if(op1->type)
6217 op1->type->refCount++;
6218 }
6219 return 0x1;
6220 }
6221
6222 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
6223 {
6224 exp->type = 2;
6225 exp->string = PrintUInt((unsigned int)(-op1->ui));
6226 if(!exp->expType)
6227 {
6228 exp->expType = op1->type;
6229 if(op1->type)
6230 op1->type->refCount++;
6231 }
6232 return 0x1;
6233 }
6234
6235 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
6236 {
6237 exp->type = 2;
6238 exp->string = PrintShort((-op1->s));
6239 if(!exp->expType)
6240 {
6241 exp->expType = op1->type;
6242 if(op1->type)
6243 op1->type->refCount++;
6244 }
6245 return 0x1;
6246 }
6247
6248 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
6249 {
6250 exp->type = 2;
6251 exp->string = PrintUShort((unsigned short)(-op1->us));
6252 if(!exp->expType)
6253 {
6254 exp->expType = op1->type;
6255 if(op1->type)
6256 op1->type->refCount++;
6257 }
6258 return 0x1;
6259 }
6260
6261 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
6262 {
6263 exp->type = 2;
6264 exp->string = PrintChar((-op1->c));
6265 if(!exp->expType)
6266 {
6267 exp->expType = op1->type;
6268 if(op1->type)
6269 op1->type->refCount++;
6270 }
6271 return 0x1;
6272 }
6273
6274 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
6275 {
6276 exp->type = 2;
6277 exp->string = PrintUChar((unsigned char)(-op1->uc));
6278 if(!exp->expType)
6279 {
6280 exp->expType = op1->type;
6281 if(op1->type)
6282 op1->type->refCount++;
6283 }
6284 return 0x1;
6285 }
6286
6287 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
6288 {
6289 exp->type = 2;
6290 exp->string = PrintFloat((float)(-op1->f));
6291 if(!exp->expType)
6292 {
6293 exp->expType = op1->type;
6294 if(op1->type)
6295 op1->type->refCount++;
6296 }
6297 return 0x1;
6298 }
6299
6300 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6301 {
6302 exp->type = 2;
6303 exp->string = PrintDouble((double)(-op1->d));
6304 if(!exp->expType)
6305 {
6306 exp->expType = op1->type;
6307 if(op1->type)
6308 op1->type->refCount++;
6309 }
6310 return 0x1;
6311 }
6312
6313 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6314 {
6315 exp->type = 2;
6316 exp->string = PrintInt((++op1->i));
6317 if(!exp->expType)
6318 {
6319 exp->expType = op1->type;
6320 if(op1->type)
6321 op1->type->refCount++;
6322 }
6323 return 0x1;
6324 }
6325
6326 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6327 {
6328 exp->type = 2;
6329 exp->string = PrintUInt((++op1->ui));
6330 if(!exp->expType)
6331 {
6332 exp->expType = op1->type;
6333 if(op1->type)
6334 op1->type->refCount++;
6335 }
6336 return 0x1;
6337 }
6338
6339 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6340 {
6341 exp->type = 2;
6342 exp->string = PrintShort((++op1->s));
6343 if(!exp->expType)
6344 {
6345 exp->expType = op1->type;
6346 if(op1->type)
6347 op1->type->refCount++;
6348 }
6349 return 0x1;
6350 }
6351
6352 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6353 {
6354 exp->type = 2;
6355 exp->string = PrintUShort((++op1->us));
6356 if(!exp->expType)
6357 {
6358 exp->expType = op1->type;
6359 if(op1->type)
6360 op1->type->refCount++;
6361 }
6362 return 0x1;
6363 }
6364
6365 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6366 {
6367 exp->type = 2;
6368 exp->string = PrintChar((++op1->c));
6369 if(!exp->expType)
6370 {
6371 exp->expType = op1->type;
6372 if(op1->type)
6373 op1->type->refCount++;
6374 }
6375 return 0x1;
6376 }
6377
6378 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6379 {
6380 exp->type = 2;
6381 exp->string = PrintUChar((++op1->uc));
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 FloatInc(struct Expression * exp, struct Operand * op1)
6392 {
6393 exp->type = 2;
6394 exp->string = PrintFloat((float)(++op1->f));
6395 if(!exp->expType)
6396 {
6397 exp->expType = op1->type;
6398 if(op1->type)
6399 op1->type->refCount++;
6400 }
6401 return 0x1;
6402 }
6403
6404 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6405 {
6406 exp->type = 2;
6407 exp->string = PrintDouble((double)(++op1->d));
6408 if(!exp->expType)
6409 {
6410 exp->expType = op1->type;
6411 if(op1->type)
6412 op1->type->refCount++;
6413 }
6414 return 0x1;
6415 }
6416
6417 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6418 {
6419 exp->type = 2;
6420 exp->string = PrintInt((--op1->i));
6421 if(!exp->expType)
6422 {
6423 exp->expType = op1->type;
6424 if(op1->type)
6425 op1->type->refCount++;
6426 }
6427 return 0x1;
6428 }
6429
6430 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6431 {
6432 exp->type = 2;
6433 exp->string = PrintUInt((--op1->ui));
6434 if(!exp->expType)
6435 {
6436 exp->expType = op1->type;
6437 if(op1->type)
6438 op1->type->refCount++;
6439 }
6440 return 0x1;
6441 }
6442
6443 static unsigned int ShortDec(struct Expression * exp, struct Operand * op1)
6444 {
6445 exp->type = 2;
6446 exp->string = PrintShort((--op1->s));
6447 if(!exp->expType)
6448 {
6449 exp->expType = op1->type;
6450 if(op1->type)
6451 op1->type->refCount++;
6452 }
6453 return 0x1;
6454 }
6455
6456 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6457 {
6458 exp->type = 2;
6459 exp->string = PrintUShort((--op1->us));
6460 if(!exp->expType)
6461 {
6462 exp->expType = op1->type;
6463 if(op1->type)
6464 op1->type->refCount++;
6465 }
6466 return 0x1;
6467 }
6468
6469 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6470 {
6471 exp->type = 2;
6472 exp->string = PrintChar((--op1->c));
6473 if(!exp->expType)
6474 {
6475 exp->expType = op1->type;
6476 if(op1->type)
6477 op1->type->refCount++;
6478 }
6479 return 0x1;
6480 }
6481
6482 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6483 {
6484 exp->type = 2;
6485 exp->string = PrintUChar((--op1->uc));
6486 if(!exp->expType)
6487 {
6488 exp->expType = op1->type;
6489 if(op1->type)
6490 op1->type->refCount++;
6491 }
6492 return 0x1;
6493 }
6494
6495 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6496 {
6497 exp->type = 2;
6498 exp->string = PrintFloat((float)(--op1->f));
6499 if(!exp->expType)
6500 {
6501 exp->expType = op1->type;
6502 if(op1->type)
6503 op1->type->refCount++;
6504 }
6505 return 0x1;
6506 }
6507
6508 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6509 {
6510 exp->type = 2;
6511 exp->string = PrintDouble((double)(--op1->d));
6512 if(!exp->expType)
6513 {
6514 exp->expType = op1->type;
6515 if(op1->type)
6516 op1->type->refCount++;
6517 }
6518 return 0x1;
6519 }
6520
6521 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6522 {
6523 int value2 = op2->i;
6524
6525 exp->type = 2;
6526 exp->string = PrintInt(op1->i = value2);
6527 if(!exp->expType)
6528 {
6529 exp->expType = op1->type;
6530 if(op1->type)
6531 op1->type->refCount++;
6532 }
6533 return 0x1;
6534 }
6535
6536 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6537 {
6538 unsigned int value2 = op2->ui;
6539
6540 exp->type = 2;
6541 exp->string = PrintUInt(op1->ui = value2);
6542 if(!exp->expType)
6543 {
6544 exp->expType = op1->type;
6545 if(op1->type)
6546 op1->type->refCount++;
6547 }
6548 return 0x1;
6549 }
6550
6551 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6552 {
6553 short value2 = op2->s;
6554
6555 exp->type = 2;
6556 exp->string = PrintShort(op1->s = value2);
6557 if(!exp->expType)
6558 {
6559 exp->expType = op1->type;
6560 if(op1->type)
6561 op1->type->refCount++;
6562 }
6563 return 0x1;
6564 }
6565
6566 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6567 {
6568 unsigned short value2 = op2->us;
6569
6570 exp->type = 2;
6571 exp->string = PrintUShort(op1->us = value2);
6572 if(!exp->expType)
6573 {
6574 exp->expType = op1->type;
6575 if(op1->type)
6576 op1->type->refCount++;
6577 }
6578 return 0x1;
6579 }
6580
6581 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6582 {
6583 char value2 = op2->c;
6584
6585 exp->type = 2;
6586 exp->string = PrintChar(op1->c = value2);
6587 if(!exp->expType)
6588 {
6589 exp->expType = op1->type;
6590 if(op1->type)
6591 op1->type->refCount++;
6592 }
6593 return 0x1;
6594 }
6595
6596 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6597 {
6598 unsigned char value2 = op2->uc;
6599
6600 exp->type = 2;
6601 exp->string = PrintUChar(op1->uc = value2);
6602 if(!exp->expType)
6603 {
6604 exp->expType = op1->type;
6605 if(op1->type)
6606 op1->type->refCount++;
6607 }
6608 return 0x1;
6609 }
6610
6611 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6612 {
6613 float value2 = op2->f;
6614
6615 exp->type = 2;
6616 exp->string = PrintFloat(op1->f = value2);
6617 if(!exp->expType)
6618 {
6619 exp->expType = op1->type;
6620 if(op1->type)
6621 op1->type->refCount++;
6622 }
6623 return 0x1;
6624 }
6625
6626 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6627 {
6628 double value2 = op2->d;
6629
6630 exp->type = 2;
6631 exp->string = PrintDouble(op1->d = value2);
6632 if(!exp->expType)
6633 {
6634 exp->expType = op1->type;
6635 if(op1->type)
6636 op1->type->refCount++;
6637 }
6638 return 0x1;
6639 }
6640
6641 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6642 {
6643 int value2 = op2->i;
6644
6645 exp->type = 2;
6646 exp->string = PrintInt(op1->i += value2);
6647 if(!exp->expType)
6648 {
6649 exp->expType = op1->type;
6650 if(op1->type)
6651 op1->type->refCount++;
6652 }
6653 return 0x1;
6654 }
6655
6656 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6657 {
6658 unsigned int value2 = op2->ui;
6659
6660 exp->type = 2;
6661 exp->string = PrintUInt(op1->ui += value2);
6662 if(!exp->expType)
6663 {
6664 exp->expType = op1->type;
6665 if(op1->type)
6666 op1->type->refCount++;
6667 }
6668 return 0x1;
6669 }
6670
6671 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6672 {
6673 short value2 = op2->s;
6674
6675 exp->type = 2;
6676 exp->string = PrintShort(op1->s += value2);
6677 if(!exp->expType)
6678 {
6679 exp->expType = op1->type;
6680 if(op1->type)
6681 op1->type->refCount++;
6682 }
6683 return 0x1;
6684 }
6685
6686 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6687 {
6688 unsigned short value2 = op2->us;
6689
6690 exp->type = 2;
6691 exp->string = PrintUShort(op1->us += value2);
6692 if(!exp->expType)
6693 {
6694 exp->expType = op1->type;
6695 if(op1->type)
6696 op1->type->refCount++;
6697 }
6698 return 0x1;
6699 }
6700
6701 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6702 {
6703 char value2 = op2->c;
6704
6705 exp->type = 2;
6706 exp->string = PrintChar(op1->c += value2);
6707 if(!exp->expType)
6708 {
6709 exp->expType = op1->type;
6710 if(op1->type)
6711 op1->type->refCount++;
6712 }
6713 return 0x1;
6714 }
6715
6716 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6717 {
6718 unsigned char value2 = op2->uc;
6719
6720 exp->type = 2;
6721 exp->string = PrintUChar(op1->uc += value2);
6722 if(!exp->expType)
6723 {
6724 exp->expType = op1->type;
6725 if(op1->type)
6726 op1->type->refCount++;
6727 }
6728 return 0x1;
6729 }
6730
6731 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6732 {
6733 float value2 = op2->f;
6734
6735 exp->type = 2;
6736 exp->string = PrintFloat(op1->f += value2);
6737 if(!exp->expType)
6738 {
6739 exp->expType = op1->type;
6740 if(op1->type)
6741 op1->type->refCount++;
6742 }
6743 return 0x1;
6744 }
6745
6746 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6747 {
6748 double value2 = op2->d;
6749
6750 exp->type = 2;
6751 exp->string = PrintDouble(op1->d += value2);
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 IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6762 {
6763 int value2 = op2->i;
6764
6765 exp->type = 2;
6766 exp->string = PrintInt(op1->i -= value2);
6767 if(!exp->expType)
6768 {
6769 exp->expType = op1->type;
6770 if(op1->type)
6771 op1->type->refCount++;
6772 }
6773 return 0x1;
6774 }
6775
6776 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6777 {
6778 unsigned int value2 = op2->ui;
6779
6780 exp->type = 2;
6781 exp->string = PrintUInt(op1->ui -= value2);
6782 if(!exp->expType)
6783 {
6784 exp->expType = op1->type;
6785 if(op1->type)
6786 op1->type->refCount++;
6787 }
6788 return 0x1;
6789 }
6790
6791 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6792 {
6793 short value2 = op2->s;
6794
6795 exp->type = 2;
6796 exp->string = PrintShort(op1->s -= value2);
6797 if(!exp->expType)
6798 {
6799 exp->expType = op1->type;
6800 if(op1->type)
6801 op1->type->refCount++;
6802 }
6803 return 0x1;
6804 }
6805
6806 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6807 {
6808 unsigned short value2 = op2->us;
6809
6810 exp->type = 2;
6811 exp->string = PrintUShort(op1->us -= value2);
6812 if(!exp->expType)
6813 {
6814 exp->expType = op1->type;
6815 if(op1->type)
6816 op1->type->refCount++;
6817 }
6818 return 0x1;
6819 }
6820
6821 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6822 {
6823 char value2 = op2->c;
6824
6825 exp->type = 2;
6826 exp->string = PrintChar(op1->c -= value2);
6827 if(!exp->expType)
6828 {
6829 exp->expType = op1->type;
6830 if(op1->type)
6831 op1->type->refCount++;
6832 }
6833 return 0x1;
6834 }
6835
6836 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6837 {
6838 unsigned char value2 = op2->uc;
6839
6840 exp->type = 2;
6841 exp->string = PrintUChar(op1->uc -= value2);
6842 if(!exp->expType)
6843 {
6844 exp->expType = op1->type;
6845 if(op1->type)
6846 op1->type->refCount++;
6847 }
6848 return 0x1;
6849 }
6850
6851 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6852 {
6853 float value2 = op2->f;
6854
6855 exp->type = 2;
6856 exp->string = PrintFloat(op1->f -= value2);
6857 if(!exp->expType)
6858 {
6859 exp->expType = op1->type;
6860 if(op1->type)
6861 op1->type->refCount++;
6862 }
6863 return 0x1;
6864 }
6865
6866 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6867 {
6868 double value2 = op2->d;
6869
6870 exp->type = 2;
6871 exp->string = PrintDouble(op1->d -= value2);
6872 if(!exp->expType)
6873 {
6874 exp->expType = op1->type;
6875 if(op1->type)
6876 op1->type->refCount++;
6877 }
6878 return 0x1;
6879 }
6880
6881 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6882 {
6883 int value2 = op2->i;
6884
6885 exp->type = 2;
6886 exp->string = PrintInt(op1->i *= value2);
6887 if(!exp->expType)
6888 {
6889 exp->expType = op1->type;
6890 if(op1->type)
6891 op1->type->refCount++;
6892 }
6893 return 0x1;
6894 }
6895
6896 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6897 {
6898 unsigned int value2 = op2->ui;
6899
6900 exp->type = 2;
6901 exp->string = PrintUInt(op1->ui *= value2);
6902 if(!exp->expType)
6903 {
6904 exp->expType = op1->type;
6905 if(op1->type)
6906 op1->type->refCount++;
6907 }
6908 return 0x1;
6909 }
6910
6911 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6912 {
6913 short value2 = op2->s;
6914
6915 exp->type = 2;
6916 exp->string = PrintShort(op1->s *= value2);
6917 if(!exp->expType)
6918 {
6919 exp->expType = op1->type;
6920 if(op1->type)
6921 op1->type->refCount++;
6922 }
6923 return 0x1;
6924 }
6925
6926 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6927 {
6928 unsigned short value2 = op2->us;
6929
6930 exp->type = 2;
6931 exp->string = PrintUShort(op1->us *= value2);
6932 if(!exp->expType)
6933 {
6934 exp->expType = op1->type;
6935 if(op1->type)
6936 op1->type->refCount++;
6937 }
6938 return 0x1;
6939 }
6940
6941 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6942 {
6943 char value2 = op2->c;
6944
6945 exp->type = 2;
6946 exp->string = PrintChar(op1->c *= value2);
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 UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6957 {
6958 unsigned char value2 = op2->uc;
6959
6960 exp->type = 2;
6961 exp->string = PrintUChar(op1->uc *= value2);
6962 if(!exp->expType)
6963 {
6964 exp->expType = op1->type;
6965 if(op1->type)
6966 op1->type->refCount++;
6967 }
6968 return 0x1;
6969 }
6970
6971 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6972 {
6973 float value2 = op2->f;
6974
6975 exp->type = 2;
6976 exp->string = PrintFloat(op1->f *= value2);
6977 if(!exp->expType)
6978 {
6979 exp->expType = op1->type;
6980 if(op1->type)
6981 op1->type->refCount++;
6982 }
6983 return 0x1;
6984 }
6985
6986 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6987 {
6988 double value2 = op2->d;
6989
6990 exp->type = 2;
6991 exp->string = PrintDouble(op1->d *= value2);
6992 if(!exp->expType)
6993 {
6994 exp->expType = op1->type;
6995 if(op1->type)
6996 op1->type->refCount++;
6997 }
6998 return 0x1;
6999 }
7000
7001 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7002 {
7003 int value2 = op2->i;
7004
7005 exp->type = 2;
7006 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
7007 if(!exp->expType)
7008 {
7009 exp->expType = op1->type;
7010 if(op1->type)
7011 op1->type->refCount++;
7012 }
7013 return 0x1;
7014 }
7015
7016 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7017 {
7018 unsigned int value2 = op2->ui;
7019
7020 exp->type = 2;
7021 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
7022 if(!exp->expType)
7023 {
7024 exp->expType = op1->type;
7025 if(op1->type)
7026 op1->type->refCount++;
7027 }
7028 return 0x1;
7029 }
7030
7031 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7032 {
7033 short value2 = op2->s;
7034
7035 exp->type = 2;
7036 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
7037 if(!exp->expType)
7038 {
7039 exp->expType = op1->type;
7040 if(op1->type)
7041 op1->type->refCount++;
7042 }
7043 return 0x1;
7044 }
7045
7046 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7047 {
7048 unsigned short value2 = op2->us;
7049
7050 exp->type = 2;
7051 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
7052 if(!exp->expType)
7053 {
7054 exp->expType = op1->type;
7055 if(op1->type)
7056 op1->type->refCount++;
7057 }
7058 return 0x1;
7059 }
7060
7061 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7062 {
7063 char value2 = op2->c;
7064
7065 exp->type = 2;
7066 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
7067 if(!exp->expType)
7068 {
7069 exp->expType = op1->type;
7070 if(op1->type)
7071 op1->type->refCount++;
7072 }
7073 return 0x1;
7074 }
7075
7076 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7077 {
7078 unsigned char value2 = op2->uc;
7079
7080 exp->type = 2;
7081 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
7082 if(!exp->expType)
7083 {
7084 exp->expType = op1->type;
7085 if(op1->type)
7086 op1->type->refCount++;
7087 }
7088 return 0x1;
7089 }
7090
7091 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7092 {
7093 float value2 = op2->f;
7094
7095 exp->type = 2;
7096 exp->string = PrintFloat(value2 ? (op1->f /= value2) : 0);
7097 if(!exp->expType)
7098 {
7099 exp->expType = op1->type;
7100 if(op1->type)
7101 op1->type->refCount++;
7102 }
7103 return 0x1;
7104 }
7105
7106 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7107 {
7108 double value2 = op2->d;
7109
7110 exp->type = 2;
7111 exp->string = PrintDouble(value2 ? (op1->d /= value2) : 0);
7112 if(!exp->expType)
7113 {
7114 exp->expType = op1->type;
7115 if(op1->type)
7116 op1->type->refCount++;
7117 }
7118 return 0x1;
7119 }
7120
7121 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7122 {
7123 int value2 = op2->i;
7124
7125 exp->type = 2;
7126 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
7127 if(!exp->expType)
7128 {
7129 exp->expType = op1->type;
7130 if(op1->type)
7131 op1->type->refCount++;
7132 }
7133 return 0x1;
7134 }
7135
7136 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7137 {
7138 unsigned int value2 = op2->ui;
7139
7140 exp->type = 2;
7141 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
7142 if(!exp->expType)
7143 {
7144 exp->expType = op1->type;
7145 if(op1->type)
7146 op1->type->refCount++;
7147 }
7148 return 0x1;
7149 }
7150
7151 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7152 {
7153 short value2 = op2->s;
7154
7155 exp->type = 2;
7156 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
7157 if(!exp->expType)
7158 {
7159 exp->expType = op1->type;
7160 if(op1->type)
7161 op1->type->refCount++;
7162 }
7163 return 0x1;
7164 }
7165
7166 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7167 {
7168 unsigned short value2 = op2->us;
7169
7170 exp->type = 2;
7171 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
7172 if(!exp->expType)
7173 {
7174 exp->expType = op1->type;
7175 if(op1->type)
7176 op1->type->refCount++;
7177 }
7178 return 0x1;
7179 }
7180
7181 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7182 {
7183 char value2 = op2->c;
7184
7185 exp->type = 2;
7186 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
7187 if(!exp->expType)
7188 {
7189 exp->expType = op1->type;
7190 if(op1->type)
7191 op1->type->refCount++;
7192 }
7193 return 0x1;
7194 }
7195
7196 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7197 {
7198 unsigned char value2 = op2->uc;
7199
7200 exp->type = 2;
7201 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
7202 if(!exp->expType)
7203 {
7204 exp->expType = op1->type;
7205 if(op1->type)
7206 op1->type->refCount++;
7207 }
7208 return 0x1;
7209 }
7210
7211 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7212 {
7213 int value2 = op2->i;
7214
7215 exp->type = 2;
7216 exp->string = PrintInt(op1->i & value2);
7217 if(!exp->expType)
7218 {
7219 exp->expType = op1->type;
7220 if(op1->type)
7221 op1->type->refCount++;
7222 }
7223 return 0x1;
7224 }
7225
7226 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7227 {
7228 unsigned int value2 = op2->ui;
7229
7230 exp->type = 2;
7231 exp->string = PrintUInt(op1->ui & value2);
7232 if(!exp->expType)
7233 {
7234 exp->expType = op1->type;
7235 if(op1->type)
7236 op1->type->refCount++;
7237 }
7238 return 0x1;
7239 }
7240
7241 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7242 {
7243 short value2 = op2->s;
7244
7245 exp->type = 2;
7246 exp->string = PrintShort(op1->s & value2);
7247 if(!exp->expType)
7248 {
7249 exp->expType = op1->type;
7250 if(op1->type)
7251 op1->type->refCount++;
7252 }
7253 return 0x1;
7254 }
7255
7256 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7257 {
7258 unsigned short value2 = op2->us;
7259
7260 exp->type = 2;
7261 exp->string = PrintUShort(op1->us & value2);
7262 if(!exp->expType)
7263 {
7264 exp->expType = op1->type;
7265 if(op1->type)
7266 op1->type->refCount++;
7267 }
7268 return 0x1;
7269 }
7270
7271 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7272 {
7273 char value2 = op2->c;
7274
7275 exp->type = 2;
7276 exp->string = PrintChar(op1->c & value2);
7277 if(!exp->expType)
7278 {
7279 exp->expType = op1->type;
7280 if(op1->type)
7281 op1->type->refCount++;
7282 }
7283 return 0x1;
7284 }
7285
7286 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7287 {
7288 unsigned char value2 = op2->uc;
7289
7290 exp->type = 2;
7291 exp->string = PrintUChar(op1->uc & value2);
7292 if(!exp->expType)
7293 {
7294 exp->expType = op1->type;
7295 if(op1->type)
7296 op1->type->refCount++;
7297 }
7298 return 0x1;
7299 }
7300
7301 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7302 {
7303 int value2 = op2->i;
7304
7305 exp->type = 2;
7306 exp->string = PrintInt(op1->i | value2);
7307 if(!exp->expType)
7308 {
7309 exp->expType = op1->type;
7310 if(op1->type)
7311 op1->type->refCount++;
7312 }
7313 return 0x1;
7314 }
7315
7316 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7317 {
7318 unsigned int value2 = op2->ui;
7319
7320 exp->type = 2;
7321 exp->string = PrintUInt(op1->ui | value2);
7322 if(!exp->expType)
7323 {
7324 exp->expType = op1->type;
7325 if(op1->type)
7326 op1->type->refCount++;
7327 }
7328 return 0x1;
7329 }
7330
7331 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7332 {
7333 short value2 = op2->s;
7334
7335 exp->type = 2;
7336 exp->string = PrintShort(op1->s | value2);
7337 if(!exp->expType)
7338 {
7339 exp->expType = op1->type;
7340 if(op1->type)
7341 op1->type->refCount++;
7342 }
7343 return 0x1;
7344 }
7345
7346 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7347 {
7348 unsigned short value2 = op2->us;
7349
7350 exp->type = 2;
7351 exp->string = PrintUShort(op1->us | value2);
7352 if(!exp->expType)
7353 {
7354 exp->expType = op1->type;
7355 if(op1->type)
7356 op1->type->refCount++;
7357 }
7358 return 0x1;
7359 }
7360
7361 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7362 {
7363 char value2 = op2->c;
7364
7365 exp->type = 2;
7366 exp->string = PrintChar(op1->c | value2);
7367 if(!exp->expType)
7368 {
7369 exp->expType = op1->type;
7370 if(op1->type)
7371 op1->type->refCount++;
7372 }
7373 return 0x1;
7374 }
7375
7376 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7377 {
7378 unsigned char value2 = op2->uc;
7379
7380 exp->type = 2;
7381 exp->string = PrintUChar(op1->uc | value2);
7382 if(!exp->expType)
7383 {
7384 exp->expType = op1->type;
7385 if(op1->type)
7386 op1->type->refCount++;
7387 }
7388 return 0x1;
7389 }
7390
7391 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7392 {
7393 int value2 = op2->i;
7394
7395 exp->type = 2;
7396 exp->string = PrintInt(op1->i ^ value2);
7397 if(!exp->expType)
7398 {
7399 exp->expType = op1->type;
7400 if(op1->type)
7401 op1->type->refCount++;
7402 }
7403 return 0x1;
7404 }
7405
7406 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7407 {
7408 unsigned int value2 = op2->ui;
7409
7410 exp->type = 2;
7411 exp->string = PrintUInt(op1->ui ^ value2);
7412 if(!exp->expType)
7413 {
7414 exp->expType = op1->type;
7415 if(op1->type)
7416 op1->type->refCount++;
7417 }
7418 return 0x1;
7419 }
7420
7421 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7422 {
7423 short value2 = op2->s;
7424
7425 exp->type = 2;
7426 exp->string = PrintShort(op1->s ^ value2);
7427 if(!exp->expType)
7428 {
7429 exp->expType = op1->type;
7430 if(op1->type)
7431 op1->type->refCount++;
7432 }
7433 return 0x1;
7434 }
7435
7436 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7437 {
7438 unsigned short value2 = op2->us;
7439
7440 exp->type = 2;
7441 exp->string = PrintUShort(op1->us ^ value2);
7442 if(!exp->expType)
7443 {
7444 exp->expType = op1->type;
7445 if(op1->type)
7446 op1->type->refCount++;
7447 }
7448 return 0x1;
7449 }
7450
7451 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7452 {
7453 char value2 = op2->c;
7454
7455 exp->type = 2;
7456 exp->string = PrintChar(op1->c ^ value2);
7457 if(!exp->expType)
7458 {
7459 exp->expType = op1->type;
7460 if(op1->type)
7461 op1->type->refCount++;
7462 }
7463 return 0x1;
7464 }
7465
7466 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7467 {
7468 unsigned char value2 = op2->uc;
7469
7470 exp->type = 2;
7471 exp->string = PrintUChar(op1->uc ^ value2);
7472 if(!exp->expType)
7473 {
7474 exp->expType = op1->type;
7475 if(op1->type)
7476 op1->type->refCount++;
7477 }
7478 return 0x1;
7479 }
7480
7481 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7482 {
7483 int value2 = op2->i;
7484
7485 exp->type = 2;
7486 exp->string = PrintInt(op1->i << value2);
7487 if(!exp->expType)
7488 {
7489 exp->expType = op1->type;
7490 if(op1->type)
7491 op1->type->refCount++;
7492 }
7493 return 0x1;
7494 }
7495
7496 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7497 {
7498 unsigned int value2 = op2->ui;
7499
7500 exp->type = 2;
7501 exp->string = PrintUInt(op1->ui << value2);
7502 if(!exp->expType)
7503 {
7504 exp->expType = op1->type;
7505 if(op1->type)
7506 op1->type->refCount++;
7507 }
7508 return 0x1;
7509 }
7510
7511 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7512 {
7513 short value2 = op2->s;
7514
7515 exp->type = 2;
7516 exp->string = PrintShort(op1->s << value2);
7517 if(!exp->expType)
7518 {
7519 exp->expType = op1->type;
7520 if(op1->type)
7521 op1->type->refCount++;
7522 }
7523 return 0x1;
7524 }
7525
7526 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7527 {
7528 unsigned short value2 = op2->us;
7529
7530 exp->type = 2;
7531 exp->string = PrintUShort(op1->us << value2);
7532 if(!exp->expType)
7533 {
7534 exp->expType = op1->type;
7535 if(op1->type)
7536 op1->type->refCount++;
7537 }
7538 return 0x1;
7539 }
7540
7541 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7542 {
7543 char value2 = op2->c;
7544
7545 exp->type = 2;
7546 exp->string = PrintChar(op1->c << value2);
7547 if(!exp->expType)
7548 {
7549 exp->expType = op1->type;
7550 if(op1->type)
7551 op1->type->refCount++;
7552 }
7553 return 0x1;
7554 }
7555
7556 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7557 {
7558 unsigned char value2 = op2->uc;
7559
7560 exp->type = 2;
7561 exp->string = PrintUChar(op1->uc << value2);
7562 if(!exp->expType)
7563 {
7564 exp->expType = op1->type;
7565 if(op1->type)
7566 op1->type->refCount++;
7567 }
7568 return 0x1;
7569 }
7570
7571 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7572 {
7573 int value2 = op2->i;
7574
7575 exp->type = 2;
7576 exp->string = PrintInt(op1->i >> value2);
7577 if(!exp->expType)
7578 {
7579 exp->expType = op1->type;
7580 if(op1->type)
7581 op1->type->refCount++;
7582 }
7583 return 0x1;
7584 }
7585
7586 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7587 {
7588 unsigned int value2 = op2->ui;
7589
7590 exp->type = 2;
7591 exp->string = PrintUInt(op1->ui >> value2);
7592 if(!exp->expType)
7593 {
7594 exp->expType = op1->type;
7595 if(op1->type)
7596 op1->type->refCount++;
7597 }
7598 return 0x1;
7599 }
7600
7601 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7602 {
7603 short value2 = op2->s;
7604
7605 exp->type = 2;
7606 exp->string = PrintShort(op1->s >> value2);
7607 if(!exp->expType)
7608 {
7609 exp->expType = op1->type;
7610 if(op1->type)
7611 op1->type->refCount++;
7612 }
7613 return 0x1;
7614 }
7615
7616 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7617 {
7618 unsigned short value2 = op2->us;
7619
7620 exp->type = 2;
7621 exp->string = PrintUShort(op1->us >> value2);
7622 if(!exp->expType)
7623 {
7624 exp->expType = op1->type;
7625 if(op1->type)
7626 op1->type->refCount++;
7627 }
7628 return 0x1;
7629 }
7630
7631 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7632 {
7633 char value2 = op2->c;
7634
7635 exp->type = 2;
7636 exp->string = PrintChar(op1->c >> value2);
7637 if(!exp->expType)
7638 {
7639 exp->expType = op1->type;
7640 if(op1->type)
7641 op1->type->refCount++;
7642 }
7643 return 0x1;
7644 }
7645
7646 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7647 {
7648 unsigned char value2 = op2->uc;
7649
7650 exp->type = 2;
7651 exp->string = PrintUChar(op1->uc >> value2);
7652 if(!exp->expType)
7653 {
7654 exp->expType = op1->type;
7655 if(op1->type)
7656 op1->type->refCount++;
7657 }
7658 return 0x1;
7659 }
7660
7661 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
7662 {
7663 exp->type = 2;
7664 exp->string = PrintInt((~op1->i));
7665 if(!exp->expType)
7666 {
7667 exp->expType = op1->type;
7668 if(op1->type)
7669 op1->type->refCount++;
7670 }
7671 return 0x1;
7672 }
7673
7674 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
7675 {
7676 exp->type = 2;
7677 exp->string = PrintUInt((unsigned int)(~op1->ui));
7678 if(!exp->expType)
7679 {
7680 exp->expType = op1->type;
7681 if(op1->type)
7682 op1->type->refCount++;
7683 }
7684 return 0x1;
7685 }
7686
7687 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
7688 {
7689 exp->type = 2;
7690 exp->string = PrintShort((short)(~op1->s));
7691 if(!exp->expType)
7692 {
7693 exp->expType = op1->type;
7694 if(op1->type)
7695 op1->type->refCount++;
7696 }
7697 return 0x1;
7698 }
7699
7700 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
7701 {
7702 exp->type = 2;
7703 exp->string = PrintUShort((unsigned short)(~op1->us));
7704 if(!exp->expType)
7705 {
7706 exp->expType = op1->type;
7707 if(op1->type)
7708 op1->type->refCount++;
7709 }
7710 return 0x1;
7711 }
7712
7713 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
7714 {
7715 exp->type = 2;
7716 exp->string = PrintChar((char)(~op1->c));
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 UCharBitNot(struct Expression * exp, struct Operand * op1)
7727 {
7728 exp->type = 2;
7729 exp->string = PrintUChar((unsigned char)(~op1->uc));
7730 if(!exp->expType)
7731 {
7732 exp->expType = op1->type;
7733 if(op1->type)
7734 op1->type->refCount++;
7735 }
7736 return 0x1;
7737 }
7738
7739 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7740 {
7741 int value2 = op2->i;
7742
7743 exp->type = 2;
7744 exp->string = PrintInt(op1->i &= value2);
7745 if(!exp->expType)
7746 {
7747 exp->expType = op1->type;
7748 if(op1->type)
7749 op1->type->refCount++;
7750 }
7751 return 0x1;
7752 }
7753
7754 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7755 {
7756 unsigned int value2 = op2->ui;
7757
7758 exp->type = 2;
7759 exp->string = PrintUInt(op1->ui &= value2);
7760 if(!exp->expType)
7761 {
7762 exp->expType = op1->type;
7763 if(op1->type)
7764 op1->type->refCount++;
7765 }
7766 return 0x1;
7767 }
7768
7769 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7770 {
7771 short value2 = op2->s;
7772
7773 exp->type = 2;
7774 exp->string = PrintShort(op1->s &= value2);
7775 if(!exp->expType)
7776 {
7777 exp->expType = op1->type;
7778 if(op1->type)
7779 op1->type->refCount++;
7780 }
7781 return 0x1;
7782 }
7783
7784 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7785 {
7786 unsigned short value2 = op2->us;
7787
7788 exp->type = 2;
7789 exp->string = PrintUShort(op1->us &= value2);
7790 if(!exp->expType)
7791 {
7792 exp->expType = op1->type;
7793 if(op1->type)
7794 op1->type->refCount++;
7795 }
7796 return 0x1;
7797 }
7798
7799 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7800 {
7801 char value2 = op2->c;
7802
7803 exp->type = 2;
7804 exp->string = PrintChar(op1->c &= value2);
7805 if(!exp->expType)
7806 {
7807 exp->expType = op1->type;
7808 if(op1->type)
7809 op1->type->refCount++;
7810 }
7811 return 0x1;
7812 }
7813
7814 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7815 {
7816 unsigned char value2 = op2->uc;
7817
7818 exp->type = 2;
7819 exp->string = PrintUChar(op1->uc &= value2);
7820 if(!exp->expType)
7821 {
7822 exp->expType = op1->type;
7823 if(op1->type)
7824 op1->type->refCount++;
7825 }
7826 return 0x1;
7827 }
7828
7829 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7830 {
7831 int value2 = op2->i;
7832
7833 exp->type = 2;
7834 exp->string = PrintInt(op1->i |= value2);
7835 if(!exp->expType)
7836 {
7837 exp->expType = op1->type;
7838 if(op1->type)
7839 op1->type->refCount++;
7840 }
7841 return 0x1;
7842 }
7843
7844 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7845 {
7846 unsigned int value2 = op2->ui;
7847
7848 exp->type = 2;
7849 exp->string = PrintUInt(op1->ui |= value2);
7850 if(!exp->expType)
7851 {
7852 exp->expType = op1->type;
7853 if(op1->type)
7854 op1->type->refCount++;
7855 }
7856 return 0x1;
7857 }
7858
7859 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7860 {
7861 short value2 = op2->s;
7862
7863 exp->type = 2;
7864 exp->string = PrintShort(op1->s |= value2);
7865 if(!exp->expType)
7866 {
7867 exp->expType = op1->type;
7868 if(op1->type)
7869 op1->type->refCount++;
7870 }
7871 return 0x1;
7872 }
7873
7874 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7875 {
7876 unsigned short value2 = op2->us;
7877
7878 exp->type = 2;
7879 exp->string = PrintUShort(op1->us |= value2);
7880 if(!exp->expType)
7881 {
7882 exp->expType = op1->type;
7883 if(op1->type)
7884 op1->type->refCount++;
7885 }
7886 return 0x1;
7887 }
7888
7889 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7890 {
7891 char value2 = op2->c;
7892
7893 exp->type = 2;
7894 exp->string = PrintChar(op1->c |= value2);
7895 if(!exp->expType)
7896 {
7897 exp->expType = op1->type;
7898 if(op1->type)
7899 op1->type->refCount++;
7900 }
7901 return 0x1;
7902 }
7903
7904 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7905 {
7906 unsigned char value2 = op2->uc;
7907
7908 exp->type = 2;
7909 exp->string = PrintUChar(op1->uc |= value2);
7910 if(!exp->expType)
7911 {
7912 exp->expType = op1->type;
7913 if(op1->type)
7914 op1->type->refCount++;
7915 }
7916 return 0x1;
7917 }
7918
7919 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7920 {
7921 int value2 = op2->i;
7922
7923 exp->type = 2;
7924 exp->string = PrintInt(op1->i ^= value2);
7925 if(!exp->expType)
7926 {
7927 exp->expType = op1->type;
7928 if(op1->type)
7929 op1->type->refCount++;
7930 }
7931 return 0x1;
7932 }
7933
7934 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7935 {
7936 unsigned int value2 = op2->ui;
7937
7938 exp->type = 2;
7939 exp->string = PrintUInt(op1->ui ^= value2);
7940 if(!exp->expType)
7941 {
7942 exp->expType = op1->type;
7943 if(op1->type)
7944 op1->type->refCount++;
7945 }
7946 return 0x1;
7947 }
7948
7949 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7950 {
7951 short value2 = op2->s;
7952
7953 exp->type = 2;
7954 exp->string = PrintShort(op1->s ^= value2);
7955 if(!exp->expType)
7956 {
7957 exp->expType = op1->type;
7958 if(op1->type)
7959 op1->type->refCount++;
7960 }
7961 return 0x1;
7962 }
7963
7964 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7965 {
7966 unsigned short value2 = op2->us;
7967
7968 exp->type = 2;
7969 exp->string = PrintUShort(op1->us ^= value2);
7970 if(!exp->expType)
7971 {
7972 exp->expType = op1->type;
7973 if(op1->type)
7974 op1->type->refCount++;
7975 }
7976 return 0x1;
7977 }
7978
7979 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7980 {
7981 char value2 = op2->c;
7982
7983 exp->type = 2;
7984 exp->string = PrintChar(op1->c ^= value2);
7985 if(!exp->expType)
7986 {
7987 exp->expType = op1->type;
7988 if(op1->type)
7989 op1->type->refCount++;
7990 }
7991 return 0x1;
7992 }
7993
7994 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7995 {
7996 unsigned char value2 = op2->uc;
7997
7998 exp->type = 2;
7999 exp->string = PrintUChar(op1->uc ^= value2);
8000 if(!exp->expType)
8001 {
8002 exp->expType = op1->type;
8003 if(op1->type)
8004 op1->type->refCount++;
8005 }
8006 return 0x1;
8007 }
8008
8009 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8010 {
8011 int value2 = op2->i;
8012
8013 exp->type = 2;
8014 exp->string = PrintInt(op1->i <<= value2);
8015 if(!exp->expType)
8016 {
8017 exp->expType = op1->type;
8018 if(op1->type)
8019 op1->type->refCount++;
8020 }
8021 return 0x1;
8022 }
8023
8024 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8025 {
8026 unsigned int value2 = op2->ui;
8027
8028 exp->type = 2;
8029 exp->string = PrintUInt(op1->ui <<= value2);
8030 if(!exp->expType)
8031 {
8032 exp->expType = op1->type;
8033 if(op1->type)
8034 op1->type->refCount++;
8035 }
8036 return 0x1;
8037 }
8038
8039 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8040 {
8041 short value2 = op2->s;
8042
8043 exp->type = 2;
8044 exp->string = PrintShort(op1->s <<= value2);
8045 if(!exp->expType)
8046 {
8047 exp->expType = op1->type;
8048 if(op1->type)
8049 op1->type->refCount++;
8050 }
8051 return 0x1;
8052 }
8053
8054 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8055 {
8056 unsigned short value2 = op2->us;
8057
8058 exp->type = 2;
8059 exp->string = PrintUShort(op1->us <<= value2);
8060 if(!exp->expType)
8061 {
8062 exp->expType = op1->type;
8063 if(op1->type)
8064 op1->type->refCount++;
8065 }
8066 return 0x1;
8067 }
8068
8069 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8070 {
8071 char value2 = op2->c;
8072
8073 exp->type = 2;
8074 exp->string = PrintChar(op1->c <<= value2);
8075 if(!exp->expType)
8076 {
8077 exp->expType = op1->type;
8078 if(op1->type)
8079 op1->type->refCount++;
8080 }
8081 return 0x1;
8082 }
8083
8084 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8085 {
8086 unsigned char value2 = op2->uc;
8087
8088 exp->type = 2;
8089 exp->string = PrintUChar(op1->uc <<= value2);
8090 if(!exp->expType)
8091 {
8092 exp->expType = op1->type;
8093 if(op1->type)
8094 op1->type->refCount++;
8095 }
8096 return 0x1;
8097 }
8098
8099 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8100 {
8101 int value2 = op2->i;
8102
8103 exp->type = 2;
8104 exp->string = PrintInt(op1->i >>= value2);
8105 if(!exp->expType)
8106 {
8107 exp->expType = op1->type;
8108 if(op1->type)
8109 op1->type->refCount++;
8110 }
8111 return 0x1;
8112 }
8113
8114 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8115 {
8116 unsigned int value2 = op2->ui;
8117
8118 exp->type = 2;
8119 exp->string = PrintUInt(op1->ui >>= value2);
8120 if(!exp->expType)
8121 {
8122 exp->expType = op1->type;
8123 if(op1->type)
8124 op1->type->refCount++;
8125 }
8126 return 0x1;
8127 }
8128
8129 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8130 {
8131 short value2 = op2->s;
8132
8133 exp->type = 2;
8134 exp->string = PrintShort(op1->s >>= value2);
8135 if(!exp->expType)
8136 {
8137 exp->expType = op1->type;
8138 if(op1->type)
8139 op1->type->refCount++;
8140 }
8141 return 0x1;
8142 }
8143
8144 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8145 {
8146 unsigned short value2 = op2->us;
8147
8148 exp->type = 2;
8149 exp->string = PrintUShort(op1->us >>= value2);
8150 if(!exp->expType)
8151 {
8152 exp->expType = op1->type;
8153 if(op1->type)
8154 op1->type->refCount++;
8155 }
8156 return 0x1;
8157 }
8158
8159 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8160 {
8161 char value2 = op2->c;
8162
8163 exp->type = 2;
8164 exp->string = PrintChar(op1->c >>= value2);
8165 if(!exp->expType)
8166 {
8167 exp->expType = op1->type;
8168 if(op1->type)
8169 op1->type->refCount++;
8170 }
8171 return 0x1;
8172 }
8173
8174 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8175 {
8176 unsigned char value2 = op2->uc;
8177
8178 exp->type = 2;
8179 exp->string = PrintUChar(op1->uc >>= value2);
8180 if(!exp->expType)
8181 {
8182 exp->expType = op1->type;
8183 if(op1->type)
8184 op1->type->refCount++;
8185 }
8186 return 0x1;
8187 }
8188
8189 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
8190 {
8191 exp->type = 2;
8192 exp->string = PrintInt((int)(!op1->i));
8193 if(!exp->expType)
8194 {
8195 exp->expType = op1->type;
8196 if(op1->type)
8197 op1->type->refCount++;
8198 }
8199 return 0x1;
8200 }
8201
8202 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
8203 {
8204 exp->type = 2;
8205 exp->string = PrintUInt((unsigned int)(!op1->ui));
8206 if(!exp->expType)
8207 {
8208 exp->expType = op1->type;
8209 if(op1->type)
8210 op1->type->refCount++;
8211 }
8212 return 0x1;
8213 }
8214
8215 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
8216 {
8217 exp->type = 2;
8218 exp->string = PrintShort((short)(!op1->s));
8219 if(!exp->expType)
8220 {
8221 exp->expType = op1->type;
8222 if(op1->type)
8223 op1->type->refCount++;
8224 }
8225 return 0x1;
8226 }
8227
8228 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
8229 {
8230 exp->type = 2;
8231 exp->string = PrintUShort((unsigned short)(!op1->us));
8232 if(!exp->expType)
8233 {
8234 exp->expType = op1->type;
8235 if(op1->type)
8236 op1->type->refCount++;
8237 }
8238 return 0x1;
8239 }
8240
8241 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
8242 {
8243 exp->type = 2;
8244 exp->string = PrintChar((char)(!op1->c));
8245 if(!exp->expType)
8246 {
8247 exp->expType = op1->type;
8248 if(op1->type)
8249 op1->type->refCount++;
8250 }
8251 return 0x1;
8252 }
8253
8254 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
8255 {
8256 exp->type = 2;
8257 exp->string = PrintUChar((unsigned char)(!op1->uc));
8258 if(!exp->expType)
8259 {
8260 exp->expType = op1->type;
8261 if(op1->type)
8262 op1->type->refCount++;
8263 }
8264 return 0x1;
8265 }
8266
8267 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8268 {
8269 int value2 = op2->i;
8270
8271 exp->type = 2;
8272 exp->string = PrintInt(op1->i == value2);
8273 if(!exp->expType)
8274 {
8275 exp->expType = op1->type;
8276 if(op1->type)
8277 op1->type->refCount++;
8278 }
8279 return 0x1;
8280 }
8281
8282 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8283 {
8284 unsigned int value2 = op2->ui;
8285
8286 exp->type = 2;
8287 exp->string = PrintUInt(op1->ui == value2);
8288 if(!exp->expType)
8289 {
8290 exp->expType = op1->type;
8291 if(op1->type)
8292 op1->type->refCount++;
8293 }
8294 return 0x1;
8295 }
8296
8297 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8298 {
8299 short value2 = op2->s;
8300
8301 exp->type = 2;
8302 exp->string = PrintShort(op1->s == value2);
8303 if(!exp->expType)
8304 {
8305 exp->expType = op1->type;
8306 if(op1->type)
8307 op1->type->refCount++;
8308 }
8309 return 0x1;
8310 }
8311
8312 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8313 {
8314 unsigned short value2 = op2->us;
8315
8316 exp->type = 2;
8317 exp->string = PrintUShort(op1->us == value2);
8318 if(!exp->expType)
8319 {
8320 exp->expType = op1->type;
8321 if(op1->type)
8322 op1->type->refCount++;
8323 }
8324 return 0x1;
8325 }
8326
8327 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8328 {
8329 char value2 = op2->c;
8330
8331 exp->type = 2;
8332 exp->string = PrintChar(op1->c == value2);
8333 if(!exp->expType)
8334 {
8335 exp->expType = op1->type;
8336 if(op1->type)
8337 op1->type->refCount++;
8338 }
8339 return 0x1;
8340 }
8341
8342 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8343 {
8344 unsigned char value2 = op2->uc;
8345
8346 exp->type = 2;
8347 exp->string = PrintUChar(op1->uc == value2);
8348 if(!exp->expType)
8349 {
8350 exp->expType = op1->type;
8351 if(op1->type)
8352 op1->type->refCount++;
8353 }
8354 return 0x1;
8355 }
8356
8357 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8358 {
8359 float value2 = op2->f;
8360
8361 exp->type = 2;
8362 exp->string = PrintFloat(op1->f == value2);
8363 if(!exp->expType)
8364 {
8365 exp->expType = op1->type;
8366 if(op1->type)
8367 op1->type->refCount++;
8368 }
8369 return 0x1;
8370 }
8371
8372 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8373 {
8374 double value2 = op2->d;
8375
8376 exp->type = 2;
8377 exp->string = PrintDouble(op1->d == value2);
8378 if(!exp->expType)
8379 {
8380 exp->expType = op1->type;
8381 if(op1->type)
8382 op1->type->refCount++;
8383 }
8384 return 0x1;
8385 }
8386
8387 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8388 {
8389 int value2 = op2->i;
8390
8391 exp->type = 2;
8392 exp->string = PrintInt(op1->i != value2);
8393 if(!exp->expType)
8394 {
8395 exp->expType = op1->type;
8396 if(op1->type)
8397 op1->type->refCount++;
8398 }
8399 return 0x1;
8400 }
8401
8402 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8403 {
8404 unsigned int value2 = op2->ui;
8405
8406 exp->type = 2;
8407 exp->string = PrintUInt(op1->ui != value2);
8408 if(!exp->expType)
8409 {
8410 exp->expType = op1->type;
8411 if(op1->type)
8412 op1->type->refCount++;
8413 }
8414 return 0x1;
8415 }
8416
8417 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8418 {
8419 short value2 = op2->s;
8420
8421 exp->type = 2;
8422 exp->string = PrintShort(op1->s != value2);
8423 if(!exp->expType)
8424 {
8425 exp->expType = op1->type;
8426 if(op1->type)
8427 op1->type->refCount++;
8428 }
8429 return 0x1;
8430 }
8431
8432 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8433 {
8434 unsigned short value2 = op2->us;
8435
8436 exp->type = 2;
8437 exp->string = PrintUShort(op1->us != value2);
8438 if(!exp->expType)
8439 {
8440 exp->expType = op1->type;
8441 if(op1->type)
8442 op1->type->refCount++;
8443 }
8444 return 0x1;
8445 }
8446
8447 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8448 {
8449 char value2 = op2->c;
8450
8451 exp->type = 2;
8452 exp->string = PrintChar(op1->c != value2);
8453 if(!exp->expType)
8454 {
8455 exp->expType = op1->type;
8456 if(op1->type)
8457 op1->type->refCount++;
8458 }
8459 return 0x1;
8460 }
8461
8462 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8463 {
8464 unsigned char value2 = op2->uc;
8465
8466 exp->type = 2;
8467 exp->string = PrintUChar(op1->uc != value2);
8468 if(!exp->expType)
8469 {
8470 exp->expType = op1->type;
8471 if(op1->type)
8472 op1->type->refCount++;
8473 }
8474 return 0x1;
8475 }
8476
8477 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8478 {
8479 float value2 = op2->f;
8480
8481 exp->type = 2;
8482 exp->string = PrintFloat(op1->f != value2);
8483 if(!exp->expType)
8484 {
8485 exp->expType = op1->type;
8486 if(op1->type)
8487 op1->type->refCount++;
8488 }
8489 return 0x1;
8490 }
8491
8492 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8493 {
8494 double value2 = op2->d;
8495
8496 exp->type = 2;
8497 exp->string = PrintDouble(op1->d != value2);
8498 if(!exp->expType)
8499 {
8500 exp->expType = op1->type;
8501 if(op1->type)
8502 op1->type->refCount++;
8503 }
8504 return 0x1;
8505 }
8506
8507 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8508 {
8509 int value2 = op2->i;
8510
8511 exp->type = 2;
8512 exp->string = PrintInt(op1->i && value2);
8513 if(!exp->expType)
8514 {
8515 exp->expType = op1->type;
8516 if(op1->type)
8517 op1->type->refCount++;
8518 }
8519 return 0x1;
8520 }
8521
8522 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8523 {
8524 unsigned int value2 = op2->ui;
8525
8526 exp->type = 2;
8527 exp->string = PrintUInt(op1->ui && value2);
8528 if(!exp->expType)
8529 {
8530 exp->expType = op1->type;
8531 if(op1->type)
8532 op1->type->refCount++;
8533 }
8534 return 0x1;
8535 }
8536
8537 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8538 {
8539 short value2 = op2->s;
8540
8541 exp->type = 2;
8542 exp->string = PrintShort(op1->s && value2);
8543 if(!exp->expType)
8544 {
8545 exp->expType = op1->type;
8546 if(op1->type)
8547 op1->type->refCount++;
8548 }
8549 return 0x1;
8550 }
8551
8552 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8553 {
8554 unsigned short value2 = op2->us;
8555
8556 exp->type = 2;
8557 exp->string = PrintUShort(op1->us && value2);
8558 if(!exp->expType)
8559 {
8560 exp->expType = op1->type;
8561 if(op1->type)
8562 op1->type->refCount++;
8563 }
8564 return 0x1;
8565 }
8566
8567 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8568 {
8569 char value2 = op2->c;
8570
8571 exp->type = 2;
8572 exp->string = PrintChar(op1->c && value2);
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 UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8583 {
8584 unsigned char value2 = op2->uc;
8585
8586 exp->type = 2;
8587 exp->string = PrintUChar(op1->uc && value2);
8588 if(!exp->expType)
8589 {
8590 exp->expType = op1->type;
8591 if(op1->type)
8592 op1->type->refCount++;
8593 }
8594 return 0x1;
8595 }
8596
8597 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8598 {
8599 float value2 = op2->f;
8600
8601 exp->type = 2;
8602 exp->string = PrintFloat(op1->f && value2);
8603 if(!exp->expType)
8604 {
8605 exp->expType = op1->type;
8606 if(op1->type)
8607 op1->type->refCount++;
8608 }
8609 return 0x1;
8610 }
8611
8612 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8613 {
8614 double value2 = op2->d;
8615
8616 exp->type = 2;
8617 exp->string = PrintDouble(op1->d && value2);
8618 if(!exp->expType)
8619 {
8620 exp->expType = op1->type;
8621 if(op1->type)
8622 op1->type->refCount++;
8623 }
8624 return 0x1;
8625 }
8626
8627 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8628 {
8629 int value2 = op2->i;
8630
8631 exp->type = 2;
8632 exp->string = PrintInt(op1->i || value2);
8633 if(!exp->expType)
8634 {
8635 exp->expType = op1->type;
8636 if(op1->type)
8637 op1->type->refCount++;
8638 }
8639 return 0x1;
8640 }
8641
8642 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8643 {
8644 unsigned int value2 = op2->ui;
8645
8646 exp->type = 2;
8647 exp->string = PrintUInt(op1->ui || value2);
8648 if(!exp->expType)
8649 {
8650 exp->expType = op1->type;
8651 if(op1->type)
8652 op1->type->refCount++;
8653 }
8654 return 0x1;
8655 }
8656
8657 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8658 {
8659 short value2 = op2->s;
8660
8661 exp->type = 2;
8662 exp->string = PrintShort(op1->s || value2);
8663 if(!exp->expType)
8664 {
8665 exp->expType = op1->type;
8666 if(op1->type)
8667 op1->type->refCount++;
8668 }
8669 return 0x1;
8670 }
8671
8672 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8673 {
8674 unsigned short value2 = op2->us;
8675
8676 exp->type = 2;
8677 exp->string = PrintUShort(op1->us || value2);
8678 if(!exp->expType)
8679 {
8680 exp->expType = op1->type;
8681 if(op1->type)
8682 op1->type->refCount++;
8683 }
8684 return 0x1;
8685 }
8686
8687 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8688 {
8689 char value2 = op2->c;
8690
8691 exp->type = 2;
8692 exp->string = PrintChar(op1->c || value2);
8693 if(!exp->expType)
8694 {
8695 exp->expType = op1->type;
8696 if(op1->type)
8697 op1->type->refCount++;
8698 }
8699 return 0x1;
8700 }
8701
8702 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8703 {
8704 unsigned char value2 = op2->uc;
8705
8706 exp->type = 2;
8707 exp->string = PrintUChar(op1->uc || value2);
8708 if(!exp->expType)
8709 {
8710 exp->expType = op1->type;
8711 if(op1->type)
8712 op1->type->refCount++;
8713 }
8714 return 0x1;
8715 }
8716
8717 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8718 {
8719 float value2 = op2->f;
8720
8721 exp->type = 2;
8722 exp->string = PrintFloat(op1->f || value2);
8723 if(!exp->expType)
8724 {
8725 exp->expType = op1->type;
8726 if(op1->type)
8727 op1->type->refCount++;
8728 }
8729 return 0x1;
8730 }
8731
8732 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8733 {
8734 double value2 = op2->d;
8735
8736 exp->type = 2;
8737 exp->string = PrintDouble(op1->d || value2);
8738 if(!exp->expType)
8739 {
8740 exp->expType = op1->type;
8741 if(op1->type)
8742 op1->type->refCount++;
8743 }
8744 return 0x1;
8745 }
8746
8747 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8748 {
8749 int value2 = op2->i;
8750
8751 exp->type = 2;
8752 exp->string = PrintInt(op1->i > value2);
8753 if(!exp->expType)
8754 {
8755 exp->expType = op1->type;
8756 if(op1->type)
8757 op1->type->refCount++;
8758 }
8759 return 0x1;
8760 }
8761
8762 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8763 {
8764 unsigned int value2 = op2->ui;
8765
8766 exp->type = 2;
8767 exp->string = PrintUInt(op1->ui > value2);
8768 if(!exp->expType)
8769 {
8770 exp->expType = op1->type;
8771 if(op1->type)
8772 op1->type->refCount++;
8773 }
8774 return 0x1;
8775 }
8776
8777 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8778 {
8779 short value2 = op2->s;
8780
8781 exp->type = 2;
8782 exp->string = PrintShort(op1->s > value2);
8783 if(!exp->expType)
8784 {
8785 exp->expType = op1->type;
8786 if(op1->type)
8787 op1->type->refCount++;
8788 }
8789 return 0x1;
8790 }
8791
8792 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8793 {
8794 unsigned short value2 = op2->us;
8795
8796 exp->type = 2;
8797 exp->string = PrintUShort(op1->us > value2);
8798 if(!exp->expType)
8799 {
8800 exp->expType = op1->type;
8801 if(op1->type)
8802 op1->type->refCount++;
8803 }
8804 return 0x1;
8805 }
8806
8807 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8808 {
8809 char value2 = op2->c;
8810
8811 exp->type = 2;
8812 exp->string = PrintChar(op1->c > value2);
8813 if(!exp->expType)
8814 {
8815 exp->expType = op1->type;
8816 if(op1->type)
8817 op1->type->refCount++;
8818 }
8819 return 0x1;
8820 }
8821
8822 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8823 {
8824 unsigned char value2 = op2->uc;
8825
8826 exp->type = 2;
8827 exp->string = PrintUChar(op1->uc > value2);
8828 if(!exp->expType)
8829 {
8830 exp->expType = op1->type;
8831 if(op1->type)
8832 op1->type->refCount++;
8833 }
8834 return 0x1;
8835 }
8836
8837 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8838 {
8839 float value2 = op2->f;
8840
8841 exp->type = 2;
8842 exp->string = PrintFloat(op1->f > value2);
8843 if(!exp->expType)
8844 {
8845 exp->expType = op1->type;
8846 if(op1->type)
8847 op1->type->refCount++;
8848 }
8849 return 0x1;
8850 }
8851
8852 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8853 {
8854 double value2 = op2->d;
8855
8856 exp->type = 2;
8857 exp->string = PrintDouble(op1->d > value2);
8858 if(!exp->expType)
8859 {
8860 exp->expType = op1->type;
8861 if(op1->type)
8862 op1->type->refCount++;
8863 }
8864 return 0x1;
8865 }
8866
8867 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8868 {
8869 int value2 = op2->i;
8870
8871 exp->type = 2;
8872 exp->string = PrintInt(op1->i < value2);
8873 if(!exp->expType)
8874 {
8875 exp->expType = op1->type;
8876 if(op1->type)
8877 op1->type->refCount++;
8878 }
8879 return 0x1;
8880 }
8881
8882 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8883 {
8884 unsigned int value2 = op2->ui;
8885
8886 exp->type = 2;
8887 exp->string = PrintUInt(op1->ui < value2);
8888 if(!exp->expType)
8889 {
8890 exp->expType = op1->type;
8891 if(op1->type)
8892 op1->type->refCount++;
8893 }
8894 return 0x1;
8895 }
8896
8897 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8898 {
8899 short value2 = op2->s;
8900
8901 exp->type = 2;
8902 exp->string = PrintShort(op1->s < value2);
8903 if(!exp->expType)
8904 {
8905 exp->expType = op1->type;
8906 if(op1->type)
8907 op1->type->refCount++;
8908 }
8909 return 0x1;
8910 }
8911
8912 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8913 {
8914 unsigned short value2 = op2->us;
8915
8916 exp->type = 2;
8917 exp->string = PrintUShort(op1->us < value2);
8918 if(!exp->expType)
8919 {
8920 exp->expType = op1->type;
8921 if(op1->type)
8922 op1->type->refCount++;
8923 }
8924 return 0x1;
8925 }
8926
8927 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8928 {
8929 char value2 = op2->c;
8930
8931 exp->type = 2;
8932 exp->string = PrintChar(op1->c < value2);
8933 if(!exp->expType)
8934 {
8935 exp->expType = op1->type;
8936 if(op1->type)
8937 op1->type->refCount++;
8938 }
8939 return 0x1;
8940 }
8941
8942 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8943 {
8944 unsigned char value2 = op2->uc;
8945
8946 exp->type = 2;
8947 exp->string = PrintUChar(op1->uc < value2);
8948 if(!exp->expType)
8949 {
8950 exp->expType = op1->type;
8951 if(op1->type)
8952 op1->type->refCount++;
8953 }
8954 return 0x1;
8955 }
8956
8957 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8958 {
8959 float value2 = op2->f;
8960
8961 exp->type = 2;
8962 exp->string = PrintFloat(op1->f < value2);
8963 if(!exp->expType)
8964 {
8965 exp->expType = op1->type;
8966 if(op1->type)
8967 op1->type->refCount++;
8968 }
8969 return 0x1;
8970 }
8971
8972 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8973 {
8974 double value2 = op2->d;
8975
8976 exp->type = 2;
8977 exp->string = PrintDouble(op1->d < value2);
8978 if(!exp->expType)
8979 {
8980 exp->expType = op1->type;
8981 if(op1->type)
8982 op1->type->refCount++;
8983 }
8984 return 0x1;
8985 }
8986
8987 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8988 {
8989 int value2 = op2->i;
8990
8991 exp->type = 2;
8992 exp->string = PrintInt(op1->i >= value2);
8993 if(!exp->expType)
8994 {
8995 exp->expType = op1->type;
8996 if(op1->type)
8997 op1->type->refCount++;
8998 }
8999 return 0x1;
9000 }
9001
9002 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9003 {
9004 unsigned int value2 = op2->ui;
9005
9006 exp->type = 2;
9007 exp->string = PrintUInt(op1->ui >= value2);
9008 if(!exp->expType)
9009 {
9010 exp->expType = op1->type;
9011 if(op1->type)
9012 op1->type->refCount++;
9013 }
9014 return 0x1;
9015 }
9016
9017 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9018 {
9019 short value2 = op2->s;
9020
9021 exp->type = 2;
9022 exp->string = PrintShort(op1->s >= value2);
9023 if(!exp->expType)
9024 {
9025 exp->expType = op1->type;
9026 if(op1->type)
9027 op1->type->refCount++;
9028 }
9029 return 0x1;
9030 }
9031
9032 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9033 {
9034 unsigned short value2 = op2->us;
9035
9036 exp->type = 2;
9037 exp->string = PrintUShort(op1->us >= value2);
9038 if(!exp->expType)
9039 {
9040 exp->expType = op1->type;
9041 if(op1->type)
9042 op1->type->refCount++;
9043 }
9044 return 0x1;
9045 }
9046
9047 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9048 {
9049 char value2 = op2->c;
9050
9051 exp->type = 2;
9052 exp->string = PrintChar(op1->c >= value2);
9053 if(!exp->expType)
9054 {
9055 exp->expType = op1->type;
9056 if(op1->type)
9057 op1->type->refCount++;
9058 }
9059 return 0x1;
9060 }
9061
9062 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9063 {
9064 unsigned char value2 = op2->uc;
9065
9066 exp->type = 2;
9067 exp->string = PrintUChar(op1->uc >= value2);
9068 if(!exp->expType)
9069 {
9070 exp->expType = op1->type;
9071 if(op1->type)
9072 op1->type->refCount++;
9073 }
9074 return 0x1;
9075 }
9076
9077 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9078 {
9079 float value2 = op2->f;
9080
9081 exp->type = 2;
9082 exp->string = PrintFloat(op1->f >= value2);
9083 if(!exp->expType)
9084 {
9085 exp->expType = op1->type;
9086 if(op1->type)
9087 op1->type->refCount++;
9088 }
9089 return 0x1;
9090 }
9091
9092 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9093 {
9094 double value2 = op2->d;
9095
9096 exp->type = 2;
9097 exp->string = PrintDouble(op1->d >= value2);
9098 if(!exp->expType)
9099 {
9100 exp->expType = op1->type;
9101 if(op1->type)
9102 op1->type->refCount++;
9103 }
9104 return 0x1;
9105 }
9106
9107 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9108 {
9109 int value2 = op2->i;
9110
9111 exp->type = 2;
9112 exp->string = PrintInt(op1->i <= value2);
9113 if(!exp->expType)
9114 {
9115 exp->expType = op1->type;
9116 if(op1->type)
9117 op1->type->refCount++;
9118 }
9119 return 0x1;
9120 }
9121
9122 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9123 {
9124 unsigned int value2 = op2->ui;
9125
9126 exp->type = 2;
9127 exp->string = PrintUInt(op1->ui <= value2);
9128 if(!exp->expType)
9129 {
9130 exp->expType = op1->type;
9131 if(op1->type)
9132 op1->type->refCount++;
9133 }
9134 return 0x1;
9135 }
9136
9137 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9138 {
9139 short value2 = op2->s;
9140
9141 exp->type = 2;
9142 exp->string = PrintShort(op1->s <= value2);
9143 if(!exp->expType)
9144 {
9145 exp->expType = op1->type;
9146 if(op1->type)
9147 op1->type->refCount++;
9148 }
9149 return 0x1;
9150 }
9151
9152 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9153 {
9154 unsigned short value2 = op2->us;
9155
9156 exp->type = 2;
9157 exp->string = PrintUShort(op1->us <= value2);
9158 if(!exp->expType)
9159 {
9160 exp->expType = op1->type;
9161 if(op1->type)
9162 op1->type->refCount++;
9163 }
9164 return 0x1;
9165 }
9166
9167 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9168 {
9169 char value2 = op2->c;
9170
9171 exp->type = 2;
9172 exp->string = PrintChar(op1->c <= value2);
9173 if(!exp->expType)
9174 {
9175 exp->expType = op1->type;
9176 if(op1->type)
9177 op1->type->refCount++;
9178 }
9179 return 0x1;
9180 }
9181
9182 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9183 {
9184 unsigned char value2 = op2->uc;
9185
9186 exp->type = 2;
9187 exp->string = PrintUChar(op1->uc <= value2);
9188 if(!exp->expType)
9189 {
9190 exp->expType = op1->type;
9191 if(op1->type)
9192 op1->type->refCount++;
9193 }
9194 return 0x1;
9195 }
9196
9197 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9198 {
9199 float value2 = op2->f;
9200
9201 exp->type = 2;
9202 exp->string = PrintFloat(op1->f <= value2);
9203 if(!exp->expType)
9204 {
9205 exp->expType = op1->type;
9206 if(op1->type)
9207 op1->type->refCount++;
9208 }
9209 return 0x1;
9210 }
9211
9212 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9213 {
9214 double value2 = op2->d;
9215
9216 exp->type = 2;
9217 exp->string = PrintDouble(op1->d <= value2);
9218 if(!exp->expType)
9219 {
9220 exp->expType = op1->type;
9221 if(op1->type)
9222 op1->type->refCount++;
9223 }
9224 return 0x1;
9225 }
9226
9227 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9228 {
9229 exp->type = 2;
9230 exp->string = PrintInt(op1->i ? op2->i : op3->i);
9231 if(!exp->expType)
9232 {
9233 exp->expType = op1->type;
9234 if(op1->type)
9235 op1->type->refCount++;
9236 }
9237 return 0x1;
9238 }
9239
9240 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9241 {
9242 exp->type = 2;
9243 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
9244 if(!exp->expType)
9245 {
9246 exp->expType = op1->type;
9247 if(op1->type)
9248 op1->type->refCount++;
9249 }
9250 return 0x1;
9251 }
9252
9253 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9254 {
9255 exp->type = 2;
9256 exp->string = PrintShort(op1->s ? op2->s : op3->s);
9257 if(!exp->expType)
9258 {
9259 exp->expType = op1->type;
9260 if(op1->type)
9261 op1->type->refCount++;
9262 }
9263 return 0x1;
9264 }
9265
9266 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9267 {
9268 exp->type = 2;
9269 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
9270 if(!exp->expType)
9271 {
9272 exp->expType = op1->type;
9273 if(op1->type)
9274 op1->type->refCount++;
9275 }
9276 return 0x1;
9277 }
9278
9279 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9280 {
9281 exp->type = 2;
9282 exp->string = PrintChar(op1->c ? op2->c : op3->c);
9283 if(!exp->expType)
9284 {
9285 exp->expType = op1->type;
9286 if(op1->type)
9287 op1->type->refCount++;
9288 }
9289 return 0x1;
9290 }
9291
9292 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9293 {
9294 exp->type = 2;
9295 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
9296 if(!exp->expType)
9297 {
9298 exp->expType = op1->type;
9299 if(op1->type)
9300 op1->type->refCount++;
9301 }
9302 return 0x1;
9303 }
9304
9305 static unsigned int FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9306 {
9307 exp->type = 2;
9308 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
9309 if(!exp->expType)
9310 {
9311 exp->expType = op1->type;
9312 if(op1->type)
9313 op1->type->refCount++;
9314 }
9315 return 0x1;
9316 }
9317
9318 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9319 {
9320 exp->type = 2;
9321 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
9322 if(!exp->expType)
9323 {
9324 exp->expType = op1->type;
9325 if(op1->type)
9326 op1->type->refCount++;
9327 }
9328 return 0x1;
9329 }
9330
9331 struct OpTable intOps = 
9332 {
9333 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
9334 };
9335
9336 struct OpTable uintOps = 
9337 {
9338 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
9339 };
9340
9341 struct OpTable shortOps = 
9342 {
9343 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
9344 };
9345
9346 struct OpTable ushortOps = 
9347 {
9348 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
9349 };
9350
9351 struct OpTable floatOps = 
9352 {
9353 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
9354 };
9355
9356 struct OpTable doubleOps = 
9357 {
9358 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
9359 };
9360
9361 struct OpTable charOps = 
9362 {
9363 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
9364 };
9365
9366 struct OpTable ucharOps = 
9367 {
9368 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
9369 };
9370
9371 void ReadString(char * output, char * string)
9372 {
9373 int len = strlen(string);
9374 int c, d = 0;
9375 unsigned int quoted = 0x0, escaped = 0x0;
9376
9377 for(c = 0; c < len; c++)
9378 {
9379 char ch = string[c];
9380
9381 if(escaped)
9382 {
9383 switch(ch)
9384 {
9385 case 'n':
9386 output[d] = '\n';
9387 break;
9388 case 't':
9389 output[d] = '\t';
9390 break;
9391 case 'a':
9392 output[d] = '\a';
9393 break;
9394 case 'b':
9395 output[d] = '\b';
9396 break;
9397 case 'f':
9398 output[d] = '\f';
9399 break;
9400 case 'r':
9401 output[d] = '\r';
9402 break;
9403 case 'v':
9404 output[d] = '\v';
9405 break;
9406 case '\\':
9407 output[d] = '\\';
9408 break;
9409 case '\"':
9410 output[d] = '\"';
9411 break;
9412 default:
9413 output[d++] = '\\';
9414 output[d] = ch;
9415 }
9416 d++;
9417 escaped = 0x0;
9418 }
9419 else
9420 {
9421 if(ch == '\"')
9422 quoted ^= 0x1;
9423 else if(quoted)
9424 {
9425 if(ch == '\\')
9426 escaped = 0x1;
9427 else
9428 output[d++] = ch;
9429 }
9430 }
9431 }
9432 output[d] = '\0';
9433 }
9434
9435 extern long long __ecereNameSpace__ecere__com___strtoi64(char *  string, char * *  endString, int base);
9436
9437 extern uint64 __ecereNameSpace__ecere__com___strtoui64(char *  string, char * *  endString, int base);
9438
9439 extern double strtod(char * , char * * );
9440
9441 struct Operand GetOperand(struct Expression * exp)
9442 {
9443 struct Operand op = 
9444 {
9445 0, 0, 0, 0, 
9446 {
9447 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
9448 }
9449 };
9450 struct Type * type = exp->expType;
9451
9452 if(type)
9453 {
9454 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9455 {
9456 if(!type->_class->registered->dataType)
9457 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9458 type = type->_class->registered->dataType;
9459 }
9460 op.kind = type->kind;
9461 op.type = exp->expType;
9462 if(exp->isConstant && exp->type == 2)
9463 {
9464 switch(op.kind)
9465 {
9466 case 24:
9467 case 1:
9468 {
9469 if(exp->constant[0] == '\'')
9470 op.c = exp->constant[1];
9471 else if(type->isSigned)
9472 {
9473 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9474 op.ops = charOps;
9475 }
9476 else
9477 {
9478 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9479 op.ops = ucharOps;
9480 }
9481 break;
9482 }
9483 case 2:
9484 if(type->isSigned)
9485 {
9486 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9487 op.ops = shortOps;
9488 }
9489 else
9490 {
9491 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9492 op.ops = ushortOps;
9493 }
9494 break;
9495 case 3:
9496 case 5:
9497 if(type->isSigned)
9498 {
9499 op.i = strtol(exp->constant, (((void *)0)), 0);
9500 op.ops = intOps;
9501 }
9502 else
9503 {
9504 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9505 op.ops = uintOps;
9506 }
9507 op.kind = 3;
9508 break;
9509 case 4:
9510 if(type->isSigned)
9511 {
9512 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9513 op.ops = intOps;
9514 }
9515 else
9516 {
9517 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9518 op.ops = uintOps;
9519 }
9520 op.kind = 3;
9521 break;
9522 case 22:
9523 if(type->isSigned)
9524 {
9525 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9526 op.ops = intOps;
9527 }
9528 else
9529 {
9530 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9531 op.ops = uintOps;
9532 }
9533 op.kind = 3;
9534 break;
9535 case 23:
9536 if(type->isSigned)
9537 {
9538 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9539 op.ops = intOps;
9540 }
9541 else
9542 {
9543 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9544 op.ops = uintOps;
9545 }
9546 op.kind = 3;
9547 break;
9548 case 6:
9549 op.f = (float)strtod(exp->constant, (((void *)0)));
9550 op.ops = floatOps;
9551 break;
9552 case 7:
9553 op.d = (double)strtod(exp->constant, (((void *)0)));
9554 op.ops = doubleOps;
9555 break;
9556 case 12:
9557 case 13:
9558 case 8:
9559 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9560 op.kind = 13;
9561 op.ops = uintOps;
9562 break;
9563 }
9564 }
9565 }
9566 return op;
9567 }
9568
9569 int __ecereVMethodID_class_OnGetString;
9570
9571 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9572
9573 static void UnusedFunction()
9574 {
9575 int a;
9576
9577 ((char *  (*)(struct __ecereNameSpace__ecere__com__Class *, void *, char *  tempString, void *  fieldData, unsigned int *  needClass))__ecereClass_int->_vTbl[__ecereVMethodID_class_OnGetString])(__ecereClass_int, &a, 0, 0, 0);
9578 }
9579
9580 extern int __ecereVMethodID_class_OnGetString;
9581
9582 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9583 {
9584 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9585
9586 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9587 {
9588 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9589 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9590 else
9591 {
9592 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9593 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9594 struct Type * type;
9595 void * ptr = inst->data + dataMember->offset + offset;
9596 char * result = (((void *)0));
9597
9598 exp->loc = member->loc = inst->loc;
9599 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9600 if(!dataMember->dataType)
9601 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9602 type = dataMember->dataType;
9603 if(type->kind == 8)
9604 {
9605 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9606
9607 if(_class->type == 4)
9608 {
9609 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9610
9611 if(enumClass)
9612 {
9613 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9614 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9615
9616 for(item = e->values.first; item; item = item->next)
9617 {
9618 if((int)item->data == *(int *)ptr)
9619 {
9620 result = item->name;
9621 break;
9622 }
9623 }
9624 if(result)
9625 {
9626 exp->identifier = MkIdentifier(result);
9627 exp->type = 0;
9628 exp->destType = MkClassType(_class->fullName);
9629 ProcessExpressionType(exp);
9630 }
9631 }
9632 }
9633 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9634 {
9635 if(!_class->dataType)
9636 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9637 type = _class->dataType;
9638 }
9639 }
9640 if(!result)
9641 {
9642 switch(type->kind)
9643 {
9644 case 6:
9645 {
9646 FreeExpContents(exp);
9647 exp->constant = PrintFloat(*(float *)ptr);
9648 exp->type = 2;
9649 break;
9650 }
9651 case 7:
9652 {
9653 FreeExpContents(exp);
9654 exp->constant = PrintDouble(*(double *)ptr);
9655 exp->type = 2;
9656 break;
9657 }
9658 case 3:
9659 {
9660 FreeExpContents(exp);
9661 exp->constant = PrintInt(*(int *)ptr);
9662 exp->type = 2;
9663 break;
9664 }
9665 case 4:
9666 {
9667 FreeExpContents(exp);
9668 exp->constant = PrintInt64(*(long long *)ptr);
9669 exp->type = 2;
9670 break;
9671 }
9672 case 22:
9673 {
9674 FreeExpContents(exp);
9675 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9676 exp->type = 2;
9677 break;
9678 }
9679 case 23:
9680 {
9681 FreeExpContents(exp);
9682 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9683 exp->type = 2;
9684 break;
9685 }
9686 default:
9687 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9688 }
9689 }
9690 ListAdd(memberList, member);
9691 }
9692 if(parentDataMember->type == 1)
9693 break;
9694 }
9695 }
9696
9697 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9698
9699 void PopulateInstance(struct Instantiation * inst)
9700 {
9701 struct Symbol * classSym = inst->_class->symbol;
9702 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9703 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9704 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9705
9706 if(!inst->members)
9707 inst->members = MkListOne(MkMembersInitList(memberList));
9708 else
9709 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*inst->members), MkMembersInitList(memberList));
9710 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9711 {
9712 if(!dataMember->isProperty)
9713 {
9714 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9715 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9716 else
9717 {
9718 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9719 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9720 struct Type * type;
9721 void * ptr = inst->data + dataMember->offset;
9722 char * result = (((void *)0));
9723
9724 exp->loc = member->loc = inst->loc;
9725 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9726 if(!dataMember->dataType)
9727 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9728 type = dataMember->dataType;
9729 if(type->kind == 8)
9730 {
9731 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9732
9733 if(_class->type == 4)
9734 {
9735 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9736
9737 if(enumClass)
9738 {
9739 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9740 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9741
9742 for(item = e->values.first; item; item = item->next)
9743 {
9744 if((int)item->data == *(int *)ptr)
9745 {
9746 result = item->name;
9747 break;
9748 }
9749 }
9750 }
9751 if(result)
9752 {
9753 exp->identifier = MkIdentifier(result);
9754 exp->type = 0;
9755 exp->destType = MkClassType(_class->fullName);
9756 ProcessExpressionType(exp);
9757 }
9758 }
9759 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9760 {
9761 if(!_class->dataType)
9762 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9763 type = _class->dataType;
9764 }
9765 }
9766 if(!result)
9767 {
9768 switch(type->kind)
9769 {
9770 case 6:
9771 {
9772 exp->constant = PrintFloat(*(float *)ptr);
9773 exp->type = 2;
9774 break;
9775 }
9776 case 7:
9777 {
9778 exp->constant = PrintDouble(*(double *)ptr);
9779 exp->type = 2;
9780 break;
9781 }
9782 case 3:
9783 {
9784 exp->constant = PrintInt(*(int *)ptr);
9785 exp->type = 2;
9786 break;
9787 }
9788 case 4:
9789 {
9790 exp->constant = PrintInt64(*(long long *)ptr);
9791 exp->type = 2;
9792 break;
9793 }
9794 case 22:
9795 {
9796 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9797 exp->type = 2;
9798 break;
9799 }
9800 default:
9801 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9802 }
9803 }
9804 ListAdd(memberList, member);
9805 }
9806 }
9807 }
9808 }
9809
9810 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, unsigned int *  offset, struct __ecereNameSpace__ecere__com__Instance * module, struct __ecereNameSpace__ecere__com__DataMember **  subMemberStack, int *  subMemberStackPos);
9811
9812 extern void FreeInstance(struct Instantiation * inst);
9813
9814 void ComputeInstantiation(struct Expression * exp)
9815 {
9816 struct Instantiation * inst = exp->instance;
9817 struct MembersInit * members;
9818 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9819 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9820 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9821 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9822 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9823 int subMemberStackPos = 0;
9824 uint64 bits = 0;
9825
9826 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9827 {
9828 if(inst->data)
9829 return ;
9830 if(_class->type == 0 || _class->type == 5)
9831 {
9832 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9833 if(_class->type == 0)
9834 ((struct __ecereNameSpace__ecere__com__Instance *)(char *)((struct __ecereNameSpace__ecere__com__Instance *)inst->data))->_refCount++;
9835 }
9836 else
9837 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9838 }
9839 if(inst->members)
9840 {
9841 for(members = (*inst->members).first; members; members = members->next)
9842 {
9843 switch(members->type)
9844 {
9845 case 0:
9846 {
9847 if(members->dataMembers)
9848 {
9849 struct MemberInit * member;
9850
9851 for(member = (*members->dataMembers).first; member; member = member->next)
9852 {
9853 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9854 unsigned int found = 0x0;
9855 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9856 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9857 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9858 unsigned int dataMemberOffset;
9859
9860 if(!ident)
9861 {
9862 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9863 if(curMember)
9864 {
9865 if(curMember->isProperty)
9866 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9867 else
9868 {
9869 dataMember = curMember;
9870 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9871 if(_class->type == 0)
9872 dataMemberOffset += _class->base->structSize;
9873 }
9874 found = 0x1;
9875 }
9876 }
9877 else
9878 {
9879 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9880 if(prop)
9881 {
9882 found = 0x1;
9883 if(prop->memberAccess == 1)
9884 {
9885 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9886 curClass = prop->_class;
9887 }
9888 }
9889 else
9890 {
9891 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9892 int _subMemberStackPos = 0;
9893
9894 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9895 if(dataMember)
9896 {
9897 found = 0x1;
9898 if(dataMember->memberAccess == 1)
9899 {
9900 curMember = dataMember;
9901 curClass = dataMember->_class;
9902 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
9903 subMemberStackPos = _subMemberStackPos;
9904 }
9905 }
9906 }
9907 }
9908 if(found && member->initializer && member->initializer->type == 0)
9909 {
9910 struct Expression * value = member->initializer->exp;
9911 struct Type * type = (((void *)0));
9912 unsigned int deepMember = 0x0;
9913
9914 if(prop)
9915 {
9916 type = prop->dataType;
9917 }
9918 else if(dataMember)
9919 {
9920 if(!dataMember->dataType)
9921 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9922 type = dataMember->dataType;
9923 }
9924 if(ident && ident->next)
9925 {
9926 deepMember = 0x1;
9927 for(ident = ident->next; ident && type; ident = ident->next)
9928 {
9929 if(type->kind == 8)
9930 {
9931 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9932 if(prop)
9933 type = prop->dataType;
9934 else
9935 {
9936 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9937 if(dataMember)
9938 type = dataMember->dataType;
9939 }
9940 }
9941 else if(type->kind == 9 || type->kind == 10)
9942 {
9943 struct Type * memberType;
9944
9945 for(memberType = type->members.first; memberType; memberType = memberType->next)
9946 {
9947 if(!strcmp(memberType->name, ident->string))
9948 {
9949 type = memberType;
9950 break;
9951 }
9952 }
9953 }
9954 }
9955 }
9956 if(value)
9957 {
9958 FreeType(value->destType);
9959 value->destType = type;
9960 if(type)
9961 type->refCount++;
9962 ComputeExpression(value);
9963 }
9964 if(!deepMember && type && value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9965 {
9966 if(type->kind == 8)
9967 {
9968 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9969
9970 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9971 {
9972 if(!_class->dataType)
9973 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9974 type = _class->dataType;
9975 }
9976 }
9977 if(dataMember)
9978 {
9979 void * ptr = inst->data + dataMemberOffset;
9980
9981 if(value->type == 2)
9982 {
9983 switch(type->kind)
9984 {
9985 case 3:
9986 {
9987 GetInt(value, (int *)ptr);
9988 break;
9989 }
9990 case 4:
9991 {
9992 GetInt64(value, (long long *)ptr);
9993 break;
9994 }
9995 case 22:
9996 {
9997 GetIntPtr(value, (intptr_t *)ptr);
9998 break;
9999 }
10000 case 23:
10001 {
10002 GetIntSize(value, (ssize_t *)ptr);
10003 break;
10004 }
10005 case 6:
10006 {
10007 GetFloat(value, (float *)ptr);
10008 break;
10009 }
10010 case 7:
10011 {
10012 GetDouble(value, (double *)ptr);
10013 break;
10014 }
10015 }
10016 }
10017 else if(value->type == 1)
10018 {
10019 if(type->kind == 8)
10020 {
10021 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10022
10023 if(_class->type == 1)
10024 {
10025 ComputeTypeSize(type);
10026 if(value->instance->data)
10027 memcpy(ptr, value->instance->data, type->size);
10028 }
10029 }
10030 }
10031 }
10032 else if(prop)
10033 {
10034 if(value->type == 1 && value->instance->data)
10035 {
10036 if(type->kind == 8)
10037 {
10038 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10039
10040 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)))
10041 {
10042 void (* Set)(void *, void *) = (void *)prop->Set;
10043
10044 Set(inst->data, value->instance->data);
10045 PopulateInstance(inst);
10046 }
10047 }
10048 }
10049 else if(value->type == 2)
10050 {
10051 switch(type->kind)
10052 {
10053 case 7:
10054 {
10055 void (* Set)(void *, double) = (void *)prop->Set;
10056
10057 Set(inst->data, strtod(value->constant, (((void *)0))));
10058 break;
10059 }
10060 case 6:
10061 {
10062 void (* Set)(void *, float) = (void *)prop->Set;
10063
10064 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
10065 break;
10066 }
10067 case 3:
10068 {
10069 void (* Set)(void *, int) = (void *)prop->Set;
10070
10071 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
10072 break;
10073 }
10074 case 4:
10075 {
10076 void (* Set)(void *, long long) = (void *)prop->Set;
10077
10078 Set(inst->data, __ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10079 break;
10080 }
10081 case 22:
10082 {
10083 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10084
10085 Set(inst->data, (intptr_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10086 break;
10087 }
10088 case 23:
10089 {
10090 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10091
10092 Set(inst->data, (ssize_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10093 break;
10094 }
10095 }
10096 }
10097 else if(value->type == 3)
10098 {
10099 char temp[1024];
10100
10101 ReadString(temp, value->string);
10102 ((void (*)(void *, void *))(void *)prop->Set)(inst->data, temp);
10103 }
10104 }
10105 }
10106 else if(!deepMember && type && _class->type == 3)
10107 {
10108 if(prop)
10109 {
10110 if(value->type == 2)
10111 {
10112 if(type->kind == 8)
10113 {
10114 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10115
10116 if(_class->type == 3)
10117 {
10118 if(!_class->dataType)
10119 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10120 type = _class->dataType;
10121 }
10122 }
10123 switch(type->kind)
10124 {
10125 case 6:
10126 {
10127 float fValue;
10128 float (* Set)(float) = (void *)prop->Set;
10129
10130 GetFloat(member->initializer->exp, &fValue);
10131 exp->constant = PrintFloat(Set(fValue));
10132 exp->type = 2;
10133 break;
10134 }
10135 case 7:
10136 {
10137 double dValue;
10138 double (* Set)(double) = (void *)prop->Set;
10139
10140 GetDouble(member->initializer->exp, &dValue);
10141 exp->constant = PrintDouble(Set(dValue));
10142 exp->type = 2;
10143 break;
10144 }
10145 }
10146 }
10147 }
10148 }
10149 else if(!deepMember && type && _class->type == 2)
10150 {
10151 if(prop)
10152 {
10153 if(value->type == 1 && value->instance->data)
10154 {
10155 unsigned int (* Set)(void *) = (void *)prop->Set;
10156
10157 bits = Set(value->instance->data);
10158 }
10159 else if(value->type == 2)
10160 {
10161 }
10162 }
10163 else if(dataMember)
10164 {
10165 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
10166 struct Type * type;
10167 int part = 0;
10168
10169 GetInt(value, &part);
10170 bits = (bits & ~bitMember->mask);
10171 if(!bitMember->dataType)
10172 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
10173 type = bitMember->dataType;
10174 if(type->kind == 8 && type->_class && type->_class->registered)
10175 {
10176 if(!type->_class->registered->dataType)
10177 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
10178 type = type->_class->registered->dataType;
10179 }
10180 switch(type->kind)
10181 {
10182 case 24:
10183 case 1:
10184 if(type->isSigned)
10185 bits |= ((char)part << bitMember->pos);
10186 else
10187 bits |= ((unsigned char)part << bitMember->pos);
10188 break;
10189 case 2:
10190 if(type->isSigned)
10191 bits |= ((short)part << bitMember->pos);
10192 else
10193 bits |= ((unsigned short)part << bitMember->pos);
10194 break;
10195 case 3:
10196 case 5:
10197 if(type->isSigned)
10198 bits |= (part << bitMember->pos);
10199 else
10200 bits |= ((unsigned int)part << bitMember->pos);
10201 break;
10202 case 4:
10203 if(type->isSigned)
10204 bits |= ((long long)part << bitMember->pos);
10205 else
10206 bits |= ((uint64)part << bitMember->pos);
10207 break;
10208 case 22:
10209 if(type->isSigned)
10210 {
10211 bits |= ((intptr_t)part << bitMember->pos);
10212 }
10213 else
10214 {
10215 bits |= ((uintptr_t)part << bitMember->pos);
10216 }
10217 break;
10218 case 23:
10219 if(type->isSigned)
10220 {
10221 bits |= ((ssize_t)part << bitMember->pos);
10222 }
10223 else
10224 {
10225 bits |= ((size_t)part << bitMember->pos);
10226 }
10227 break;
10228 }
10229 }
10230 }
10231 }
10232 else
10233 {
10234 if(_class && _class->type == 3)
10235 {
10236 ComputeExpression(member->initializer->exp);
10237 exp->constant = member->initializer->exp->constant;
10238 exp->type = 2;
10239 member->initializer->exp->constant = (((void *)0));
10240 }
10241 }
10242 }
10243 }
10244 break;
10245 }
10246 }
10247 }
10248 }
10249 if(_class && _class->type == 2)
10250 {
10251 exp->constant = PrintHexUInt(bits);
10252 exp->type = 2;
10253 }
10254 if(exp->type != 1)
10255 {
10256 FreeInstance(inst);
10257 }
10258 }
10259
10260 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
10261 {
10262 if(exp->op.op == SIZEOF)
10263 {
10264 FreeExpContents(exp);
10265 exp->type = 2;
10266 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
10267 }
10268 else
10269 {
10270 if(!exp->op.exp1)
10271 {
10272 switch(exp->op.op)
10273 {
10274 case '+':
10275 {
10276 struct Expression * exp2 = exp->op.exp2;
10277
10278 exp->op.exp2 = (((void *)0));
10279 FreeExpContents(exp);
10280 FreeType(exp->expType);
10281 FreeType(exp->destType);
10282 *exp = *exp2;
10283 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
10284 break;
10285 }
10286 case '-':
10287 if(op1->ops.Neg)
10288 {
10289 FreeExpContents(exp);
10290 op1->ops.Neg(exp, op1);
10291 }
10292 break;
10293 case '~':
10294 if(op1->ops.BitNot)
10295 {
10296 FreeExpContents(exp);
10297 op1->ops.BitNot(exp, op1);
10298 }
10299 break;
10300 case '!':
10301 if(op1->ops.Not)
10302 {
10303 FreeExpContents(exp);
10304 op1->ops.Not(exp, op1);
10305 }
10306 break;
10307 }
10308 }
10309 else
10310 {
10311 switch(exp->op.op)
10312 {
10313 case '+':
10314 if(op1->ops.Add)
10315 {
10316 FreeExpContents(exp);
10317 op1->ops.Add(exp, op1, op2);
10318 }
10319 break;
10320 case '-':
10321 if(op1->ops.Sub)
10322 {
10323 FreeExpContents(exp);
10324 op1->ops.Sub(exp, op1, op2);
10325 }
10326 break;
10327 case '*':
10328 if(op1->ops.Mul)
10329 {
10330 FreeExpContents(exp);
10331 op1->ops.Mul(exp, op1, op2);
10332 }
10333 break;
10334 case '/':
10335 if(op1->ops.Div)
10336 {
10337 FreeExpContents(exp);
10338 op1->ops.Div(exp, op1, op2);
10339 }
10340 break;
10341 case '%':
10342 if(op1->ops.Mod)
10343 {
10344 FreeExpContents(exp);
10345 op1->ops.Mod(exp, op1, op2);
10346 }
10347 break;
10348 case '&':
10349 if(exp->op.exp2)
10350 {
10351 if(op1->ops.BitAnd)
10352 {
10353 FreeExpContents(exp);
10354 op1->ops.BitAnd(exp, op1, op2);
10355 }
10356 }
10357 break;
10358 case '|':
10359 if(op1->ops.BitOr)
10360 {
10361 FreeExpContents(exp);
10362 op1->ops.BitOr(exp, op1, op2);
10363 }
10364 break;
10365 case '^':
10366 if(op1->ops.BitXor)
10367 {
10368 FreeExpContents(exp);
10369 op1->ops.BitXor(exp, op1, op2);
10370 }
10371 break;
10372 case LEFT_OP:
10373 if(op1->ops.LShift)
10374 {
10375 FreeExpContents(exp);
10376 op1->ops.LShift(exp, op1, op2);
10377 }
10378 break;
10379 case RIGHT_OP:
10380 if(op1->ops.RShift)
10381 {
10382 FreeExpContents(exp);
10383 op1->ops.RShift(exp, op1, op2);
10384 }
10385 break;
10386 case EQ_OP:
10387 if(op1->ops.Equ)
10388 {
10389 FreeExpContents(exp);
10390 op1->ops.Equ(exp, op1, op2);
10391 }
10392 break;
10393 case NE_OP:
10394 if(op1->ops.Nqu)
10395 {
10396 FreeExpContents(exp);
10397 op1->ops.Nqu(exp, op1, op2);
10398 }
10399 break;
10400 case AND_OP:
10401 if(op1->ops.And)
10402 {
10403 FreeExpContents(exp);
10404 op1->ops.And(exp, op1, op2);
10405 }
10406 break;
10407 case OR_OP:
10408 if(op1->ops.Or)
10409 {
10410 FreeExpContents(exp);
10411 op1->ops.Or(exp, op1, op2);
10412 }
10413 break;
10414 case '>':
10415 if(op1->ops.Grt)
10416 {
10417 FreeExpContents(exp);
10418 op1->ops.Grt(exp, op1, op2);
10419 }
10420 break;
10421 case '<':
10422 if(op1->ops.Sma)
10423 {
10424 FreeExpContents(exp);
10425 op1->ops.Sma(exp, op1, op2);
10426 }
10427 break;
10428 case GE_OP:
10429 if(op1->ops.GrtEqu)
10430 {
10431 FreeExpContents(exp);
10432 op1->ops.GrtEqu(exp, op1, op2);
10433 }
10434 break;
10435 case LE_OP:
10436 if(op1->ops.SmaEqu)
10437 {
10438 FreeExpContents(exp);
10439 op1->ops.SmaEqu(exp, op1, op2);
10440 }
10441 break;
10442 }
10443 }
10444 }
10445 }
10446
10447 void PrintTypeNoConst(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
10448
10449 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10450
10451 void ComputeExpression(struct Expression * exp)
10452 {
10453 char expString[10240];
10454
10455 expString[0] = '\0';
10456 switch(exp->type)
10457 {
10458 case 1:
10459 {
10460 ComputeInstantiation(exp);
10461 break;
10462 }
10463 case 4:
10464 {
10465 struct Expression * exp1, * exp2 = (((void *)0));
10466 struct Operand op1 = 
10467 {
10468 0, 0, 0, 0, 
10469 {
10470 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10471 }
10472 };
10473 struct Operand op2 = 
10474 {
10475 0, 0, 0, 0, 
10476 {
10477 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10478 }
10479 };
10480
10481 if(exp->op.exp2)
10482 ComputeExpression(exp->op.exp2);
10483 if(exp->op.exp1)
10484 {
10485 ComputeExpression(exp->op.exp1);
10486 exp1 = exp->op.exp1;
10487 exp2 = exp->op.exp2;
10488 op1 = GetOperand(exp1);
10489 if(op1.type)
10490 op1.type->refCount++;
10491 if(exp2)
10492 {
10493 op2 = GetOperand(exp2);
10494 if(op2.type)
10495 op2.type->refCount++;
10496 }
10497 }
10498 else
10499 {
10500 exp1 = exp->op.exp2;
10501 op1 = GetOperand(exp1);
10502 if(op1.type)
10503 op1.type->refCount++;
10504 }
10505 CallOperator(exp, exp1, exp2, &op1, &op2);
10506 if(op1.type)
10507 FreeType(op1.type);
10508 if(op2.type)
10509 FreeType(op2.type);
10510 break;
10511 }
10512 case 5:
10513 case 34:
10514 {
10515 struct Expression * e, * n;
10516
10517 for(e = (*exp->list).first; e; e = n)
10518 {
10519 n = e->next;
10520 if(!n)
10521 {
10522 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10523
10524 ComputeExpression(e);
10525 FreeType(exp->expType);
10526 FreeType(exp->destType);
10527 *exp = *e;
10528 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10529 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10530 }
10531 else
10532 {
10533 FreeExpression(e);
10534 }
10535 }
10536 break;
10537 }
10538 case 8:
10539 {
10540 struct Expression * memberExp = exp->member.exp;
10541 struct Identifier * memberID = exp->member.member;
10542 struct Type * type;
10543
10544 ComputeExpression(exp->member.exp);
10545 type = exp->member.exp->expType;
10546 if(type)
10547 {
10548 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)));
10549 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10550 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10551 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10552
10553 if(type->kind == 19 && exp->member.exp->type == 26)
10554 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10555 if(!_class)
10556 {
10557 char string[256];
10558 struct Symbol * classSym;
10559
10560 string[0] = '\0';
10561 PrintTypeNoConst(type, string, 0x0, 0x1);
10562 classSym = FindClass(string);
10563 _class = classSym ? classSym->registered : (((void *)0));
10564 }
10565 if(exp->member.member)
10566 {
10567 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10568 if(!prop)
10569 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10570 }
10571 if(!prop && !member && _class && exp->member.member)
10572 {
10573 struct Symbol * classSym = FindClass(exp->member.member->string);
10574
10575 convertTo = _class;
10576 _class = classSym ? classSym->registered : (((void *)0));
10577 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10578 }
10579 if(prop)
10580 {
10581 if(prop->compiled)
10582 {
10583 struct Type * type = prop->dataType;
10584
10585 if(_class->type == 3)
10586 {
10587 if(type->kind == 8)
10588 {
10589 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10590
10591 if(_class->type == 3)
10592 {
10593 if(!_class->dataType)
10594 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10595 type = _class->dataType;
10596 }
10597 }
10598 switch(type->kind)
10599 {
10600 case 6:
10601 {
10602 float value;
10603 float (* Get)(float) = (void *)prop->Get;
10604
10605 GetFloat(exp->member.exp, &value);
10606 exp->constant = PrintFloat(Get ? Get(value) : value);
10607 exp->type = 2;
10608 break;
10609 }
10610 case 7:
10611 {
10612 double value;
10613 double (* Get)(double);
10614
10615 GetDouble(exp->member.exp, &value);
10616 if(convertTo)
10617 Get = (void *)prop->Set;
10618 else
10619 Get = (void *)prop->Get;
10620 exp->constant = PrintDouble(Get ? Get(value) : value);
10621 exp->type = 2;
10622 break;
10623 }
10624 }
10625 }
10626 else
10627 {
10628 if(convertTo)
10629 {
10630 struct Expression * value = exp->member.exp;
10631 struct Type * type;
10632
10633 if(!prop->dataType)
10634 ProcessPropertyType(prop);
10635 type = prop->dataType;
10636 if(!type)
10637 {
10638 }
10639 else if(_class->type == 1)
10640 {
10641 switch(type->kind)
10642 {
10643 case 8:
10644 {
10645 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10646
10647 if(propertyClass->type == 1 && value->type == 1)
10648 {
10649 void (* Set)(void *, void *) = (void *)prop->Set;
10650
10651 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10652 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10653 exp->instance->_class = MkSpecifierName(_class->fullName);
10654 exp->instance->loc = exp->loc;
10655 exp->type = 1;
10656 Set(exp->instance->data, value->instance->data);
10657 PopulateInstance(exp->instance);
10658 }
10659 break;
10660 }
10661 case 3:
10662 {
10663 int intValue;
10664 void (* Set)(void *, int) = (void *)prop->Set;
10665
10666 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10667 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10668 exp->instance->_class = MkSpecifierName(_class->fullName);
10669 exp->instance->loc = exp->loc;
10670 exp->type = 1;
10671 GetInt(value, &intValue);
10672 Set(exp->instance->data, intValue);
10673 PopulateInstance(exp->instance);
10674 break;
10675 }
10676 case 4:
10677 {
10678 long long intValue;
10679 void (* Set)(void *, long long) = (void *)prop->Set;
10680
10681 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10682 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10683 exp->instance->_class = MkSpecifierName(_class->fullName);
10684 exp->instance->loc = exp->loc;
10685 exp->type = 1;
10686 GetInt64(value, &intValue);
10687 Set(exp->instance->data, intValue);
10688 PopulateInstance(exp->instance);
10689 break;
10690 }
10691 case 22:
10692 {
10693 intptr_t intValue;
10694 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10695
10696 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10697 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10698 exp->instance->_class = MkSpecifierName(_class->fullName);
10699 exp->instance->loc = exp->loc;
10700 exp->type = 1;
10701 GetIntPtr(value, &intValue);
10702 Set(exp->instance->data, intValue);
10703 PopulateInstance(exp->instance);
10704 break;
10705 }
10706 case 23:
10707 {
10708 ssize_t intValue;
10709 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10710
10711 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10712 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10713 exp->instance->_class = MkSpecifierName(_class->fullName);
10714 exp->instance->loc = exp->loc;
10715 exp->type = 1;
10716 GetIntSize(value, &intValue);
10717 Set(exp->instance->data, intValue);
10718 PopulateInstance(exp->instance);
10719 break;
10720 }
10721 case 7:
10722 {
10723 double doubleValue;
10724 void (* Set)(void *, double) = (void *)prop->Set;
10725
10726 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10727 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10728 exp->instance->_class = MkSpecifierName(_class->fullName);
10729 exp->instance->loc = exp->loc;
10730 exp->type = 1;
10731 GetDouble(value, &doubleValue);
10732 Set(exp->instance->data, doubleValue);
10733 PopulateInstance(exp->instance);
10734 break;
10735 }
10736 }
10737 }
10738 else if(_class->type == 2)
10739 {
10740 switch(type->kind)
10741 {
10742 case 8:
10743 {
10744 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10745
10746 if(propertyClass->type == 1 && value->instance->data)
10747 {
10748 unsigned int (* Set)(void *) = (void *)prop->Set;
10749 unsigned int bits = Set(value->instance->data);
10750
10751 exp->constant = PrintHexUInt(bits);
10752 exp->type = 2;
10753 break;
10754 }
10755 else if(_class->type == 2)
10756 {
10757 unsigned int value;
10758 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10759 unsigned int bits;
10760
10761 GetUInt(exp->member.exp, &value);
10762 bits = Set(value);
10763 exp->constant = PrintHexUInt(bits);
10764 exp->type = 2;
10765 }
10766 }
10767 }
10768 }
10769 }
10770 else
10771 {
10772 if(_class->type == 2)
10773 {
10774 unsigned int value;
10775
10776 GetUInt(exp->member.exp, &value);
10777 switch(type->kind)
10778 {
10779 case 8:
10780 {
10781 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10782
10783 if(_class->type == 1)
10784 {
10785 void (* Get)(unsigned int, void *) = (void *)prop->Get;
10786
10787 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10788 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10789 exp->instance->_class = MkSpecifierName(_class->fullName);
10790 exp->instance->loc = exp->loc;
10791 exp->type = 1;
10792 Get(value, exp->instance->data);
10793 PopulateInstance(exp->instance);
10794 }
10795 else if(_class->type == 2)
10796 {
10797 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10798 uint64 bits = Get(value);
10799
10800 exp->constant = PrintHexUInt64(bits);
10801 exp->type = 2;
10802 }
10803 break;
10804 }
10805 }
10806 }
10807 else if(_class->type == 1)
10808 {
10809 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10810
10811 switch(type->kind)
10812 {
10813 case 8:
10814 {
10815 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10816
10817 if(_class->type == 1 && value)
10818 {
10819 void (* Get)(void *, void *) = (void *)prop->Get;
10820
10821 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10822 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10823 exp->instance->_class = MkSpecifierName(_class->fullName);
10824 exp->instance->loc = exp->loc;
10825 exp->type = 1;
10826 Get(value, exp->instance->data);
10827 PopulateInstance(exp->instance);
10828 }
10829 break;
10830 }
10831 }
10832 }
10833 }
10834 }
10835 }
10836 else
10837 {
10838 exp->isConstant = 0x0;
10839 }
10840 }
10841 else if(member)
10842 {
10843 }
10844 }
10845 if(exp->type != 8)
10846 {
10847 FreeExpression(memberExp);
10848 FreeIdentifier(memberID);
10849 }
10850 break;
10851 }
10852 case 10:
10853 {
10854 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10855
10856 FreeExpContents(exp);
10857 exp->constant = PrintUInt(ComputeTypeSize(type));
10858 exp->type = 2;
10859 FreeType(type);
10860 break;
10861 }
10862 case 15:
10863 {
10864 struct Symbol * classSym = exp->_class->symbol;
10865
10866 if(classSym && classSym->registered)
10867 {
10868 if(classSym->registered->fixed)
10869 {
10870 FreeSpecifier(exp->_class);
10871 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10872 exp->type = 2;
10873 }
10874 else
10875 {
10876 char className[1024];
10877
10878 strcpy(className, "__ecereClass_");
10879 FullClassNameCat(className, classSym->string, 0x1);
10880 MangleClassName(className);
10881 DeclareClass(classSym, className);
10882 FreeExpContents(exp);
10883 exp->type = 9;
10884 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10885 exp->member.member = MkIdentifier("structSize");
10886 }
10887 }
10888 break;
10889 }
10890 case 11:
10891 {
10892 struct Type * type;
10893 struct Expression * e = exp;
10894
10895 if(exp->type == 11)
10896 {
10897 if(exp->cast.exp)
10898 ComputeExpression(exp->cast.exp);
10899 e = exp->cast.exp;
10900 }
10901 if(e && exp->expType)
10902 {
10903 type = exp->expType;
10904 if(type->kind == 8)
10905 {
10906 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10907
10908 if(_class && (_class->type == 3 || _class->type == 2))
10909 {
10910 if(!_class->dataType)
10911 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10912 type = _class->dataType;
10913 }
10914 }
10915 switch(type->kind)
10916 {
10917 case 24:
10918 case 1:
10919 if(type->isSigned)
10920 {
10921 char value;
10922
10923 GetChar(e, &value);
10924 FreeExpContents(exp);
10925 exp->constant = PrintChar(value);
10926 exp->type = 2;
10927 }
10928 else
10929 {
10930 unsigned char value;
10931
10932 GetUChar(e, &value);
10933 FreeExpContents(exp);
10934 exp->constant = PrintUChar(value);
10935 exp->type = 2;
10936 }
10937 break;
10938 case 2:
10939 if(type->isSigned)
10940 {
10941 short value;
10942
10943 GetShort(e, &value);
10944 FreeExpContents(exp);
10945 exp->constant = PrintShort(value);
10946 exp->type = 2;
10947 }
10948 else
10949 {
10950 unsigned short value;
10951
10952 GetUShort(e, &value);
10953 FreeExpContents(exp);
10954 exp->constant = PrintUShort(value);
10955 exp->type = 2;
10956 }
10957 break;
10958 case 3:
10959 if(type->isSigned)
10960 {
10961 int value;
10962
10963 GetInt(e, &value);
10964 FreeExpContents(exp);
10965 exp->constant = PrintInt(value);
10966 exp->type = 2;
10967 }
10968 else
10969 {
10970 unsigned int value;
10971
10972 GetUInt(e, &value);
10973 FreeExpContents(exp);
10974 exp->constant = PrintUInt(value);
10975 exp->type = 2;
10976 }
10977 break;
10978 case 4:
10979 if(type->isSigned)
10980 {
10981 long long value;
10982
10983 GetInt64(e, &value);
10984 FreeExpContents(exp);
10985 exp->constant = PrintInt64(value);
10986 exp->type = 2;
10987 }
10988 else
10989 {
10990 uint64 value;
10991
10992 GetUInt64(e, &value);
10993 FreeExpContents(exp);
10994 exp->constant = PrintUInt64(value);
10995 exp->type = 2;
10996 }
10997 break;
10998 case 22:
10999 if(type->isSigned)
11000 {
11001 intptr_t value;
11002
11003 GetIntPtr(e, &value);
11004 FreeExpContents(exp);
11005 exp->constant = PrintInt64((long long)value);
11006 exp->type = 2;
11007 }
11008 else
11009 {
11010 uintptr_t value;
11011
11012 GetUIntPtr(e, &value);
11013 FreeExpContents(exp);
11014 exp->constant = PrintUInt64((uint64)value);
11015 exp->type = 2;
11016 }
11017 break;
11018 case 23:
11019 if(type->isSigned)
11020 {
11021 ssize_t value;
11022
11023 GetIntSize(e, &value);
11024 FreeExpContents(exp);
11025 exp->constant = PrintInt64((long long)value);
11026 exp->type = 2;
11027 }
11028 else
11029 {
11030 size_t value;
11031
11032 GetUIntSize(e, &value);
11033 FreeExpContents(exp);
11034 exp->constant = PrintUInt64((uint64)value);
11035 exp->type = 2;
11036 }
11037 break;
11038 case 6:
11039 {
11040 float value;
11041
11042 GetFloat(e, &value);
11043 FreeExpContents(exp);
11044 exp->constant = PrintFloat(value);
11045 exp->type = 2;
11046 break;
11047 }
11048 case 7:
11049 {
11050 double value;
11051
11052 GetDouble(e, &value);
11053 FreeExpContents(exp);
11054 exp->constant = PrintDouble(value);
11055 exp->type = 2;
11056 break;
11057 }
11058 }
11059 }
11060 break;
11061 }
11062 case 12:
11063 {
11064 struct Operand op1 = 
11065 {
11066 0, 0, 0, 0, 
11067 {
11068 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11069 }
11070 };
11071 struct Operand op2 = 
11072 {
11073 0, 0, 0, 0, 
11074 {
11075 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11076 }
11077 };
11078 struct Operand op3 = 
11079 {
11080 0, 0, 0, 0, 
11081 {
11082 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11083 }
11084 };
11085
11086 if(exp->cond.exp)
11087 ComputeExpression((*exp->cond.exp).last);
11088 if(exp->cond.elseExp)
11089 ComputeExpression(exp->cond.elseExp);
11090 if(exp->cond.cond)
11091 ComputeExpression(exp->cond.cond);
11092 op1 = GetOperand(exp->cond.cond);
11093 if(op1.type)
11094 op1.type->refCount++;
11095 op2 = GetOperand((*exp->cond.exp).last);
11096 if(op2.type)
11097 op2.type->refCount++;
11098 op3 = GetOperand(exp->cond.elseExp);
11099 if(op3.type)
11100 op3.type->refCount++;
11101 if(op1.ops.Cond)
11102 {
11103 FreeExpContents(exp);
11104 op1.ops.Cond(exp, &op1, &op2, &op3);
11105 }
11106 if(op1.type)
11107 FreeType(op1.type);
11108 if(op2.type)
11109 FreeType(op2.type);
11110 if(op3.type)
11111 FreeType(op3.type);
11112 break;
11113 }
11114 }
11115 }
11116
11117 void ApplyAnyObjectLogic(struct Expression * e);
11118
11119 extern void CopyTypeInto(struct Type * type, struct Type * src);
11120
11121 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
11122 {
11123 unsigned int result = 0x1;
11124
11125 if(destType)
11126 {
11127 struct __ecereNameSpace__ecere__sys__OldList converts = 
11128 {
11129 0, 0, 0, 0, 0
11130 };
11131 struct Conversion * convert;
11132
11133 if(destType->kind == 0)
11134 return 0x0;
11135 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
11136 result = 0x0;
11137 if(converts.count)
11138 {
11139 for(convert = converts.first; convert; convert = convert->next)
11140 {
11141 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
11142
11143 if(!empty)
11144 {
11145 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11146 int objectType = exp->expType ? exp->expType->classObjectType : 0;
11147
11148 *newExp = *exp;
11149 newExp->destType = (((void *)0));
11150 if(convert->isGet)
11151 {
11152 exp->type = 8;
11153 exp->addedThis = 0x1;
11154 exp->member.exp = newExp;
11155 FreeType(exp->member.exp->expType);
11156 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
11157 exp->member.exp->expType->classObjectType = objectType;
11158 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
11159 exp->member.memberType = 1;
11160 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11161 exp->needCast = 0x1;
11162 if(exp->expType)
11163 exp->expType->refCount++;
11164 ApplyAnyObjectLogic(exp->member.exp);
11165 }
11166 else
11167 {
11168 {
11169 exp->type = 8;
11170 exp->addedThis = 0x1;
11171 exp->member.exp = newExp;
11172 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
11173 {
11174 newExp->byReference = 0x1;
11175 }
11176 FreeType(exp->member.exp->expType);
11177 exp->member.exp->expType = (((void *)0));
11178 if(convert->convert->dataType)
11179 {
11180 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11181 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
11182 exp->member.exp->expType->refCount = 1;
11183 exp->member.exp->expType->classObjectType = objectType;
11184 ApplyAnyObjectLogic(exp->member.exp);
11185 }
11186 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
11187 exp->member.memberType = 4;
11188 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11189 exp->needCast = 0x1;
11190 if(convert->resultType)
11191 convert->resultType->refCount++;
11192 }
11193 }
11194 }
11195 else
11196 {
11197 FreeType(exp->expType);
11198 if(convert->isGet)
11199 {
11200 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11201 exp->needCast = 0x1;
11202 if(exp->expType)
11203 exp->expType->refCount++;
11204 }
11205 else
11206 {
11207 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11208 exp->needCast = 0x1;
11209 if(convert->resultType)
11210 convert->resultType->refCount++;
11211 }
11212 }
11213 }
11214 if(exp->isConstant && inCompiler)
11215 ComputeExpression(exp);
11216 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
11217 }
11218 if(!result && exp->expType && converts.count)
11219 {
11220 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
11221 }
11222 if(!result && exp->expType && exp->destType)
11223 {
11224 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))
11225 result = 0x1;
11226 }
11227 }
11228 return result;
11229 }
11230
11231 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
11232
11233 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
11234
11235 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
11236
11237 void CheckTemplateTypes(struct Expression * exp)
11238 {
11239 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
11240 {
11241 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11242 struct Statement * compound;
11243 struct Context * context;
11244
11245 *newExp = *exp;
11246 if(exp->destType)
11247 exp->destType->refCount++;
11248 if(exp->expType)
11249 exp->expType->refCount++;
11250 newExp->prev = (((void *)0));
11251 newExp->next = (((void *)0));
11252 switch(exp->expType->kind)
11253 {
11254 case 7:
11255 if(exp->destType->classObjectType)
11256 {
11257 if(exp->destType)
11258 exp->destType->refCount--;
11259 if(exp->expType)
11260 exp->expType->refCount--;
11261 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11262 }
11263 else
11264 {
11265 struct __ecereNameSpace__ecere__sys__OldList * specs;
11266 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11267 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11268
11269 context = PushContext();
11270 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11271 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11272 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11273 exp->type = 25;
11274 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11275 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
11276 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
11277 exp->compound->compound.context = context;
11278 PopContext(context);
11279 }
11280 break;
11281 default:
11282 exp->type = 11;
11283 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
11284 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11285 break;
11286 }
11287 }
11288 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
11289 {
11290 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11291 struct Statement * compound;
11292 struct Context * context;
11293
11294 *newExp = *exp;
11295 if(exp->destType)
11296 exp->destType->refCount++;
11297 if(exp->expType)
11298 exp->expType->refCount++;
11299 newExp->prev = (((void *)0));
11300 newExp->next = (((void *)0));
11301 switch(exp->expType->kind)
11302 {
11303 case 7:
11304 if(exp->destType->classObjectType)
11305 {
11306 if(exp->destType)
11307 exp->destType->refCount--;
11308 if(exp->expType)
11309 exp->expType->refCount--;
11310 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11311 }
11312 else
11313 {
11314 struct __ecereNameSpace__ecere__sys__OldList * specs;
11315 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11316 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11317
11318 context = PushContext();
11319 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11320 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11321 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11322 exp->type = 25;
11323 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11324 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
11325 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
11326 exp->compound->compound.context = context;
11327 PopContext(context);
11328 }
11329 break;
11330 case 8:
11331 {
11332 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
11333 {
11334 exp->type = 5;
11335 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
11336 ProcessExpressionType((*exp->list).first);
11337 break;
11338 }
11339 else
11340 {
11341 exp->type = 5;
11342 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
11343 newExp->needCast = 0x1;
11344 ProcessExpressionType((*exp->list).first);
11345 break;
11346 }
11347 }
11348 default:
11349 {
11350 if(exp->expType->kind == 20)
11351 {
11352 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
11353
11354 if(type)
11355 {
11356 FreeType(exp->destType);
11357 FreeType(exp->expType);
11358 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11359 break;
11360 }
11361 }
11362 if(newExp->type == 8 && newExp->member.memberType == 3)
11363 {
11364 exp->type = 4;
11365 exp->op.op = '*';
11366 exp->op.exp1 = (((void *)0));
11367 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
11368 }
11369 else
11370 {
11371 char typeString[1024];
11372 struct Declarator * decl;
11373 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11374
11375 typeString[0] = '\0';
11376 PrintType(exp->expType, typeString, 0x0, 0x0);
11377 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11378 exp->type = 11;
11379 exp->cast.typeName = MkTypeName(specs, decl);
11380 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11381 exp->cast.exp->needCast = 0x1;
11382 }
11383 break;
11384 }
11385 }
11386 }
11387 }
11388
11389 extern int strncmp(const char * , const char * , size_t n);
11390
11391 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
11392
11393 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
11394 {
11395 int nsLen = strlen(nameSpace);
11396 struct Symbol * symbol;
11397
11398 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)))
11399 {
11400 char * s = symbol->string;
11401
11402 if(!strncmp(s, nameSpace, nsLen))
11403 {
11404 int c;
11405 char * namePart;
11406
11407 for(c = strlen(s) - 1; c >= 0; c--)
11408 if(s[c] == ':')
11409 break;
11410 namePart = s + c + 1;
11411 if(!strcmp(namePart, name))
11412 {
11413 return symbol;
11414 }
11415 }
11416 else
11417 break;
11418 }
11419 return (((void *)0));
11420 }
11421
11422 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
11423 {
11424 int c;
11425 char nameSpace[1024];
11426 char * namePart;
11427 unsigned int gotColon = 0x0;
11428
11429 nameSpace[0] = '\0';
11430 for(c = strlen(name) - 1; c >= 0; c--)
11431 if(name[c] == ':')
11432 {
11433 gotColon = 0x1;
11434 break;
11435 }
11436 namePart = name + c + 1;
11437 while(c >= 0 && name[c] == ':')
11438 c--;
11439 if(c >= 0)
11440 {
11441 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
11442
11443 if(symbol)
11444 return symbol;
11445 memcpy(nameSpace, name, c + 1);
11446 nameSpace[c + 1] = (char)0;
11447 return ScanWithNameSpace(tree, nameSpace, namePart);
11448 }
11449 else if(gotColon)
11450 {
11451 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11452
11453 return symbol;
11454 }
11455 else
11456 {
11457 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11458
11459 if(symbol)
11460 return symbol;
11461 return ScanWithNameSpace(tree, "", namePart);
11462 }
11463 return (((void *)0));
11464 }
11465
11466 static void ProcessDeclaration(struct Declaration * decl);
11467
11468 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
11469 {
11470 struct Context * ctx;
11471 struct Symbol * symbol = (((void *)0));
11472
11473 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
11474 {
11475 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
11476 {
11477 symbol = (((void *)0));
11478 if(thisNameSpace)
11479 {
11480 char curName[1024];
11481
11482 strcpy(curName, thisNameSpace);
11483 strcat(curName, "::");
11484 strcat(curName, name);
11485 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
11486 }
11487 if(!symbol)
11488 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
11489 }
11490 else
11491 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
11492 if(symbol || ctx == endContext)
11493 break;
11494 }
11495 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
11496 {
11497 if(symbol->pointerExternal->type == 0)
11498 {
11499 struct FunctionDefinition * function = symbol->pointerExternal->function;
11500 struct Context * tmpContext = curContext;
11501
11502 curContext = (((void *)0));
11503 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
11504 curContext = tmpContext;
11505 symbol->pointerExternal->symbol = symbol;
11506 DeclareType(symbol->type, 0x1, 0x1);
11507 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
11508 symbol->id = curExternal->symbol->idCode;
11509 }
11510 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
11511 {
11512 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
11513 symbol->id = curExternal->symbol->idCode;
11514 }
11515 }
11516 return symbol;
11517 }
11518
11519 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
11520 {
11521 if(!type->isSigned && type->kind != 22 && type->kind != 23)
11522 ListAdd(specs, MkSpecifier(UNSIGNED));
11523 switch(type->kind)
11524 {
11525 case 8:
11526 {
11527 if(type->_class->registered)
11528 {
11529 if(!type->_class->registered->dataType)
11530 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11531 GetTypeSpecs(type->_class->registered->dataType, specs);
11532 }
11533 break;
11534 }
11535 case 7:
11536 ListAdd(specs, MkSpecifier(DOUBLE));
11537 break;
11538 case 6:
11539 ListAdd(specs, MkSpecifier(FLOAT));
11540 break;
11541 case 1:
11542 ListAdd(specs, MkSpecifier(CHAR));
11543 break;
11544 case 24:
11545 ListAdd(specs, MkSpecifier(_BOOL));
11546 break;
11547 case 2:
11548 ListAdd(specs, MkSpecifier(SHORT));
11549 break;
11550 case 4:
11551 ListAdd(specs, MkSpecifier(INT64));
11552 break;
11553 case 22:
11554 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
11555 break;
11556 case 23:
11557 ListAdd(specs, MkSpecifierName(type->isSigned ? "intsize" : "uintsize"));
11558 break;
11559 case 3:
11560 default:
11561 ListAdd(specs, MkSpecifier(INT));
11562 break;
11563 }
11564 }
11565
11566 static void PrintArraySize(struct Type * arrayType, char * string)
11567 {
11568 char size[256];
11569
11570 size[0] = '\0';
11571 strcat(size, "[");
11572 if(arrayType->enumClass)
11573 strcat(size, arrayType->enumClass->string);
11574 else if(arrayType->arraySizeExp)
11575 PrintExpression(arrayType->arraySizeExp, size);
11576 strcat(size, "]");
11577 strcat(string, size);
11578 }
11579
11580 static void PrintTypeSpecs(struct Type * type, char * string, unsigned int fullName, unsigned int printConst)
11581 {
11582 if(type)
11583 {
11584 if(printConst && type->constant)
11585 strcat(string, "const ");
11586 switch(type->kind)
11587 {
11588 case 8:
11589 {
11590 struct Symbol * c = type->_class;
11591
11592 if(type->classObjectType == 2)
11593 strcat(string, "typed_object");
11594 else if(type->classObjectType == 3)
11595 strcat(string, "any_object");
11596 else
11597 {
11598 if(c && c->string)
11599 strcat(string, (fullName || !c->registered) ? c->string : c->registered->name);
11600 }
11601 if(type->byReference)
11602 strcat(string, " &");
11603 break;
11604 }
11605 case 0:
11606 strcat(string, "void");
11607 break;
11608 case 3:
11609 strcat(string, type->isSigned ? "int" : "uint");
11610 break;
11611 case 4:
11612 strcat(string, type->isSigned ? "int64" : "uint64");
11613 break;
11614 case 22:
11615 strcat(string, type->isSigned ? "intptr" : "uintptr");
11616 break;
11617 case 23:
11618 strcat(string, type->isSigned ? "intsize" : "uintsize");
11619 break;
11620 case 1:
11621 strcat(string, type->isSigned ? "char" : "byte");
11622 break;
11623 case 24:
11624 strcat(string, "_Bool");
11625 break;
11626 case 2:
11627 strcat(string, type->isSigned ? "short" : "uint16");
11628 break;
11629 case 6:
11630 strcat(string, "float");
11631 break;
11632 case 7:
11633 strcat(string, "double");
11634 break;
11635 case 9:
11636 if(type->enumName)
11637 {
11638 strcat(string, "struct ");
11639 strcat(string, type->enumName);
11640 }
11641 else if(type->typeName)
11642 strcat(string, type->typeName);
11643 else
11644 {
11645 struct Type * member;
11646
11647 strcat(string, "struct { ");
11648 for(member = type->members.first; member; member = member->next)
11649 {
11650 PrintType(member, string, 0x1, fullName);
11651 strcat(string, "; ");
11652 }
11653 strcat(string, "}");
11654 }
11655 break;
11656 case 10:
11657 if(type->enumName)
11658 {
11659 strcat(string, "union ");
11660 strcat(string, type->enumName);
11661 }
11662 else if(type->typeName)
11663 strcat(string, type->typeName);
11664 else
11665 {
11666 strcat(string, "union ");
11667 strcat(string, "(unnamed)");
11668 }
11669 break;
11670 case 15:
11671 if(type->enumName)
11672 {
11673 strcat(string, "enum ");
11674 strcat(string, type->enumName);
11675 }
11676 else if(type->typeName)
11677 strcat(string, type->typeName);
11678 else
11679 strcat(string, "int");
11680 break;
11681 case 14:
11682 strcat(string, "...");
11683 break;
11684 case 19:
11685 strcat(string, "subclass(");
11686 strcat(string, type->_class ? type->_class->string : "int");
11687 strcat(string, ")");
11688 break;
11689 case 20:
11690 strcat(string, type->templateParameter->identifier->string);
11691 break;
11692 case 21:
11693 strcat(string, "thisclass");
11694 break;
11695 case 17:
11696 strcat(string, "__builtin_va_list");
11697 break;
11698 }
11699 }
11700 }
11701
11702 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
11703
11704 static void PrintName(struct Type * type, char * string, unsigned int fullName)
11705 {
11706 if(type->name && type->name[0])
11707 {
11708 if(fullName)
11709 strcat(string, type->name);
11710 else
11711 {
11712 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11713
11714 if(name)
11715 name += 2;
11716 else
11717 name = type->name;
11718 strcat(string, name);
11719 }
11720 }
11721 }
11722
11723 static void PrintAttribs(struct Type * type, char * string)
11724 {
11725 if(type)
11726 {
11727 if(type->dllExport)
11728 strcat(string, "dllexport ");
11729 if(type->attrStdcall)
11730 strcat(string, "stdcall ");
11731 }
11732 }
11733
11734 static void PrePrintType(struct Type * type, char * string, unsigned int fullName, struct Type * parentType, unsigned int printConst)
11735 {
11736 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
11737 {
11738 struct Type * attrType = (((void *)0));
11739
11740 if((type->kind == 11 || type->kind == 16) && (!parentType || parentType->kind != 13))
11741 PrintAttribs(type, string);
11742 if(printConst && type->constant && (type->kind == 11 || type->kind == 16))
11743 strcat(string, " const");
11744 PrePrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName, type, printConst);
11745 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
11746 strcat(string, " (");
11747 if(type->kind == 13)
11748 {
11749 if(type->type->kind == 11 || type->type->kind == 16)
11750 PrintAttribs(type->type, string);
11751 }
11752 if(type->kind == 13)
11753 {
11754 if(type->type->kind == 11 || type->type->kind == 16 || type->type->kind == 12)
11755 strcat(string, "*");
11756 else
11757 strcat(string, " *");
11758 }
11759 if(printConst && type->constant && type->kind == 13)
11760 strcat(string, " const");
11761 }
11762 else
11763 PrintTypeSpecs(type, string, fullName, printConst);
11764 }
11765
11766 static void PostPrintType(struct Type * type, char * string, unsigned int fullName)
11767 {
11768 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
11769 strcat(string, ")");
11770 if(type->kind == 12)
11771 PrintArraySize(type, string);
11772 else if(type->kind == 11)
11773 {
11774 struct Type * param;
11775
11776 strcat(string, "(");
11777 for(param = type->params.first; param; param = param->next)
11778 {
11779 PrintType(param, string, 0x1, fullName);
11780 if(param->next)
11781 strcat(string, ", ");
11782 }
11783 strcat(string, ")");
11784 }
11785 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
11786 PostPrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName);
11787 }
11788
11789 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName, unsigned int printConst)
11790 {
11791 PrePrintType(type, string, fullName, (((void *)0)), printConst);
11792 if(type->thisClass || (printName && type->name && type->name[0]))
11793 strcat(string, " ");
11794 if((type->thisClass || type->staticMethod))
11795 {
11796 struct Symbol * _class = type->thisClass;
11797
11798 if((type->classObjectType == 2 || type->classObjectType == 1) || (_class && !strcmp(_class->string, "class")))
11799 {
11800 if(type->classObjectType == 1)
11801 strcat(string, "class");
11802 else
11803 strcat(string, type->byReference ? "typed_object&" : "typed_object");
11804 }
11805 else if(_class && _class->string)
11806 {
11807 char * s = _class->string;
11808
11809 if(fullName)
11810 strcat(string, s);
11811 else
11812 {
11813 char * name = __ecereNameSpace__ecere__sys__RSearchString(s, "::", strlen(s), 0x1, 0x0);
11814
11815 if(name)
11816 name += 2;
11817 else
11818 name = s;
11819 strcat(string, name);
11820 }
11821 }
11822 strcat(string, "::");
11823 }
11824 if(printName && type->name)
11825 PrintName(type, string, fullName);
11826 PostPrintType(type, string, fullName);
11827 if(type->bitFieldCount)
11828 {
11829 char count[100];
11830
11831 sprintf(count, ":%d", type->bitFieldCount);
11832 strcat(string, count);
11833 }
11834 }
11835
11836 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11837 {
11838 _PrintType(type, string, printName, fullName, 0x1);
11839 }
11840
11841 void PrintTypeNoConst(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11842 {
11843 _PrintType(type, string, printName, fullName, 0x0);
11844 }
11845
11846 static struct Type * FindMember(struct Type * type, char * string)
11847 {
11848 struct Type * memberType;
11849
11850 for(memberType = type->members.first; memberType; memberType = memberType->next)
11851 {
11852 if(!memberType->name)
11853 {
11854 struct Type * subType = FindMember(memberType, string);
11855
11856 if(subType)
11857 return subType;
11858 }
11859 else if(!strcmp(memberType->name, string))
11860 return memberType;
11861 }
11862 return (((void *)0));
11863 }
11864
11865 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11866 {
11867 struct Type * memberType;
11868
11869 for(memberType = type->members.first; memberType; memberType = memberType->next)
11870 {
11871 if(!memberType->name)
11872 {
11873 struct Type * subType = FindMember(memberType, string);
11874
11875 if(subType)
11876 {
11877 *offset += memberType->offset;
11878 return subType;
11879 }
11880 }
11881 else if(!strcmp(memberType->name, string))
11882 {
11883 *offset += memberType->offset;
11884 return memberType;
11885 }
11886 }
11887 return (((void *)0));
11888 }
11889
11890 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11891
11892 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11893
11894 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__File;
11895
11896 struct Expression * ParseExpressionString(char * expression)
11897 {
11898 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11899 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
11900 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
11901
11902 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
11903 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, expression, 1, strlen(expression));
11904 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
11905 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
11906
11907 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
11908 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11909 echoOn = 0x0;
11910 parsedExpression = (((void *)0));
11911 resetScanner();
11912 expression_yyparse();
11913 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11914 return parsedExpression;
11915 }
11916
11917 extern char *  QMkString(char *  source);
11918
11919 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11920 {
11921 struct Identifier * id = exp->identifier;
11922 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11923 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11924 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11925 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11926
11927 if(_class && _class->type == 4)
11928 {
11929 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11930 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11931
11932 if(enumClass)
11933 {
11934 struct __ecereNameSpace__ecere__com__Class * baseClass;
11935
11936 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11937 {
11938 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11939
11940 for(value = e->values.first; value; value = value->next)
11941 {
11942 if(!strcmp(value->name, id->string))
11943 break;
11944 }
11945 if(value)
11946 {
11947 char constant[256];
11948
11949 FreeExpContents(exp);
11950 exp->type = 2;
11951 exp->isConstant = 0x1;
11952 if(!strcmp(baseClass->dataTypeString, "int"))
11953 sprintf(constant, "%d", (int)value->data);
11954 else
11955 sprintf(constant, "0x%X", (int)value->data);
11956 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11957 exp->expType = MkClassType(baseClass->fullName);
11958 break;
11959 }
11960 }
11961 }
11962 if(value)
11963 return 0x1;
11964 }
11965 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11966 {
11967 ProcessMethodType(method);
11968 exp->expType = __extension__ ({
11969 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11970
11971 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), __ecereInstance1;
11972 });
11973 return 0x1;
11974 }
11975 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11976 {
11977 if(!prop->dataType)
11978 ProcessPropertyType(prop);
11979 exp->expType = prop->dataType;
11980 if(prop->dataType)
11981 prop->dataType->refCount++;
11982 return 0x1;
11983 }
11984 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11985 {
11986 if(!member->dataType)
11987 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11988 exp->expType = member->dataType;
11989 if(member->dataType)
11990 member->dataType->refCount++;
11991 return 0x1;
11992 }
11993 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11994 {
11995 if(!classProp->dataType)
11996 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11997 if(classProp->constant)
11998 {
11999 FreeExpContents(exp);
12000 exp->isConstant = 0x1;
12001 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
12002 {
12003 exp->type = 3;
12004 exp->constant = QMkString((char *)classProp->Get(_class));
12005 }
12006 else
12007 {
12008 char constant[256];
12009
12010 exp->type = 2;
12011 sprintf(constant, "%d", (int)classProp->Get(_class));
12012 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
12013 }
12014 }
12015 else
12016 {
12017 }
12018 exp->expType = classProp->dataType;
12019 if(classProp->dataType)
12020 classProp->dataType->refCount++;
12021 return 0x1;
12022 }
12023 return 0x0;
12024 }
12025
12026 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
12027 {
12028 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
12029 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
12030 struct __ecereNameSpace__ecere__com__NameSpace * child;
12031
12032 if(!data)
12033 {
12034 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)))
12035 {
12036 data = ScanGlobalData(child, name);
12037 if(data)
12038 break;
12039 }
12040 }
12041 return data;
12042 }
12043
12044 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
12045
12046 extern char *  strncpy(char * , const char * , size_t n);
12047
12048 static struct GlobalData * FindGlobalData(char * name)
12049 {
12050 int start = 0, c;
12051 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
12052
12053 nameSpace = globalData;
12054 for(c = 0; name[c]; c++)
12055 {
12056 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
12057 {
12058 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
12059 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
12060
12061 strncpy(spaceName, name + start, c - start);
12062 spaceName[c - start] = '\0';
12063 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
12064 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
12065 if(!newSpace)
12066 return (((void *)0));
12067 nameSpace = newSpace;
12068 if(name[c] == ':')
12069 c++;
12070 start = c + 1;
12071 }
12072 }
12073 if(c - start)
12074 {
12075 return ScanGlobalData(nameSpace, name + start);
12076 }
12077 return (((void *)0));
12078 }
12079
12080 static int definedExpStackPos;
12081
12082 static void * definedExpStack[512];
12083
12084 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
12085 {
12086 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
12087
12088 FreeExpContents(checkedExp);
12089 FreeType(checkedExp->expType);
12090 FreeType(checkedExp->destType);
12091 *checkedExp = *newExp;
12092 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12093 checkedExp->prev = prev;
12094 checkedExp->next = next;
12095 }
12096
12097 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
12098
12099 extern int printf(char * , ...);
12100
12101 void __ecereMethod_Expression_Clear();
12102
12103 void ApplyAnyObjectLogic(struct Expression * e)
12104 {
12105 struct Type * destType = e->destType;
12106
12107 if(destType && (destType->classObjectType == 3))
12108 {
12109 if(e && e->expType)
12110 {
12111 struct Type * type = e->expType;
12112 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
12113
12114 if(type->kind == 8 && type->_class && type->_class->registered)
12115 {
12116 _class = type->_class->registered;
12117 }
12118 else if(type->kind == 19)
12119 {
12120 _class = FindClass("ecere::com::Class")->registered;
12121 }
12122 else
12123 {
12124 char string[1024] = "";
12125 struct Symbol * classSym;
12126
12127 PrintTypeNoConst(type, string, 0x0, 0x1);
12128 classSym = FindClass(string);
12129 if(classSym)
12130 _class = classSym->registered;
12131 }
12132 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)))
12133 {
12134 if(!_class || strcmp(_class->fullName, "char *"))
12135 {
12136 struct Expression * checkedExp = e, * newExp;
12137
12138 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12139 {
12140 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12141 {
12142 if(checkedExp->type == 25)
12143 {
12144 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12145 }
12146 else
12147 checkedExp = (*checkedExp->list).last;
12148 }
12149 else if(checkedExp->type == 11)
12150 checkedExp = checkedExp->cast.exp;
12151 }
12152 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
12153 {
12154 newExp = checkedExp->op.exp2;
12155 checkedExp->op.exp2 = (((void *)0));
12156 FreeExpContents(checkedExp);
12157 if(e->expType && e->expType->passAsTemplate)
12158 {
12159 char size[100];
12160
12161 ComputeTypeSize(e->expType);
12162 sprintf(size, "%d", e->expType->size);
12163 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))))));
12164 }
12165 ReplaceExpContents(checkedExp, newExp);
12166 e->byReference = 0x1;
12167 }
12168 else if(!e->byReference || (_class && _class->type == 5))
12169 {
12170 struct Expression * checkedExp, * newExp;
12171
12172 {
12173 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;
12174
12175 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
12176 {
12177 struct Context * context = PushContext();
12178 struct Declarator * decl;
12179 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12180 char typeString[1024];
12181 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12182
12183 typeString[0] = '\0';
12184 *newExp = *e;
12185 newExp->prev = (((void *)0));
12186 newExp->next = (((void *)0));
12187 newExp->expType = (((void *)0));
12188 PrintTypeNoConst(e->expType, typeString, 0x0, 0x1);
12189 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12190 newExp->destType = ProcessType(specs, decl);
12191 curContext = context;
12192 if(curCompound)
12193 {
12194 char name[100];
12195 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
12196
12197 e->type = 25;
12198 sprintf(name, "__internalValue%03X", internalValueCounter++);
12199 if(!curCompound->compound.declarations)
12200 curCompound->compound.declarations = MkList();
12201 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
12202 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
12203 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
12204 e->compound = MkCompoundStmt((((void *)0)), stmts);
12205 }
12206 else
12207 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
12208 {
12209 struct Type * type = e->destType;
12210
12211 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12212 CopyTypeInto(e->destType, type);
12213 e->destType->refCount = 1;
12214 e->destType->classObjectType = 0;
12215 FreeType(type);
12216 }
12217 e->compound->compound.context = context;
12218 PopContext(context);
12219 curContext = context->parent;
12220 }
12221 }
12222 checkedExp = e;
12223 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12224 {
12225 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12226 {
12227 if(checkedExp->type == 25)
12228 {
12229 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12230 }
12231 else
12232 checkedExp = (*checkedExp->list).last;
12233 }
12234 else if(checkedExp->type == 11)
12235 checkedExp = checkedExp->cast.exp;
12236 }
12237 {
12238 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12239
12240 *operand = *checkedExp;
12241 checkedExp->destType = (((void *)0));
12242 checkedExp->expType = (((void *)0));
12243 __ecereMethod_Expression_Clear(checkedExp);
12244 checkedExp->type = 4;
12245 checkedExp->op.op = '&';
12246 checkedExp->op.exp1 = (((void *)0));
12247 checkedExp->op.exp2 = operand;
12248 }
12249 }
12250 }
12251 }
12252 }
12253 }
12254 {
12255 }
12256 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))))
12257 {
12258 if(e->expType->classObjectType && destType && destType->classObjectType)
12259 {
12260 return ;
12261 }
12262 else
12263 {
12264 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12265
12266 *thisExp = *e;
12267 thisExp->prev = (((void *)0));
12268 thisExp->next = (((void *)0));
12269 __ecereMethod_Expression_Clear(e);
12270 e->type = 5;
12271 e->list = MkListOne(MkExpOp((((void *)0)), '*', thisExp->type == 0 ? thisExp : MkExpBrackets(MkListOne(thisExp))));
12272 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
12273 ((struct Expression *)(*e->list).first)->byReference = 0x1;
12274 {
12275 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12276 CopyTypeInto(e->expType, thisExp->expType);
12277 e->expType->byReference = 0x0;
12278 e->expType->refCount = 1;
12279 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))
12280 {
12281 e->expType->classObjectType = 0;
12282 }
12283 }
12284 }
12285 }
12286 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
12287 {
12288 if(destType->kind == 14)
12289 {
12290 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unspecified type\n", (((void *)0))));
12291 }
12292 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
12293 {
12294 unsigned int byReference = e->expType->byReference;
12295 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12296 struct Declarator * decl;
12297 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12298 char typeString[1024];
12299 struct Type * type;
12300 int backupClassObjectType;
12301 unsigned int backupByReference;
12302
12303 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
12304 type = e->expType;
12305 else
12306 type = destType;
12307 backupClassObjectType = type->classObjectType;
12308 backupByReference = type->byReference;
12309 type->classObjectType = 0;
12310 type->byReference = 0x0;
12311 typeString[0] = '\0';
12312 PrintType(type, typeString, 0x0, 0x1);
12313 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12314 type->classObjectType = backupClassObjectType;
12315 type->byReference = backupByReference;
12316 *thisExp = *e;
12317 thisExp->prev = (((void *)0));
12318 thisExp->next = (((void *)0));
12319 __ecereMethod_Expression_Clear(e);
12320 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)))
12321 {
12322 e->type = 4;
12323 e->op.op = '*';
12324 e->op.exp1 = (((void *)0));
12325 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
12326 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12327 CopyTypeInto(e->expType, type);
12328 e->expType->byReference = 0x0;
12329 e->expType->refCount = 1;
12330 }
12331 else
12332 {
12333 e->type = 11;
12334 e->cast.typeName = MkTypeName(specs, decl);
12335 e->cast.exp = thisExp;
12336 e->byReference = 0x1;
12337 e->expType = type;
12338 type->refCount++;
12339 }
12340 e->destType = destType;
12341 destType->refCount++;
12342 }
12343 }
12344 }
12345
12346 extern char *  strstr(const char * , const char * );
12347
12348 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
12349
12350 struct __ecereNameSpace__ecere__com__DefinedExpression
12351 {
12352 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
12353 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
12354 char *  name;
12355 char *  value;
12356 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
12357 } __attribute__ ((gcc_struct));
12358
12359 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12360
12361 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12362
12363 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
12364
12365 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
12366
12367 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
12368
12369 extern struct Expression * CopyExpression(struct Expression * exp);
12370
12371 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
12372
12373 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
12374
12375 static void ProcessStatement(struct Statement * stmt);
12376
12377 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
12378
12379 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
12380
12381 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
12382
12383 extern char *  sourceFile;
12384
12385 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
12386
12387 void ProcessExpressionType(struct Expression * exp)
12388 {
12389 unsigned int unresolved = 0x0;
12390 struct Location oldyylloc = yylloc;
12391 unsigned int notByReference = 0x0;
12392
12393 if(!exp || exp->expType)
12394 return ;
12395 yylloc = exp->loc;
12396 switch(exp->type)
12397 {
12398 case 0:
12399 {
12400 struct Identifier * id = exp->identifier;
12401
12402 if(!id)
12403 return ;
12404 if(id->_class && id->_class->name)
12405 {
12406 id->classSym = id->_class->symbol;
12407 }
12408 if(strstr(id->string, "__ecereClass") == id->string)
12409 {
12410 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
12411 break;
12412 }
12413 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
12414 {
12415 ReplaceClassMembers(exp, thisClass);
12416 if(exp->type != 0)
12417 {
12418 ProcessExpressionType(exp);
12419 break;
12420 }
12421 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
12422 break;
12423 }
12424 else
12425 {
12426 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12427
12428 if(!symbol)
12429 {
12430 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
12431 break;
12432 else
12433 {
12434 if(thisClass)
12435 {
12436 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
12437 if(exp->type != 0)
12438 {
12439 ProcessExpressionType(exp);
12440 break;
12441 }
12442 }
12443 else if(currentClass && !id->_class)
12444 {
12445 if(ResolveIdWithClass(exp, currentClass, 0x1))
12446 break;
12447 }
12448 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12449 }
12450 }
12451 if(symbol)
12452 {
12453 struct Type * type = symbol->type;
12454 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
12455
12456 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
12457 {
12458 struct Context * context = SetupTemplatesContext(_class);
12459
12460 type = ReplaceThisClassType(_class);
12461 FinishTemplatesContext(context);
12462 if(type)
12463 type->refCount = 0;
12464 }
12465 FreeSpecifier(id->_class);
12466 id->_class = (((void *)0));
12467 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12468 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
12469 id->classSym = (((void *)0));
12470 exp->expType = type;
12471 if(type)
12472 type->refCount++;
12473 if(type && (type->kind == 15 || (_class && _class->type == 4)))
12474 exp->isConstant = 0x1;
12475 if(symbol->isParam || !strcmp(id->string, "this"))
12476 {
12477 if(_class && _class->type == 1 && !type->declaredWithStruct)
12478 exp->byReference = 0x1;
12479 }
12480 if(symbol->isIterator)
12481 {
12482 if(symbol->isIterator == 3)
12483 {
12484 exp->type = 5;
12485 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
12486 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
12487 exp->expType = (((void *)0));
12488 ProcessExpressionType(exp);
12489 }
12490 else if(symbol->isIterator != 4)
12491 {
12492 exp->type = 8;
12493 exp->member.exp = MkExpIdentifier(exp->identifier);
12494 exp->member.exp->expType = exp->expType;
12495 exp->member.member = MkIdentifier("data");
12496 exp->expType = (((void *)0));
12497 ProcessExpressionType(exp);
12498 }
12499 }
12500 break;
12501 }
12502 else
12503 {
12504 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
12505
12506 if(thisNameSpace && !(id->_class && !id->_class->name))
12507 {
12508 char name[1024];
12509
12510 strcpy(name, thisNameSpace);
12511 strcat(name, "::");
12512 strcat(name, id->string);
12513 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
12514 }
12515 if(!definedExp)
12516 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
12517 if(definedExp)
12518 {
12519 int c;
12520
12521 for(c = 0; c < definedExpStackPos; c++)
12522 if(definedExpStack[c] == definedExp)
12523 break;
12524 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
12525 {
12526 struct Location backupYylloc = yylloc;
12527
12528 definedExpStack[definedExpStackPos++] = definedExp;
12529 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
12530 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
12531 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
12532
12533 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
12534 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, definedExp->value, 1, strlen(definedExp->value));
12535 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
12536 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
12537
12538 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
12539 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
12540 echoOn = 0x0;
12541 parsedExpression = (((void *)0));
12542 resetScanner();
12543 expression_yyparse();
12544 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
12545 yylloc = backupYylloc;
12546 if(parsedExpression)
12547 {
12548 FreeIdentifier(id);
12549 exp->type = 5;
12550 exp->list = MkListOne(parsedExpression);
12551 parsedExpression->loc = yylloc;
12552 ProcessExpressionType(exp);
12553 definedExpStackPos--;
12554 return ;
12555 }
12556 definedExpStackPos--;
12557 }
12558 else
12559 {
12560 if(inCompiler)
12561 {
12562 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
12563 }
12564 }
12565 }
12566 else
12567 {
12568 struct GlobalData * data = (((void *)0));
12569
12570 if(thisNameSpace && !(id->_class && !id->_class->name))
12571 {
12572 char name[1024];
12573
12574 strcpy(name, thisNameSpace);
12575 strcat(name, "::");
12576 strcat(name, id->string);
12577 data = FindGlobalData(name);
12578 }
12579 if(!data)
12580 data = FindGlobalData(id->string);
12581 if(data)
12582 {
12583 DeclareGlobalData(data);
12584 exp->expType = data->dataType;
12585 if(data->dataType)
12586 data->dataType->refCount++;
12587 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12588 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12589 FreeSpecifier(id->_class);
12590 id->_class = (((void *)0));
12591 break;
12592 }
12593 else
12594 {
12595 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
12596
12597 if(thisNameSpace && !(id->_class && !id->_class->name))
12598 {
12599 char name[1024];
12600
12601 strcpy(name, thisNameSpace);
12602 strcat(name, "::");
12603 strcat(name, id->string);
12604 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12605 }
12606 if(!function)
12607 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12608 if(function)
12609 {
12610 char name[1024];
12611
12612 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12613 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12614 name[0] = (char)0;
12615 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12616 strcpy(name, "__ecereFunction_");
12617 FullClassNameCat(name, id->string, 0x0);
12618 if(DeclareFunction(function, name))
12619 {
12620 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12621 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12622 }
12623 exp->expType = function->dataType;
12624 if(function->dataType)
12625 function->dataType->refCount++;
12626 FreeSpecifier(id->_class);
12627 id->_class = (((void *)0));
12628 break;
12629 }
12630 }
12631 }
12632 }
12633 }
12634 unresolved = 0x1;
12635 break;
12636 }
12637 case 1:
12638 {
12639 struct __ecereNameSpace__ecere__com__Class * _class;
12640
12641 if(!exp->instance->_class)
12642 {
12643 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12644 {
12645 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12646 }
12647 }
12648 ProcessInstantiationType(exp->instance);
12649 exp->isConstant = exp->instance->isConstant;
12650 if(exp->instance->_class)
12651 {
12652 exp->expType = MkClassType(exp->instance->_class->name);
12653 }
12654 break;
12655 }
12656 case 2:
12657 {
12658 if(!exp->expType)
12659 {
12660 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12661
12662 exp->expType = type;
12663 if(exp->constant[0] == '\'')
12664 {
12665 if((int)((unsigned char *)exp->constant)[1] > 127)
12666 {
12667 int nb;
12668 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12669
12670 if(nb < 2)
12671 ch = exp->constant[1];
12672 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12673 exp->constant = PrintUInt(ch);
12674 type->kind = 8;
12675 type->_class = FindClass("unichar");
12676 type->isSigned = 0x0;
12677 }
12678 else
12679 {
12680 type->kind = 1;
12681 type->isSigned = 0x1;
12682 }
12683 }
12684 else if(strchr(exp->constant, '.'))
12685 {
12686 char ch = exp->constant[strlen(exp->constant) - 1];
12687
12688 if(ch == 'f')
12689 type->kind = 6;
12690 else
12691 type->kind = 7;
12692 type->isSigned = 0x1;
12693 }
12694 else
12695 {
12696 if(exp->constant[0] == '0' && exp->constant[1])
12697 type->isSigned = 0x0;
12698 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12699 type->isSigned = 0x0;
12700 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12701 type->isSigned = 0x0;
12702 else
12703 type->isSigned = 0x1;
12704 type->kind = 3;
12705 }
12706 exp->isConstant = 0x1;
12707 if(exp->destType && exp->destType->kind == 7)
12708 type->kind = 7;
12709 else if(exp->destType && exp->destType->kind == 6)
12710 type->kind = 6;
12711 else if(exp->destType && exp->destType->kind == 4)
12712 type->kind = 4;
12713 }
12714 break;
12715 }
12716 case 3:
12717 {
12718 exp->isConstant = 0x1;
12719 exp->expType = __extension__ ({
12720 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12721
12722 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
12723 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12724
12725 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 1, __ecereInstance1->constant = 0x1, __ecereInstance1->isSigned = 0x1, __ecereInstance1;
12726 }), __ecereInstance2;
12727 });
12728 break;
12729 }
12730 case 13:
12731 case 28:
12732 ProcessExpressionType(exp->_new.size);
12733 exp->expType = __extension__ ({
12734 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12735
12736 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_new.typeName->qualifiers, exp->_new.typeName->declarator), __ecereInstance1;
12737 });
12738 DeclareType(exp->expType->type, 0x0, 0x0);
12739 break;
12740 case 14:
12741 case 29:
12742 ProcessExpressionType(exp->_renew.size);
12743 ProcessExpressionType(exp->_renew.exp);
12744 exp->expType = __extension__ ({
12745 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12746
12747 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), __ecereInstance1;
12748 });
12749 DeclareType(exp->expType->type, 0x0, 0x0);
12750 break;
12751 case 4:
12752 {
12753 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12754 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12755 unsigned int useDestType = 0x0, useSideType = 0x0;
12756 struct Location oldyylloc = yylloc;
12757 unsigned int useSideUnit = 0x0;
12758 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
12759
12760 switch(exp->op.op)
12761 {
12762 case '=':
12763 case MUL_ASSIGN:
12764 case DIV_ASSIGN:
12765 case MOD_ASSIGN:
12766 case ADD_ASSIGN:
12767 case SUB_ASSIGN:
12768 case LEFT_ASSIGN:
12769 case RIGHT_ASSIGN:
12770 case AND_ASSIGN:
12771 case XOR_ASSIGN:
12772 case OR_ASSIGN:
12773 assign = 0x1;
12774 break;
12775 case '!':
12776 break;
12777 case AND_OP:
12778 case OR_OP:
12779 boolOps = 0x1;
12780 boolResult = 0x1;
12781 break;
12782 case EQ_OP:
12783 case '<':
12784 case '>':
12785 case LE_OP:
12786 case GE_OP:
12787 case NE_OP:
12788 boolResult = 0x1;
12789 useSideType = 0x1;
12790 break;
12791 case '+':
12792 case '-':
12793 useSideUnit = 0x1;
12794 case '|':
12795 case '&':
12796 case '^':
12797 case '/':
12798 case '%':
12799 case '*':
12800 if(exp->op.op != '*' || exp->op.exp1)
12801 {
12802 useSideType = 0x1;
12803 useDestType = 0x1;
12804 }
12805 break;
12806 }
12807 if(exp->op.op == '&')
12808 {
12809 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12810 {
12811 struct Identifier * id = exp->op.exp2->identifier;
12812 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12813
12814 if(symbol && symbol->isIterator == 2)
12815 {
12816 exp->type = 8;
12817 exp->member.exp = exp->op.exp2;
12818 exp->member.member = MkIdentifier("key");
12819 exp->expType = (((void *)0));
12820 exp->op.exp2->expType = symbol->type;
12821 symbol->type->refCount++;
12822 ProcessExpressionType(exp);
12823 FreeType(dummy);
12824 break;
12825 }
12826 }
12827 }
12828 if(exp->op.exp1)
12829 {
12830 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class && exp->destType->_class->registered && useDestType && ((exp->destType->_class->registered->type == 3 && useSideUnit) || exp->destType->_class->registered->type == 4 || exp->destType->_class->registered->type == 2))
12831 {
12832 if(exp->op.exp1->destType)
12833 FreeType(exp->op.exp1->destType);
12834 exp->op.exp1->destType = exp->destType;
12835 if(exp->destType)
12836 exp->destType->refCount++;
12837 }
12838 else if(!assign)
12839 {
12840 if(exp->op.exp1->destType)
12841 FreeType(exp->op.exp1->destType);
12842 exp->op.exp1->destType = dummy;
12843 dummy->refCount++;
12844 }
12845 if(exp->op.exp1->destType && exp->op.op != '=')
12846 exp->op.exp1->destType->count++;
12847 ProcessExpressionType(exp->op.exp1);
12848 if(exp->op.exp1->destType && exp->op.op != '=')
12849 exp->op.exp1->destType->count--;
12850 if(exp->op.exp1->destType == dummy)
12851 {
12852 FreeType(dummy);
12853 exp->op.exp1->destType = (((void *)0));
12854 }
12855 type1 = exp->op.exp1->expType;
12856 }
12857 if(exp->op.exp2)
12858 {
12859 char expString[10240];
12860
12861 expString[0] = '\0';
12862 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12863 {
12864 if(exp->op.exp1)
12865 {
12866 exp->op.exp2->destType = exp->op.exp1->expType;
12867 if(exp->op.exp1->expType)
12868 exp->op.exp1->expType->refCount++;
12869 }
12870 else
12871 {
12872 exp->op.exp2->destType = exp->destType;
12873 if(exp->destType)
12874 exp->destType->refCount++;
12875 }
12876 if(type1)
12877 type1->refCount++;
12878 exp->expType = type1;
12879 }
12880 else if(assign)
12881 {
12882 if(inCompiler)
12883 PrintExpression(exp->op.exp2, expString);
12884 if(type1 && type1->kind == 13)
12885 {
12886 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)
12887 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12888 else if(exp->op.op == '=')
12889 {
12890 if(exp->op.exp2->destType)
12891 FreeType(exp->op.exp2->destType);
12892 exp->op.exp2->destType = type1;
12893 if(type1)
12894 type1->refCount++;
12895 }
12896 }
12897 else
12898 {
12899 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)
12900 ;
12901 else
12902 {
12903 if(exp->op.exp2->destType)
12904 FreeType(exp->op.exp2->destType);
12905 exp->op.exp2->destType = type1;
12906 if(type1)
12907 type1->refCount++;
12908 }
12909 }
12910 if(type1)
12911 type1->refCount++;
12912 exp->expType = type1;
12913 }
12914 else if(exp->destType && exp->destType->kind == 8 && exp->destType->_class && exp->destType->_class->registered && ((exp->destType->_class->registered->type == 3 && useDestType && useSideUnit) || (exp->destType->_class->registered->type == 4 && useDestType)))
12915 {
12916 if(exp->op.exp2->destType)
12917 FreeType(exp->op.exp2->destType);
12918 exp->op.exp2->destType = exp->destType;
12919 if(exp->destType)
12920 exp->destType->refCount++;
12921 }
12922 else
12923 {
12924 if(exp->op.exp2->destType)
12925 FreeType(exp->op.exp2->destType);
12926 exp->op.exp2->destType = dummy;
12927 dummy->refCount++;
12928 }
12929 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12930 {
12931 FreeType(exp->op.exp2->destType);
12932 exp->op.exp2->destType = type1;
12933 type1->refCount++;
12934 }
12935 if(exp->op.exp2->destType && exp->op.op != '=')
12936 exp->op.exp2->destType->count++;
12937 ProcessExpressionType(exp->op.exp2);
12938 if(exp->op.exp2->destType && exp->op.op != '=')
12939 exp->op.exp2->destType->count--;
12940 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12941 {
12942 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)
12943 {
12944 if(exp->op.op != '=' && type1->type->kind == 0)
12945 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12946 }
12947 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)))
12948 {
12949 if(exp->op.op == ADD_ASSIGN)
12950 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12951 }
12952 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))
12953 {
12954 if(exp->op.op == ADD_ASSIGN)
12955 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12956 }
12957 else if(inCompiler)
12958 {
12959 char type1String[1024];
12960 char type2String[1024];
12961
12962 type1String[0] = '\0';
12963 type2String[0] = '\0';
12964 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12965 PrintType(type1, type2String, 0x0, 0x1);
12966 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12967 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12968 }
12969 }
12970 if(exp->op.exp2->destType == dummy)
12971 {
12972 FreeType(dummy);
12973 exp->op.exp2->destType = (((void *)0));
12974 }
12975 if(exp->op.op == '-' && !exp->op.exp1 && exp->op.exp2->expType && !exp->op.exp2->expType->isSigned)
12976 {
12977 type2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12978 type2->refCount = 1;
12979 CopyTypeInto(type2, exp->op.exp2->expType);
12980 type2->isSigned = 0x1;
12981 }
12982 else if(exp->op.op == '~' && !exp->op.exp1 && exp->op.exp2->expType && (!exp->op.exp2->expType->isSigned || exp->op.exp2->expType->kind != 3))
12983 {
12984 type2 = __extension__ ({
12985 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12986
12987 __ecereInstance1->kind = 3, __ecereInstance1;
12988 });
12989 type2->refCount = 1;
12990 type2->isSigned = 0x1;
12991 }
12992 else
12993 type2 = exp->op.exp2->expType;
12994 }
12995 dummy->kind = 0;
12996 if(exp->op.op == SIZEOF)
12997 {
12998 exp->expType = __extension__ ({
12999 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13000
13001 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
13002 });
13003 exp->isConstant = 0x1;
13004 }
13005 else if(exp->op.op == '*' && !exp->op.exp1)
13006 {
13007 exp->expType = Dereference(type2);
13008 if(type2 && type2->kind == 8)
13009 notByReference = 0x1;
13010 }
13011 else if(exp->op.op == '&' && !exp->op.exp1)
13012 exp->expType = Reference(type2);
13013 else if(!assign)
13014 {
13015 if(boolOps)
13016 {
13017 if(exp->op.exp1)
13018 {
13019 if(exp->op.exp1->destType)
13020 FreeType(exp->op.exp1->destType);
13021 exp->op.exp1->destType = MkClassType("bool");
13022 exp->op.exp1->destType->truth = 0x1;
13023 if(!exp->op.exp1->expType)
13024 ProcessExpressionType(exp->op.exp1);
13025 else
13026 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13027 FreeType(exp->op.exp1->expType);
13028 exp->op.exp1->expType = MkClassType("bool");
13029 exp->op.exp1->expType->truth = 0x1;
13030 }
13031 if(exp->op.exp2)
13032 {
13033 if(exp->op.exp2->destType)
13034 FreeType(exp->op.exp2->destType);
13035 exp->op.exp2->destType = MkClassType("bool");
13036 exp->op.exp2->destType->truth = 0x1;
13037 if(!exp->op.exp2->expType)
13038 ProcessExpressionType(exp->op.exp2);
13039 else
13040 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13041 FreeType(exp->op.exp2->expType);
13042 exp->op.exp2->expType = MkClassType("bool");
13043 exp->op.exp2->expType->truth = 0x1;
13044 }
13045 }
13046 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")))))
13047 {
13048 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
13049 {
13050 if(exp->op.exp2->destType)
13051 FreeType(exp->op.exp2->destType);
13052 exp->op.exp2->destType = type1;
13053 type1->refCount++;
13054 if(exp->op.exp1->destType)
13055 FreeType(exp->op.exp1->destType);
13056 exp->op.exp1->destType = type2;
13057 type2->refCount++;
13058 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)
13059 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operating on %s and %s with an untyped result, assuming %s\n", (((void *)0))), type1->_class->string, type2->_class->string, type1->_class->string);
13060 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
13061 {
13062 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
13063
13064 if(argExp)
13065 {
13066 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
13067
13068 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
13069 ProcessExpressionType(exp->op.exp1);
13070 if(type2->kind != 13)
13071 {
13072 ProcessExpressionType(classExp);
13073 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"))))))));
13074 if(!exp->op.exp2->expType)
13075 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
13076 ProcessExpressionType(exp->op.exp2);
13077 }
13078 }
13079 }
13080 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)))
13081 {
13082 if(type1->kind != 8 && type1->type->kind == 0)
13083 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
13084 exp->expType = type1;
13085 if(type1)
13086 type1->refCount++;
13087 }
13088 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)))
13089 {
13090 if(type2->kind != 8 && type2->type->kind == 0)
13091 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
13092 exp->expType = type2;
13093 if(type2)
13094 type2->refCount++;
13095 }
13096 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))
13097 {
13098 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
13099 }
13100 else
13101 {
13102 unsigned int success = 0x0;
13103
13104 if(type1->kind == 13 && type2->kind == 13)
13105 {
13106 if(exp->op.op == '+')
13107 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
13108 else if(exp->op.op == '-')
13109 {
13110 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
13111 {
13112 exp->expType = __extension__ ({
13113 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13114
13115 __ecereInstance1->kind = 3, __ecereInstance1->refCount = 1, __ecereInstance1;
13116 });
13117 success = 0x1;
13118 if(type1->type->kind == 20)
13119 {
13120 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
13121
13122 if(argExp)
13123 {
13124 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
13125
13126 ProcessExpressionType(classExp);
13127 exp->type = 5;
13128 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")))))));
13129 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
13130 FreeType(dummy);
13131 return ;
13132 }
13133 }
13134 }
13135 }
13136 }
13137 if(!success && exp->op.exp1->type == 2)
13138 {
13139 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13140 {
13141 if(exp->expType)
13142 FreeType(exp->expType);
13143 exp->expType = exp->op.exp1->destType;
13144 if(exp->op.exp1->destType)
13145 exp->op.exp1->destType->refCount++;
13146 success = 0x1;
13147 }
13148 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13149 {
13150 if(exp->expType)
13151 FreeType(exp->expType);
13152 exp->expType = exp->op.exp2->destType;
13153 if(exp->op.exp2->destType)
13154 exp->op.exp2->destType->refCount++;
13155 success = 0x1;
13156 }
13157 }
13158 else if(!success)
13159 {
13160 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13161 {
13162 if(exp->expType)
13163 FreeType(exp->expType);
13164 exp->expType = exp->op.exp2->destType;
13165 if(exp->op.exp2->destType)
13166 exp->op.exp2->destType->refCount++;
13167 success = 0x1;
13168 }
13169 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13170 {
13171 if(exp->expType)
13172 FreeType(exp->expType);
13173 exp->expType = exp->op.exp1->destType;
13174 if(exp->op.exp1->destType)
13175 exp->op.exp1->destType->refCount++;
13176 success = 0x1;
13177 }
13178 }
13179 if(!success)
13180 {
13181 char expString1[10240];
13182 char expString2[10240];
13183 char type1[1024];
13184 char type2[1024];
13185
13186 expString1[0] = '\0';
13187 expString2[0] = '\0';
13188 type1[0] = '\0';
13189 type2[0] = '\0';
13190 if(inCompiler)
13191 {
13192 PrintExpression(exp->op.exp1, expString1);
13193 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13194 PrintExpression(exp->op.exp2, expString2);
13195 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13196 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
13197 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
13198 }
13199 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
13200 }
13201 }
13202 }
13203 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13204 {
13205 if(exp->op.exp1->destType)
13206 FreeType(exp->op.exp1->destType);
13207 exp->op.exp1->destType = type2->_class->registered->dataType;
13208 if(type2->_class->registered->dataType)
13209 type2->_class->registered->dataType->refCount++;
13210 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13211 exp->expType = type2;
13212 if(type2)
13213 type2->refCount++;
13214 }
13215 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13216 {
13217 if(exp->op.exp2->destType)
13218 FreeType(exp->op.exp2->destType);
13219 exp->op.exp2->destType = type1->_class->registered->dataType;
13220 if(type1->_class->registered->dataType)
13221 type1->_class->registered->dataType->refCount++;
13222 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13223 exp->expType = type1;
13224 if(type1)
13225 type1->refCount++;
13226 }
13227 else if(type1)
13228 {
13229 unsigned int valid = 0x0;
13230
13231 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
13232 {
13233 if(exp->op.exp2->destType)
13234 FreeType(exp->op.exp2->destType);
13235 if(!type1->_class->registered->dataType)
13236 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
13237 exp->op.exp2->destType = type1->_class->registered->dataType;
13238 exp->op.exp2->destType->refCount++;
13239 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13240 type2 = exp->op.exp2->destType;
13241 exp->expType = type2;
13242 type2->refCount++;
13243 }
13244 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
13245 {
13246 if(exp->op.exp1->destType)
13247 FreeType(exp->op.exp1->destType);
13248 if(!type2->_class->registered->dataType)
13249 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
13250 exp->op.exp1->destType = type2->_class->registered->dataType;
13251 exp->op.exp1->destType->refCount++;
13252 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13253 type1 = exp->op.exp1->destType;
13254 exp->expType = type1;
13255 type1->refCount++;
13256 }
13257 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
13258 {
13259 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
13260 {
13261 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
13262 {
13263 if(exp->expType)
13264 FreeType(exp->expType);
13265 exp->expType = exp->op.exp1->expType;
13266 if(exp->op.exp2->expType)
13267 exp->op.exp1->expType->refCount++;
13268 valid = 0x1;
13269 }
13270 }
13271 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
13272 {
13273 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
13274 {
13275 if(exp->expType)
13276 FreeType(exp->expType);
13277 exp->expType = exp->op.exp2->expType;
13278 if(exp->op.exp2->expType)
13279 exp->op.exp2->expType->refCount++;
13280 valid = 0x1;
13281 }
13282 }
13283 }
13284 if(!valid)
13285 {
13286 if(exp->op.exp2->destType)
13287 FreeType(exp->op.exp2->destType);
13288 exp->op.exp2->destType = type1;
13289 type1->refCount++;
13290 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13291 {
13292 if(exp->expType)
13293 FreeType(exp->expType);
13294 exp->expType = exp->op.exp2->destType;
13295 if(exp->op.exp2->destType)
13296 exp->op.exp2->destType->refCount++;
13297 }
13298 else if(type1 && type2)
13299 {
13300 char expString1[10240];
13301 char expString2[10240];
13302 char type1String[1024];
13303 char type2String[1024];
13304
13305 expString1[0] = '\0';
13306 expString2[0] = '\0';
13307 type1String[0] = '\0';
13308 type2String[0] = '\0';
13309 if(inCompiler)
13310 {
13311 PrintExpression(exp->op.exp1, expString1);
13312 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13313 PrintExpression(exp->op.exp2, expString2);
13314 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13315 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
13316 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
13317 }
13318 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
13319 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
13320 {
13321 exp->expType = exp->op.exp1->expType;
13322 if(exp->op.exp1->expType)
13323 exp->op.exp1->expType->refCount++;
13324 }
13325 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13326 {
13327 exp->expType = exp->op.exp2->expType;
13328 if(exp->op.exp2->expType)
13329 exp->op.exp2->expType->refCount++;
13330 }
13331 }
13332 }
13333 }
13334 else if(type2)
13335 {
13336 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13337 {
13338 struct Type * oldType = exp->op.exp1->expType;
13339
13340 exp->op.exp1->expType = (((void *)0));
13341 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13342 FreeType(oldType);
13343 else
13344 exp->op.exp1->expType = oldType;
13345 }
13346 if(exp->op.exp1->destType)
13347 FreeType(exp->op.exp1->destType);
13348 exp->op.exp1->destType = type2;
13349 type2->refCount++;
13350 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13351 {
13352 if(exp->expType)
13353 FreeType(exp->expType);
13354 exp->expType = exp->op.exp1->destType;
13355 if(exp->op.exp1->destType)
13356 exp->op.exp1->destType->refCount++;
13357 }
13358 }
13359 }
13360 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
13361 {
13362 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13363 {
13364 if(exp->op.exp1->destType)
13365 FreeType(exp->op.exp1->destType);
13366 exp->op.exp1->destType = type2->_class->registered->dataType;
13367 if(type2->_class->registered->dataType)
13368 type2->_class->registered->dataType->refCount++;
13369 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13370 }
13371 if(exp->op.op == '!')
13372 {
13373 exp->expType = MkClassType("bool");
13374 exp->expType->truth = 0x1;
13375 }
13376 else
13377 {
13378 exp->expType = type2;
13379 if(type2)
13380 type2->refCount++;
13381 }
13382 }
13383 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
13384 {
13385 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13386 {
13387 if(exp->op.exp2->destType)
13388 FreeType(exp->op.exp2->destType);
13389 exp->op.exp2->destType = type1->_class->registered->dataType;
13390 if(type1->_class->registered->dataType)
13391 type1->_class->registered->dataType->refCount++;
13392 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13393 }
13394 exp->expType = type1;
13395 if(type1)
13396 type1->refCount++;
13397 }
13398 }
13399 yylloc = exp->loc;
13400 if(exp->op.exp1 && !exp->op.exp1->expType)
13401 {
13402 char expString[10000];
13403
13404 expString[0] = '\0';
13405 if(inCompiler)
13406 {
13407 PrintExpression(exp->op.exp1, expString);
13408 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13409 }
13410 if(expString[0])
13411 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13412 }
13413 if(exp->op.exp2 && !exp->op.exp2->expType)
13414 {
13415 char expString[10240];
13416
13417 expString[0] = '\0';
13418 if(inCompiler)
13419 {
13420 PrintExpression(exp->op.exp2, expString);
13421 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13422 }
13423 if(expString[0])
13424 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13425 }
13426 if(boolResult)
13427 {
13428 FreeType(exp->expType);
13429 exp->expType = MkClassType("bool");
13430 exp->expType->truth = 0x1;
13431 }
13432 if(exp->op.op != SIZEOF)
13433 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
13434 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
13435 {
13436 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
13437 }
13438 yylloc = oldyylloc;
13439 FreeType(dummy);
13440 break;
13441 }
13442 case 5:
13443 case 34:
13444 {
13445 struct Expression * e;
13446
13447 exp->isConstant = 0x1;
13448 for(e = (*exp->list).first; e; e = e->next)
13449 {
13450 unsigned int inced = 0x0;
13451
13452 if(!e->next)
13453 {
13454 FreeType(e->destType);
13455 e->destType = exp->destType;
13456 if(e->destType)
13457 {
13458 exp->destType->refCount++;
13459 e->destType->count++;
13460 inced = 0x1;
13461 }
13462 }
13463 ProcessExpressionType(e);
13464 if(inced)
13465 exp->destType->count--;
13466 if(!exp->expType && !e->next)
13467 {
13468 exp->expType = e->expType;
13469 if(e->expType)
13470 e->expType->refCount++;
13471 }
13472 if(!e->isConstant)
13473 exp->isConstant = 0x0;
13474 }
13475 e = (*exp->list).first;
13476 if(!e->next && e->type == 8)
13477 {
13478 struct Expression * next = exp->next, * prev = exp->prev;
13479
13480 FreeType(exp->expType);
13481 FreeType(exp->destType);
13482 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
13483 *exp = *e;
13484 exp->prev = prev;
13485 exp->next = next;
13486 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
13487 ProcessExpressionType(exp);
13488 }
13489 break;
13490 }
13491 case 6:
13492 {
13493 struct Expression * e;
13494
13495 exp->isConstant = 0x1;
13496 ProcessExpressionType(exp->index.exp);
13497 if(!exp->index.exp->isConstant)
13498 exp->isConstant = 0x0;
13499 if(exp->index.exp->expType)
13500 {
13501 struct Type * source = exp->index.exp->expType;
13502
13503 if(source->kind == 8 && source->_class && source->_class->registered)
13504 {
13505 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
13506 struct __ecereNameSpace__ecere__com__Class * c = _class->templateClass ? _class->templateClass : _class;
13507
13508 if(_class != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(c, containerClass) && _class->templateArgs)
13509 {
13510 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
13511 if(exp->index.index && (*exp->index.index).last)
13512 {
13513 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
13514 }
13515 }
13516 }
13517 }
13518 for(e = (*exp->index.index).first; e; e = e->next)
13519 {
13520 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
13521 {
13522 if(e->destType)
13523 FreeType(e->destType);
13524 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
13525 }
13526 ProcessExpressionType(e);
13527 if(!e->next)
13528 {
13529 }
13530 if(!e->isConstant)
13531 exp->isConstant = 0x0;
13532 }
13533 if(!exp->expType)
13534 exp->expType = Dereference(exp->index.exp->expType);
13535 if(exp->expType)
13536 DeclareType(exp->expType, 0x0, 0x0);
13537 break;
13538 }
13539 case 7:
13540 {
13541 struct Expression * e;
13542 struct Type * functionType;
13543 struct Type * methodType = (((void *)0));
13544 char name[1024];
13545
13546 name[0] = '\0';
13547 if(inCompiler)
13548 {
13549 PrintExpression(exp->call.exp, name);
13550 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
13551 {
13552 PrintExpression(exp->call.exp, name);
13553 }
13554 }
13555 if(exp->call.exp->type == 0)
13556 {
13557 struct Expression * idExp = exp->call.exp;
13558 struct Identifier * id = idExp->identifier;
13559
13560 if(!strcmp(id->string, "__builtin_frame_address"))
13561 {
13562 exp->expType = ProcessTypeString("void *", 0x1);
13563 if(exp->call.arguments && (*exp->call.arguments).first)
13564 ProcessExpressionType((*exp->call.arguments).first);
13565 break;
13566 }
13567 else if(!strcmp(id->string, "__ENDIAN_PAD"))
13568 {
13569 exp->expType = ProcessTypeString("int", 0x1);
13570 if(exp->call.arguments && (*exp->call.arguments).first)
13571 ProcessExpressionType((*exp->call.arguments).first);
13572 break;
13573 }
13574 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
13575 {
13576 struct Expression * a = (((void *)0));
13577 struct Expression * b = (((void *)0));
13578 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
13579
13580 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
13581 {
13582 a = (*exp->call.arguments).first;
13583 b = (*exp->call.arguments).last;
13584 tempExp1 = a;
13585 tempExp2 = b;
13586 }
13587 else if((*exp->call.arguments).count == 1)
13588 {
13589 a = (*exp->call.arguments).first;
13590 tempExp1 = a;
13591 }
13592 if(a)
13593 {
13594 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
13595 idExp->identifier = (((void *)0));
13596 FreeExpContents(exp);
13597 ProcessExpressionType(a);
13598 if(b)
13599 ProcessExpressionType(b);
13600 exp->type = 5;
13601 exp->list = MkList();
13602 if(a->expType && (!b || b->expType))
13603 {
13604 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
13605 {
13606 if(inCompiler)
13607 {
13608 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13609 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
13610 struct Declaration * decl;
13611 char temp1[1024], temp2[1024];
13612
13613 GetTypeSpecs(a->expType, specs);
13614 if(a && !a->isConstant && a->type != 0)
13615 {
13616 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
13617 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
13618 tempExp1 = QMkExpId(temp1);
13619 tempExp1->expType = a->expType;
13620 if(a->expType)
13621 a->expType->refCount++;
13622 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
13623 }
13624 if(b && !b->isConstant && b->type != 0)
13625 {
13626 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
13627 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
13628 tempExp2 = QMkExpId(temp2);
13629 tempExp2->expType = b->expType;
13630 if(b->expType)
13631 b->expType->refCount++;
13632 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
13633 }
13634 decl = MkDeclaration(specs, decls);
13635 if(!curCompound->compound.declarations)
13636 curCompound->compound.declarations = MkList();
13637 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
13638 }
13639 }
13640 }
13641 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13642 {
13643 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13644
13645 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13646 exp->expType = a->expType;
13647 if(a->expType)
13648 a->expType->refCount++;
13649 }
13650 else if(!strcmp(id->string, "Abs"))
13651 {
13652 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13653 exp->expType = a->expType;
13654 if(a->expType)
13655 a->expType->refCount++;
13656 }
13657 else if(!strcmp(id->string, "Sgn"))
13658 {
13659 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"))))));
13660 exp->expType = ProcessTypeString("int", 0x0);
13661 }
13662 FreeExpression(tempExp1);
13663 if(tempExp2)
13664 FreeExpression(tempExp2);
13665 FreeIdentifier(id);
13666 break;
13667 }
13668 }
13669 }
13670 {
13671 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
13672
13673 if(!exp->call.exp->destType)
13674 {
13675 exp->call.exp->destType = dummy;
13676 dummy->refCount++;
13677 }
13678 ProcessExpressionType(exp->call.exp);
13679 if(exp->call.exp->destType == dummy)
13680 {
13681 FreeType(dummy);
13682 exp->call.exp->destType = (((void *)0));
13683 }
13684 FreeType(dummy);
13685 }
13686 functionType = exp->call.exp->expType;
13687 if(functionType && functionType->kind == 16)
13688 {
13689 methodType = functionType;
13690 functionType = methodType->method->dataType;
13691 if(exp->call.exp->expType->usedClass)
13692 {
13693 char typeString[1024];
13694
13695 typeString[0] = '\0';
13696 {
13697 struct Symbol * back = functionType->thisClass;
13698
13699 functionType->thisClass = (((void *)0));
13700 PrintType(functionType, typeString, 0x1, 0x1);
13701 functionType->thisClass = back;
13702 }
13703 if(strstr(typeString, "thisclass"))
13704 {
13705 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13706 struct Declarator * decl;
13707
13708 {
13709 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13710
13711 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13712 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13713 thisClassParams = 0x0;
13714 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13715 {
13716 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13717
13718 thisClass = exp->call.exp->expType->usedClass;
13719 ProcessDeclarator(decl);
13720 thisClass = backupThisClass;
13721 }
13722 thisClassParams = 0x1;
13723 functionType = ProcessType(specs, decl);
13724 functionType->refCount = 0;
13725 FinishTemplatesContext(context);
13726 }
13727 FreeList(specs, FreeSpecifier);
13728 FreeDeclarator(decl);
13729 }
13730 }
13731 }
13732 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13733 {
13734 struct Type * type = functionType->type;
13735
13736 if(!functionType->refCount)
13737 {
13738 functionType->type = (((void *)0));
13739 FreeType(functionType);
13740 }
13741 functionType = type;
13742 }
13743 if(functionType && functionType->kind != 11)
13744 {
13745 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13746 }
13747 else if(functionType)
13748 {
13749 unsigned int emptyParams = 0x0, noParams = 0x0;
13750 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13751 struct Type * type = functionType->params.first;
13752 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13753 int extra = 0;
13754 struct Location oldyylloc = yylloc;
13755
13756 if(!type)
13757 emptyParams = 0x1;
13758 if(functionType->extraParam && e && functionType->thisClass)
13759 {
13760 e->destType = MkClassType(functionType->thisClass->string);
13761 e = e->next;
13762 }
13763 if(!functionType->staticMethod && !functionType->extraParam)
13764 {
13765 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13766 {
13767 type = MkClassType(memberExp->member.exp->expType->_class->string);
13768 if(e)
13769 {
13770 e->destType = type;
13771 e = e->next;
13772 type = functionType->params.first;
13773 }
13774 else
13775 type->refCount = 0;
13776 }
13777 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13778 {
13779 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13780 type->byReference = functionType->byReference;
13781 type->typedByReference = functionType->typedByReference;
13782 if(e)
13783 {
13784 if(e->next && type->kind == 8 && (functionType && functionType->thisClass) && functionType->classObjectType == 2)
13785 e = e->next;
13786 e->destType = type;
13787 e = e->next;
13788 type = functionType->params.first;
13789 }
13790 else
13791 type->refCount = 0;
13792 }
13793 }
13794 if(type && type->kind == 0)
13795 {
13796 noParams = 0x1;
13797 if(!type->refCount)
13798 FreeType(type);
13799 type = (((void *)0));
13800 }
13801 for(; e; e = e->next)
13802 {
13803 if(!type && !emptyParams)
13804 {
13805 yylloc = e->loc;
13806 if(methodType && methodType->methodClass)
13807 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many arguments for method %s::%s (%d given, expected %d)\n", (((void *)0))), methodType->methodClass->fullName, methodType->method->name, (*exp->call.arguments).count, noParams ? 0 : functionType->params.count);
13808 else
13809 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many arguments for function %s (%d given, expected %d)\n", (((void *)0))), name, (*exp->call.arguments).count, noParams ? 0 : functionType->params.count);
13810 break;
13811 }
13812 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13813 {
13814 struct Type * templatedType = (((void *)0));
13815 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13816 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13817 int id = 0;
13818
13819 if(_class && _class->templateArgs)
13820 {
13821 struct __ecereNameSpace__ecere__com__Class * sClass;
13822
13823 for(sClass = _class; sClass; sClass = sClass->base)
13824 {
13825 if(sClass->templateClass)
13826 sClass = sClass->templateClass;
13827 id = 0;
13828 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13829 {
13830 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13831 {
13832 struct __ecereNameSpace__ecere__com__Class * nextClass;
13833
13834 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13835 {
13836 if(nextClass->templateClass)
13837 nextClass = nextClass->templateClass;
13838 id += nextClass->templateParams.count;
13839 }
13840 break;
13841 }
13842 id++;
13843 }
13844 if(curParam)
13845 break;
13846 }
13847 }
13848 if(curParam && _class->templateArgs[id].dataTypeString)
13849 {
13850 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13851
13852 {
13853 struct Context * context = SetupTemplatesContext(_class);
13854
13855 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13856 FinishTemplatesContext(context);
13857 }
13858 e->destType = templatedType;
13859 if(templatedType)
13860 {
13861 templatedType->passAsTemplate = 0x1;
13862 }
13863 }
13864 else
13865 {
13866 e->destType = type;
13867 if(type)
13868 type->refCount++;
13869 }
13870 }
13871 else
13872 {
13873 if(type && type->kind == 14 && type->prev && type->prev->kind == 8 && type->prev->classObjectType)
13874 {
13875 e->destType = type->prev;
13876 e->destType->refCount++;
13877 }
13878 else
13879 {
13880 e->destType = type;
13881 if(type)
13882 type->refCount++;
13883 }
13884 }
13885 if(type && type->kind != 14)
13886 {
13887 struct Type * next = type->next;
13888
13889 if(!type->refCount)
13890 FreeType(type);
13891 type = next;
13892 }
13893 }
13894 if(type && type->kind != 14)
13895 {
13896 if(methodType && methodType->methodClass)
13897 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough arguments for method %s::%s (%d given, expected %d)\n", (((void *)0))), methodType->methodClass->fullName, methodType->method->name, exp->call.arguments ? (*exp->call.arguments).count : 0, functionType->params.count + extra);
13898 else
13899 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough arguments for function %s (%d given, expected %d)\n", (((void *)0))), name, exp->call.arguments ? (*exp->call.arguments).count : 0, functionType->params.count + extra);
13900 }
13901 yylloc = oldyylloc;
13902 if(type && !type->refCount)
13903 FreeType(type);
13904 }
13905 else
13906 {
13907 functionType = __extension__ ({
13908 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13909
13910 __ecereInstance1->refCount = 0, __ecereInstance1->kind = 11, __ecereInstance1;
13911 });
13912 if(exp->call.exp->type == 0)
13913 {
13914 char * string = exp->call.exp->identifier->string;
13915
13916 if(inCompiler)
13917 {
13918 struct Symbol * symbol;
13919 struct Location oldyylloc = yylloc;
13920
13921 yylloc = exp->call.exp->identifier->loc;
13922 if(strstr(string, "__builtin_") == string)
13923 {
13924 if(exp->destType)
13925 {
13926 functionType->returnType = exp->destType;
13927 exp->destType->refCount++;
13928 }
13929 }
13930 else
13931 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13932 symbol = __extension__ ({
13933 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
13934
13935 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString(string), __ecereInstance1->type = ProcessTypeString("int()", 0x1), __ecereInstance1;
13936 });
13937 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13938 if(strstr(symbol->string, "::"))
13939 globalContext->hasNameSpace = 0x1;
13940 yylloc = oldyylloc;
13941 }
13942 }
13943 else if(exp->call.exp->type == 8)
13944 {
13945 }
13946 else
13947 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13948 if(!functionType->returnType)
13949 {
13950 functionType->returnType = __extension__ ({
13951 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13952
13953 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
13954 });
13955 }
13956 }
13957 if(functionType && functionType->kind == 11)
13958 {
13959 exp->expType = functionType->returnType;
13960 if(functionType->returnType)
13961 functionType->returnType->refCount++;
13962 if(!functionType->refCount)
13963 FreeType(functionType);
13964 }
13965 if(exp->call.arguments)
13966 {
13967 for(e = (*exp->call.arguments).first; e; e = e->next)
13968 {
13969 struct Type * destType = e->destType;
13970
13971 ProcessExpressionType(e);
13972 }
13973 }
13974 break;
13975 }
13976 case 8:
13977 {
13978 struct Type * type;
13979 struct Location oldyylloc = yylloc;
13980 unsigned int thisPtr;
13981 struct Expression * checkExp = exp->member.exp;
13982
13983 while(checkExp)
13984 {
13985 if(checkExp->type == 11)
13986 checkExp = checkExp->cast.exp;
13987 else if(checkExp->type == 5)
13988 checkExp = checkExp->list ? (*checkExp->list).first : (((void *)0));
13989 else
13990 break;
13991 }
13992 thisPtr = (checkExp && checkExp->type == 0 && !strcmp(checkExp->identifier->string, "this"));
13993 exp->thisPtr = thisPtr;
13994 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13995 {
13996 exp->member.member->classSym = exp->member.member->_class->symbol;
13997 }
13998 ProcessExpressionType(exp->member.exp);
13999 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)
14000 {
14001 exp->isConstant = 0x0;
14002 }
14003 else
14004 exp->isConstant = exp->member.exp->isConstant;
14005 type = exp->member.exp->expType;
14006 yylloc = exp->loc;
14007 if(type && (type->kind == 20))
14008 {
14009 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14010 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
14011
14012 if(_class)
14013 {
14014 for(param = _class->templateParams.first; param; param = param->next)
14015 {
14016 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
14017 break;
14018 }
14019 }
14020 if(param && param->defaultArg.member)
14021 {
14022 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
14023
14024 if(argExp)
14025 {
14026 struct Expression * expMember = exp->member.exp;
14027 struct Declarator * decl;
14028 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14029 char thisClassTypeString[1024];
14030
14031 FreeIdentifier(exp->member.member);
14032 ProcessExpressionType(argExp);
14033 {
14034 char * colon = strstr(param->defaultArg.memberString, "::");
14035
14036 if(colon)
14037 {
14038 char className[1024];
14039 struct __ecereNameSpace__ecere__com__Class * sClass;
14040
14041 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
14042 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
14043 }
14044 else
14045 strcpy(thisClassTypeString, _class->fullName);
14046 }
14047 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
14048 exp->expType = ProcessType(specs, decl);
14049 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
14050 {
14051 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
14052 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
14053 int c;
14054 int paramCount = 0;
14055 int lastParam = -1;
14056 char templateString[1024];
14057 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
14058
14059 sprintf(templateString, "%s<", expClass->templateClass->fullName);
14060 for(cClass = expClass; cClass; cClass = cClass->base)
14061 {
14062 int p = 0;
14063
14064 for(param = cClass->templateParams.first; param; param = param->next)
14065 {
14066 int id = p;
14067 struct __ecereNameSpace__ecere__com__Class * sClass;
14068 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
14069
14070 for(sClass = cClass->base; sClass; sClass = sClass->base)
14071 id += sClass->templateParams.count;
14072 arg = expClass->templateArgs[id];
14073 for(sClass = _class; sClass; sClass = sClass->base)
14074 {
14075 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
14076 int p = 0;
14077 struct __ecereNameSpace__ecere__com__Class * nextClass;
14078
14079 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
14080 p += nextClass->templateParams.count;
14081 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
14082 {
14083 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
14084 {
14085 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14086 {
14087 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
14088 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
14089 break;
14090 }
14091 }
14092 }
14093 }
14094 {
14095 char argument[256];
14096
14097 argument[0] = '\0';
14098 switch(param->type)
14099 {
14100 case 2:
14101 {
14102 char expString[1024];
14103 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14104 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14105 struct Expression * exp;
14106 char * string = PrintHexUInt64(arg.expression.ui64);
14107
14108 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14109 ProcessExpressionType(exp);
14110 ComputeExpression(exp);
14111 expString[0] = '\0';
14112 PrintExpression(exp, expString);
14113 strcat(argument, expString);
14114 FreeExpression(exp);
14115 break;
14116 }
14117 case 1:
14118 {
14119 strcat(argument, arg.member->name);
14120 break;
14121 }
14122 case 0:
14123 {
14124 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14125 {
14126 if(!strcmp(arg.dataTypeString, "thisclass"))
14127 strcat(argument, thisClassTypeString);
14128 else
14129 strcat(argument, arg.dataTypeString);
14130 }
14131 break;
14132 }
14133 }
14134 if(argument[0])
14135 {
14136 if(paramCount)
14137 strcat(templateString, ", ");
14138 if(lastParam != p - 1)
14139 {
14140 strcat(templateString, param->name);
14141 strcat(templateString, " = ");
14142 }
14143 strcat(templateString, argument);
14144 paramCount++;
14145 lastParam = p;
14146 }
14147 p++;
14148 }
14149 }
14150 }
14151 {
14152 int len = strlen(templateString);
14153
14154 if(templateString[len - 1] == '>')
14155 templateString[len++] = ' ';
14156 templateString[len++] = '>';
14157 templateString[len++] = '\0';
14158 }
14159 {
14160 struct Context * context = SetupTemplatesContext(_class);
14161
14162 FreeType(exp->expType);
14163 exp->expType = ProcessTypeString(templateString, 0x0);
14164 FinishTemplatesContext(context);
14165 }
14166 }
14167 exp->type = 5;
14168 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")))))))));
14169 }
14170 }
14171 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
14172 {
14173 type = ProcessTemplateParameterType(type->templateParameter);
14174 }
14175 }
14176 if(type && (type->kind == 20))
14177 ;
14178 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)))
14179 {
14180 struct Identifier * id = exp->member.member;
14181 int typeKind = type->kind;
14182 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));
14183
14184 if(typeKind == 19 && exp->member.exp->type == 26)
14185 {
14186 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
14187 typeKind = 8;
14188 }
14189 if(id)
14190 {
14191 if(typeKind == 3 || typeKind == 15)
14192 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
14193 else if(!_class)
14194 {
14195 if(type->kind == 8 && type->_class && type->_class->registered)
14196 {
14197 _class = type->_class->registered;
14198 }
14199 else if((type->kind == 12 || type->kind == 13) && type->type && type->type->kind == 1)
14200 {
14201 _class = FindClass("char *")->registered;
14202 }
14203 else if(type->kind == 13)
14204 {
14205 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "uintptr");
14206 FreeType(exp->expType);
14207 exp->expType = ProcessTypeString("uintptr", 0x0);
14208 exp->byReference = 0x1;
14209 }
14210 else
14211 {
14212 char string[1024] = "";
14213 struct Symbol * classSym;
14214
14215 PrintTypeNoConst(type, string, 0x0, 0x1);
14216 classSym = FindClass(string);
14217 if(classSym)
14218 _class = classSym->registered;
14219 }
14220 }
14221 }
14222 if(_class && id)
14223 {
14224 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
14225 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
14226 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
14227 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
14228 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
14229
14230 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
14231 exp->member.memberType = 1;
14232 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
14233 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
14234 if(typeKind != 19)
14235 {
14236 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
14237 {
14238 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
14239 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
14240 {
14241 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14242 if(prop)
14243 member = (((void *)0));
14244 }
14245 if(!member && !prop)
14246 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14247 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
14248 exp->member.thisPtr = 0x1;
14249 }
14250 else
14251 {
14252 if(!id->classSym)
14253 {
14254 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
14255 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
14256 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
14257 }
14258 if(!prop && !member)
14259 {
14260 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
14261 if(!method)
14262 {
14263 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14264 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
14265 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
14266 }
14267 }
14268 if(member && prop)
14269 {
14270 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
14271 prop = (((void *)0));
14272 else
14273 member = (((void *)0));
14274 }
14275 }
14276 }
14277 if(!prop && !member && !method)
14278 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
14279 if(!prop && !member && !method)
14280 {
14281 if(typeKind == 19)
14282 {
14283 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
14284 if(classProp)
14285 {
14286 exp->member.memberType = 5;
14287 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
14288 }
14289 else
14290 {
14291 char structName[1024];
14292 struct Identifier * id = exp->member.member;
14293 struct Expression * classExp = exp->member.exp;
14294
14295 type->refCount++;
14296 FreeType(classExp->expType);
14297 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
14298 strcpy(structName, "__ecereClassData_");
14299 FullClassNameCat(structName, type->_class->string, 0x0);
14300 exp->type = 9;
14301 exp->member.member = id;
14302 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"))))))));
14303 FreeType(type);
14304 ProcessExpressionType(exp);
14305 return ;
14306 }
14307 }
14308 else
14309 {
14310 struct Symbol * classSym = FindClass(id->string);
14311
14312 if(classSym)
14313 {
14314 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
14315
14316 if(convertClass)
14317 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
14318 }
14319 }
14320 }
14321 if(prop)
14322 {
14323 exp->member.memberType = 1;
14324 if(!prop->dataType)
14325 ProcessPropertyType(prop);
14326 exp->expType = prop->dataType;
14327 if(prop->dataType)
14328 prop->dataType->refCount++;
14329 }
14330 else if(member)
14331 {
14332 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14333 {
14334 FreeExpContents(exp);
14335 exp->type = 0;
14336 exp->identifier = MkIdentifier("class");
14337 ProcessExpressionType(exp);
14338 return ;
14339 }
14340 exp->member.memberType = 3;
14341 DeclareStruct(_class->fullName, 0x0);
14342 if(!member->dataType)
14343 {
14344 struct Context * context = SetupTemplatesContext(_class);
14345
14346 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
14347 FinishTemplatesContext(context);
14348 }
14349 exp->expType = member->dataType;
14350 if(member->dataType)
14351 member->dataType->refCount++;
14352 }
14353 else if(revConvert)
14354 {
14355 exp->member.memberType = 4;
14356 exp->expType = MkClassType(revConvert->_class->fullName);
14357 }
14358 else if(method)
14359 {
14360 {
14361 exp->member.memberType = 2;
14362 }
14363 if(!method->dataType)
14364 ProcessMethodType(method);
14365 exp->expType = __extension__ ({
14366 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14367
14368 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1;
14369 });
14370 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
14371 exp->expType->usedClass = _class;
14372 }
14373 else if(!classProp)
14374 {
14375 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14376 {
14377 FreeExpContents(exp);
14378 exp->type = 0;
14379 exp->identifier = MkIdentifier("class");
14380 ProcessExpressionType(exp);
14381 return ;
14382 }
14383 yylloc = exp->member.member->loc;
14384 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
14385 if(inCompiler)
14386 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
14387 }
14388 if(_class && exp->expType)
14389 {
14390 struct __ecereNameSpace__ecere__com__Class * tClass;
14391
14392 tClass = _class;
14393 while(tClass && !tClass->templateClass)
14394 tClass = tClass->base;
14395 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
14396 {
14397 int id = 0;
14398 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14399 struct __ecereNameSpace__ecere__com__Class * sClass;
14400
14401 for(sClass = tClass; sClass; sClass = sClass->base)
14402 {
14403 id = 0;
14404 if(sClass->templateClass)
14405 sClass = sClass->templateClass;
14406 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14407 {
14408 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
14409 {
14410 for(sClass = sClass->base; sClass; sClass = sClass->base)
14411 id += sClass->templateParams.count;
14412 break;
14413 }
14414 id++;
14415 }
14416 if(curParam)
14417 break;
14418 }
14419 if(curParam && tClass->templateArgs[id].dataTypeString)
14420 {
14421 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14422 struct Context * context = SetupTemplatesContext(tClass);
14423
14424 FreeType(exp->expType);
14425 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
14426 if(exp->expType)
14427 {
14428 if(exp->expType->kind == 21)
14429 {
14430 FreeType(exp->expType);
14431 exp->expType = ReplaceThisClassType(_class);
14432 }
14433 if(tClass->templateClass)
14434 exp->expType->passAsTemplate = 0x1;
14435 if(!exp->destType)
14436 {
14437 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
14438 if(exp->destType->kind == 21)
14439 {
14440 FreeType(exp->destType);
14441 exp->destType = ReplaceThisClassType(_class);
14442 }
14443 }
14444 }
14445 FinishTemplatesContext(context);
14446 }
14447 }
14448 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
14449 {
14450 int id = 0;
14451 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14452 struct __ecereNameSpace__ecere__com__Class * sClass;
14453
14454 for(sClass = tClass; sClass; sClass = sClass->base)
14455 {
14456 id = 0;
14457 if(sClass->templateClass)
14458 sClass = sClass->templateClass;
14459 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14460 {
14461 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
14462 {
14463 for(sClass = sClass->base; sClass; sClass = sClass->base)
14464 id += sClass->templateParams.count;
14465 break;
14466 }
14467 id++;
14468 }
14469 if(curParam)
14470 break;
14471 }
14472 if(curParam)
14473 {
14474 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14475 struct Context * context = SetupTemplatesContext(tClass);
14476 struct Type * basicType;
14477
14478 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
14479 if(basicType)
14480 {
14481 if(basicType->kind == 21)
14482 {
14483 FreeType(basicType);
14484 basicType = ReplaceThisClassType(_class);
14485 }
14486 FreeType(exp->expType);
14487 exp->expType = __extension__ ({
14488 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14489
14490 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = basicType, __ecereInstance1;
14491 });
14492 if(!exp->destType)
14493 {
14494 exp->destType = exp->expType;
14495 exp->destType->refCount++;
14496 }
14497 {
14498 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14499 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14500 struct Declarator * decl;
14501
14502 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
14503 *newExp = *exp;
14504 if(exp->destType)
14505 exp->destType->refCount++;
14506 if(exp->expType)
14507 exp->expType->refCount++;
14508 exp->type = 11;
14509 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
14510 exp->cast.exp = newExp;
14511 }
14512 }
14513 FinishTemplatesContext(context);
14514 }
14515 }
14516 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
14517 {
14518 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
14519
14520 if(expClass)
14521 {
14522 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
14523 int c;
14524 int p = 0;
14525 int paramCount = 0;
14526 int lastParam = -1;
14527 char templateString[1024];
14528 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
14529
14530 sprintf(templateString, "%s<", expClass->templateClass->fullName);
14531 while(cClass != expClass)
14532 {
14533 struct __ecereNameSpace__ecere__com__Class * sClass;
14534
14535 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
14536 ;
14537 cClass = sClass;
14538 for(param = cClass->templateParams.first; param; param = param->next)
14539 {
14540 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
14541 int c;
14542 int cp = 0;
14543 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
14544 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
14545
14546 while(cClassCur != tClass && !paramCur)
14547 {
14548 struct __ecereNameSpace__ecere__com__Class * sClassCur;
14549
14550 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
14551 ;
14552 cClassCur = sClassCur;
14553 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
14554 {
14555 if(!strcmp(paramCur->name, param->name))
14556 {
14557 break;
14558 }
14559 cp++;
14560 }
14561 }
14562 if(paramCur && paramCur->type == 0)
14563 arg = tClass->templateArgs[cp];
14564 else
14565 arg = expClass->templateArgs[p];
14566 {
14567 char argument[256];
14568
14569 argument[0] = '\0';
14570 switch(param->type)
14571 {
14572 case 2:
14573 {
14574 char expString[1024];
14575 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14576 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14577 struct Expression * exp;
14578 char * string = PrintHexUInt64(arg.expression.ui64);
14579
14580 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14581 ProcessExpressionType(exp);
14582 ComputeExpression(exp);
14583 expString[0] = '\0';
14584 PrintExpression(exp, expString);
14585 strcat(argument, expString);
14586 FreeExpression(exp);
14587 break;
14588 }
14589 case 1:
14590 {
14591 strcat(argument, arg.member->name);
14592 break;
14593 }
14594 case 0:
14595 {
14596 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14597 strcat(argument, arg.dataTypeString);
14598 break;
14599 }
14600 }
14601 if(argument[0])
14602 {
14603 if(paramCount)
14604 strcat(templateString, ", ");
14605 if(lastParam != p - 1)
14606 {
14607 strcat(templateString, param->name);
14608 strcat(templateString, " = ");
14609 }
14610 strcat(templateString, argument);
14611 paramCount++;
14612 lastParam = p;
14613 }
14614 }
14615 p++;
14616 }
14617 }
14618 {
14619 int len = strlen(templateString);
14620
14621 if(templateString[len - 1] == '>')
14622 templateString[len++] = ' ';
14623 templateString[len++] = '>';
14624 templateString[len++] = '\0';
14625 }
14626 FreeType(exp->expType);
14627 {
14628 struct Context * context = SetupTemplatesContext(tClass);
14629
14630 exp->expType = ProcessTypeString(templateString, 0x0);
14631 FinishTemplatesContext(context);
14632 }
14633 }
14634 }
14635 }
14636 }
14637 else
14638 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "undefined class %s\n", (((void *)0))), (id && (!id->_class || id->_class->name)) ? (id->classSym ? id->classSym->string : (type->_class ? type->_class->string : (((void *)0)))) : "(null)");
14639 }
14640 else if(type && (type->kind == 9 || type->kind == 10))
14641 {
14642 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
14643
14644 if(memberType)
14645 {
14646 exp->expType = memberType;
14647 if(memberType)
14648 memberType->refCount++;
14649 }
14650 }
14651 else
14652 {
14653 char expString[10240];
14654
14655 expString[0] = '\0';
14656 if(inCompiler)
14657 {
14658 PrintExpression(exp, expString);
14659 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14660 }
14661 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
14662 }
14663 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
14664 {
14665 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
14666 {
14667 struct Identifier * id = exp->member.member;
14668 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));
14669
14670 if(_class)
14671 {
14672 FreeType(exp->expType);
14673 exp->expType = ReplaceThisClassType(_class);
14674 }
14675 }
14676 }
14677 yylloc = oldyylloc;
14678 break;
14679 }
14680 case 9:
14681 {
14682 struct Type * destType = exp->destType;
14683
14684 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
14685 {
14686 exp->member.member->classSym = exp->member.member->_class->symbol;
14687 }
14688 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
14689 exp->type = 8;
14690 if(destType)
14691 destType->count++;
14692 ProcessExpressionType(exp);
14693 if(destType)
14694 destType->count--;
14695 break;
14696 }
14697 case 15:
14698 {
14699 struct Symbol * classSym = exp->_class->symbol;
14700
14701 if(classSym && classSym->registered)
14702 {
14703 if(classSym->registered->type == 5)
14704 {
14705 char name[1024];
14706
14707 name[0] = '\0';
14708 DeclareStruct(classSym->string, 0x0);
14709 FreeSpecifier(exp->_class);
14710 exp->type = 10;
14711 FullClassNameCat(name, classSym->string, 0x0);
14712 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
14713 }
14714 else
14715 {
14716 if(classSym->registered->fixed)
14717 {
14718 FreeSpecifier(exp->_class);
14719 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
14720 exp->type = 2;
14721 }
14722 else
14723 {
14724 char className[1024];
14725
14726 strcpy(className, "__ecereClass_");
14727 FullClassNameCat(className, classSym->string, 0x1);
14728 MangleClassName(className);
14729 DeclareClass(classSym, className);
14730 FreeExpContents(exp);
14731 exp->type = 9;
14732 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14733 exp->member.member = MkIdentifier("structSize");
14734 }
14735 }
14736 }
14737 exp->expType = __extension__ ({
14738 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14739
14740 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
14741 });
14742 break;
14743 }
14744 case 10:
14745 {
14746 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
14747
14748 exp->expType = __extension__ ({
14749 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14750
14751 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
14752 });
14753 exp->isConstant = 0x1;
14754 DeclareType(type, 0x0, 0x0);
14755 FreeType(type);
14756 break;
14757 }
14758 case 11:
14759 {
14760 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14761
14762 type->count = 1;
14763 FreeType(exp->cast.exp->destType);
14764 exp->cast.exp->destType = type;
14765 type->refCount++;
14766 ProcessExpressionType(exp->cast.exp);
14767 type->count = 0;
14768 exp->expType = type;
14769 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14770 {
14771 void * prev = exp->prev, * next = exp->next;
14772 struct Type * expType = exp->cast.exp->destType;
14773 struct Expression * castExp = exp->cast.exp;
14774 struct Type * destType = exp->destType;
14775
14776 if(expType)
14777 expType->refCount++;
14778 FreeType(exp->expType);
14779 FreeTypeName(exp->cast.typeName);
14780 *exp = *castExp;
14781 FreeType(exp->expType);
14782 FreeType(exp->destType);
14783 exp->expType = expType;
14784 exp->destType = destType;
14785 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14786 exp->prev = prev;
14787 exp->next = next;
14788 }
14789 else
14790 {
14791 exp->isConstant = exp->cast.exp->isConstant;
14792 }
14793 break;
14794 }
14795 case 35:
14796 {
14797 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14798
14799 exp->expType = type;
14800 break;
14801 }
14802 case 36:
14803 {
14804 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14805
14806 ProcessExpressionType(exp->vaArg.exp);
14807 exp->expType = type;
14808 break;
14809 }
14810 case 12:
14811 {
14812 struct Expression * e;
14813
14814 exp->isConstant = 0x1;
14815 FreeType(exp->cond.cond->destType);
14816 exp->cond.cond->destType = MkClassType("bool");
14817 exp->cond.cond->destType->truth = 0x1;
14818 ProcessExpressionType(exp->cond.cond);
14819 if(!exp->cond.cond->isConstant)
14820 exp->isConstant = 0x0;
14821 for(e = (*exp->cond.exp).first; e; e = e->next)
14822 {
14823 if(!e->next)
14824 {
14825 FreeType(e->destType);
14826 e->destType = exp->destType;
14827 if(e->destType)
14828 e->destType->refCount++;
14829 }
14830 ProcessExpressionType(e);
14831 if(!e->next)
14832 {
14833 exp->expType = e->expType;
14834 if(e->expType)
14835 e->expType->refCount++;
14836 }
14837 if(!e->isConstant)
14838 exp->isConstant = 0x0;
14839 }
14840 FreeType(exp->cond.elseExp->destType);
14841 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14842 if(exp->cond.elseExp->destType)
14843 exp->cond.elseExp->destType->refCount++;
14844 ProcessExpressionType(exp->cond.elseExp);
14845 if(!exp->cond.elseExp->isConstant)
14846 exp->isConstant = 0x0;
14847 break;
14848 }
14849 case 25:
14850 {
14851 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14852 {
14853 struct Statement * last = (*exp->compound->compound.statements).last;
14854
14855 if(last->type == 3 && last->expressions && (*last->expressions).last)
14856 {
14857 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14858 if(exp->destType)
14859 exp->destType->refCount++;
14860 }
14861 ProcessStatement(exp->compound);
14862 exp->expType = (last->expressions && (*last->expressions).last) ? ((struct Expression *)(*last->expressions).last)->expType : (((void *)0));
14863 if(exp->expType)
14864 exp->expType->refCount++;
14865 }
14866 break;
14867 }
14868 case 26:
14869 {
14870 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14871
14872 if(spec && spec->type == 1)
14873 {
14874 exp->expType = MkClassType(spec->name);
14875 exp->expType->kind = 19;
14876 exp->byReference = 0x1;
14877 }
14878 else
14879 {
14880 exp->expType = MkClassType("ecere::com::Class");
14881 exp->byReference = 0x1;
14882 }
14883 break;
14884 }
14885 case 27:
14886 {
14887 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14888
14889 if(_class)
14890 {
14891 struct Identifier * id = exp->classData.id;
14892 char structName[1024];
14893 struct Expression * classExp;
14894
14895 strcpy(structName, "__ecereClassData_");
14896 FullClassNameCat(structName, _class->fullName, 0x0);
14897 exp->type = 9;
14898 exp->member.member = id;
14899 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14900 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14901 else
14902 classExp = MkExpIdentifier(MkIdentifier("class"));
14903 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"))))))));
14904 ProcessExpressionType(exp);
14905 return ;
14906 }
14907 break;
14908 }
14909 case 37:
14910 {
14911 struct Type * type = (((void *)0));
14912 char * typeString = (((void *)0));
14913 char typeStringBuf[1024];
14914
14915 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))
14916 {
14917 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14918
14919 typeString = templateClass->templateArgs[2].dataTypeString;
14920 }
14921 else if(exp->list)
14922 {
14923 struct Expression * e;
14924
14925 for(e = (*exp->list).first; e; e = e->next)
14926 {
14927 ProcessExpressionType(e);
14928 if(e->expType)
14929 {
14930 if(!type)
14931 {
14932 type = e->expType;
14933 type->refCount++;
14934 }
14935 else
14936 {
14937 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14938 {
14939 FreeType(type);
14940 type = e->expType;
14941 e->expType = (((void *)0));
14942 e = (*exp->list).first;
14943 ProcessExpressionType(e);
14944 if(e->expType)
14945 {
14946 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14947 {
14948 FreeType(e->expType);
14949 e->expType = (((void *)0));
14950 FreeType(type);
14951 type = (((void *)0));
14952 break;
14953 }
14954 }
14955 }
14956 }
14957 if(e->expType)
14958 {
14959 FreeType(e->expType);
14960 e->expType = (((void *)0));
14961 }
14962 }
14963 }
14964 if(type)
14965 {
14966 typeStringBuf[0] = '\0';
14967 PrintTypeNoConst(type, typeStringBuf, 0x0, 0x1);
14968 typeString = typeStringBuf;
14969 FreeType(type);
14970 type = (((void *)0));
14971 }
14972 }
14973 if(typeString)
14974 {
14975 char templateString[1024];
14976 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14977 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14978 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14979 struct Expression * expExt;
14980 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14981
14982 sprintf(templateString, "Container<%s>", typeString);
14983 if(exp->list)
14984 {
14985 struct Expression * e;
14986
14987 type = ProcessTypeString(typeString, 0x0);
14988 while(e = (*exp->list).first)
14989 {
14990 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14991 e->destType = type;
14992 type->refCount++;
14993 ProcessExpressionType(e);
14994 ListAdd(initializers, MkInitializerAssignment(e));
14995 }
14996 FreeType(type);
14997 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14998 }
14999 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
15000 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
15001 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
15002 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
15003 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
15004 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
15005 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
15006 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
15007 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
15008 ListAdd(structInitializers, MkInitializerAssignment(__extension__ ({
15009 struct Expression * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
15010
15011 __ecereInstance1->type = 2, __ecereInstance1->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, (void *)0), __ecereInstance1;
15012 })));
15013 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
15014 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
15015 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
15016 exp->expType = ProcessTypeString(templateString, 0x0);
15017 exp->type = 5;
15018 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
15019 ProcessExpressionType(expExt);
15020 }
15021 else
15022 {
15023 exp->expType = ProcessTypeString("Container", 0x0);
15024 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15025 }
15026 break;
15027 }
15028 }
15029 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
15030 {
15031 FreeType(exp->expType);
15032 exp->expType = ReplaceThisClassType(thisClass);
15033 }
15034 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
15035 {
15036 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
15037
15038 if(symbol)
15039 {
15040 if(exp->expType->kind != 15)
15041 {
15042 struct Type * member;
15043 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
15044
15045 FreeType(exp->expType);
15046 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
15047 exp->expType->kind = symbol->type->kind;
15048 exp->expType->refCount++;
15049 exp->expType->enumName = enumName;
15050 exp->expType->members = symbol->type->members;
15051 for(member = symbol->type->members.first; member; member = member->next)
15052 member->refCount++;
15053 }
15054 else
15055 {
15056 struct __ecereNameSpace__ecere__sys__NamedLink * member;
15057
15058 for(member = symbol->type->members.first; member; member = member->next)
15059 {
15060 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(structSize_NamedLink), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
15061
15062 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
15063 }
15064 }
15065 }
15066 }
15067 yylloc = exp->loc;
15068 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
15069 ;
15070 else if(exp->destType && !exp->destType->keepCast)
15071 {
15072 if(!CheckExpressionType(exp, exp->destType, 0x0))
15073 {
15074 if(!exp->destType->count || unresolved)
15075 {
15076 if(!exp->expType)
15077 {
15078 yylloc = exp->loc;
15079 if(exp->destType->kind != 14)
15080 {
15081 char type2[1024];
15082
15083 type2[0] = '\0';
15084 if(inCompiler)
15085 {
15086 char expString[10240];
15087
15088 expString[0] = '\0';
15089 PrintType(exp->destType, type2, 0x0, 0x1);
15090 if(inCompiler)
15091 {
15092 PrintExpression(exp, expString);
15093 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15094 }
15095 if(unresolved)
15096 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
15097 else if(exp->type != 16)
15098 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
15099 }
15100 }
15101 else
15102 {
15103 char expString[10240];
15104
15105 expString[0] = '\0';
15106 if(inCompiler)
15107 {
15108 PrintExpression(exp, expString);
15109 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15110 }
15111 if(unresolved)
15112 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
15113 else if(exp->type != 16)
15114 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
15115 }
15116 }
15117 else
15118 {
15119 char type1[1024];
15120 char type2[1024];
15121
15122 type1[0] = '\0';
15123 type2[0] = '\0';
15124 if(inCompiler)
15125 {
15126 PrintType(exp->expType, type1, 0x0, 0x1);
15127 PrintType(exp->destType, type2, 0x0, 0x1);
15128 }
15129 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)))
15130 ;
15131 else
15132 {
15133 char expString[10240];
15134
15135 expString[0] = '\0';
15136 if(inCompiler)
15137 {
15138 PrintExpression(exp, expString);
15139 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15140 }
15141 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
15142 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
15143 FreeType(exp->expType);
15144 exp->destType->refCount++;
15145 exp->expType = exp->destType;
15146 }
15147 }
15148 }
15149 }
15150 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
15151 {
15152 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
15153 char typeString[1024];
15154 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15155 struct Declarator * decl;
15156
15157 typeString[0] = '\0';
15158 *newExp = *exp;
15159 if(exp->expType)
15160 exp->expType->refCount++;
15161 if(exp->expType)
15162 exp->expType->refCount++;
15163 exp->type = 11;
15164 newExp->destType = exp->expType;
15165 PrintType(exp->expType, typeString, 0x0, 0x0);
15166 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
15167 exp->cast.typeName = MkTypeName(specs, decl);
15168 exp->cast.exp = newExp;
15169 }
15170 }
15171 else if(unresolved)
15172 {
15173 if(exp->identifier->_class && exp->identifier->_class->name)
15174 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
15175 else if(exp->identifier->string && exp->identifier->string[0])
15176 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
15177 }
15178 else if(!exp->expType && exp->type != 16)
15179 {
15180 char expString[10240];
15181
15182 expString[0] = '\0';
15183 if(inCompiler)
15184 {
15185 PrintExpression(exp, expString);
15186 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15187 }
15188 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
15189 }
15190 if(inCompiler)
15191 ApplyAnyObjectLogic(exp);
15192 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)))
15193 {
15194 exp->byReference = 0x1;
15195 }
15196 yylloc = oldyylloc;
15197 }
15198
15199 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)
15200 {
15201 if(*curMember)
15202 {
15203 *curMember = (*curMember)->next;
15204 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
15205 {
15206 *curMember = subMemberStack[--(*subMemberStackPos)];
15207 *curMember = (*curMember)->next;
15208 }
15209 while((*curMember) && (*curMember)->isProperty)
15210 *curMember = (*curMember)->next;
15211 if(subMemberStackPos)
15212 {
15213 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
15214 {
15215 subMemberStack[(*subMemberStackPos)++] = *curMember;
15216 *curMember = (*curMember)->members.first;
15217 while(*curMember && (*curMember)->isProperty)
15218 *curMember = (*curMember)->next;
15219 }
15220 }
15221 }
15222 while(!*curMember)
15223 {
15224 if(!*curMember)
15225 {
15226 if(subMemberStackPos && *subMemberStackPos)
15227 {
15228 *curMember = subMemberStack[--(*subMemberStackPos)];
15229 *curMember = (*curMember)->next;
15230 }
15231 else
15232 {
15233 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
15234
15235 if(*curClass == _class)
15236 break;
15237 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
15238 ;
15239 *curMember = (*curClass)->membersAndProperties.first;
15240 }
15241 while((*curMember) && (*curMember)->isProperty)
15242 *curMember = (*curMember)->next;
15243 if(subMemberStackPos)
15244 {
15245 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
15246 {
15247 subMemberStack[(*subMemberStackPos)++] = *curMember;
15248 *curMember = (*curMember)->members.first;
15249 while(*curMember && (*curMember)->isProperty)
15250 *curMember = (*curMember)->next;
15251 }
15252 }
15253 }
15254 }
15255 }
15256
15257 static void ProcessInitializer(struct Initializer * init, struct Type * type)
15258 {
15259 switch(init->type)
15260 {
15261 case 0:
15262 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
15263 {
15264 if(init->exp && !init->exp->destType)
15265 {
15266 FreeType(init->exp->destType);
15267 init->exp->destType = type;
15268 if(type)
15269 type->refCount++;
15270 }
15271 if(init->exp)
15272 {
15273 ProcessExpressionType(init->exp);
15274 init->isConstant = init->exp->isConstant;
15275 }
15276 break;
15277 }
15278 else
15279 {
15280 struct Expression * exp = init->exp;
15281 struct Instantiation * inst = exp->instance;
15282 struct MembersInit * members;
15283
15284 init->type = 1;
15285 init->list = MkList();
15286 if(inst->members)
15287 {
15288 for(members = (*inst->members).first; members; members = members->next)
15289 {
15290 if(members->type == 0)
15291 {
15292 struct MemberInit * member;
15293
15294 for(member = (*members->dataMembers).first; member; member = member->next)
15295 {
15296 ListAdd(init->list, member->initializer);
15297 member->initializer = (((void *)0));
15298 }
15299 }
15300 }
15301 }
15302 FreeExpression(exp);
15303 }
15304 case 1:
15305 {
15306 struct Initializer * i;
15307 struct Type * initializerType = (((void *)0));
15308 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
15309 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
15310 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
15311 int subMemberStackPos = 0;
15312
15313 if(type && type->kind == 12)
15314 initializerType = Dereference(type);
15315 else if(type && (type->kind == 9 || type->kind == 10))
15316 initializerType = type->members.first;
15317 for(i = (*init->list).first; i; i = i->next)
15318 {
15319 if(type && type->kind == 8 && type->_class && type->_class->registered)
15320 {
15321 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
15322 if(curMember)
15323 {
15324 if(!curMember->dataType)
15325 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
15326 initializerType = curMember->dataType;
15327 }
15328 }
15329 ProcessInitializer(i, initializerType);
15330 if(initializerType && type && (type->kind == 9 || type->kind == 10))
15331 initializerType = initializerType->next;
15332 if(!i->isConstant)
15333 init->isConstant = 0x0;
15334 }
15335 if(type && type->kind == 12)
15336 FreeType(initializerType);
15337 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
15338 {
15339 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
15340 }
15341 break;
15342 }
15343 }
15344 }
15345
15346 extern struct Symbol * FindType(struct Context * ctx, char *  name);
15347
15348 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
15349
15350 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
15351 {
15352 switch(spec->type)
15353 {
15354 case 0:
15355 {
15356 if(spec->specifier == THISCLASS)
15357 {
15358 if(thisClass)
15359 {
15360 spec->type = 1;
15361 spec->name = ReplaceThisClass(thisClass);
15362 spec->symbol = FindClass(spec->name);
15363 ProcessSpecifier(spec, declareStruct);
15364 }
15365 }
15366 break;
15367 }
15368 case 1:
15369 {
15370 struct Symbol * symbol = FindType(curContext, spec->name);
15371
15372 if(symbol)
15373 DeclareType(symbol->type, 0x1, 0x1);
15374 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
15375 DeclareStruct(spec->name, 0x0);
15376 break;
15377 }
15378 case 2:
15379 {
15380 struct Enumerator * e;
15381
15382 if(spec->list)
15383 {
15384 for(e = (*spec->list).first; e; e = e->next)
15385 {
15386 if(e->exp)
15387 ProcessExpressionType(e->exp);
15388 }
15389 }
15390 break;
15391 }
15392 case 3:
15393 case 4:
15394 {
15395 if(spec->definitions)
15396 {
15397 struct ClassDef * def;
15398 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
15399
15400 ProcessClass(spec->definitions, symbol);
15401 }
15402 break;
15403 }
15404 }
15405 }
15406
15407 static void ProcessDeclarator(struct Declarator * decl)
15408 {
15409 switch(decl->type)
15410 {
15411 case 1:
15412 if(decl->identifier->classSym)
15413 {
15414 FreeSpecifier(decl->identifier->_class);
15415 decl->identifier->_class = (((void *)0));
15416 }
15417 break;
15418 case 3:
15419 if(decl->array.exp)
15420 ProcessExpressionType(decl->array.exp);
15421 case 0:
15422 case 2:
15423 case 4:
15424 case 5:
15425 case 6:
15426 case 7:
15427 if(decl->declarator)
15428 ProcessDeclarator(decl->declarator);
15429 if(decl->type == 4)
15430 {
15431 struct Identifier * id = GetDeclId(decl);
15432
15433 if(id && id->_class)
15434 {
15435 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
15436
15437 if(!decl->function.parameters)
15438 decl->function.parameters = MkList();
15439 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
15440 id->_class = (((void *)0));
15441 }
15442 if(decl->function.parameters)
15443 {
15444 struct TypeName * param;
15445
15446 for(param = (*decl->function.parameters).first; param; param = param->next)
15447 {
15448 if(param->qualifiers && (*param->qualifiers).first)
15449 {
15450 struct Specifier * spec = (*param->qualifiers).first;
15451
15452 if(spec && spec->specifier == TYPED_OBJECT)
15453 {
15454 struct Declarator * d = param->declarator;
15455 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);
15456
15457 FreeList(param->qualifiers, FreeSpecifier);
15458 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
15459 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
15460 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
15461 param = newParam;
15462 }
15463 else if(spec && spec->specifier == ANY_OBJECT)
15464 {
15465 struct Declarator * d = param->declarator;
15466
15467 FreeList(param->qualifiers, FreeSpecifier);
15468 param->qualifiers = MkListOne(MkSpecifier(VOID));
15469 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
15470 }
15471 else if(spec->specifier == THISCLASS)
15472 {
15473 if(thisClass)
15474 {
15475 spec->type = 1;
15476 spec->name = ReplaceThisClass(thisClass);
15477 spec->symbol = FindClass(spec->name);
15478 ProcessSpecifier(spec, 0x0);
15479 }
15480 }
15481 }
15482 if(param->declarator)
15483 ProcessDeclarator(param->declarator);
15484 }
15485 }
15486 }
15487 break;
15488 }
15489 }
15490
15491 extern struct Identifier * CopyIdentifier(struct Identifier * id);
15492
15493 extern void FreeInitDeclarator(struct InitDeclarator * decl);
15494
15495 static void ProcessDeclaration(struct Declaration * decl)
15496 {
15497 yylloc = decl->loc;
15498 switch(decl->type)
15499 {
15500 case 1:
15501 {
15502 unsigned int declareStruct = 0x0;
15503
15504 if(decl->declarators)
15505 {
15506 struct InitDeclarator * d;
15507
15508 for(d = (*decl->declarators).first; d; d = d->next)
15509 {
15510 struct Type * type, * subType;
15511
15512 ProcessDeclarator(d->declarator);
15513 type = ProcessType(decl->specifiers, d->declarator);
15514 if(d->initializer)
15515 {
15516 ProcessInitializer(d->initializer, type);
15517 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
15518 {
15519 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
15520 {
15521 struct Instantiation * inst = d->initializer->exp->instance;
15522
15523 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
15524 d->initializer->exp->instance = (((void *)0));
15525 if(decl->specifiers)
15526 FreeList(decl->specifiers, FreeSpecifier);
15527 FreeList(decl->declarators, FreeInitDeclarator);
15528 d = (((void *)0));
15529 decl->type = 2;
15530 decl->inst = inst;
15531 }
15532 }
15533 }
15534 for(subType = type; subType; )
15535 {
15536 if(subType->kind == 8)
15537 {
15538 declareStruct = 0x1;
15539 break;
15540 }
15541 else if(subType->kind == 13)
15542 break;
15543 else if(subType->kind == 12)
15544 subType = subType->arrayType;
15545 else
15546 break;
15547 }
15548 FreeType(type);
15549 if(!d)
15550 break;
15551 }
15552 }
15553 if(decl->specifiers)
15554 {
15555 struct Specifier * s;
15556
15557 for(s = (*decl->specifiers).first; s; s = s->next)
15558 {
15559 ProcessSpecifier(s, declareStruct);
15560 }
15561 }
15562 break;
15563 }
15564 case 2:
15565 {
15566 ProcessInstantiationType(decl->inst);
15567 break;
15568 }
15569 case 0:
15570 {
15571 struct Specifier * spec;
15572 struct Declarator * d;
15573 unsigned int declareStruct = 0x0;
15574
15575 if(decl->declarators)
15576 {
15577 for(d = (*decl->declarators).first; d; d = d->next)
15578 {
15579 struct Type * type = ProcessType(decl->specifiers, d->declarator);
15580 struct Type * subType;
15581
15582 ProcessDeclarator(d);
15583 for(subType = type; subType; )
15584 {
15585 if(subType->kind == 8)
15586 {
15587 declareStruct = 0x1;
15588 break;
15589 }
15590 else if(subType->kind == 13)
15591 break;
15592 else if(subType->kind == 12)
15593 subType = subType->arrayType;
15594 else
15595 break;
15596 }
15597 FreeType(type);
15598 }
15599 }
15600 if(decl->specifiers)
15601 {
15602 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
15603 ProcessSpecifier(spec, declareStruct);
15604 }
15605 break;
15606 }
15607 }
15608 }
15609
15610 static struct FunctionDefinition * curFunction;
15611
15612 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
15613 {
15614 char propName[1024], propNameM[1024];
15615 char getName[1024], setName[1024];
15616 struct __ecereNameSpace__ecere__sys__OldList * args;
15617
15618 DeclareProperty(prop, setName, getName);
15619 strcpy(propName, "__ecereProp_");
15620 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15621 strcat(propName, "_");
15622 FullClassNameCat(propName, prop->name, 0x1);
15623 MangleClassName(propName);
15624 strcpy(propNameM, "__ecerePropM_");
15625 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
15626 strcat(propNameM, "_");
15627 FullClassNameCat(propNameM, prop->name, 0x1);
15628 MangleClassName(propNameM);
15629 if(prop->isWatchable)
15630 {
15631 args = MkList();
15632 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15633 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15634 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15635 args = MkList();
15636 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15637 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15638 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15639 }
15640 {
15641 args = MkList();
15642 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15643 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15644 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15645 args = MkList();
15646 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15647 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15648 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15649 }
15650 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15651 curFunction->propSet->fireWatchersDone = 0x1;
15652 }
15653
15654 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
15655
15656 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
15657
15658 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
15659
15660 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
15661
15662 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
15663
15664 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
15665
15666 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
15667
15668 extern void FreePropertyWatch(struct PropertyWatch * watcher);
15669
15670 static void ProcessStatement(struct Statement * stmt)
15671 {
15672 yylloc = stmt->loc;
15673 switch(stmt->type)
15674 {
15675 case 0:
15676 ProcessStatement(stmt->labeled.stmt);
15677 break;
15678 case 1:
15679 if(stmt->caseStmt.exp)
15680 {
15681 FreeType(stmt->caseStmt.exp->destType);
15682 stmt->caseStmt.exp->destType = curSwitchType;
15683 if(curSwitchType)
15684 curSwitchType->refCount++;
15685 ProcessExpressionType(stmt->caseStmt.exp);
15686 ComputeExpression(stmt->caseStmt.exp);
15687 }
15688 if(stmt->caseStmt.stmt)
15689 ProcessStatement(stmt->caseStmt.stmt);
15690 break;
15691 case 2:
15692 {
15693 if(stmt->compound.context)
15694 {
15695 struct Declaration * decl;
15696 struct Statement * s;
15697 struct Statement * prevCompound = curCompound;
15698 struct Context * prevContext = curContext;
15699
15700 if(!stmt->compound.isSwitch)
15701 {
15702 curCompound = stmt;
15703 curContext = stmt->compound.context;
15704 }
15705 if(stmt->compound.declarations)
15706 {
15707 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
15708 ProcessDeclaration(decl);
15709 }
15710 if(stmt->compound.statements)
15711 {
15712 for(s = (*stmt->compound.statements).first; s; s = s->next)
15713 ProcessStatement(s);
15714 }
15715 curContext = prevContext;
15716 curCompound = prevCompound;
15717 }
15718 break;
15719 }
15720 case 3:
15721 {
15722 struct Expression * exp;
15723
15724 if(stmt->expressions)
15725 {
15726 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15727 ProcessExpressionType(exp);
15728 }
15729 break;
15730 }
15731 case 4:
15732 {
15733 struct Expression * exp;
15734
15735 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15736 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15737 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15738 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15739 {
15740 ProcessExpressionType(exp);
15741 }
15742 if(stmt->ifStmt.stmt)
15743 ProcessStatement(stmt->ifStmt.stmt);
15744 if(stmt->ifStmt.elseStmt)
15745 ProcessStatement(stmt->ifStmt.elseStmt);
15746 break;
15747 }
15748 case 5:
15749 {
15750 struct Type * oldSwitchType = curSwitchType;
15751
15752 if(stmt->switchStmt.exp)
15753 {
15754 struct Expression * exp;
15755
15756 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15757 {
15758 if(!exp->next)
15759 {
15760 ProcessExpressionType(exp);
15761 }
15762 if(!exp->next)
15763 curSwitchType = exp->expType;
15764 }
15765 }
15766 ProcessStatement(stmt->switchStmt.stmt);
15767 curSwitchType = oldSwitchType;
15768 break;
15769 }
15770 case 6:
15771 {
15772 if(stmt->whileStmt.exp)
15773 {
15774 struct Expression * exp;
15775
15776 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15777 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15778 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15779 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15780 {
15781 ProcessExpressionType(exp);
15782 }
15783 }
15784 if(stmt->whileStmt.stmt)
15785 ProcessStatement(stmt->whileStmt.stmt);
15786 break;
15787 }
15788 case 7:
15789 {
15790 if(stmt->doWhile.exp)
15791 {
15792 struct Expression * exp;
15793
15794 if((*stmt->doWhile.exp).last)
15795 {
15796 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15797 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15798 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15799 }
15800 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15801 {
15802 ProcessExpressionType(exp);
15803 }
15804 }
15805 if(stmt->doWhile.stmt)
15806 ProcessStatement(stmt->doWhile.stmt);
15807 break;
15808 }
15809 case 8:
15810 {
15811 struct Expression * exp;
15812
15813 if(stmt->forStmt.init)
15814 ProcessStatement(stmt->forStmt.init);
15815 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15816 {
15817 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15818 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15819 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15820 }
15821 if(stmt->forStmt.check)
15822 ProcessStatement(stmt->forStmt.check);
15823 if(stmt->forStmt.increment)
15824 {
15825 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15826 ProcessExpressionType(exp);
15827 }
15828 if(stmt->forStmt.stmt)
15829 ProcessStatement(stmt->forStmt.stmt);
15830 break;
15831 }
15832 case 18:
15833 {
15834 struct Identifier * id = stmt->forEachStmt.id;
15835 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15836 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15837 struct Statement * block = stmt->forEachStmt.stmt;
15838 char iteratorType[1024];
15839 struct Type * source;
15840 struct Expression * e;
15841 unsigned int isBuiltin = exp && (*exp).last && (((struct Expression *)(*exp).last)->type == 37 || (((struct Expression *)(*exp).last)->type == 11 && ((struct Expression *)(*exp).last)->cast.exp->type == 37));
15842 struct Expression * arrayExp;
15843 char * typeString = (((void *)0));
15844 int builtinCount = 0;
15845
15846 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15847 {
15848 if(!e->next)
15849 {
15850 FreeType(e->destType);
15851 e->destType = ProcessTypeString("Container", 0x0);
15852 }
15853 if(!isBuiltin || e->next)
15854 ProcessExpressionType(e);
15855 }
15856 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15857 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15858 {
15859 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15860 struct Symbol * symbol;
15861 struct Expression * expIt = (((void *)0));
15862 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15863 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15864 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15865 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15866
15867 stmt->type = 2;
15868 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15869 stmt->compound.context->parent = curContext;
15870 curContext = stmt->compound.context;
15871 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15872 {
15873 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15874 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15875
15876 isCustomAVLTree = 0x1;
15877 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15878 isAVLTree = 0x1;
15879 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15880 isMap = 0x1;
15881 }
15882 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15883 isArray = 0x1;
15884 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15885 {
15886 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15887
15888 isLinkList = 0x1;
15889 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15890 }
15891 if(isArray)
15892 {
15893 struct Declarator * decl;
15894 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15895
15896 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15897 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15898 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15899 }
15900 else if(isBuiltin)
15901 {
15902 struct Type * type = (((void *)0));
15903 char typeStringBuf[1024];
15904
15905 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15906 if(((struct Expression *)(*exp).last)->type == 11)
15907 {
15908 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15909
15910 if(typeName)
15911 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15912 }
15913 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)
15914 {
15915 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15916
15917 typeString = templateClass->templateArgs[2].dataTypeString;
15918 }
15919 else if(arrayExp->list)
15920 {
15921 struct Expression * e;
15922
15923 for(e = (*arrayExp->list).first; e; e = e->next)
15924 {
15925 ProcessExpressionType(e);
15926 if(e->expType)
15927 {
15928 if(!type)
15929 {
15930 type = e->expType;
15931 type->refCount++;
15932 }
15933 else
15934 {
15935 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15936 {
15937 FreeType(type);
15938 type = e->expType;
15939 e->expType = (((void *)0));
15940 e = (*arrayExp->list).first;
15941 ProcessExpressionType(e);
15942 if(e->expType)
15943 {
15944 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15945 {
15946 FreeType(e->expType);
15947 e->expType = (((void *)0));
15948 FreeType(type);
15949 type = (((void *)0));
15950 break;
15951 }
15952 }
15953 }
15954 }
15955 if(e->expType)
15956 {
15957 FreeType(e->expType);
15958 e->expType = (((void *)0));
15959 }
15960 }
15961 }
15962 if(type)
15963 {
15964 typeStringBuf[0] = '\0';
15965 PrintType(type, typeStringBuf, 0x0, 0x1);
15966 typeString = typeStringBuf;
15967 FreeType(type);
15968 }
15969 }
15970 if(typeString)
15971 {
15972 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15973 struct Declarator * decl;
15974 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15975
15976 if(arrayExp->list)
15977 {
15978 struct Expression * e;
15979
15980 builtinCount = (*arrayExp->list).count;
15981 type = ProcessTypeString(typeString, 0x0);
15982 while(e = (*arrayExp->list).first)
15983 {
15984 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15985 e->destType = type;
15986 type->refCount++;
15987 ProcessExpressionType(e);
15988 ListAdd(initializers, MkInitializerAssignment(e));
15989 }
15990 FreeType(type);
15991 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15992 }
15993 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15994 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15995 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(PlugDeclarator(decl, MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), (((void *)0)))), MkInitializerList(initializers)))));
15996 FreeList(exp, FreeExpression);
15997 }
15998 else
15999 {
16000 arrayExp->expType = ProcessTypeString("Container", 0x0);
16001 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
16002 }
16003 }
16004 else if(isLinkList && !isList)
16005 {
16006 struct Declarator * decl;
16007 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16008
16009 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
16010 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
16011 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
16012 }
16013 else if(_class->templateArgs)
16014 {
16015 if(isMap)
16016 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
16017 else
16018 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
16019 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
16020 }
16021 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
16022 if(block)
16023 {
16024 switch(block->type)
16025 {
16026 case 2:
16027 if(block->compound.context)
16028 block->compound.context->parent = stmt->compound.context;
16029 break;
16030 case 4:
16031 if(block->ifStmt.stmt && block->ifStmt.stmt->type == 2 && block->ifStmt.stmt->compound.context)
16032 block->ifStmt.stmt->compound.context->parent = stmt->compound.context;
16033 if(block->ifStmt.elseStmt && block->ifStmt.elseStmt->type == 2 && block->ifStmt.elseStmt->compound.context)
16034 block->ifStmt.elseStmt->compound.context->parent = stmt->compound.context;
16035 break;
16036 case 5:
16037 if(block->switchStmt.stmt && block->switchStmt.stmt->type == 2 && block->switchStmt.stmt->compound.context)
16038 block->switchStmt.stmt->compound.context->parent = stmt->compound.context;
16039 break;
16040 case 6:
16041 if(block->whileStmt.stmt && block->whileStmt.stmt->type == 2 && block->whileStmt.stmt->compound.context)
16042 block->whileStmt.stmt->compound.context->parent = stmt->compound.context;
16043 break;
16044 case 7:
16045 if(block->doWhile.stmt && block->doWhile.stmt->type == 2 && block->doWhile.stmt->compound.context)
16046 block->doWhile.stmt->compound.context->parent = stmt->compound.context;
16047 break;
16048 case 8:
16049 if(block->forStmt.stmt && block->forStmt.stmt->type == 2 && block->forStmt.stmt->compound.context)
16050 block->forStmt.stmt->compound.context->parent = stmt->compound.context;
16051 break;
16052 case 18:
16053 if(block->forEachStmt.stmt && block->forEachStmt.stmt->type == 2 && block->forEachStmt.stmt->compound.context)
16054 block->forEachStmt.stmt->compound.context->parent = stmt->compound.context;
16055 break;
16056 }
16057 }
16058 if(filter)
16059 {
16060 block = MkIfStmt(filter, block, (((void *)0)));
16061 }
16062 if(isArray)
16063 {
16064 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));
16065 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
16066 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
16067 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
16068 }
16069 else if(isBuiltin)
16070 {
16071 char count[128];
16072
16073 sprintf(count, "%d", builtinCount);
16074 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));
16075 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
16076 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
16077 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
16078 }
16079 else if(isLinkList && !isList)
16080 {
16081 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
16082 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
16083
16084 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
16085 {
16086 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));
16087 }
16088 else
16089 {
16090 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16091 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
16092
16093 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));
16094 }
16095 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
16096 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
16097 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
16098 }
16099 else
16100 {
16101 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
16102 }
16103 ProcessExpressionType(expIt);
16104 if((*stmt->compound.declarations).first)
16105 ProcessDeclaration((*stmt->compound.declarations).first);
16106 if(symbol)
16107 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
16108 ProcessStatement(stmt);
16109 curContext = stmt->compound.context->parent;
16110 break;
16111 }
16112 else
16113 {
16114 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
16115 }
16116 break;
16117 }
16118 case 9:
16119 break;
16120 case 10:
16121 break;
16122 case 11:
16123 break;
16124 case 12:
16125 {
16126 struct Expression * exp;
16127
16128 if(stmt->expressions)
16129 {
16130 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
16131 {
16132 if(!exp->next)
16133 {
16134 if(curFunction && !curFunction->type)
16135 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
16136 FreeType(exp->destType);
16137 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
16138 if(exp->destType)
16139 exp->destType->refCount++;
16140 }
16141 ProcessExpressionType(exp);
16142 }
16143 }
16144 break;
16145 }
16146 case 14:
16147 {
16148 ProcessDeclaration(stmt->decl);
16149 break;
16150 }
16151 case 13:
16152 {
16153 struct AsmField * field;
16154
16155 if(stmt->asmStmt.inputFields)
16156 {
16157 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
16158 if(field->expression)
16159 ProcessExpressionType(field->expression);
16160 }
16161 if(stmt->asmStmt.outputFields)
16162 {
16163 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
16164 if(field->expression)
16165 ProcessExpressionType(field->expression);
16166 }
16167 if(stmt->asmStmt.clobberedFields)
16168 {
16169 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
16170 {
16171 if(field->expression)
16172 ProcessExpressionType(field->expression);
16173 }
16174 }
16175 break;
16176 }
16177 case 17:
16178 {
16179 struct PropertyWatch * propWatch;
16180 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16181 struct Expression * object = stmt->_watch.object;
16182 struct Expression * watcher = stmt->_watch.watcher;
16183
16184 if(watcher)
16185 ProcessExpressionType(watcher);
16186 if(object)
16187 ProcessExpressionType(object);
16188 if(inCompiler)
16189 {
16190 if(watcher || thisClass)
16191 {
16192 struct External * external = curExternal;
16193 struct Context * context = curContext;
16194
16195 stmt->type = 3;
16196 stmt->expressions = MkList();
16197 curExternal = external->prev;
16198 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
16199 {
16200 struct ClassFunction * func;
16201 char watcherName[1024];
16202 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
16203 struct External * createdExternal;
16204 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
16205
16206 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
16207 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
16208 if(propWatch->deleteWatch)
16209 strcat(watcherName, "_delete");
16210 else
16211 {
16212 struct Identifier * propID;
16213
16214 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
16215 {
16216 strcat(watcherName, "_");
16217 strcat(watcherName, propID->string);
16218 }
16219 }
16220 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
16221 {
16222 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
16223 ProcessClassFunctionBody(func, propWatch->compound);
16224 propWatch->compound = (((void *)0));
16225 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
16226 createdExternal->symbol->idCode = external->symbol->idCode;
16227 curExternal = createdExternal;
16228 ProcessFunction(createdExternal->function);
16229 {
16230 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
16231
16232 externalDecl->declaration = decl;
16233 if(decl->symbol && !decl->symbol->pointerExternal)
16234 decl->symbol->pointerExternal = externalDecl;
16235 }
16236 if(propWatch->deleteWatch)
16237 {
16238 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16239
16240 ListAdd(args, CopyExpression(object));
16241 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16242 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
16243 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
16244 }
16245 else
16246 {
16247 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
16248 struct Identifier * propID;
16249
16250 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
16251 {
16252 char propName[1024];
16253 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16254
16255 if(prop)
16256 {
16257 char getName[1024], setName[1024];
16258 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16259
16260 DeclareProperty(prop, setName, getName);
16261 strcpy(propName, "__ecereProp_");
16262 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16263 strcat(propName, "_");
16264 FullClassNameCat(propName, prop->name, 0x1);
16265 ListAdd(args, CopyExpression(object));
16266 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16267 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16268 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
16269 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
16270 }
16271 else
16272 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16273 }
16274 }
16275 }
16276 else
16277 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
16278 }
16279 curExternal = external;
16280 curContext = context;
16281 if(watcher)
16282 FreeExpression(watcher);
16283 if(object)
16284 FreeExpression(object);
16285 FreeList(watches, FreePropertyWatch);
16286 }
16287 else
16288 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
16289 }
16290 else
16291 {
16292 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
16293 {
16294 ProcessStatement(propWatch->compound);
16295 }
16296 }
16297 break;
16298 }
16299 case 15:
16300 {
16301 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16302 struct Expression * object = stmt->_watch.object;
16303 struct __ecereNameSpace__ecere__com__Class * _class;
16304
16305 if(object)
16306 ProcessExpressionType(object);
16307 if(inCompiler)
16308 {
16309 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
16310 if(_class)
16311 {
16312 struct Identifier * propID;
16313
16314 stmt->type = 3;
16315 stmt->expressions = MkList();
16316 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
16317 {
16318 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
16319 }
16320 else if(!watches)
16321 {
16322 }
16323 if(watches)
16324 {
16325 for(propID = (*watches).first; propID; propID = propID->next)
16326 {
16327 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16328
16329 if(prop)
16330 {
16331 CreateFireWatcher(prop, object, stmt);
16332 }
16333 else
16334 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
16335 }
16336 }
16337 else
16338 {
16339 struct __ecereNameSpace__ecere__com__Property * prop;
16340 struct __ecereNameSpace__ecere__com__Class * base;
16341
16342 for(base = _class; base; base = base->base)
16343 {
16344 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
16345 {
16346 if(prop->isProperty && prop->isWatchable)
16347 {
16348 CreateFireWatcher(prop, object, stmt);
16349 }
16350 }
16351 }
16352 }
16353 if(object)
16354 FreeExpression(object);
16355 FreeList(watches, FreeIdentifier);
16356 }
16357 else
16358 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16359 }
16360 break;
16361 }
16362 case 16:
16363 {
16364 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16365 struct Expression * object = stmt->_watch.object;
16366 struct Expression * watcher = stmt->_watch.watcher;
16367 struct __ecereNameSpace__ecere__com__Class * _class;
16368
16369 if(object)
16370 ProcessExpressionType(object);
16371 if(watcher)
16372 ProcessExpressionType(watcher);
16373 if(inCompiler)
16374 {
16375 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
16376 if(watcher || thisClass)
16377 {
16378 if(_class)
16379 {
16380 struct Identifier * propID;
16381
16382 stmt->type = 3;
16383 stmt->expressions = MkList();
16384 if(!watches)
16385 {
16386 struct __ecereNameSpace__ecere__sys__OldList * args;
16387
16388 args = MkList();
16389 ListAdd(args, CopyExpression(object));
16390 ListAdd(args, MkExpConstant("0"));
16391 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16392 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16393 }
16394 else
16395 {
16396 for(propID = (*watches).first; propID; propID = propID->next)
16397 {
16398 char propName[1024];
16399 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16400
16401 if(prop)
16402 {
16403 char getName[1024], setName[1024];
16404 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16405
16406 DeclareProperty(prop, setName, getName);
16407 strcpy(propName, "__ecereProp_");
16408 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16409 strcat(propName, "_");
16410 FullClassNameCat(propName, prop->name, 0x1);
16411 MangleClassName(propName);
16412 ListAdd(args, CopyExpression(object));
16413 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16414 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16415 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16416 }
16417 else
16418 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16419 }
16420 }
16421 if(object)
16422 FreeExpression(object);
16423 if(watcher)
16424 FreeExpression(watcher);
16425 FreeList(watches, FreeIdentifier);
16426 }
16427 else
16428 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16429 }
16430 else
16431 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
16432 }
16433 break;
16434 }
16435 }
16436 }
16437
16438 extern struct Expression * QBrackets(struct Expression * exp);
16439
16440 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
16441
16442 extern struct Declarator * QMkPtrDecl(char *  id);
16443
16444 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
16445
16446 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
16447
16448 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
16449
16450 static void ProcessFunction(struct FunctionDefinition * function)
16451 {
16452 struct Identifier * id = GetDeclId(function->declarator);
16453 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
16454 struct Type * type = symbol ? symbol->type : (((void *)0));
16455 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
16456 struct Context * oldTopContext = topContext;
16457
16458 yylloc = function->loc;
16459 if(type && type->thisClass)
16460 {
16461 struct Symbol * classSym = type->thisClass;
16462 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
16463 char className[1024];
16464 char structName[1024];
16465 struct Declarator * funcDecl;
16466 struct Symbol * thisSymbol;
16467 unsigned int typedObject = 0x0;
16468
16469 if(_class && !_class->base)
16470 {
16471 _class = currentClass;
16472 if(_class && !_class->symbol)
16473 _class->symbol = FindClass(_class->fullName);
16474 classSym = _class ? _class->symbol : (((void *)0));
16475 typedObject = 0x1;
16476 }
16477 thisClass = _class;
16478 if(inCompiler && _class)
16479 {
16480 if(type->kind == 11)
16481 {
16482 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
16483 {
16484 struct Type * param = symbol->type->params.first;
16485
16486 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
16487 FreeType(param);
16488 }
16489 if(type->classObjectType != 1)
16490 {
16491 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
16492 symbol->type->staticMethod = 0x1;
16493 symbol->type->thisClass = (((void *)0));
16494 symbol->type->extraParam = 0x0;
16495 }
16496 }
16497 strcpy(className, "__ecereClass_");
16498 FullClassNameCat(className, _class->fullName, 0x1);
16499 MangleClassName(className);
16500 structName[0] = (char)0;
16501 FullClassNameCat(structName, _class->fullName, 0x0);
16502 funcDecl = GetFuncDecl(function->declarator);
16503 if(funcDecl)
16504 {
16505 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16506 {
16507 struct TypeName * param = (*funcDecl->function.parameters).first;
16508
16509 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16510 {
16511 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16512 FreeTypeName(param);
16513 }
16514 }
16515 if(!function->propertyNoThis)
16516 {
16517 struct TypeName * thisParam;
16518
16519 if(type->classObjectType != 1)
16520 {
16521 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16522 if(!funcDecl->function.parameters)
16523 funcDecl->function.parameters = MkList();
16524 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16525 }
16526 if(typedObject)
16527 {
16528 if(type->classObjectType != 1)
16529 {
16530 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
16531 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
16532 }
16533 thisParam = __extension__ ({
16534 struct TypeName * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName);
16535
16536 __ecereInstance1->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), __ecereInstance1->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), __ecereInstance1;
16537 });
16538 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16539 }
16540 }
16541 }
16542 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16543 {
16544 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16545
16546 funcDecl = GetFuncDecl(initDecl->declarator);
16547 if(funcDecl)
16548 {
16549 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16550 {
16551 struct TypeName * param = (*funcDecl->function.parameters).first;
16552
16553 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16554 {
16555 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16556 FreeTypeName(param);
16557 }
16558 }
16559 if(type->classObjectType != 1)
16560 {
16561 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
16562 {
16563 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16564
16565 if(!funcDecl->function.parameters)
16566 funcDecl->function.parameters = MkList();
16567 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16568 }
16569 }
16570 }
16571 }
16572 }
16573 if(function->body)
16574 {
16575 if(type->classObjectType != 1)
16576 {
16577 thisSymbol = __extension__ ({
16578 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
16579
16580 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("this"), __ecereInstance1->type = classSym ? MkClassType(classSym->string) : (((void *)0)), __ecereInstance1;
16581 });
16582 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16583 if(typedObject && thisSymbol->type)
16584 {
16585 thisSymbol->type->classObjectType = 2;
16586 thisSymbol->type->byReference = type->byReference;
16587 thisSymbol->type->typedByReference = type->byReference;
16588 }
16589 }
16590 }
16591 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
16592 {
16593 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
16594
16595 {
16596 struct __ecereNameSpace__ecere__com__Class * base;
16597
16598 for(base = _class; base && base->type != 1000; base = base->next)
16599 {
16600 for(member = base->membersAndProperties.first; member; member = member->next)
16601 if(!member->isProperty)
16602 break;
16603 if(member)
16604 break;
16605 }
16606 }
16607 for(member = _class->membersAndProperties.first; member; member = member->next)
16608 if(!member->isProperty)
16609 break;
16610 if(member)
16611 {
16612 char pointerName[1024];
16613 struct Declaration * decl;
16614 struct Initializer * initializer;
16615 struct Expression * exp, * bytePtr;
16616
16617 strcpy(pointerName, "__ecerePointer_");
16618 FullClassNameCat(pointerName, _class->fullName, 0x0);
16619 {
16620 char className[1024];
16621
16622 strcpy(className, "__ecereClass_");
16623 FullClassNameCat(className, classSym->string, 0x1);
16624 MangleClassName(className);
16625 DeclareClass(classSym, className);
16626 }
16627 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
16628 if(_class->fixed)
16629 {
16630 char string[256];
16631
16632 sprintf(string, "%d", _class->offset);
16633 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
16634 }
16635 else
16636 {
16637 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
16638 }
16639 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
16640 exp->expType = __extension__ ({
16641 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16642
16643 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
16644 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16645
16646 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 0, __ecereInstance1;
16647 }), __ecereInstance2;
16648 });
16649 if(function->body)
16650 {
16651 yylloc = function->body->loc;
16652 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
16653 {
16654 struct Context * prevContext = curContext;
16655
16656 curContext = function->body->compound.context;
16657 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
16658 curContext = prevContext;
16659 }
16660 decl->symbol = (((void *)0));
16661 if(!function->body->compound.declarations)
16662 function->body->compound.declarations = MkList();
16663 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
16664 }
16665 }
16666 }
16667 }
16668 else
16669 thisClass = (((void *)0));
16670 if(id)
16671 {
16672 FreeSpecifier(id->_class);
16673 id->_class = (((void *)0));
16674 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16675 {
16676 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16677
16678 id = GetDeclId(initDecl->declarator);
16679 FreeSpecifier(id->_class);
16680 id->_class = (((void *)0));
16681 }
16682 }
16683 if(function->body)
16684 topContext = function->body->compound.context;
16685 {
16686 struct FunctionDefinition * oldFunction = curFunction;
16687
16688 curFunction = function;
16689 if(function->body)
16690 ProcessStatement(function->body);
16691 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
16692 {
16693 struct Statement * prevCompound = curCompound;
16694 struct Context * prevContext = curContext;
16695 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
16696
16697 if(!function->body->compound.statements)
16698 function->body->compound.statements = MkList();
16699 ListAdd(function->body->compound.statements, fireWatchers);
16700 curCompound = function->body;
16701 curContext = function->body->compound.context;
16702 ProcessStatement(fireWatchers);
16703 curContext = prevContext;
16704 curCompound = prevCompound;
16705 }
16706 curFunction = oldFunction;
16707 }
16708 if(function->declarator)
16709 {
16710 ProcessDeclarator(function->declarator);
16711 }
16712 topContext = oldTopContext;
16713 thisClass = oldThisClass;
16714 }
16715
16716 extern void FreeSymbol(struct Symbol * symbol);
16717
16718 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
16719
16720 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
16721 {
16722 struct ClassDef * def;
16723 struct External * external = curExternal;
16724 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
16725
16726 for(def = definitions->first; def; def = def->next)
16727 {
16728 if(def->type == 0)
16729 {
16730 if(def->function->declarator)
16731 curExternal = def->function->declarator->symbol->pointerExternal;
16732 else
16733 curExternal = external;
16734 ProcessFunction((struct FunctionDefinition *)def->function);
16735 }
16736 else if(def->type == 2)
16737 {
16738 if(def->decl->type == 2)
16739 {
16740 thisClass = regClass;
16741 ProcessInstantiationType(def->decl->inst);
16742 thisClass = (((void *)0));
16743 }
16744 else
16745 {
16746 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
16747
16748 if(regClass)
16749 thisClass = regClass;
16750 ProcessDeclaration(def->decl);
16751 thisClass = backThisClass;
16752 }
16753 }
16754 else if(def->type == 1 && def->defProperties)
16755 {
16756 struct MemberInit * defProperty;
16757 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);
16758
16759 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16760 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
16761 {
16762 thisClass = regClass;
16763 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
16764 thisClass = (((void *)0));
16765 }
16766 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16767 FreeSymbol(thisSymbol);
16768 }
16769 else if(def->type == 3 && def->propertyDef)
16770 {
16771 struct PropertyDef * prop = def->propertyDef;
16772
16773 thisClass = regClass;
16774 if(prop->setStmt)
16775 {
16776 if(regClass)
16777 {
16778 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16779
16780 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16781 }
16782 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16783 ProcessStatement(prop->setStmt);
16784 }
16785 if(prop->getStmt)
16786 {
16787 if(regClass)
16788 {
16789 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16790
16791 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16792 }
16793 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16794 ProcessStatement(prop->getStmt);
16795 }
16796 if(prop->issetStmt)
16797 {
16798 if(regClass)
16799 {
16800 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16801
16802 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16803 }
16804 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16805 ProcessStatement(prop->issetStmt);
16806 }
16807 thisClass = (((void *)0));
16808 }
16809 else if(def->type == 4 && def->propertyWatch)
16810 {
16811 struct PropertyWatch * propertyWatch = def->propertyWatch;
16812
16813 thisClass = regClass;
16814 if(propertyWatch->compound)
16815 {
16816 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);
16817
16818 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16819 curExternal = (((void *)0));
16820 ProcessStatement(propertyWatch->compound);
16821 }
16822 thisClass = (((void *)0));
16823 }
16824 }
16825 }
16826
16827 void DeclareFunctionUtil(char * s)
16828 {
16829 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
16830
16831 if(function)
16832 {
16833 char name[1024];
16834
16835 name[0] = (char)0;
16836 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
16837 strcpy(name, "__ecereFunction_");
16838 FullClassNameCat(name, s, 0x0);
16839 DeclareFunction(function, name);
16840 }
16841 }
16842
16843 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16844
16845 void ComputeDataTypes()
16846 {
16847 struct External * external;
16848 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16849 struct External * after = (((void *)0));
16850
16851 currentClass = (((void *)0));
16852 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16853 for(external = (*ast).first; external; external = external->next)
16854 {
16855 if(external->type == 1)
16856 {
16857 struct Declaration * decl = external->declaration;
16858
16859 if(decl)
16860 {
16861 struct __ecereNameSpace__ecere__sys__OldList * decls = decl->declarators;
16862
16863 if(decls)
16864 {
16865 struct InitDeclarator * initDecl = (*decls).first;
16866
16867 if(initDecl)
16868 {
16869 struct Declarator * declarator = initDecl->declarator;
16870
16871 if(declarator && declarator->type == 1)
16872 {
16873 struct Identifier * id = declarator->identifier;
16874
16875 if(id && id->string)
16876 {
16877 if(!strcmp(id->string, "uintptr_t") || !strcmp(id->string, "intptr_t") || !strcmp(id->string, "size_t") || !strcmp(id->string, "ssize_t"))
16878 {
16879 external->symbol->id = -1001, external->symbol->idCode = -1001;
16880 after = external;
16881 }
16882 }
16883 }
16884 }
16885 }
16886 }
16887 }
16888 }
16889 temp->symbol = __extension__ ({
16890 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
16891
16892 __ecereInstance1->id = -1000, __ecereInstance1->idCode = -1000, __ecereInstance1;
16893 });
16894 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), after, temp);
16895 curExternal = temp;
16896 DeclareFunctionUtil("eSystem_New");
16897 DeclareFunctionUtil("eSystem_New0");
16898 DeclareFunctionUtil("eSystem_Renew");
16899 DeclareFunctionUtil("eSystem_Renew0");
16900 DeclareFunctionUtil("eClass_GetProperty");
16901 DeclareStruct("ecere::com::Class", 0x0);
16902 DeclareStruct("ecere::com::Instance", 0x0);
16903 DeclareStruct("ecere::com::Property", 0x0);
16904 DeclareStruct("ecere::com::DataMember", 0x0);
16905 DeclareStruct("ecere::com::Method", 0x0);
16906 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16907 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16908 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16909 for(external = (*ast).first; external; external = external->next)
16910 {
16911 afterExternal = curExternal = external;
16912 if(external->type == 0)
16913 {
16914 currentClass = external->function->_class;
16915 ProcessFunction(external->function);
16916 }
16917 else if(external->type == 1)
16918 {
16919 currentClass = (((void *)0));
16920 ProcessDeclaration(external->declaration);
16921 }
16922 else if(external->type == 2)
16923 {
16924 struct ClassDefinition * _class = external->_class;
16925
16926 currentClass = external->symbol->registered;
16927 if(_class->definitions)
16928 {
16929 ProcessClass(_class->definitions, _class->symbol);
16930 }
16931 if(inCompiler)
16932 {
16933 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16934 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16935 }
16936 }
16937 else if(external->type == 4)
16938 {
16939 thisNameSpace = external->id->string;
16940 }
16941 }
16942 currentClass = (((void *)0));
16943 thisNameSpace = (((void *)0));
16944 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16945 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16946 }
16947
16948 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_RegisterFunction(char *  name, char *  type, void *  func, struct __ecereNameSpace__ecere__com__Instance * module, int declMode);
16949
16950 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, char *  name, char *  baseName, int size, int sizeClass, unsigned int (*  Constructor)(void * ), void (*  Destructor)(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
16951
16952 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16953 {
16954 struct __ecereNameSpace__ecere__com__Class * class;
16955
16956 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16957 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16958 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16959 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16960 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16961 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16962 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16963 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16964 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16965 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16966 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16967 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16968 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16969 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16970 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16971 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16972 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16973 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16974 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16975 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16976 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16977 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16978 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
16979 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
16980 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntSize", "bool GetIntSize(Expression exp, intsize * value2)", GetIntSize, module, 1);
16981 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntSize", "bool GetUIntSize(Expression exp, uintsize * value2)", GetUIntSize, module, 1);
16982 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16983 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16984 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16985 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16986 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16987 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16988 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16989 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16990 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16991 __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);
16992 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16993 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16994 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16995 __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);
16996 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16997 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16998 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16999 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
17000 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
17001 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
17002 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
17003 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
17004 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
17005 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
17006 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
17007 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
17008 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
17009 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
17010 __ecereClass_Conversion = class;
17011 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypes", "bool MatchTypes(Type source, Type dest, ecere::sys::OldList conversions, ecere::com::Class owningClassSource, ecere::com::Class owningClassDest, bool doConversion, bool enumBaseType, bool acceptReversedParams, bool isConversionExploration)", MatchTypes, module, 1);
17012 __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);
17013 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
17014 __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);
17015 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
17016 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
17017 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
17018 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
17019 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
17020 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
17021 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
17022 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
17023 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
17024 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
17025 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintTypeNoConst", "void PrintTypeNoConst(Type type, char * string, bool printName, bool fullName)", PrintTypeNoConst, module, 1);
17026 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
17027 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
17028 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
17029 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
17030 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
17031 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
17032 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
17033 }
17034
17035 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
17036 {
17037
17038 }
17039