ecere/com; gfx: Improvements to cross-compiling to 32 bit
[sdk] / compiler / bootstrap / libec / bootstrap / pass15.c
1 #if defined(__GNUC__)
2 typedef long long int64;
3 typedef unsigned long long uint64;
4 #ifndef _WIN32
5 #define __declspec(x)
6 #endif
7 #elif defined(__TINYC__)
8 #include <stdarg.h>
9 #define __builtin_va_list va_list
10 #define __builtin_va_start va_start
11 #define __builtin_va_end va_end
12 #ifdef _WIN32
13 #define strcasecmp stricmp
14 #define strncasecmp strnicmp
15 #define __declspec(x) __attribute__((x))
16 #else
17 #define __declspec(x)
18 #endif
19 typedef long long int64;
20 typedef unsigned long long uint64;
21 #else
22 typedef __int64 int64;
23 typedef unsigned __int64 uint64;
24 #endif
25 #ifdef __BIG_ENDIAN__
26 #define __ENDIAN_PAD(x) (8 - (x))
27 #else
28 #define __ENDIAN_PAD(x) 0
29 #endif
30 #include <stdint.h>
31 #include <sys/types.h>
32
33 #if /*defined(_W64) || */(defined(__WORDSIZE) && __WORDSIZE == 8) || defined(__x86_64__)
34 #define _64BIT 1
35 #else
36 #define _64BIT 0
37 #endif
38
39 #define arch_PointerSize                  sizeof(void *)
40 #define structSize_Instance               (_64BIT ? 24 : 12)
41 #define structSize_Module                 (_64BIT ? 560 : 300)
42 #define structSize_NamedLink              (_64BIT ? 32 : 16)
43
44 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
45
46 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
47
48 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
49
50 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
51
52 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
53
54 struct __ecereNameSpace__ecere__sys__BTNode;
55
56 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;
57
58 struct __ecereNameSpace__ecere__sys__BinaryTree
59 {
60 struct __ecereNameSpace__ecere__sys__BTNode * root;
61 int count;
62 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
63 void (*  FreeKey)(void *  key);
64 } __attribute__ ((gcc_struct));
65
66 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;
67
68 struct __ecereNameSpace__ecere__sys__OldList
69 {
70 void *  first;
71 void *  last;
72 int count;
73 unsigned int offset;
74 unsigned int circ;
75 } __attribute__ ((gcc_struct));
76
77 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;
78
79 struct __ecereNameSpace__ecere__com__Method
80 {
81 char *  name;
82 struct __ecereNameSpace__ecere__com__Method * parent;
83 struct __ecereNameSpace__ecere__com__Method * left;
84 struct __ecereNameSpace__ecere__com__Method * right;
85 int depth;
86 int (*  function)();
87 int vid;
88 int type;
89 struct __ecereNameSpace__ecere__com__Class * _class;
90 void *  symbol;
91 char *  dataTypeString;
92 struct Type * dataType;
93 int memberAccess;
94 } __attribute__ ((gcc_struct));
95
96 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;
97
98 struct __ecereNameSpace__ecere__com__Property
99 {
100 struct __ecereNameSpace__ecere__com__Property * prev;
101 struct __ecereNameSpace__ecere__com__Property * next;
102 char *  name;
103 unsigned int isProperty;
104 int memberAccess;
105 int id;
106 struct __ecereNameSpace__ecere__com__Class * _class;
107 char *  dataTypeString;
108 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
109 struct Type * dataType;
110 void (*  Set)(void * , int);
111 int (*  Get)(void * );
112 unsigned int (*  IsSet)(void * );
113 void *  data;
114 void *  symbol;
115 int vid;
116 unsigned int conversion;
117 unsigned int watcherOffset;
118 char *  category;
119 unsigned int compiled;
120 unsigned int selfWatchable;
121 unsigned int isWatchable;
122 } __attribute__ ((gcc_struct));
123
124 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
125
126 struct CodePosition
127 {
128 int line;
129 int charPos;
130 int pos;
131 unsigned int included;
132 } __attribute__ ((gcc_struct));
133
134 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
135
136 struct Location
137 {
138 struct CodePosition start;
139 struct CodePosition end;
140 } __attribute__ ((gcc_struct));
141
142 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attrib;
143
144 struct Attrib;
145
146 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ExtDecl;
147
148 struct ExtDecl
149 {
150 struct Location loc;
151 int type;
152 union
153 {
154 char * s;
155 struct Attrib * attr;
156 } __attribute__ ((gcc_struct));
157 } __attribute__ ((gcc_struct));
158
159 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
160
161 struct ClassDefinition
162 {
163 struct ClassDefinition * prev;
164 struct ClassDefinition * next;
165 struct Location loc;
166 struct Specifier * _class;
167 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
168 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
169 struct Symbol * symbol;
170 struct Location blockStart;
171 struct Location nameLoc;
172 int endid;
173 int declMode;
174 unsigned int deleteWatchable;
175 } __attribute__ ((gcc_struct));
176
177 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
178
179 struct Context
180 {
181 struct Context * parent;
182 struct __ecereNameSpace__ecere__sys__BinaryTree types;
183 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
184 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
185 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
186 int nextID;
187 int simpleID;
188 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
189 struct ClassDefinition * classDef;
190 unsigned int templateTypesOnly;
191 unsigned int hasNameSpace;
192 } __attribute__ ((gcc_struct));
193
194 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
195
196 struct Instantiation
197 {
198 struct Instantiation * prev;
199 struct Instantiation * next;
200 struct Location loc;
201 struct Specifier * _class;
202 struct Expression * exp;
203 struct __ecereNameSpace__ecere__sys__OldList *  members;
204 struct Symbol * symbol;
205 unsigned int fullSet;
206 unsigned int isConstant;
207 unsigned char *  data;
208 struct Location nameLoc;
209 struct Location insideLoc;
210 unsigned int built;
211 } __attribute__ ((gcc_struct));
212
213 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
214
215 struct Declaration
216 {
217 struct Declaration * prev;
218 struct Declaration * next;
219 struct Location loc;
220 int type;
221 union
222 {
223 struct
224 {
225 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
226 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
227 } __attribute__ ((gcc_struct));
228 struct Instantiation * inst;
229 struct
230 {
231 struct Identifier * id;
232 struct Expression * exp;
233 } __attribute__ ((gcc_struct));
234 } __attribute__ ((gcc_struct));
235 struct Specifier * extStorage;
236 struct Symbol * symbol;
237 int declMode;
238 } __attribute__ ((gcc_struct));
239
240 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
241
242 struct Statement
243 {
244 struct Statement * prev;
245 struct Statement * next;
246 struct Location loc;
247 int type;
248 union
249 {
250 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
251 struct
252 {
253 struct Identifier * id;
254 struct Statement * stmt;
255 } __attribute__ ((gcc_struct)) labeled;
256 struct
257 {
258 struct Expression * exp;
259 struct Statement * stmt;
260 } __attribute__ ((gcc_struct)) caseStmt;
261 struct
262 {
263 struct __ecereNameSpace__ecere__sys__OldList * declarations;
264 struct __ecereNameSpace__ecere__sys__OldList * statements;
265 struct Context * context;
266 unsigned int isSwitch;
267 } __attribute__ ((gcc_struct)) compound;
268 struct
269 {
270 struct __ecereNameSpace__ecere__sys__OldList * exp;
271 struct Statement * stmt;
272 struct Statement * elseStmt;
273 } __attribute__ ((gcc_struct)) ifStmt;
274 struct
275 {
276 struct __ecereNameSpace__ecere__sys__OldList * exp;
277 struct Statement * stmt;
278 } __attribute__ ((gcc_struct)) switchStmt;
279 struct
280 {
281 struct __ecereNameSpace__ecere__sys__OldList * exp;
282 struct Statement * stmt;
283 } __attribute__ ((gcc_struct)) whileStmt;
284 struct
285 {
286 struct __ecereNameSpace__ecere__sys__OldList * exp;
287 struct Statement * stmt;
288 } __attribute__ ((gcc_struct)) doWhile;
289 struct
290 {
291 struct Statement * init;
292 struct Statement * check;
293 struct __ecereNameSpace__ecere__sys__OldList * increment;
294 struct Statement * stmt;
295 } __attribute__ ((gcc_struct)) forStmt;
296 struct
297 {
298 struct Identifier * id;
299 } __attribute__ ((gcc_struct)) gotoStmt;
300 struct
301 {
302 struct Specifier * spec;
303 char * statements;
304 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
305 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
306 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
307 } __attribute__ ((gcc_struct)) asmStmt;
308 struct
309 {
310 struct Expression * watcher;
311 struct Expression * object;
312 struct __ecereNameSpace__ecere__sys__OldList * watches;
313 } __attribute__ ((gcc_struct)) _watch;
314 struct
315 {
316 struct Identifier * id;
317 struct __ecereNameSpace__ecere__sys__OldList * exp;
318 struct __ecereNameSpace__ecere__sys__OldList * filter;
319 struct Statement * stmt;
320 } __attribute__ ((gcc_struct)) forEachStmt;
321 struct Declaration * decl;
322 } __attribute__ ((gcc_struct));
323 } __attribute__ ((gcc_struct));
324
325 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
326
327 struct TypeName
328 {
329 struct TypeName * prev;
330 struct TypeName * next;
331 struct Location loc;
332 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
333 struct Declarator * declarator;
334 int classObjectType;
335 struct Expression * bitCount;
336 } __attribute__ ((gcc_struct));
337
338 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
339
340 struct Initializer
341 {
342 struct Initializer * prev;
343 struct Initializer * next;
344 struct Location loc;
345 int type;
346 union
347 {
348 struct Expression * exp;
349 struct __ecereNameSpace__ecere__sys__OldList *  list;
350 } __attribute__ ((gcc_struct));
351 unsigned int isConstant;
352 } __attribute__ ((gcc_struct));
353
354 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
355
356 struct __ecereNameSpace__ecere__com__DataValue
357 {
358 union
359 {
360 char c;
361 unsigned char uc;
362 short s;
363 unsigned short us;
364 int i;
365 unsigned int ui;
366 void *  p;
367 float f;
368 double d;
369 long long i64;
370 uint64 ui64;
371 } __attribute__ ((gcc_struct));
372 } __attribute__ ((gcc_struct));
373
374 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
375
376 struct Expression
377 {
378 struct Expression * prev;
379 struct Expression * next;
380 struct Location loc;
381 int type;
382 union
383 {
384 struct
385 {
386 char *  constant;
387 struct Identifier * identifier;
388 } __attribute__ ((gcc_struct));
389 struct Statement * compound;
390 struct Instantiation * instance;
391 char *  string;
392 struct __ecereNameSpace__ecere__sys__OldList *  list;
393 struct
394 {
395 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
396 struct Declarator * decl;
397 } __attribute__ ((gcc_struct)) _classExp;
398 struct
399 {
400 struct Identifier * id;
401 } __attribute__ ((gcc_struct)) classData;
402 struct
403 {
404 struct Expression * exp;
405 struct __ecereNameSpace__ecere__sys__OldList * arguments;
406 struct Location argLoc;
407 } __attribute__ ((gcc_struct)) call;
408 struct
409 {
410 struct Expression * exp;
411 struct __ecereNameSpace__ecere__sys__OldList * index;
412 } __attribute__ ((gcc_struct)) index;
413 struct
414 {
415 struct Expression * exp;
416 struct Identifier * member;
417 int memberType;
418 unsigned int thisPtr;
419 } __attribute__ ((gcc_struct)) member;
420 struct
421 {
422 int op;
423 struct Expression * exp1;
424 struct Expression * exp2;
425 } __attribute__ ((gcc_struct)) op;
426 struct TypeName * typeName;
427 struct Specifier * _class;
428 struct
429 {
430 struct TypeName * typeName;
431 struct Expression * exp;
432 } __attribute__ ((gcc_struct)) cast;
433 struct
434 {
435 struct Expression * cond;
436 struct __ecereNameSpace__ecere__sys__OldList * exp;
437 struct Expression * elseExp;
438 } __attribute__ ((gcc_struct)) cond;
439 struct
440 {
441 struct TypeName * typeName;
442 struct Expression * size;
443 } __attribute__ ((gcc_struct)) _new;
444 struct
445 {
446 struct TypeName * typeName;
447 struct Expression * size;
448 struct Expression * exp;
449 } __attribute__ ((gcc_struct)) _renew;
450 struct
451 {
452 char * table;
453 struct Identifier * id;
454 } __attribute__ ((gcc_struct)) db;
455 struct
456 {
457 struct Expression * ds;
458 struct Expression * name;
459 } __attribute__ ((gcc_struct)) dbopen;
460 struct
461 {
462 struct TypeName * typeName;
463 struct Initializer * initializer;
464 } __attribute__ ((gcc_struct)) initializer;
465 struct
466 {
467 struct Expression * exp;
468 struct TypeName * typeName;
469 } __attribute__ ((gcc_struct)) vaArg;
470 } __attribute__ ((gcc_struct));
471 unsigned int debugValue;
472 struct __ecereNameSpace__ecere__com__DataValue val;
473 uint64 address;
474 unsigned int hasAddress;
475 struct Type * expType;
476 struct Type * destType;
477 unsigned int usage;
478 int tempCount;
479 unsigned int byReference;
480 unsigned int isConstant;
481 unsigned int addedThis;
482 unsigned int needCast;
483 unsigned int thisPtr;
484 } __attribute__ ((gcc_struct));
485
486 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
487
488 struct TemplateDatatype
489 {
490 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
491 struct Declarator * decl;
492 } __attribute__ ((gcc_struct));
493
494 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
495
496 struct TemplateArgument;
497
498 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
499
500 struct TemplateParameter
501 {
502 struct TemplateParameter * prev;
503 struct TemplateParameter * next;
504 struct Location loc;
505 int type;
506 struct Identifier * identifier;
507 union
508 {
509 struct TemplateDatatype * dataType;
510 int memberType;
511 } __attribute__ ((gcc_struct));
512 struct TemplateArgument * defaultArgument;
513 char *  dataTypeString;
514 struct Type * baseType;
515 } __attribute__ ((gcc_struct));
516
517 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
518
519 struct Specifier
520 {
521 struct Specifier * prev;
522 struct Specifier * next;
523 struct Location loc;
524 int type;
525 union
526 {
527 int specifier;
528 struct
529 {
530 struct ExtDecl * extDecl;
531 char *  name;
532 struct Symbol * symbol;
533 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
534 } __attribute__ ((gcc_struct));
535 struct
536 {
537 struct Identifier * id;
538 struct __ecereNameSpace__ecere__sys__OldList *  list;
539 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
540 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
541 unsigned int addNameSpace;
542 struct Context * ctx;
543 struct ExtDecl * extDeclStruct;
544 } __attribute__ ((gcc_struct));
545 struct Expression * expression;
546 struct Specifier * _class;
547 struct TemplateParameter * templateParameter;
548 } __attribute__ ((gcc_struct));
549 } __attribute__ ((gcc_struct));
550
551 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
552
553 struct Identifier
554 {
555 struct Identifier * prev;
556 struct Identifier * next;
557 struct Location loc;
558 struct Symbol * classSym;
559 struct Specifier * _class;
560 char *  string;
561 struct Identifier * badID;
562 } __attribute__ ((gcc_struct));
563
564 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
565
566 struct Pointer;
567
568 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
569
570 struct Declarator
571 {
572 struct Declarator * prev;
573 struct Declarator * next;
574 struct Location loc;
575 int type;
576 struct Symbol * symbol;
577 struct Declarator * declarator;
578 union
579 {
580 struct Identifier * identifier;
581 struct
582 {
583 struct Expression * exp;
584 struct Expression * posExp;
585 struct Attrib * attrib;
586 } __attribute__ ((gcc_struct)) structDecl;
587 struct
588 {
589 struct Expression * exp;
590 struct Specifier * enumClass;
591 } __attribute__ ((gcc_struct)) array;
592 struct
593 {
594 struct __ecereNameSpace__ecere__sys__OldList * parameters;
595 } __attribute__ ((gcc_struct)) function;
596 struct
597 {
598 struct Pointer * pointer;
599 } __attribute__ ((gcc_struct)) pointer;
600 struct
601 {
602 struct ExtDecl * extended;
603 } __attribute__ ((gcc_struct)) extended;
604 } __attribute__ ((gcc_struct));
605 } __attribute__ ((gcc_struct));
606
607 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
608
609 struct FunctionDefinition
610 {
611 struct FunctionDefinition * prev;
612 struct FunctionDefinition * next;
613 struct Location loc;
614 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
615 struct Declarator * declarator;
616 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
617 struct Statement * body;
618 struct __ecereNameSpace__ecere__com__Class * _class;
619 struct __ecereNameSpace__ecere__sys__OldList attached;
620 int declMode;
621 struct Type * type;
622 struct Symbol * propSet;
623 int tempCount;
624 unsigned int propertyNoThis;
625 } __attribute__ ((gcc_struct));
626
627 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
628
629 struct DBTableDef;
630
631 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
632
633 struct External
634 {
635 struct External * prev;
636 struct External * next;
637 struct Location loc;
638 int type;
639 struct Symbol * symbol;
640 union
641 {
642 struct FunctionDefinition * function;
643 struct ClassDefinition * _class;
644 struct Declaration * declaration;
645 char *  importString;
646 struct Identifier * id;
647 struct DBTableDef * table;
648 } __attribute__ ((gcc_struct));
649 int importType;
650 } __attribute__ ((gcc_struct));
651
652 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
653
654 struct ModuleImport
655 {
656 struct ModuleImport * prev;
657 struct ModuleImport * next;
658 char *  name;
659 struct __ecereNameSpace__ecere__sys__OldList classes;
660 struct __ecereNameSpace__ecere__sys__OldList functions;
661 int importType;
662 int importAccess;
663 } __attribute__ ((gcc_struct));
664
665 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
666
667 struct ClassImport
668 {
669 struct ClassImport * prev;
670 struct ClassImport * next;
671 char *  name;
672 struct __ecereNameSpace__ecere__sys__OldList methods;
673 struct __ecereNameSpace__ecere__sys__OldList properties;
674 unsigned int itself;
675 unsigned int isRemote;
676 } __attribute__ ((gcc_struct));
677
678 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
679
680 struct Symbol
681 {
682 char *  string;
683 struct Symbol * parent;
684 struct Symbol * left;
685 struct Symbol * right;
686 int depth;
687 struct Type * type;
688 union
689 {
690 struct __ecereNameSpace__ecere__com__Method * method;
691 struct __ecereNameSpace__ecere__com__Property * _property;
692 struct __ecereNameSpace__ecere__com__Class * registered;
693 } __attribute__ ((gcc_struct));
694 int id;
695 int idCode;
696 union
697 {
698 struct
699 {
700 struct External * pointerExternal;
701 struct External * structExternal;
702 } __attribute__ ((gcc_struct));
703 struct
704 {
705 struct External * externalGet;
706 struct External * externalSet;
707 struct External * externalPtr;
708 struct External * externalIsSet;
709 } __attribute__ ((gcc_struct));
710 struct
711 {
712 struct External * methodExternal;
713 struct External * methodCodeExternal;
714 } __attribute__ ((gcc_struct));
715 } __attribute__ ((gcc_struct));
716 unsigned int imported;
717 unsigned int declaredStructSym;
718 struct __ecereNameSpace__ecere__com__Class * _class;
719 unsigned int declaredStruct;
720 unsigned int needConstructor;
721 unsigned int needDestructor;
722 char *  constructorName;
723 char *  structName;
724 char *  className;
725 char *  destructorName;
726 struct ModuleImport * module;
727 struct ClassImport * _import;
728 struct Location nameLoc;
729 unsigned int isParam;
730 unsigned int isRemote;
731 unsigned int isStruct;
732 unsigned int fireWatchersDone;
733 int declaring;
734 unsigned int classData;
735 unsigned int isStatic;
736 char *  shortName;
737 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
738 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
739 struct Context * ctx;
740 int isIterator;
741 struct Expression * propCategory;
742 } __attribute__ ((gcc_struct));
743
744 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
745
746 struct Type
747 {
748 struct Type * prev;
749 struct Type * next;
750 int refCount;
751 union
752 {
753 struct Symbol * _class;
754 struct
755 {
756 struct __ecereNameSpace__ecere__sys__OldList members;
757 char *  enumName;
758 } __attribute__ ((gcc_struct));
759 struct
760 {
761 struct Type * returnType;
762 struct __ecereNameSpace__ecere__sys__OldList params;
763 struct Symbol * thisClass;
764 unsigned int staticMethod;
765 struct TemplateParameter * thisClassTemplate;
766 } __attribute__ ((gcc_struct));
767 struct
768 {
769 struct __ecereNameSpace__ecere__com__Method * method;
770 struct __ecereNameSpace__ecere__com__Class * methodClass;
771 struct __ecereNameSpace__ecere__com__Class * usedClass;
772 } __attribute__ ((gcc_struct));
773 struct
774 {
775 struct Type * arrayType;
776 int arraySize;
777 struct Expression * arraySizeExp;
778 unsigned int freeExp;
779 struct Symbol * enumClass;
780 } __attribute__ ((gcc_struct));
781 struct Type * type;
782 struct TemplateParameter * templateParameter;
783 } __attribute__ ((gcc_struct));
784 unsigned int isSigned;
785 int kind;
786 unsigned int constant;
787 unsigned int size;
788 char *  name;
789 char *  typeName;
790 unsigned int count;
791 unsigned int truth;
792 int classObjectType;
793 unsigned int byReference;
794 unsigned int extraParam;
795 int alignment;
796 unsigned int directClassAccess;
797 unsigned int computing;
798 unsigned int dllExport;
799 unsigned int offset;
800 unsigned int keepCast;
801 unsigned int passAsTemplate;
802 int bitFieldCount;
803 } __attribute__ ((gcc_struct));
804
805 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
806
807 struct __ecereNameSpace__ecere__com__Class
808 {
809 struct __ecereNameSpace__ecere__com__Class * prev;
810 struct __ecereNameSpace__ecere__com__Class * next;
811 char *  name;
812 int offset;
813 int structSize;
814 int (* *  _vTbl)();
815 int vTblSize;
816 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
817 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
818 int offsetClass;
819 int sizeClass;
820 struct __ecereNameSpace__ecere__com__Class * base;
821 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
822 struct __ecereNameSpace__ecere__sys__BinaryTree members;
823 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
824 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
825 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
826 struct __ecereNameSpace__ecere__sys__OldList derivatives;
827 int memberID;
828 int startMemberID;
829 int type;
830 struct __ecereNameSpace__ecere__com__Instance * module;
831 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
832 char *  dataTypeString;
833 struct Type * dataType;
834 int typeSize;
835 int defaultAlignment;
836 void (*  Initialize)();
837 int memberOffset;
838 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
839 char *  designerClass;
840 unsigned int noExpansion;
841 char *  defaultProperty;
842 unsigned int comRedefinition;
843 int count;
844 unsigned int isRemote;
845 unsigned int internalDecl;
846 void *  data;
847 unsigned int computeSize;
848 int structAlignment;
849 int destructionWatchOffset;
850 unsigned int fixed;
851 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
852 int inheritanceAccess;
853 char *  fullName;
854 void *  symbol;
855 struct __ecereNameSpace__ecere__sys__OldList conversions;
856 struct __ecereNameSpace__ecere__sys__OldList templateParams;
857 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
858 struct __ecereNameSpace__ecere__com__Class * templateClass;
859 struct __ecereNameSpace__ecere__sys__OldList templatized;
860 int numParams;
861 } __attribute__ ((gcc_struct));
862
863 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
864
865 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
866
867 struct __ecereNameSpace__ecere__com__Instance
868 {
869 int (* *  _vTbl)();
870 struct __ecereNameSpace__ecere__com__Class * _class;
871 int _refCount;
872 } __attribute__ ((gcc_struct));
873
874 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
875
876 struct __ecereNameSpace__ecere__com__DataMember
877 {
878 struct __ecereNameSpace__ecere__com__DataMember * prev;
879 struct __ecereNameSpace__ecere__com__DataMember * next;
880 char *  name;
881 unsigned int isProperty;
882 int memberAccess;
883 int id;
884 struct __ecereNameSpace__ecere__com__Class * _class;
885 char *  dataTypeString;
886 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
887 struct Type * dataType;
888 int type;
889 int offset;
890 int memberID;
891 struct __ecereNameSpace__ecere__sys__OldList members;
892 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
893 int memberOffset;
894 int structAlignment;
895 } __attribute__ ((gcc_struct));
896
897 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
898
899 struct __ecereNameSpace__ecere__com__SerialBuffer
900 {
901 unsigned char *  _buffer;
902 unsigned int count;
903 unsigned int _size;
904 unsigned int pos;
905 } __attribute__ ((gcc_struct));
906
907 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
908
909 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
910 {
911 union
912 {
913 struct
914 {
915 char *  dataTypeString;
916 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
917 } __attribute__ ((gcc_struct));
918 struct __ecereNameSpace__ecere__com__DataValue expression;
919 struct
920 {
921 char *  memberString;
922 union
923 {
924 struct __ecereNameSpace__ecere__com__DataMember * member;
925 struct __ecereNameSpace__ecere__com__Property * prop;
926 struct __ecereNameSpace__ecere__com__Method * method;
927 } __attribute__ ((gcc_struct));
928 } __attribute__ ((gcc_struct));
929 } __attribute__ ((gcc_struct));
930 } __attribute__ ((gcc_struct));
931
932 void exit(int status);
933
934 void * calloc(size_t nmemb, size_t size);
935
936 void free(void * ptr);
937
938 void * malloc(size_t size);
939
940 void * realloc(void * ptr, size_t size);
941
942 long int strtol(const char * nptr, char ** endptr, int base);
943
944 long long int strtoll(const char * nptr, char ** endptr, int base);
945
946 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
947
948 enum yytokentype
949 {
950 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
951 };
952
953 typedef union YYSTYPE
954 {
955 int specifierType;
956 int i;
957 int declMode;
958 struct Identifier * id;
959 struct Expression * exp;
960 struct Specifier * specifier;
961 struct __ecereNameSpace__ecere__sys__OldList * list;
962 struct Enumerator * enumerator;
963 struct Declarator * declarator;
964 struct Pointer * pointer;
965 struct Initializer * initializer;
966 struct InitDeclarator * initDeclarator;
967 struct TypeName * typeName;
968 struct Declaration * declaration;
969 struct Statement * stmt;
970 struct FunctionDefinition * function;
971 struct External * external;
972 struct Context * context;
973 struct AsmField * asmField;
974 struct Attrib * attrib;
975 struct ExtDecl * extDecl;
976 struct Attribute * attribute;
977 struct Instantiation * instance;
978 struct MembersInit * membersInit;
979 struct MemberInit * memberInit;
980 struct ClassFunction * classFunction;
981 struct ClassDefinition * _class;
982 struct ClassDef * classDef;
983 struct PropertyDef * prop;
984 char * string;
985 struct Symbol * symbol;
986 struct PropertyWatch * propertyWatch;
987 struct TemplateParameter * templateParameter;
988 struct TemplateArgument * templateArgument;
989 struct TemplateDatatype * templateDatatype;
990 struct DBTableEntry * dbtableEntry;
991 struct DBIndexItem * dbindexItem;
992 struct DBTableDef * dbtableDef;
993 } __attribute__ ((gcc_struct)) YYSTYPE;
994
995 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
996
997 struct Enumerator
998 {
999 struct Enumerator * prev;
1000 struct Enumerator * next;
1001 struct Location loc;
1002 struct Identifier * id;
1003 struct Expression * exp;
1004 } __attribute__ ((gcc_struct));
1005
1006 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
1007
1008 struct InitDeclarator
1009 {
1010 struct InitDeclarator * prev;
1011 struct InitDeclarator * next;
1012 struct Location loc;
1013 struct Declarator * declarator;
1014 struct Initializer * initializer;
1015 } __attribute__ ((gcc_struct));
1016
1017 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
1018
1019 struct AsmField
1020 {
1021 struct AsmField * prev;
1022 struct AsmField * next;
1023 struct Location loc;
1024 char *  command;
1025 struct Expression * expression;
1026 } __attribute__ ((gcc_struct));
1027
1028 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
1029
1030 struct Attribute;
1031
1032 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
1033
1034 struct ClassFunction
1035 {
1036 struct ClassFunction * prev;
1037 struct ClassFunction * next;
1038 struct Location loc;
1039 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1040 struct Declarator * declarator;
1041 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1042 struct Statement * body;
1043 struct __ecereNameSpace__ecere__com__Class * _class;
1044 struct __ecereNameSpace__ecere__sys__OldList attached;
1045 int declMode;
1046 struct Type * type;
1047 struct Symbol * propSet;
1048 unsigned int isVirtual;
1049 unsigned int isConstructor;
1050 unsigned int isDestructor;
1051 unsigned int dontMangle;
1052 int id;
1053 int idCode;
1054 } __attribute__ ((gcc_struct));
1055
1056 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1057
1058 struct MembersInit
1059 {
1060 struct MembersInit * prev;
1061 struct MembersInit * next;
1062 struct Location loc;
1063 int type;
1064 union
1065 {
1066 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1067 struct ClassFunction * function;
1068 } __attribute__ ((gcc_struct));
1069 } __attribute__ ((gcc_struct));
1070
1071 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1072
1073 struct MemberInit
1074 {
1075 struct MemberInit * prev;
1076 struct MemberInit * next;
1077 struct Location loc;
1078 struct Location realLoc;
1079 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1080 struct Initializer * initializer;
1081 unsigned int used;
1082 unsigned int variable;
1083 unsigned int takeOutExp;
1084 } __attribute__ ((gcc_struct));
1085
1086 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1087
1088 struct PropertyDef
1089 {
1090 struct PropertyDef * prev;
1091 struct PropertyDef * next;
1092 struct Location loc;
1093 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1094 struct Declarator * declarator;
1095 struct Identifier * id;
1096 struct Statement * getStmt;
1097 struct Statement * setStmt;
1098 struct Statement * issetStmt;
1099 struct Symbol * symbol;
1100 unsigned int conversion;
1101 unsigned int isWatchable;
1102 struct Expression * category;
1103 } __attribute__ ((gcc_struct));
1104
1105 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1106
1107 struct PropertyWatch
1108 {
1109 struct PropertyWatch * prev;
1110 struct PropertyWatch * next;
1111 struct Location loc;
1112 struct Statement * compound;
1113 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1114 unsigned int deleteWatch;
1115 } __attribute__ ((gcc_struct));
1116
1117 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1118
1119 struct ClassDef
1120 {
1121 struct ClassDef * prev;
1122 struct ClassDef * next;
1123 struct Location loc;
1124 int type;
1125 union
1126 {
1127 struct Declaration * decl;
1128 struct ClassFunction * function;
1129 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1130 struct PropertyDef * propertyDef;
1131 struct PropertyWatch * propertyWatch;
1132 char *  designer;
1133 struct Identifier * defaultProperty;
1134 struct
1135 {
1136 struct Identifier * id;
1137 struct Initializer * initializer;
1138 } __attribute__ ((gcc_struct));
1139 } __attribute__ ((gcc_struct));
1140 int memberAccess;
1141 void *  object;
1142 } __attribute__ ((gcc_struct));
1143
1144 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1145
1146 struct DBTableEntry;
1147
1148 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1149
1150 struct DBIndexItem;
1151
1152 extern YYSTYPE yylval;
1153
1154 extern struct Location yylloc;
1155
1156 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1157
1158 extern int returnCode;
1159
1160 extern struct Expression * parsedExpression;
1161
1162 extern unsigned int yydebug;
1163
1164 void SetYydebug(unsigned int b)
1165 {
1166 yydebug = b;
1167 }
1168
1169 extern unsigned int echoOn;
1170
1171 void resetScanner();
1172
1173 int propWatcherID;
1174
1175 int expression_yyparse();
1176
1177 static struct Statement * curCompound;
1178
1179 struct External * curExternal, * afterExternal;
1180
1181 static struct Type * curSwitchType;
1182
1183 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1184
1185 struct __ecereNameSpace__ecere__com__Class * thisClass;
1186
1187 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1188 {
1189 thisClass = c;
1190 }
1191
1192 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1193 {
1194 return thisClass;
1195 }
1196
1197 static char * thisNameSpace;
1198
1199 struct __ecereNameSpace__ecere__com__Class * containerClass;
1200
1201 unsigned int thisClassParams = 0x1;
1202
1203 unsigned int internalValueCounter;
1204
1205 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1206
1207 extern size_t strlen(const char * );
1208
1209 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1210
1211 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1212
1213 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1214
1215 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1216
1217 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1218
1219 void PrintExpression(struct Expression * exp, char * string)
1220 {
1221 {
1222 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1223 int count;
1224
1225 if(exp)
1226 OutputExpression(exp, f);
1227 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1228 count = strlen(string);
1229 count += ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Read])(f, string + count, 1, 1023);
1230 string[count] = '\0';
1231 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1232 }
1233 }
1234
1235 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1236
1237 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1238
1239 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1240 {
1241 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1242 {
1243 if(!param->baseType)
1244 {
1245 if(param->dataTypeString)
1246 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1247 else
1248 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1249 }
1250 return param->baseType;
1251 }
1252 return (((void *)0));
1253 }
1254
1255 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1256 {
1257 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1258 return 0x1;
1259 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1260 {
1261 return 0x0;
1262 }
1263 if(type1->kind == type2->kind)
1264 {
1265 switch(type1->kind)
1266 {
1267 case 1:
1268 case 2:
1269 case 3:
1270 case 4:
1271 case 22:
1272 case 23:
1273 if(type1->passAsTemplate && !type2->passAsTemplate)
1274 return 0x1;
1275 return type1->isSigned != type2->isSigned;
1276 case 8:
1277 return type1->_class != type2->_class;
1278 case 13:
1279 return NeedCast(type1->type, type2->type);
1280 default:
1281 return 0x1;
1282 }
1283 }
1284 return 0x1;
1285 }
1286
1287 extern int strcmp(const char * , const char * );
1288
1289 extern struct Context * curContext;
1290
1291 extern struct Context * topContext;
1292
1293 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1294
1295 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);
1296
1297 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1298
1299 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);
1300
1301 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);
1302
1303 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1304
1305 struct __ecereNameSpace__ecere__com__ClassProperty
1306 {
1307 char *  name;
1308 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1309 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1310 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1311 int depth;
1312 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, long long);
1313 long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1314 char *  dataTypeString;
1315 struct Type * dataType;
1316 unsigned int constant;
1317 } __attribute__ ((gcc_struct));
1318
1319 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1320
1321 extern struct Expression * QMkExpId(char *  id);
1322
1323 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1324
1325 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1326 {
1327 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1328 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1329 char *  name;
1330 int type;
1331 union
1332 {
1333 char *  dataTypeString;
1334 int memberType;
1335 } __attribute__ ((gcc_struct));
1336 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1337 void *  param;
1338 } __attribute__ ((gcc_struct));
1339
1340 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1341
1342 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1343
1344 extern void FreeIdentifier(struct Identifier * id);
1345
1346 void ProcessExpressionType(struct Expression * exp);
1347
1348 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1349
1350 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1351
1352 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1353
1354 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1355
1356 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1357
1358 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1359
1360 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1361
1362 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1363
1364 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1365 {
1366 if(exp->type == 0 && exp->identifier)
1367 {
1368 struct Identifier * id = exp->identifier;
1369 struct Context * ctx;
1370 struct Symbol * symbol = (((void *)0));
1371
1372 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1373 {
1374 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1375 {
1376 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1377 if(symbol)
1378 break;
1379 }
1380 }
1381 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1382 {
1383 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1384 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1385 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1386 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
1387
1388 if(!prop)
1389 {
1390 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1391 }
1392 if(!prop && !method)
1393 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1394 if(!prop && !method && !member)
1395 {
1396 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1397 }
1398 if(prop || method || member || classProp)
1399 {
1400 exp->type = 8;
1401 exp->member.member = id;
1402 exp->member.memberType = 0;
1403 exp->member.exp = QMkExpId("this");
1404 exp->addedThis = 0x1;
1405 }
1406 else if(_class && _class->templateParams.first)
1407 {
1408 struct __ecereNameSpace__ecere__com__Class * sClass;
1409
1410 for(sClass = _class; sClass; sClass = sClass->base)
1411 {
1412 if(sClass->templateParams.first)
1413 {
1414 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1415
1416 for(param = sClass->templateParams.first; param; param = param->next)
1417 {
1418 if(param->type == 2 && !strcmp(param->name, id->string))
1419 {
1420 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1421
1422 if(argExp)
1423 {
1424 struct Declarator * decl;
1425 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1426
1427 FreeIdentifier(exp->member.member);
1428 ProcessExpressionType(argExp);
1429 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1430 exp->expType = ProcessType(specs, decl);
1431 exp->type = 5;
1432 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1433 }
1434 }
1435 }
1436 }
1437 }
1438 }
1439 }
1440 }
1441 }
1442
1443 extern int sprintf(char * , char * , ...);
1444
1445 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1446
1447 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1448
1449 char * PrintInt(long long result)
1450 {
1451 char temp[100];
1452
1453 if(result > (((long long)0x7fffffffffffffffLL)))
1454 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1455 else
1456 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1457 return __ecereNameSpace__ecere__sys__CopyString(temp);
1458 }
1459
1460 char * PrintUInt(uint64 result)
1461 {
1462 char temp[100];
1463
1464 if(result > (0xffffffff))
1465 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1466 else if(result > (((int)0x7fffffff)))
1467 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1468 else
1469 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1470 return __ecereNameSpace__ecere__sys__CopyString(temp);
1471 }
1472
1473 char * PrintInt64(long long result)
1474 {
1475 char temp[100];
1476
1477 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1478 return __ecereNameSpace__ecere__sys__CopyString(temp);
1479 }
1480
1481 char * PrintUInt64(uint64 result)
1482 {
1483 char temp[100];
1484
1485 if(result > (((long long)0x7fffffffffffffffLL)))
1486 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1487 else
1488 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1489 return __ecereNameSpace__ecere__sys__CopyString(temp);
1490 }
1491
1492 char * PrintHexUInt(uint64 result)
1493 {
1494 char temp[100];
1495
1496 if(result > (0xffffffff))
1497 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1498 else
1499 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1500 return __ecereNameSpace__ecere__sys__CopyString(temp);
1501 }
1502
1503 char * PrintHexUInt64(uint64 result)
1504 {
1505 char temp[100];
1506
1507 if(result > (0xffffffff))
1508 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1509 else
1510 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1511 return __ecereNameSpace__ecere__sys__CopyString(temp);
1512 }
1513
1514 char * PrintShort(short result)
1515 {
1516 char temp[100];
1517
1518 sprintf(temp, "%d", (unsigned short)result);
1519 return __ecereNameSpace__ecere__sys__CopyString(temp);
1520 }
1521
1522 char * PrintUShort(unsigned short result)
1523 {
1524 char temp[100];
1525
1526 if(result > (unsigned short)32767)
1527 sprintf(temp, "0x%X", (int)result);
1528 else
1529 sprintf(temp, "%d", result);
1530 return __ecereNameSpace__ecere__sys__CopyString(temp);
1531 }
1532
1533 extern int isprint(int c);
1534
1535 char * PrintChar(char result)
1536 {
1537 char temp[100];
1538
1539 if(result > (char)0 && isprint(result))
1540 sprintf(temp, "'%c'", result);
1541 else if(result < (char)0)
1542 sprintf(temp, "%d", result);
1543 else
1544 sprintf(temp, "0x%X", (unsigned char)result);
1545 return __ecereNameSpace__ecere__sys__CopyString(temp);
1546 }
1547
1548 char * PrintUChar(unsigned char result)
1549 {
1550 char temp[100];
1551
1552 sprintf(temp, "0x%X", result);
1553 return __ecereNameSpace__ecere__sys__CopyString(temp);
1554 }
1555
1556 char * PrintFloat(float result)
1557 {
1558 char temp[350];
1559
1560 sprintf(temp, "%.16ff", result);
1561 return __ecereNameSpace__ecere__sys__CopyString(temp);
1562 }
1563
1564 char * PrintDouble(double result)
1565 {
1566 char temp[350];
1567
1568 sprintf(temp, "%.16f", result);
1569 return __ecereNameSpace__ecere__sys__CopyString(temp);
1570 }
1571
1572 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1573
1574 struct OpTable
1575 {
1576 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1577 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1578 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1579 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1580 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1581 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1582 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1583 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1584 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1585 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1586 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1587 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1588 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1589 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1590 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1591 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1592 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1593 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1594 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1595 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1596 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1597 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1598 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1599 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1600 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1601 unsigned int (*  Not)(struct Expression *, struct Operand *);
1602 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1603 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1604 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1605 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1606 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1607 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1608 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1609 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1610 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1611 } __attribute__ ((gcc_struct));
1612
1613 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1614
1615 struct Operand
1616 {
1617 int kind;
1618 struct Type * type;
1619 unsigned int ptrSize;
1620 union
1621 {
1622 char c;
1623 unsigned char uc;
1624 short s;
1625 unsigned short us;
1626 int i;
1627 unsigned int ui;
1628 float f;
1629 double d;
1630 long long i64;
1631 uint64 ui64;
1632 } __attribute__ ((gcc_struct));
1633 struct OpTable ops;
1634 } __attribute__ ((gcc_struct));
1635
1636 struct Operand GetOperand(struct Expression * exp);
1637
1638 unsigned int GetInt(struct Expression * exp, int * value2)
1639 {
1640 struct Operand op2 = GetOperand(exp);
1641
1642 if(op2.kind == 3 && op2.type->isSigned)
1643 *value2 = op2.i;
1644 else if(op2.kind == 3)
1645 *value2 = (int)op2.ui;
1646 else if(op2.kind == 4 && op2.type->isSigned)
1647 *value2 = (int)op2.i64;
1648 else if(op2.kind == 4)
1649 *value2 = (int)op2.ui64;
1650 else if(op2.kind == 23 && op2.type->isSigned)
1651 *value2 = (int)op2.i64;
1652 else if(op2.kind == 23)
1653 *value2 = (int)op2.ui64;
1654 else if(op2.kind == 22 && op2.type->isSigned)
1655 *value2 = (int)op2.i64;
1656 else if(op2.kind == 22)
1657 *value2 = (int)op2.ui64;
1658 else if(op2.kind == 2 && op2.type->isSigned)
1659 *value2 = (int)op2.s;
1660 else if(op2.kind == 2)
1661 *value2 = (int)op2.us;
1662 else if(op2.kind == 1 && op2.type->isSigned)
1663 *value2 = (int)op2.c;
1664 else if(op2.kind == 1)
1665 *value2 = (int)op2.uc;
1666 else if(op2.kind == 6)
1667 *value2 = (int)op2.f;
1668 else if(op2.kind == 7)
1669 *value2 = (int)op2.d;
1670 else if(op2.kind == 13)
1671 *value2 = (int)op2.ui64;
1672 else
1673 return 0x0;
1674 return 0x1;
1675 }
1676
1677 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1678 {
1679 struct Operand op2 = GetOperand(exp);
1680
1681 if(op2.kind == 3 && op2.type->isSigned)
1682 *value2 = (unsigned int)op2.i;
1683 else if(op2.kind == 3)
1684 *value2 = op2.ui;
1685 else if(op2.kind == 4 && op2.type->isSigned)
1686 *value2 = (unsigned int)op2.i64;
1687 else if(op2.kind == 4)
1688 *value2 = (unsigned int)op2.ui64;
1689 else if(op2.kind == 23 && op2.type->isSigned)
1690 *value2 = (unsigned int)op2.i64;
1691 else if(op2.kind == 23)
1692 *value2 = (unsigned int)op2.ui64;
1693 else if(op2.kind == 22 && op2.type->isSigned)
1694 *value2 = (unsigned int)op2.i64;
1695 else if(op2.kind == 22)
1696 *value2 = (unsigned int)op2.ui64;
1697 else if(op2.kind == 2 && op2.type->isSigned)
1698 *value2 = (unsigned int)op2.s;
1699 else if(op2.kind == 2)
1700 *value2 = (unsigned int)op2.us;
1701 else if(op2.kind == 1 && op2.type->isSigned)
1702 *value2 = (unsigned int)op2.c;
1703 else if(op2.kind == 1)
1704 *value2 = (unsigned int)op2.uc;
1705 else if(op2.kind == 6)
1706 *value2 = (unsigned int)op2.f;
1707 else if(op2.kind == 7)
1708 *value2 = (unsigned int)op2.d;
1709 else if(op2.kind == 13)
1710 *value2 = (unsigned int)op2.ui64;
1711 else
1712 return 0x0;
1713 return 0x1;
1714 }
1715
1716 unsigned int GetInt64(struct Expression * exp, long long * value2)
1717 {
1718 struct Operand op2 = GetOperand(exp);
1719
1720 if(op2.kind == 3 && op2.type->isSigned)
1721 *value2 = (long long)op2.i;
1722 else if(op2.kind == 3)
1723 *value2 = (long long)op2.ui;
1724 else if(op2.kind == 4 && op2.type->isSigned)
1725 *value2 = op2.i64;
1726 else if(op2.kind == 4)
1727 *value2 = (long long)op2.ui64;
1728 else if(op2.kind == 23 && op2.type->isSigned)
1729 *value2 = op2.i64;
1730 else if(op2.kind == 23)
1731 *value2 = (long long)op2.ui64;
1732 else if(op2.kind == 22 && op2.type->isSigned)
1733 *value2 = op2.i64;
1734 else if(op2.kind == 22)
1735 *value2 = (long long)op2.ui64;
1736 else if(op2.kind == 2 && op2.type->isSigned)
1737 *value2 = (long long)op2.s;
1738 else if(op2.kind == 2)
1739 *value2 = (long long)op2.us;
1740 else if(op2.kind == 1 && op2.type->isSigned)
1741 *value2 = (long long)op2.c;
1742 else if(op2.kind == 1)
1743 *value2 = (long long)op2.uc;
1744 else if(op2.kind == 6)
1745 *value2 = (long long)op2.f;
1746 else if(op2.kind == 7)
1747 *value2 = (long long)op2.d;
1748 else if(op2.kind == 13)
1749 *value2 = (long long)op2.ui64;
1750 else
1751 return 0x0;
1752 return 0x1;
1753 }
1754
1755 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1756 {
1757 struct Operand op2 = GetOperand(exp);
1758
1759 if(op2.kind == 3 && op2.type->isSigned)
1760 *value2 = (uint64)op2.i;
1761 else if(op2.kind == 3)
1762 *value2 = (uint64)op2.ui;
1763 else if(op2.kind == 4 && op2.type->isSigned)
1764 *value2 = (uint64)op2.i64;
1765 else if(op2.kind == 4)
1766 *value2 = op2.ui64;
1767 else if(op2.kind == 23 && op2.type->isSigned)
1768 *value2 = (uint64)op2.i64;
1769 else if(op2.kind == 23)
1770 *value2 = op2.ui64;
1771 else if(op2.kind == 22 && op2.type->isSigned)
1772 *value2 = (uint64)op2.i64;
1773 else if(op2.kind == 22)
1774 *value2 = op2.ui64;
1775 else if(op2.kind == 2 && op2.type->isSigned)
1776 *value2 = (uint64)op2.s;
1777 else if(op2.kind == 2)
1778 *value2 = (uint64)op2.us;
1779 else if(op2.kind == 1 && op2.type->isSigned)
1780 *value2 = (uint64)op2.c;
1781 else if(op2.kind == 1)
1782 *value2 = (uint64)op2.uc;
1783 else if(op2.kind == 6)
1784 *value2 = (uint64)op2.f;
1785 else if(op2.kind == 7)
1786 *value2 = (uint64)op2.d;
1787 else if(op2.kind == 13)
1788 *value2 = op2.ui64;
1789 else
1790 return 0x0;
1791 return 0x1;
1792 }
1793
1794 unsigned int GetIntPtr(struct Expression * exp, intptr_t * value2)
1795 {
1796 struct Operand op2 = GetOperand(exp);
1797
1798 if(op2.kind == 3 && op2.type->isSigned)
1799 *value2 = (intptr_t)op2.i;
1800 else if(op2.kind == 3)
1801 *value2 = (intptr_t)op2.ui;
1802 else if(op2.kind == 4 && op2.type->isSigned)
1803 *value2 = (intptr_t)op2.i64;
1804 else if(op2.kind == 4)
1805 *value2 = (intptr_t)op2.ui64;
1806 else if(op2.kind == 23 && op2.type->isSigned)
1807 *value2 = (intptr_t)op2.i64;
1808 else if(op2.kind == 23)
1809 *value2 = (intptr_t)op2.ui64;
1810 else if(op2.kind == 22 && op2.type->isSigned)
1811 *value2 = (intptr_t)op2.i64;
1812 else if(op2.kind == 22)
1813 *value2 = (intptr_t)op2.ui64;
1814 else if(op2.kind == 2 && op2.type->isSigned)
1815 *value2 = (intptr_t)op2.s;
1816 else if(op2.kind == 2)
1817 *value2 = (intptr_t)op2.us;
1818 else if(op2.kind == 1 && op2.type->isSigned)
1819 *value2 = (intptr_t)op2.c;
1820 else if(op2.kind == 1)
1821 *value2 = (intptr_t)op2.uc;
1822 else if(op2.kind == 6)
1823 *value2 = (intptr_t)op2.f;
1824 else if(op2.kind == 7)
1825 *value2 = (intptr_t)op2.d;
1826 else if(op2.kind == 13)
1827 *value2 = (intptr_t)op2.ui64;
1828 else
1829 return 0x0;
1830 return 0x1;
1831 }
1832
1833 unsigned int GetUIntPtr(struct Expression * exp, uintptr_t * value2)
1834 {
1835 struct Operand op2 = GetOperand(exp);
1836
1837 if(op2.kind == 3 && op2.type->isSigned)
1838 *value2 = (uintptr_t)op2.i;
1839 else if(op2.kind == 3)
1840 *value2 = (uintptr_t)op2.ui;
1841 else if(op2.kind == 4 && op2.type->isSigned)
1842 *value2 = (uintptr_t)op2.i64;
1843 else if(op2.kind == 4)
1844 *value2 = (uintptr_t)op2.ui64;
1845 else if(op2.kind == 23 && op2.type->isSigned)
1846 *value2 = (uintptr_t)op2.i64;
1847 else if(op2.kind == 23)
1848 *value2 = (uintptr_t)op2.ui64;
1849 else if(op2.kind == 22 && op2.type->isSigned)
1850 *value2 = (uintptr_t)op2.i64;
1851 else if(op2.kind == 22)
1852 *value2 = (uintptr_t)op2.ui64;
1853 else if(op2.kind == 2 && op2.type->isSigned)
1854 *value2 = (uintptr_t)op2.s;
1855 else if(op2.kind == 2)
1856 *value2 = (uintptr_t)op2.us;
1857 else if(op2.kind == 1 && op2.type->isSigned)
1858 *value2 = (uintptr_t)op2.c;
1859 else if(op2.kind == 1)
1860 *value2 = (uintptr_t)op2.uc;
1861 else if(op2.kind == 6)
1862 *value2 = (uintptr_t)op2.f;
1863 else if(op2.kind == 7)
1864 *value2 = (uintptr_t)op2.d;
1865 else if(op2.kind == 13)
1866 *value2 = (uintptr_t)op2.ui64;
1867 else
1868 return 0x0;
1869 return 0x1;
1870 }
1871
1872 unsigned int GetIntSize(struct Expression * exp, ssize_t * value2)
1873 {
1874 struct Operand op2 = GetOperand(exp);
1875
1876 if(op2.kind == 3 && op2.type->isSigned)
1877 *value2 = (ssize_t)op2.i;
1878 else if(op2.kind == 3)
1879 *value2 = (ssize_t)op2.ui;
1880 else if(op2.kind == 4 && op2.type->isSigned)
1881 *value2 = (ssize_t)op2.i64;
1882 else if(op2.kind == 4)
1883 *value2 = (ssize_t)op2.ui64;
1884 else if(op2.kind == 23 && op2.type->isSigned)
1885 *value2 = (ssize_t)op2.i64;
1886 else if(op2.kind == 23)
1887 *value2 = (ssize_t)op2.ui64;
1888 else if(op2.kind == 22 && op2.type->isSigned)
1889 *value2 = (ssize_t)op2.i64;
1890 else if(op2.kind == 22)
1891 *value2 = (ssize_t)op2.ui64;
1892 else if(op2.kind == 2 && op2.type->isSigned)
1893 *value2 = (ssize_t)op2.s;
1894 else if(op2.kind == 2)
1895 *value2 = (ssize_t)op2.us;
1896 else if(op2.kind == 1 && op2.type->isSigned)
1897 *value2 = (ssize_t)op2.c;
1898 else if(op2.kind == 1)
1899 *value2 = (ssize_t)op2.uc;
1900 else if(op2.kind == 6)
1901 *value2 = (ssize_t)op2.f;
1902 else if(op2.kind == 7)
1903 *value2 = (ssize_t)op2.d;
1904 else if(op2.kind == 13)
1905 *value2 = (ssize_t)op2.ui64;
1906 else
1907 return 0x0;
1908 return 0x1;
1909 }
1910
1911 unsigned int GetUIntSize(struct Expression * exp, size_t * value2)
1912 {
1913 struct Operand op2 = GetOperand(exp);
1914
1915 if(op2.kind == 3 && op2.type->isSigned)
1916 *value2 = (size_t)op2.i;
1917 else if(op2.kind == 3)
1918 *value2 = (size_t)op2.ui;
1919 else if(op2.kind == 4 && op2.type->isSigned)
1920 *value2 = (size_t)op2.i64;
1921 else if(op2.kind == 4)
1922 *value2 = (size_t)op2.ui64;
1923 else if(op2.kind == 23 && op2.type->isSigned)
1924 *value2 = (size_t)op2.i64;
1925 else if(op2.kind == 23)
1926 *value2 = (size_t)op2.ui64;
1927 else if(op2.kind == 22 && op2.type->isSigned)
1928 *value2 = (size_t)op2.i64;
1929 else if(op2.kind == 22)
1930 *value2 = (size_t)op2.ui64;
1931 else if(op2.kind == 2 && op2.type->isSigned)
1932 *value2 = (size_t)op2.s;
1933 else if(op2.kind == 2)
1934 *value2 = (size_t)op2.us;
1935 else if(op2.kind == 1 && op2.type->isSigned)
1936 *value2 = (size_t)op2.c;
1937 else if(op2.kind == 1)
1938 *value2 = (size_t)op2.uc;
1939 else if(op2.kind == 6)
1940 *value2 = (size_t)op2.f;
1941 else if(op2.kind == 7)
1942 *value2 = (size_t)op2.d;
1943 else if(op2.kind == 13)
1944 *value2 = (size_t)op2.ui64;
1945 else
1946 return 0x0;
1947 return 0x1;
1948 }
1949
1950 unsigned int GetShort(struct Expression * exp, short * value2)
1951 {
1952 struct Operand op2 = GetOperand(exp);
1953
1954 if(op2.kind == 3 && op2.type->isSigned)
1955 *value2 = (short)op2.i;
1956 else if(op2.kind == 3)
1957 *value2 = (short)op2.ui;
1958 else if(op2.kind == 4 && op2.type->isSigned)
1959 *value2 = (short)op2.i64;
1960 else if(op2.kind == 4)
1961 *value2 = (short)op2.ui64;
1962 else if(op2.kind == 23 && op2.type->isSigned)
1963 *value2 = (short)op2.i64;
1964 else if(op2.kind == 23)
1965 *value2 = (short)op2.ui64;
1966 else if(op2.kind == 22 && op2.type->isSigned)
1967 *value2 = (short)op2.i64;
1968 else if(op2.kind == 22)
1969 *value2 = (short)op2.ui64;
1970 else if(op2.kind == 2 && op2.type->isSigned)
1971 *value2 = op2.s;
1972 else if(op2.kind == 2)
1973 *value2 = (short)op2.us;
1974 else if(op2.kind == 1 && op2.type->isSigned)
1975 *value2 = (short)op2.c;
1976 else if(op2.kind == 1)
1977 *value2 = (short)op2.uc;
1978 else if(op2.kind == 6)
1979 *value2 = (short)op2.f;
1980 else if(op2.kind == 7)
1981 *value2 = (short)op2.d;
1982 else if(op2.kind == 13)
1983 *value2 = (short)op2.ui64;
1984 else
1985 return 0x0;
1986 return 0x1;
1987 }
1988
1989 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
1990 {
1991 struct Operand op2 = GetOperand(exp);
1992
1993 if(op2.kind == 3 && op2.type->isSigned)
1994 *value2 = (unsigned short)op2.i;
1995 else if(op2.kind == 3)
1996 *value2 = (unsigned short)op2.ui;
1997 else if(op2.kind == 4 && op2.type->isSigned)
1998 *value2 = (unsigned short)op2.i64;
1999 else if(op2.kind == 4)
2000 *value2 = (unsigned short)op2.ui64;
2001 else if(op2.kind == 23 && op2.type->isSigned)
2002 *value2 = (unsigned short)op2.i64;
2003 else if(op2.kind == 23)
2004 *value2 = (unsigned short)op2.ui64;
2005 else if(op2.kind == 22 && op2.type->isSigned)
2006 *value2 = (unsigned short)op2.i64;
2007 else if(op2.kind == 22)
2008 *value2 = (unsigned short)op2.ui64;
2009 else if(op2.kind == 2 && op2.type->isSigned)
2010 *value2 = (unsigned short)op2.s;
2011 else if(op2.kind == 2)
2012 *value2 = op2.us;
2013 else if(op2.kind == 1 && op2.type->isSigned)
2014 *value2 = (unsigned short)op2.c;
2015 else if(op2.kind == 1)
2016 *value2 = (unsigned short)op2.uc;
2017 else if(op2.kind == 6)
2018 *value2 = (unsigned short)op2.f;
2019 else if(op2.kind == 7)
2020 *value2 = (unsigned short)op2.d;
2021 else if(op2.kind == 13)
2022 *value2 = (unsigned short)op2.ui64;
2023 else
2024 return 0x0;
2025 return 0x1;
2026 }
2027
2028 unsigned int GetChar(struct Expression * exp, char * value2)
2029 {
2030 struct Operand op2 = GetOperand(exp);
2031
2032 if(op2.kind == 3 && op2.type->isSigned)
2033 *value2 = (char)op2.i;
2034 else if(op2.kind == 3)
2035 *value2 = (char)op2.ui;
2036 else if(op2.kind == 4 && op2.type->isSigned)
2037 *value2 = (char)op2.i64;
2038 else if(op2.kind == 4)
2039 *value2 = (char)op2.ui64;
2040 else if(op2.kind == 23 && op2.type->isSigned)
2041 *value2 = (char)op2.i64;
2042 else if(op2.kind == 23)
2043 *value2 = (char)op2.ui64;
2044 else if(op2.kind == 22 && op2.type->isSigned)
2045 *value2 = (char)op2.i64;
2046 else if(op2.kind == 22)
2047 *value2 = (char)op2.ui64;
2048 else if(op2.kind == 2 && op2.type->isSigned)
2049 *value2 = (char)op2.s;
2050 else if(op2.kind == 2)
2051 *value2 = (char)op2.us;
2052 else if(op2.kind == 1 && op2.type->isSigned)
2053 *value2 = op2.c;
2054 else if(op2.kind == 1)
2055 *value2 = (char)op2.uc;
2056 else if(op2.kind == 6)
2057 *value2 = (char)op2.f;
2058 else if(op2.kind == 7)
2059 *value2 = (char)op2.d;
2060 else if(op2.kind == 13)
2061 *value2 = (char)op2.ui64;
2062 else
2063 return 0x0;
2064 return 0x1;
2065 }
2066
2067 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
2068 {
2069 struct Operand op2 = GetOperand(exp);
2070
2071 if(op2.kind == 3 && op2.type->isSigned)
2072 *value2 = (unsigned char)op2.i;
2073 else if(op2.kind == 3)
2074 *value2 = (unsigned char)op2.ui;
2075 else if(op2.kind == 4 && op2.type->isSigned)
2076 *value2 = (unsigned char)op2.i64;
2077 else if(op2.kind == 4)
2078 *value2 = (unsigned char)op2.ui64;
2079 else if(op2.kind == 23 && op2.type->isSigned)
2080 *value2 = (unsigned char)op2.i64;
2081 else if(op2.kind == 23)
2082 *value2 = (unsigned char)op2.ui64;
2083 else if(op2.kind == 22 && op2.type->isSigned)
2084 *value2 = (unsigned char)op2.i64;
2085 else if(op2.kind == 22)
2086 *value2 = (unsigned char)op2.ui64;
2087 else if(op2.kind == 2 && op2.type->isSigned)
2088 *value2 = (unsigned char)op2.s;
2089 else if(op2.kind == 2)
2090 *value2 = (unsigned char)op2.us;
2091 else if(op2.kind == 1 && op2.type->isSigned)
2092 *value2 = (unsigned char)op2.c;
2093 else if(op2.kind == 1)
2094 *value2 = op2.uc;
2095 else if(op2.kind == 6)
2096 *value2 = (unsigned char)op2.f;
2097 else if(op2.kind == 7)
2098 *value2 = (unsigned char)op2.d;
2099 else if(op2.kind == 13)
2100 *value2 = (unsigned char)op2.ui64;
2101 else
2102 return 0x0;
2103 return 0x1;
2104 }
2105
2106 unsigned int GetFloat(struct Expression * exp, float * value2)
2107 {
2108 struct Operand op2 = GetOperand(exp);
2109
2110 if(op2.kind == 3 && op2.type->isSigned)
2111 *value2 = (float)(float)op2.i;
2112 else if(op2.kind == 3)
2113 *value2 = (float)(float)op2.ui;
2114 else if(op2.kind == 4 && op2.type->isSigned)
2115 *value2 = (float)(float)op2.i64;
2116 else if(op2.kind == 4)
2117 *value2 = (float)(float)op2.ui64;
2118 else if(op2.kind == 23 && op2.type->isSigned)
2119 *value2 = (float)(float)op2.i64;
2120 else if(op2.kind == 23)
2121 *value2 = (float)(float)op2.ui64;
2122 else if(op2.kind == 22 && op2.type->isSigned)
2123 *value2 = (float)(float)op2.i64;
2124 else if(op2.kind == 22)
2125 *value2 = (float)(float)op2.ui64;
2126 else if(op2.kind == 2 && op2.type->isSigned)
2127 *value2 = (float)(float)op2.s;
2128 else if(op2.kind == 2)
2129 *value2 = (float)(float)op2.us;
2130 else if(op2.kind == 1 && op2.type->isSigned)
2131 *value2 = (float)(float)op2.c;
2132 else if(op2.kind == 1)
2133 *value2 = (float)(float)op2.uc;
2134 else if(op2.kind == 6)
2135 *value2 = (float)op2.f;
2136 else if(op2.kind == 7)
2137 *value2 = (float)op2.d;
2138 else if(op2.kind == 13)
2139 *value2 = (float)(float)op2.ui64;
2140 else
2141 return 0x0;
2142 return 0x1;
2143 }
2144
2145 unsigned int GetDouble(struct Expression * exp, double * value2)
2146 {
2147 struct Operand op2 = GetOperand(exp);
2148
2149 if(op2.kind == 3 && op2.type->isSigned)
2150 *value2 = (double)(double)op2.i;
2151 else if(op2.kind == 3)
2152 *value2 = (double)(double)op2.ui;
2153 else if(op2.kind == 4 && op2.type->isSigned)
2154 *value2 = (double)(double)op2.i64;
2155 else if(op2.kind == 4)
2156 *value2 = (double)(double)op2.ui64;
2157 else if(op2.kind == 23 && op2.type->isSigned)
2158 *value2 = (double)(double)op2.i64;
2159 else if(op2.kind == 23)
2160 *value2 = (double)(double)op2.ui64;
2161 else if(op2.kind == 22 && op2.type->isSigned)
2162 *value2 = (double)(double)op2.i64;
2163 else if(op2.kind == 22)
2164 *value2 = (double)(double)op2.ui64;
2165 else if(op2.kind == 2 && op2.type->isSigned)
2166 *value2 = (double)(double)op2.s;
2167 else if(op2.kind == 2)
2168 *value2 = (double)(double)op2.us;
2169 else if(op2.kind == 1 && op2.type->isSigned)
2170 *value2 = (double)(double)op2.c;
2171 else if(op2.kind == 1)
2172 *value2 = (double)(double)op2.uc;
2173 else if(op2.kind == 6)
2174 *value2 = (double)op2.f;
2175 else if(op2.kind == 7)
2176 *value2 = (double)op2.d;
2177 else if(op2.kind == 13)
2178 *value2 = (double)(double)op2.ui64;
2179 else
2180 return 0x0;
2181 return 0x1;
2182 }
2183
2184 void ComputeExpression(struct Expression * exp);
2185
2186 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2187
2188 extern int targetBits;
2189
2190 int ComputeTypeSize(struct Type * type);
2191
2192 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2193
2194 struct __ecereNameSpace__ecere__com__BitMember
2195 {
2196 struct __ecereNameSpace__ecere__com__BitMember * prev;
2197 struct __ecereNameSpace__ecere__com__BitMember * next;
2198 char *  name;
2199 unsigned int isProperty;
2200 int memberAccess;
2201 int id;
2202 struct __ecereNameSpace__ecere__com__Class * _class;
2203 char *  dataTypeString;
2204 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2205 struct Type * dataType;
2206 int type;
2207 int size;
2208 int pos;
2209 uint64 mask;
2210 } __attribute__ ((gcc_struct));
2211
2212 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2213
2214 struct __ecereNameSpace__ecere__sys__OldLink
2215 {
2216 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2217 struct __ecereNameSpace__ecere__sys__OldLink * next;
2218 void *  data;
2219 } __attribute__ ((gcc_struct));
2220
2221 void FinishTemplatesContext(struct Context * context);
2222
2223 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2224 {
2225 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2226 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2227
2228 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))
2229 {
2230 int c;
2231 int unionMemberOffset = 0;
2232 int bitFields = 0;
2233
2234 if(member)
2235 {
2236 member->memberOffset = 0;
2237 if(targetBits < sizeof(void *) * 8)
2238 member->structAlignment = 0;
2239 }
2240 else if(targetBits < sizeof(void *) * 8)
2241 _class->structAlignment = 0;
2242 if(!member && ((_class->type == 0 || _class->type == 5) || (_class->type == 1 && _class->memberOffset && _class->memberOffset > _class->base->structSize)))
2243 _class->memberOffset = (_class->base && _class->type == 1) ? _class->base->structSize : 0;
2244 if(!member && _class->destructionWatchOffset)
2245 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2246 {
2247 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2248
2249 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2250 {
2251 if(!dataMember->isProperty)
2252 {
2253 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2254 {
2255 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2256 }
2257 }
2258 }
2259 }
2260 {
2261 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2262
2263 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2264 {
2265 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2266 {
2267 if(!isMember && _class->type == 2 && dataMember->dataType)
2268 {
2269 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2270 uint64 mask = 0;
2271 int d;
2272
2273 ComputeTypeSize(dataMember->dataType);
2274 if(bitMember->pos == -1)
2275 bitMember->pos = _class->memberOffset;
2276 if(!bitMember->size)
2277 bitMember->size = dataMember->dataType->size * 8;
2278 _class->memberOffset = bitMember->pos + bitMember->size;
2279 for(d = 0; d < bitMember->size; d++)
2280 {
2281 if(d)
2282 mask <<= 1;
2283 mask |= 1;
2284 }
2285 bitMember->mask = mask << bitMember->pos;
2286 }
2287 else if(dataMember->type == 0 && dataMember->dataType)
2288 {
2289 int size;
2290 int alignment = 0;
2291
2292 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2293 ComputeTypeSize(dataMember->dataType);
2294 if(dataMember->dataType->bitFieldCount)
2295 {
2296 bitFields += dataMember->dataType->bitFieldCount;
2297 size = 0;
2298 }
2299 else
2300 {
2301 if(bitFields)
2302 {
2303 int size = (bitFields + 7) / 8;
2304
2305 if(isMember)
2306 {
2307 int __simpleStruct0;
2308
2309 if(alignment)
2310 {
2311 int __simpleStruct0;
2312
2313 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2314 if(member->memberOffset % alignment)
2315 member->memberOffset += alignment - (member->memberOffset % alignment);
2316 }
2317 dataMember->offset = member->memberOffset;
2318 if(member->type == 1)
2319 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2320 else
2321 {
2322 member->memberOffset += size;
2323 }
2324 }
2325 else
2326 {
2327 if(alignment)
2328 {
2329 int __simpleStruct0;
2330
2331 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2332 if(_class->memberOffset % alignment)
2333 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2334 }
2335 dataMember->offset = _class->memberOffset;
2336 _class->memberOffset += size;
2337 }
2338 bitFields = 0;
2339 }
2340 size = dataMember->dataType->size;
2341 alignment = dataMember->dataType->alignment;
2342 }
2343 if(isMember)
2344 {
2345 int __simpleStruct0;
2346
2347 if(alignment)
2348 {
2349 int __simpleStruct0;
2350
2351 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2352 if(member->memberOffset % alignment)
2353 member->memberOffset += alignment - (member->memberOffset % alignment);
2354 }
2355 dataMember->offset = member->memberOffset;
2356 if(member->type == 1)
2357 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2358 else
2359 {
2360 member->memberOffset += size;
2361 }
2362 }
2363 else
2364 {
2365 if(alignment)
2366 {
2367 int __simpleStruct0;
2368
2369 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2370 if(_class->memberOffset % alignment)
2371 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2372 }
2373 dataMember->offset = _class->memberOffset;
2374 _class->memberOffset += size;
2375 }
2376 }
2377 else
2378 {
2379 int alignment;
2380
2381 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2382 alignment = dataMember->structAlignment;
2383 if(isMember)
2384 {
2385 int __simpleStruct0;
2386
2387 if(alignment)
2388 {
2389 int __simpleStruct0;
2390
2391 if(member->memberOffset % alignment)
2392 member->memberOffset += alignment - (member->memberOffset % alignment);
2393 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2394 }
2395 dataMember->offset = member->memberOffset;
2396 if(member->type == 1)
2397 unionMemberOffset = (__simpleStruct0 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2398 else
2399 member->memberOffset += dataMember->memberOffset;
2400 }
2401 else
2402 {
2403 if(alignment)
2404 {
2405 int __simpleStruct0;
2406
2407 if(_class->memberOffset % alignment)
2408 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2409 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2410 }
2411 dataMember->offset = _class->memberOffset;
2412 _class->memberOffset += dataMember->memberOffset;
2413 }
2414 }
2415 }
2416 }
2417 if(bitFields)
2418 {
2419 int alignment = 0;
2420 int size = (bitFields + 7) / 8;
2421
2422 if(isMember)
2423 {
2424 int __simpleStruct0;
2425
2426 if(alignment)
2427 {
2428 int __simpleStruct0;
2429
2430 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2431 if(member->memberOffset % alignment)
2432 member->memberOffset += alignment - (member->memberOffset % alignment);
2433 }
2434 if(member->type == 1)
2435 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2436 else
2437 {
2438 member->memberOffset += size;
2439 }
2440 }
2441 else
2442 {
2443 if(alignment)
2444 {
2445 int __simpleStruct0;
2446
2447 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2448 if(_class->memberOffset % alignment)
2449 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2450 }
2451 _class->memberOffset += size;
2452 }
2453 bitFields = 0;
2454 }
2455 }
2456 if(member && member->type == 1)
2457 {
2458 member->memberOffset = unionMemberOffset;
2459 }
2460 if(!isMember)
2461 {
2462 if(_class->type != 2)
2463 {
2464 int extra = 0;
2465
2466 if(_class->structAlignment)
2467 {
2468 if(_class->memberOffset % _class->structAlignment)
2469 extra += _class->structAlignment - (_class->memberOffset % _class->structAlignment);
2470 }
2471 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset + extra;
2472 if(!member)
2473 {
2474 struct __ecereNameSpace__ecere__com__Property * prop;
2475
2476 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2477 {
2478 if(prop->isProperty && prop->isWatchable)
2479 {
2480 prop->watcherOffset = _class->structSize;
2481 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2482 }
2483 }
2484 }
2485 {
2486 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2487
2488 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2489 {
2490 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2491
2492 if(deriv->computeSize)
2493 {
2494 deriv->offset = _class->structSize;
2495 deriv->memberOffset = 0;
2496 deriv->structSize = deriv->offset;
2497 ComputeClassMembers(deriv, 0x0);
2498 }
2499 }
2500 }
2501 }
2502 }
2503 }
2504 if(context)
2505 FinishTemplatesContext(context);
2506 }
2507
2508 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2509
2510 struct __ecereNameSpace__ecere__com__NameSpace
2511 {
2512 char *  name;
2513 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2514 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2515 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2516 int depth;
2517 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2518 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2519 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2520 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2521 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2522 } __attribute__ ((gcc_struct));
2523
2524 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2525
2526 struct __ecereNameSpace__ecere__com__Module
2527 {
2528 struct __ecereNameSpace__ecere__com__Instance * application;
2529 struct __ecereNameSpace__ecere__sys__OldList classes;
2530 struct __ecereNameSpace__ecere__sys__OldList defines;
2531 struct __ecereNameSpace__ecere__sys__OldList functions;
2532 struct __ecereNameSpace__ecere__sys__OldList modules;
2533 struct __ecereNameSpace__ecere__com__Instance * prev;
2534 struct __ecereNameSpace__ecere__com__Instance * next;
2535 char *  name;
2536 void *  library;
2537 void *  Unload;
2538 int importType;
2539 int origImportType;
2540 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2541 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2542 } __attribute__ ((gcc_struct));
2543
2544 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2545 {
2546 struct __ecereNameSpace__ecere__com__Class * _class;
2547 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2548
2549 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
2550 ComputeModuleClasses(subModule->data);
2551 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->classes.first; _class; _class = _class->next)
2552 ComputeClassMembers(_class, 0x0);
2553 }
2554
2555 extern unsigned int inCompiler;
2556
2557 extern void Compiler_Error(char *  format, ...);
2558
2559 extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
2560
2561 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
2562
2563 int ComputeTypeSize(struct Type * type)
2564 {
2565 unsigned int size = type ? type->size : 0;
2566
2567 if(!size && type && !type->computing)
2568 {
2569 type->computing = 0x1;
2570 switch(type->kind)
2571 {
2572 case 1:
2573 type->alignment = size = sizeof(char);
2574 break;
2575 case 3:
2576 type->alignment = size = sizeof(int);
2577 break;
2578 case 4:
2579 type->alignment = size = sizeof(long long);
2580 break;
2581 case 22:
2582 type->alignment = size = targetBits / 8;
2583 break;
2584 case 23:
2585 type->alignment = size = targetBits / 8;
2586 break;
2587 case 5:
2588 type->alignment = size = sizeof(long);
2589 break;
2590 case 2:
2591 type->alignment = size = sizeof(short);
2592 break;
2593 case 6:
2594 type->alignment = size = sizeof(float);
2595 break;
2596 case 7:
2597 type->alignment = size = sizeof(double);
2598 break;
2599 case 8:
2600 {
2601 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2602
2603 if(_class && _class->type == 1)
2604 {
2605 ComputeClassMembers(_class, 0x0);
2606 type->alignment = _class->structAlignment;
2607 size = _class->structSize;
2608 if(type->alignment && size % type->alignment)
2609 size += type->alignment - (size % type->alignment);
2610 }
2611 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2612 {
2613 if(!_class->dataType)
2614 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2615 size = type->alignment = ComputeTypeSize(_class->dataType);
2616 }
2617 else
2618 size = type->alignment = targetBits / 8;
2619 break;
2620 }
2621 case 13:
2622 case 19:
2623 size = type->alignment = targetBits / 8;
2624 break;
2625 case 12:
2626 if(type->arraySizeExp)
2627 {
2628 ProcessExpressionType(type->arraySizeExp);
2629 ComputeExpression(type->arraySizeExp);
2630 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)))
2631 {
2632 struct Location oldLoc = yylloc;
2633 char expression[10240];
2634
2635 expression[0] = '\0';
2636 type->arraySizeExp->expType = (((void *)0));
2637 yylloc = type->arraySizeExp->loc;
2638 if(inCompiler)
2639 PrintExpression(type->arraySizeExp, expression);
2640 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Array size not constant int (%s)\n", (((void *)0))), expression);
2641 yylloc = oldLoc;
2642 }
2643 GetInt(type->arraySizeExp, &type->arraySize);
2644 }
2645 else if(type->enumClass)
2646 {
2647 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2648 {
2649 type->arraySize = (int)__ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2650 }
2651 else
2652 type->arraySize = 0;
2653 }
2654 else
2655 {
2656 type->arraySize = 0;
2657 }
2658 size = ComputeTypeSize(type->type) * type->arraySize;
2659 type->alignment = type->type->alignment;
2660 break;
2661 case 9:
2662 {
2663 struct Type * member;
2664
2665 for(member = type->members.first; member; member = member->next)
2666 {
2667 int __simpleStruct0, __simpleStruct1;
2668 unsigned int addSize = ComputeTypeSize(member);
2669
2670 member->offset = size;
2671 if(member->alignment && size % member->alignment)
2672 member->offset += member->alignment - (size % member->alignment);
2673 size = member->offset;
2674 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2675 size += addSize;
2676 }
2677 if(type->alignment && size % type->alignment)
2678 size += type->alignment - (size % type->alignment);
2679 break;
2680 }
2681 case 10:
2682 {
2683 struct Type * member;
2684
2685 for(member = type->members.first; member; member = member->next)
2686 {
2687 int __simpleStruct0, __simpleStruct1;
2688 unsigned int addSize = ComputeTypeSize(member);
2689
2690 member->offset = size;
2691 if(member->alignment && size % member->alignment)
2692 member->offset += member->alignment - (size % member->alignment);
2693 size = member->offset;
2694 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2695 size = ((size > addSize) ? size : addSize);
2696 }
2697 if(type->alignment && size % type->alignment)
2698 size += type->alignment - (size % type->alignment);
2699 break;
2700 }
2701 case 20:
2702 {
2703 struct TemplateParameter * param = type->templateParameter;
2704 struct Type * baseType = ProcessTemplateParameterType(param);
2705
2706 if(baseType)
2707 {
2708 size = ComputeTypeSize(baseType);
2709 type->alignment = baseType->alignment;
2710 }
2711 else
2712 type->alignment = size = sizeof(uint64);
2713 break;
2714 }
2715 case 15:
2716 {
2717 type->alignment = size = sizeof(enum
2718 {
2719 test
2720 });
2721 break;
2722 }
2723 case 21:
2724 {
2725 type->alignment = size = targetBits / 8;
2726 break;
2727 }
2728 }
2729 type->size = size;
2730 type->computing = 0x0;
2731 }
2732 return size;
2733 }
2734
2735 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2736
2737 extern struct Identifier * MkIdentifier(char *  string);
2738
2739 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2740
2741 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2742
2743 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2744
2745 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2746
2747 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2748
2749 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2750
2751 extern void FreeType(struct Type * type);
2752
2753 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2754
2755 extern struct Specifier * MkSpecifier(int specifier);
2756
2757 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2758
2759 extern struct Expression * MkExpConstant(char *  string);
2760
2761 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)
2762 {
2763 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2764 unsigned int totalSize = 0;
2765 unsigned int maxSize = 0;
2766 int alignment, size;
2767 struct __ecereNameSpace__ecere__com__DataMember * member;
2768 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2769
2770 if(addedPadding)
2771 *addedPadding = 0x0;
2772 if(!isMember && _class->base)
2773 {
2774 maxSize = _class->structSize;
2775 {
2776 if(_class->type == 1 || _class->type == 5)
2777 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass, (((void *)0)));
2778 else
2779 {
2780 unsigned int baseSize = _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2781
2782 if(maxSize > baseSize)
2783 maxSize -= baseSize;
2784 else
2785 maxSize = 0;
2786 }
2787 }
2788 }
2789 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2790 {
2791 if(!member->isProperty)
2792 {
2793 switch(member->type)
2794 {
2795 case 0:
2796 {
2797 if(member->dataTypeString)
2798 {
2799 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2800 struct Declarator * decl;
2801
2802 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2803 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2804 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2805 if(!member->dataType)
2806 member->dataType = ProcessType(specs, decl);
2807 ReplaceThisClassSpecifiers(specs, topClass);
2808 {
2809 struct Type * type = ProcessType(specs, decl);
2810
2811 DeclareType(member->dataType, 0x0, 0x0);
2812 FreeType(type);
2813 }
2814 ComputeTypeSize(member->dataType);
2815 size = member->dataType->size;
2816 alignment = member->dataType->alignment;
2817 if(alignment)
2818 {
2819 if(totalSize % alignment)
2820 totalSize += alignment - (totalSize % alignment);
2821 }
2822 totalSize += size;
2823 }
2824 break;
2825 }
2826 case 1:
2827 case 2:
2828 {
2829 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2830
2831 size = 0;
2832 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass, (((void *)0)));
2833 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
2834 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
2835 alignment = member->structAlignment;
2836 if(alignment)
2837 {
2838 if(totalSize % alignment)
2839 totalSize += alignment - (totalSize % alignment);
2840 }
2841 totalSize += size;
2842 break;
2843 }
2844 }
2845 }
2846 }
2847 if(retSize)
2848 {
2849 unsigned int __simpleStruct0;
2850
2851 if(topMember && topMember->type == 1)
2852 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
2853 else
2854 *retSize += totalSize;
2855 }
2856 else if(totalSize < maxSize && _class->type != 1000)
2857 {
2858 int autoPadding = 0;
2859
2860 if(!isMember && _class->structAlignment && totalSize % _class->structAlignment)
2861 autoPadding = _class->structAlignment - (totalSize % _class->structAlignment);
2862 if(totalSize + autoPadding < maxSize)
2863 {
2864 char sizeString[50];
2865
2866 sprintf(sizeString, "%d", maxSize - totalSize);
2867 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
2868 if(addedPadding)
2869 *addedPadding = 0x1;
2870 }
2871 }
2872 if(context)
2873 FinishTemplatesContext(context);
2874 return topMember ? topMember->memberID : _class->memberID;
2875 }
2876
2877 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2878 {
2879 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2880 unsigned int totalSize = 0;
2881 struct __ecereNameSpace__ecere__com__DataMember * member;
2882 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2883
2884 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
2885 DeclareMembers(_class->base, 0x0);
2886 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2887 {
2888 if(!member->isProperty)
2889 {
2890 switch(member->type)
2891 {
2892 case 0:
2893 {
2894 if(!member->dataType && member->dataTypeString)
2895 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
2896 if(member->dataType)
2897 DeclareType(member->dataType, 0x0, 0x0);
2898 break;
2899 }
2900 case 1:
2901 case 2:
2902 {
2903 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
2904 break;
2905 }
2906 }
2907 }
2908 }
2909 if(context)
2910 FinishTemplatesContext(context);
2911 return topMember ? topMember->memberID : _class->memberID;
2912 }
2913
2914 extern struct Symbol * FindClass(char *  name);
2915
2916 extern char *  strchr(const char * , int);
2917
2918 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
2919
2920 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (* )(void * ));
2921
2922 extern void FreeClassDef(struct ClassDef * def);
2923
2924 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
2925
2926 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
2927
2928 extern char *  strcpy(char * , const char * );
2929
2930 extern void MangleClassName(char *  className);
2931
2932 extern void DeclareClass(struct Symbol * classSym, char *  className);
2933
2934 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
2935
2936 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
2937
2938 void DeclareStruct(char * name, unsigned int skipNoHead)
2939 {
2940 struct External * external = (((void *)0));
2941 struct Symbol * classSym = FindClass(name);
2942
2943 if(!inCompiler || !classSym)
2944 return ;
2945 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
2946 return ;
2947 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
2948 {
2949 struct Declaration * decl;
2950 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2951 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
2952 char structName[1024];
2953
2954 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
2955 classSym->declaring++;
2956 if(strchr(classSym->string, '<'))
2957 {
2958 if(classSym->registered->templateClass)
2959 {
2960 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
2961 classSym->declaring--;
2962 }
2963 return ;
2964 }
2965 DeclareMembers(classSym->registered, 0x0);
2966 structName[0] = (char)0;
2967 FullClassNameCat(structName, name, 0x0);
2968 if(!skipNoHead)
2969 {
2970 unsigned int addedPadding = 0x0;
2971
2972 classSym->declaredStructSym = 0x1;
2973 declarations = MkList();
2974 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered, &addedPadding);
2975 if(!(*declarations).count || ((*declarations).count == 1 && addedPadding))
2976 {
2977 FreeList(declarations, FreeClassDef);
2978 declarations = (((void *)0));
2979 }
2980 }
2981 if(skipNoHead || declarations)
2982 {
2983 if(external && external->declaration)
2984 {
2985 ((struct Specifier *)(*external->declaration->specifiers).first)->definitions = declarations;
2986 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2987 {
2988 if(classSym->structExternal)
2989 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2990 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2991 classSym->id = curExternal->symbol->idCode;
2992 classSym->idCode = curExternal->symbol->idCode;
2993 }
2994 }
2995 else
2996 {
2997 if(!external)
2998 external = MkExternalDeclaration((((void *)0)));
2999 specifiers = MkList();
3000 declarators = MkList();
3001 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
3002 external->declaration = decl = MkDeclaration(specifiers, declarators);
3003 if(decl->symbol && !decl->symbol->pointerExternal)
3004 decl->symbol->pointerExternal = external;
3005 if(classSym->registered && classSym->registered->type == 1)
3006 {
3007 char className[1024];
3008
3009 strcpy(className, "__ecereClass_");
3010 FullClassNameCat(className, classSym->string, 0x1);
3011 MangleClassName(className);
3012 DeclareClass(classSym, className);
3013 external->symbol = classSym;
3014 classSym->pointerExternal = external;
3015 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3016 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3017 }
3018 else
3019 {
3020 char className[1024];
3021
3022 strcpy(className, "__ecereClass_");
3023 FullClassNameCat(className, classSym->string, 0x1);
3024 MangleClassName(className);
3025 classSym->structExternal = external;
3026 DeclareClass(classSym, className);
3027 external->symbol = classSym;
3028 }
3029 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
3030 }
3031 }
3032 classSym->declaring--;
3033 }
3034 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3035 {
3036 classSym->declaring++;
3037 {
3038 if(classSym->registered)
3039 DeclareMembers(classSym->registered, 0x0);
3040 }
3041 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
3042 {
3043 if(classSym->structExternal)
3044 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3045 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3046 classSym->id = curExternal->symbol->idCode;
3047 classSym->idCode = curExternal->symbol->idCode;
3048 }
3049 classSym->declaring--;
3050 }
3051 }
3052
3053 extern char *  strcat(char * , const char * );
3054
3055 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
3056
3057 extern struct ModuleImport * mainModule;
3058
3059 extern struct Specifier * MkSpecifierName(char *  name);
3060
3061 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
3062
3063 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
3064
3065 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
3066
3067 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
3068
3069 extern void FreeDeclarator(struct Declarator * decl);
3070
3071 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
3072
3073 struct PropertyImport
3074 {
3075 struct PropertyImport * prev;
3076 struct PropertyImport * next;
3077 char *  name;
3078 unsigned int isVirtual;
3079 unsigned int hasSet;
3080 unsigned int hasGet;
3081 } __attribute__ ((gcc_struct));
3082
3083 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3084
3085 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
3086 {
3087 void * __ecereTemp1;
3088 struct Symbol * symbol = prop->symbol;
3089 char propName[1024];
3090
3091 strcpy(setName, "__ecereProp_");
3092 FullClassNameCat(setName, prop->_class->fullName, 0x0);
3093 strcat(setName, "_Set_");
3094 FullClassNameCat(setName, prop->name, 0x1);
3095 strcpy(getName, "__ecereProp_");
3096 FullClassNameCat(getName, prop->_class->fullName, 0x0);
3097 strcat(getName, "_Get_");
3098 FullClassNameCat(getName, prop->name, 0x1);
3099 strcpy(propName, "__ecereProp_");
3100 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3101 strcat(propName, "_");
3102 FullClassNameCat(propName, prop->name, 0x1);
3103 MangleClassName(getName);
3104 MangleClassName(setName);
3105 MangleClassName(propName);
3106 if(prop->_class->type == 1)
3107 DeclareStruct(prop->_class->fullName, 0x0);
3108 if(!symbol || curExternal->symbol->idCode < symbol->id)
3109 {
3110 unsigned int imported = 0x0;
3111 unsigned int dllImport = 0x0;
3112
3113 if(!symbol || symbol->_import)
3114 {
3115 if(!symbol)
3116 {
3117 struct Symbol * classSym;
3118
3119 if(!prop->_class->symbol)
3120 prop->_class->symbol = FindClass(prop->_class->fullName);
3121 classSym = prop->_class->symbol;
3122 if(classSym && !classSym->_import)
3123 {
3124 struct ModuleImport * module;
3125
3126 if(prop->_class->module)
3127 module = FindModule(prop->_class->module);
3128 else
3129 module = mainModule;
3130 classSym->_import = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport), ((struct ClassImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), ((struct ClassImport *)__ecereTemp1)->isRemote = prop->_class->isRemote, ((struct ClassImport *)__ecereTemp1));
3131 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3132 }
3133 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3134 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport), ((struct PropertyImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), ((struct PropertyImport *)__ecereTemp1)->isVirtual = 0x0, ((struct PropertyImport *)__ecereTemp1)->hasSet = prop->Set ? 0x1 : 0x0, ((struct PropertyImport *)__ecereTemp1)->hasGet = prop->Get ? 0x1 : 0x0, ((struct PropertyImport *)__ecereTemp1));
3135 if(classSym)
3136 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
3137 }
3138 imported = 0x1;
3139 if(prop->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + structSize_Instance)))->importType != 1)
3140 dllImport = 0x1;
3141 }
3142 if(!symbol->type)
3143 {
3144 struct Context * context = SetupTemplatesContext(prop->_class);
3145
3146 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
3147 FinishTemplatesContext(context);
3148 }
3149 if(prop->Get)
3150 {
3151 if(!symbol->externalGet || symbol->externalGet->type == 0)
3152 {
3153 struct Declaration * decl;
3154 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3155 struct Declarator * d;
3156 struct __ecereNameSpace__ecere__sys__OldList * params;
3157 struct Specifier * spec;
3158 struct External * external;
3159 struct Declarator * typeDecl;
3160 unsigned int simple = 0x0;
3161
3162 specifiers = MkList();
3163 declarators = MkList();
3164 params = MkList();
3165 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3166 d = MkDeclaratorIdentifier(MkIdentifier(getName));
3167 if(dllImport)
3168 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3169 {
3170 struct Context * context = SetupTemplatesContext(prop->_class);
3171
3172 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
3173 FinishTemplatesContext(context);
3174 }
3175 for(spec = (*specifiers).first; spec; spec = spec->next)
3176 {
3177 if(spec->type == 1)
3178 {
3179 if((!typeDecl || typeDecl->type == 1))
3180 {
3181 struct Symbol * classSym = spec->symbol;
3182
3183 symbol->_class = classSym->registered;
3184 if(classSym->registered && classSym->registered->type == 1)
3185 {
3186 DeclareStruct(spec->name, 0x0);
3187 simple = 0x1;
3188 }
3189 }
3190 }
3191 }
3192 if(!simple)
3193 d = PlugDeclarator(typeDecl, d);
3194 else
3195 {
3196 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3197 specifiers = MkList();
3198 }
3199 d = MkDeclaratorFunction(d, params);
3200 if(dllImport)
3201 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3202 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3203 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3204 if(simple)
3205 ListAdd(specifiers, MkSpecifier(VOID));
3206 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3207 decl = MkDeclaration(specifiers, declarators);
3208 external = MkExternalDeclaration(decl);
3209 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3210 external->symbol = symbol;
3211 symbol->externalGet = external;
3212 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3213 if(typeDecl)
3214 FreeDeclarator(typeDecl);
3215 }
3216 else
3217 {
3218 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3219 }
3220 }
3221 if(prop->Set)
3222 {
3223 if(!symbol->externalSet || symbol->externalSet->type == 0)
3224 {
3225 struct Declaration * decl;
3226 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3227 struct Declarator * d;
3228 struct __ecereNameSpace__ecere__sys__OldList * params;
3229 struct Specifier * spec;
3230 struct External * external;
3231 struct Declarator * typeDecl;
3232
3233 declarators = MkList();
3234 params = MkList();
3235 if(!prop->conversion || prop->_class->type == 1)
3236 {
3237 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3238 }
3239 specifiers = MkList();
3240 {
3241 struct Context * context = SetupTemplatesContext(prop->_class);
3242
3243 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3244 FinishTemplatesContext(context);
3245 }
3246 ListAdd(params, MkTypeName(specifiers, d));
3247 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3248 if(dllImport)
3249 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3250 d = MkDeclaratorFunction(d, params);
3251 for(spec = (*specifiers).first; spec; spec = spec->next)
3252 {
3253 if(spec->type == 1)
3254 {
3255 if((!typeDecl || typeDecl->type == 1))
3256 {
3257 struct Symbol * classSym = spec->symbol;
3258
3259 symbol->_class = classSym->registered;
3260 if(classSym->registered && classSym->registered->type == 1)
3261 DeclareStruct(spec->name, 0x0);
3262 }
3263 }
3264 }
3265 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3266 specifiers = MkList();
3267 if(dllImport)
3268 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3269 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3270 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3271 if(!prop->conversion || prop->_class->type == 1)
3272 ListAdd(specifiers, MkSpecifier(VOID));
3273 else
3274 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3275 decl = MkDeclaration(specifiers, declarators);
3276 external = MkExternalDeclaration(decl);
3277 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3278 external->symbol = symbol;
3279 symbol->externalSet = external;
3280 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3281 }
3282 else
3283 {
3284 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3285 }
3286 }
3287 if(!symbol->externalPtr)
3288 {
3289 struct Declaration * decl;
3290 struct External * external;
3291 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3292
3293 if(imported)
3294 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3295 else
3296 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3297 ListAdd(specifiers, MkSpecifierName("Property"));
3298 {
3299 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3300
3301 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3302 if(!imported)
3303 {
3304 strcpy(propName, "__ecerePropM_");
3305 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3306 strcat(propName, "_");
3307 FullClassNameCat(propName, prop->name, 0x1);
3308 MangleClassName(propName);
3309 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3310 }
3311 decl = MkDeclaration(specifiers, list);
3312 }
3313 external = MkExternalDeclaration(decl);
3314 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3315 external->symbol = symbol;
3316 symbol->externalPtr = external;
3317 }
3318 else
3319 {
3320 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3321 }
3322 symbol->id = curExternal->symbol->idCode;
3323 }
3324 }
3325
3326 struct Type * Dereference(struct Type * source)
3327 {
3328 void * __ecereTemp1;
3329 struct Type * type = (((void *)0));
3330
3331 if(source)
3332 {
3333 if(source->kind == 13 || source->kind == 12)
3334 {
3335 type = source->type;
3336 source->type->refCount++;
3337 }
3338 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3339 {
3340 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 1, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
3341 }
3342 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3343 {
3344 type = source;
3345 source->refCount++;
3346 }
3347 else
3348 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot dereference type\n", (((void *)0))));
3349 }
3350 return type;
3351 }
3352
3353 static struct Type * Reference(struct Type * source)
3354 {
3355 void * __ecereTemp1;
3356 struct Type * type = (((void *)0));
3357
3358 if(source)
3359 {
3360 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = source, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
3361 source->refCount++;
3362 }
3363 return type;
3364 }
3365
3366 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);
3367
3368 extern void *  memcpy(void * , const void * , size_t size);
3369
3370 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3371
3372 extern void FreeExpression(struct Expression * exp);
3373
3374 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3375
3376 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);
3377
3378 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3379
3380 extern struct Type * MkClassType(char *  name);
3381
3382 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);
3383
3384 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)
3385 {
3386 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3387 unsigned int found = 0x0;
3388 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3389 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3390 unsigned int freeType = 0x0;
3391
3392 yylloc = member->loc;
3393 if(!ident)
3394 {
3395 if(curMember)
3396 {
3397 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3398 if(*curMember)
3399 {
3400 found = 0x1;
3401 dataMember = *curMember;
3402 }
3403 }
3404 }
3405 else
3406 {
3407 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3408 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3409 int _subMemberStackPos = 0;
3410
3411 if(!thisMember)
3412 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3413 if(thisMember)
3414 {
3415 dataMember = thisMember;
3416 if(curMember && thisMember->memberAccess == 1)
3417 {
3418 *curMember = thisMember;
3419 *curClass = thisMember->_class;
3420 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
3421 *subMemberStackPos = _subMemberStackPos;
3422 }
3423 found = 0x1;
3424 }
3425 else
3426 {
3427 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3428 if(method && method->type == 1)
3429 found = 0x1;
3430 else
3431 method = (((void *)0));
3432 }
3433 }
3434 if(found)
3435 {
3436 struct Type * type = (((void *)0));
3437
3438 if(dataMember)
3439 {
3440 if(!dataMember->dataType && dataMember->dataTypeString)
3441 {
3442 struct Context * context = SetupTemplatesContext(_class);
3443
3444 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3445 FinishTemplatesContext(context);
3446 }
3447 type = dataMember->dataType;
3448 }
3449 else if(method)
3450 {
3451 if(!method->dataType)
3452 ProcessMethodType(method);
3453 type = method->dataType;
3454 }
3455 if(ident && ident->next)
3456 {
3457 for(ident = ident->next; ident && type; ident = ident->next)
3458 {
3459 if(type->kind == 8)
3460 {
3461 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3462 if(!dataMember)
3463 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3464 if(dataMember)
3465 type = dataMember->dataType;
3466 }
3467 else if(type->kind == 9 || type->kind == 10)
3468 {
3469 struct Type * memberType;
3470
3471 for(memberType = type->members.first; memberType; memberType = memberType->next)
3472 {
3473 if(!strcmp(memberType->name, ident->string))
3474 {
3475 type = memberType;
3476 break;
3477 }
3478 }
3479 }
3480 }
3481 }
3482 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3483 {
3484 int id = 0;
3485 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3486 struct __ecereNameSpace__ecere__com__Class * sClass;
3487
3488 for(sClass = _class; sClass; sClass = sClass->base)
3489 {
3490 id = 0;
3491 if(sClass->templateClass)
3492 sClass = sClass->templateClass;
3493 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3494 {
3495 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3496 {
3497 for(sClass = sClass->base; sClass; sClass = sClass->base)
3498 {
3499 if(sClass->templateClass)
3500 sClass = sClass->templateClass;
3501 id += sClass->templateParams.count;
3502 }
3503 break;
3504 }
3505 id++;
3506 }
3507 if(curParam)
3508 break;
3509 }
3510 if(curParam)
3511 {
3512 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3513
3514 if(arg.dataTypeString)
3515 {
3516 type = ProcessTypeString(arg.dataTypeString, 0x0);
3517 freeType = 0x1;
3518 if(type && _class->templateClass)
3519 type->passAsTemplate = 0x1;
3520 if(type)
3521 {
3522 }
3523 }
3524 }
3525 }
3526 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3527 {
3528 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3529 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3530 int c;
3531 int paramCount = 0;
3532 int lastParam = -1;
3533 char templateString[1024];
3534 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3535
3536 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3537 for(cClass = expClass; cClass; cClass = cClass->base)
3538 {
3539 int p = 0;
3540
3541 if(cClass->templateClass)
3542 cClass = cClass->templateClass;
3543 for(param = cClass->templateParams.first; param; param = param->next)
3544 {
3545 int id = p;
3546 struct __ecereNameSpace__ecere__com__Class * sClass;
3547 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3548
3549 for(sClass = cClass->base; sClass; sClass = sClass->base)
3550 {
3551 if(sClass->templateClass)
3552 sClass = sClass->templateClass;
3553 id += sClass->templateParams.count;
3554 }
3555 arg = expClass->templateArgs[id];
3556 for(sClass = _class; sClass; sClass = sClass->base)
3557 {
3558 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3559 int p = 0;
3560 struct __ecereNameSpace__ecere__com__Class * nextClass;
3561
3562 if(sClass->templateClass)
3563 sClass = sClass->templateClass;
3564 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3565 {
3566 if(nextClass->templateClass)
3567 nextClass = nextClass->templateClass;
3568 p += nextClass->templateParams.count;
3569 }
3570 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3571 {
3572 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3573 {
3574 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3575 {
3576 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3577 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3578 break;
3579 }
3580 }
3581 }
3582 }
3583 {
3584 char argument[256];
3585
3586 argument[0] = '\0';
3587 switch(param->type)
3588 {
3589 case 2:
3590 {
3591 char expString[1024];
3592 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3593 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3594 struct Expression * exp;
3595 char * string = PrintHexUInt64(arg.expression.ui64);
3596
3597 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3598 ProcessExpressionType(exp);
3599 ComputeExpression(exp);
3600 expString[0] = '\0';
3601 PrintExpression(exp, expString);
3602 strcat(argument, expString);
3603 FreeExpression(exp);
3604 break;
3605 }
3606 case 1:
3607 {
3608 strcat(argument, arg.member->name);
3609 break;
3610 }
3611 case 0:
3612 {
3613 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3614 strcat(argument, arg.dataTypeString);
3615 break;
3616 }
3617 }
3618 if(argument[0])
3619 {
3620 if(paramCount)
3621 strcat(templateString, ", ");
3622 if(lastParam != p - 1)
3623 {
3624 strcat(templateString, param->name);
3625 strcat(templateString, " = ");
3626 }
3627 strcat(templateString, argument);
3628 paramCount++;
3629 lastParam = p;
3630 }
3631 p++;
3632 }
3633 }
3634 }
3635 {
3636 int len = strlen(templateString);
3637
3638 if(templateString[len - 1] == '<')
3639 len--;
3640 else
3641 {
3642 if(templateString[len - 1] == '>')
3643 templateString[len++] = ' ';
3644 templateString[len++] = '>';
3645 }
3646 templateString[len++] = '\0';
3647 }
3648 {
3649 struct Context * context = SetupTemplatesContext(_class);
3650
3651 if(freeType)
3652 FreeType(type);
3653 type = ProcessTypeString(templateString, 0x0);
3654 freeType = 0x1;
3655 FinishTemplatesContext(context);
3656 }
3657 }
3658 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3659 {
3660 ProcessExpressionType(member->initializer->exp);
3661 if(!member->initializer->exp->expType)
3662 {
3663 if(inCompiler)
3664 {
3665 char expString[10240];
3666
3667 expString[0] = '\0';
3668 PrintExpression(member->initializer->exp, expString);
3669 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3670 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3671 }
3672 }
3673 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3674 {
3675 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible instance method %s\n", (((void *)0))), ident->string);
3676 }
3677 }
3678 else if(member->initializer)
3679 {
3680 ProcessInitializer(member->initializer, type);
3681 }
3682 if(freeType)
3683 FreeType(type);
3684 }
3685 else
3686 {
3687 if(_class && _class->type == 3)
3688 {
3689 if(member->initializer)
3690 {
3691 struct Type * type = MkClassType(_class->fullName);
3692
3693 ProcessInitializer(member->initializer, type);
3694 FreeType(type);
3695 }
3696 }
3697 else
3698 {
3699 if(member->initializer)
3700 {
3701 ProcessInitializer(member->initializer, (((void *)0)));
3702 }
3703 if(ident)
3704 {
3705 if(method)
3706 {
3707 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3708 }
3709 else if(_class)
3710 {
3711 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3712 if(inCompiler)
3713 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3714 }
3715 }
3716 else if(_class)
3717 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3718 }
3719 }
3720 }
3721
3722 extern struct Identifier * GetDeclId(struct Declarator * decl);
3723
3724 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);
3725
3726 extern void FreeSpecifier(struct Specifier * spec);
3727
3728 static void ProcessFunction(struct FunctionDefinition * function);
3729
3730 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (* )(void * ));
3731
3732 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3733
3734 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3735
3736 extern void FreeClassFunction(struct ClassFunction * func);
3737
3738 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3739
3740 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3741
3742 void ProcessInstantiationType(struct Instantiation * inst)
3743 {
3744 yylloc = inst->loc;
3745 if(inst->_class)
3746 {
3747 struct MembersInit * members;
3748 struct Symbol * classSym;
3749 struct __ecereNameSpace__ecere__com__Class * _class;
3750
3751 classSym = inst->_class->symbol;
3752 _class = classSym ? classSym->registered : (((void *)0));
3753 if(!_class || _class->type != 5)
3754 DeclareStruct(inst->_class->name, 0x0);
3755 afterExternal = afterExternal ? afterExternal : curExternal;
3756 if(inst->exp)
3757 ProcessExpressionType(inst->exp);
3758 inst->isConstant = 0x1;
3759 if(inst->members)
3760 {
3761 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3762 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3763 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3764 int subMemberStackPos = 0;
3765
3766 for(members = (*inst->members).first; members; members = members->next)
3767 {
3768 switch(members->type)
3769 {
3770 case 1:
3771 {
3772 char name[1024];
3773 static unsigned int instMethodID = 0;
3774 struct External * external = curExternal;
3775 struct Context * context = curContext;
3776 struct Declarator * declarator = members->function->declarator;
3777 struct Identifier * nameID = GetDeclId(declarator);
3778 char * unmangled = nameID ? nameID->string : (((void *)0));
3779 struct Expression * exp;
3780 struct External * createdExternal = (((void *)0));
3781
3782 if(inCompiler)
3783 {
3784 char number[16];
3785
3786 strcpy(name, "__ecereInstMeth_");
3787 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3788 strcat(name, "_");
3789 strcat(name, nameID->string);
3790 strcat(name, "_");
3791 sprintf(number, "_%08d", instMethodID++);
3792 strcat(name, number);
3793 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3794 }
3795 if(declarator)
3796 {
3797 struct Symbol * symbol = declarator->symbol;
3798 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3799
3800 if(method && method->type == 1)
3801 {
3802 symbol->method = method;
3803 ProcessMethodType(method);
3804 if(!symbol->type->thisClass)
3805 {
3806 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3807 {
3808 if(!currentClass->symbol)
3809 currentClass->symbol = FindClass(currentClass->fullName);
3810 symbol->type->thisClass = currentClass->symbol;
3811 }
3812 else
3813 {
3814 if(!_class->symbol)
3815 _class->symbol = FindClass(_class->fullName);
3816 symbol->type->thisClass = _class->symbol;
3817 }
3818 }
3819 DeclareType(symbol->type, 0x1, 0x1);
3820 }
3821 else if(classSym)
3822 {
3823 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
3824 }
3825 }
3826 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
3827 if(nameID)
3828 {
3829 FreeSpecifier(nameID->_class);
3830 nameID->_class = (((void *)0));
3831 }
3832 if(inCompiler)
3833 {
3834 struct Type * type = declarator->symbol->type;
3835 struct External * oldExternal = curExternal;
3836
3837 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
3838 {
3839 struct External * externalDecl;
3840
3841 externalDecl = MkExternalDeclaration((((void *)0)));
3842 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
3843 if(createdExternal->function)
3844 {
3845 ProcessFunction(createdExternal->function);
3846 {
3847 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
3848
3849 externalDecl->declaration = decl;
3850 if(decl->symbol && !decl->symbol->pointerExternal)
3851 decl->symbol->pointerExternal = externalDecl;
3852 declarator->symbol->pointerExternal = externalDecl;
3853 }
3854 }
3855 }
3856 }
3857 else if(declarator)
3858 {
3859 curExternal = declarator->symbol->pointerExternal;
3860 ProcessFunction((struct FunctionDefinition *)members->function);
3861 }
3862 curExternal = external;
3863 curContext = context;
3864 if(inCompiler)
3865 {
3866 FreeClassFunction(members->function);
3867 exp = QMkExpId(name);
3868 members->type = 0;
3869 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
3870 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
3871 }
3872 break;
3873 }
3874 case 0:
3875 {
3876 if(members->dataMembers && classSym)
3877 {
3878 struct MemberInit * member;
3879 struct Location oldyyloc = yylloc;
3880
3881 for(member = (*members->dataMembers).first; member; member = member->next)
3882 {
3883 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
3884 if(member->initializer && !member->initializer->isConstant)
3885 inst->isConstant = 0x0;
3886 }
3887 yylloc = oldyyloc;
3888 }
3889 break;
3890 }
3891 }
3892 }
3893 }
3894 }
3895 }
3896
3897 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
3898 {
3899 if(inCompiler)
3900 {
3901 if(type->kind == 11)
3902 {
3903 struct Type * param;
3904
3905 if(declareParams)
3906 {
3907 for(param = type->params.first; param; param = param->next)
3908 DeclareType(param, declarePointers, 0x1);
3909 }
3910 DeclareType(type->returnType, declarePointers, 0x1);
3911 }
3912 else if(type->kind == 13 && declarePointers)
3913 DeclareType(type->type, declarePointers, 0x0);
3914 else if(type->kind == 8)
3915 {
3916 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
3917 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
3918 }
3919 else if(type->kind == 9 || type->kind == 10)
3920 {
3921 struct Type * member;
3922
3923 for(member = type->members.first; member; member = member->next)
3924 DeclareType(member, 0x0, 0x0);
3925 }
3926 else if(type->kind == 12)
3927 DeclareType(type->arrayType, declarePointers, 0x0);
3928 }
3929 }
3930
3931 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
3932
3933 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
3934 {
3935 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
3936 int id = 0;
3937 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3938 struct __ecereNameSpace__ecere__com__Class * sClass;
3939
3940 for(sClass = _class; sClass; sClass = sClass->base)
3941 {
3942 id = 0;
3943 if(sClass->templateClass)
3944 sClass = sClass->templateClass;
3945 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3946 {
3947 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
3948 {
3949 for(sClass = sClass->base; sClass; sClass = sClass->base)
3950 {
3951 if(sClass->templateClass)
3952 sClass = sClass->templateClass;
3953 id += sClass->templateParams.count;
3954 }
3955 break;
3956 }
3957 id++;
3958 }
3959 if(curParam)
3960 break;
3961 }
3962 if(curParam)
3963 {
3964 arg = &_class->templateArgs[id];
3965 if(arg && param->type == 0)
3966 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
3967 }
3968 return arg;
3969 }
3970
3971 extern struct Context * PushContext(void);
3972
3973 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
3974
3975 struct TemplatedType
3976 {
3977 uintptr_t key;
3978 struct __ecereNameSpace__ecere__sys__BTNode * parent;
3979 struct __ecereNameSpace__ecere__sys__BTNode * left;
3980 struct __ecereNameSpace__ecere__sys__BTNode * right;
3981 int depth;
3982 struct TemplateParameter * param;
3983 } __attribute__ ((gcc_struct));
3984
3985 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
3986
3987 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
3988 {
3989 void * __ecereTemp1;
3990 struct Context * context = PushContext();
3991
3992 context->templateTypesOnly = 0x1;
3993 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
3994 {
3995 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
3996
3997 for(; param; param = param->next)
3998 {
3999 if(param->type == 0 && param->identifier)
4000 {
4001 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (uintptr_t)param->identifier->string, type->param = param, type);
4002
4003 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4004 }
4005 }
4006 }
4007 else if(_class)
4008 {
4009 struct __ecereNameSpace__ecere__com__Class * sClass;
4010
4011 for(sClass = _class; sClass; sClass = sClass->base)
4012 {
4013 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
4014
4015 for(p = sClass->templateParams.first; p; p = p->next)
4016 {
4017 if(p->type == 0)
4018 {
4019 struct TemplateParameter * param = p->param;
4020 struct TemplatedType * type;
4021
4022 if(!param)
4023 {
4024 p->param = param = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter), ((struct TemplateParameter *)__ecereTemp1)->identifier = MkIdentifier(p->name), ((struct TemplateParameter *)__ecereTemp1)->type = p->type, ((struct TemplateParameter *)__ecereTemp1)->dataTypeString = p->dataTypeString, ((struct TemplateParameter *)__ecereTemp1));
4025 }
4026 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), ((struct TemplatedType *)__ecereTemp1)->key = (uintptr_t)p->name, ((struct TemplatedType *)__ecereTemp1)->param = param, ((struct TemplatedType *)__ecereTemp1));
4027 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4028 }
4029 }
4030 }
4031 }
4032 return context;
4033 }
4034
4035 extern void PopContext(struct Context * ctx);
4036
4037 extern void FreeContext(struct Context * context);
4038
4039 void FinishTemplatesContext(struct Context * context)
4040 {
4041 PopContext(context);
4042 FreeContext(context);
4043 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
4044 }
4045
4046 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
4047 {
4048 if(!method->dataType)
4049 {
4050 struct Context * context = SetupTemplatesContext(method->_class);
4051
4052 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4053 FinishTemplatesContext(context);
4054 if(method->type != 1 && method->dataType)
4055 {
4056 if(!method->dataType->thisClass && !method->dataType->staticMethod)
4057 {
4058 if(!method->_class->symbol)
4059 method->_class->symbol = FindClass(method->_class->fullName);
4060 method->dataType->thisClass = method->_class->symbol;
4061 }
4062 }
4063 }
4064 }
4065
4066 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
4067 {
4068 if(!prop->dataType)
4069 {
4070 struct Context * context = SetupTemplatesContext(prop->_class);
4071
4072 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
4073 FinishTemplatesContext(context);
4074 }
4075 }
4076
4077 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
4078
4079 extern void FreeTypeName(struct TypeName * typeName);
4080
4081 static void ProcessDeclarator(struct Declarator * decl);
4082
4083 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
4084
4085 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
4086
4087 struct MethodImport
4088 {
4089 struct MethodImport * prev;
4090 struct MethodImport * next;
4091 char *  name;
4092 unsigned int isVirtual;
4093 } __attribute__ ((gcc_struct));
4094
4095 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
4096
4097 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
4098 {
4099 void * __ecereTemp1;
4100 struct Symbol * symbol = method->symbol;
4101
4102 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
4103 {
4104 unsigned int imported = 0x0;
4105 unsigned int dllImport = 0x0;
4106
4107 if(!method->dataType)
4108 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4109 if(!symbol || symbol->_import || method->type == 1)
4110 {
4111 if(!symbol || method->type == 1)
4112 {
4113 struct Symbol * classSym;
4114
4115 if(!method->_class->symbol)
4116 method->_class->symbol = FindClass(method->_class->fullName);
4117 classSym = method->_class->symbol;
4118 if(!classSym->_import)
4119 {
4120 struct ModuleImport * module;
4121
4122 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->name)
4123 module = FindModule(method->_class->module);
4124 else
4125 module = mainModule;
4126 classSym->_import = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport), ((struct ClassImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), ((struct ClassImport *)__ecereTemp1)->isRemote = method->_class->isRemote, ((struct ClassImport *)__ecereTemp1));
4127 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
4128 }
4129 if(!symbol)
4130 {
4131 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4132 }
4133 if(!symbol->_import)
4134 {
4135 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport), ((struct MethodImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(method->name), ((struct MethodImport *)__ecereTemp1)->isVirtual = method->type == 1, ((struct MethodImport *)__ecereTemp1));
4136 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
4137 }
4138 if(!symbol)
4139 {
4140 symbol->type = method->dataType;
4141 if(symbol->type)
4142 symbol->type->refCount++;
4143 }
4144 }
4145 if(!method->dataType->dllExport)
4146 {
4147 imported = 0x1;
4148 if(method->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->importType != 1)
4149 dllImport = 0x1;
4150 }
4151 }
4152 if(method->type != 1 && method->dataType)
4153 DeclareType(method->dataType, 0x1, 0x1);
4154 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4155 {
4156 struct Declaration * decl;
4157 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4158 struct Declarator * d;
4159 struct Declarator * funcDecl;
4160 struct External * external;
4161
4162 specifiers = MkList();
4163 declarators = MkList();
4164 if(dllImport)
4165 ListAdd(specifiers, MkSpecifier(EXTERN));
4166 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
4167 ListAdd(specifiers, MkSpecifier(STATIC));
4168 if(method->type == 1)
4169 {
4170 ListAdd(specifiers, MkSpecifier(INT));
4171 d = MkDeclaratorIdentifier(MkIdentifier(name));
4172 }
4173 else
4174 {
4175 d = MkDeclaratorIdentifier(MkIdentifier(name));
4176 if(dllImport)
4177 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4178 {
4179 struct Context * context = SetupTemplatesContext(method->_class);
4180
4181 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
4182 FinishTemplatesContext(context);
4183 }
4184 funcDecl = GetFuncDecl(d);
4185 if(dllImport)
4186 {
4187 struct Specifier * spec, * next;
4188
4189 for(spec = (*specifiers).first; spec; spec = next)
4190 {
4191 next = spec->next;
4192 if(spec->type == 5)
4193 {
4194 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4195 FreeSpecifier(spec);
4196 }
4197 }
4198 }
4199 if(method->dataType && !method->dataType->staticMethod)
4200 {
4201 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4202 {
4203 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4204 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")));
4205 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4206 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4207
4208 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4209 {
4210 struct TypeName * param = (*funcDecl->function.parameters).first;
4211
4212 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4213 FreeTypeName(param);
4214 }
4215 if(!funcDecl->function.parameters)
4216 funcDecl->function.parameters = MkList();
4217 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4218 }
4219 }
4220 }
4221 ProcessDeclarator(d);
4222 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4223 decl = MkDeclaration(specifiers, declarators);
4224 ReplaceThisClassSpecifiers(specifiers, method->_class);
4225 if(symbol->pointerExternal)
4226 {
4227 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4228
4229 {
4230 *functionSymbol = *symbol;
4231 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4232 if(functionSymbol->type)
4233 functionSymbol->type->refCount++;
4234 }
4235 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4236 symbol->pointerExternal->symbol = functionSymbol;
4237 }
4238 external = MkExternalDeclaration(decl);
4239 if(curExternal)
4240 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4241 external->symbol = symbol;
4242 symbol->pointerExternal = external;
4243 }
4244 else if(ast)
4245 {
4246 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4247 }
4248 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4249 }
4250 }
4251
4252 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4253 {
4254 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4255 {
4256 unsigned int first = 0x1;
4257 int p = 0;
4258 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4259 int lastParam = -1;
4260 char className[1024];
4261
4262 strcpy(className, _class->fullName);
4263 for(param = _class->templateParams.first; param; param = param->next)
4264 {
4265 {
4266 if(first)
4267 strcat(className, "<");
4268 if(!first)
4269 strcat(className, ", ");
4270 if(lastParam + 1 != p)
4271 {
4272 strcat(className, param->name);
4273 strcat(className, " = ");
4274 }
4275 strcat(className, param->name);
4276 first = 0x0;
4277 lastParam = p;
4278 }
4279 p++;
4280 }
4281 if(!first)
4282 {
4283 int len = strlen(className);
4284
4285 if(className[len - 1] == '>')
4286 className[len++] = ' ';
4287 className[len++] = '>';
4288 className[len++] = '\0';
4289 }
4290 return __ecereNameSpace__ecere__sys__CopyString(className);
4291 }
4292 else
4293 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4294 }
4295
4296 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4297 {
4298 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4299 {
4300 unsigned int first = 0x1;
4301 int p = 0;
4302 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4303 int lastParam = -1;
4304 char className[1024];
4305
4306 strcpy(className, _class->fullName);
4307 for(param = _class->templateParams.first; param; param = param->next)
4308 {
4309 {
4310 if(first)
4311 strcat(className, "<");
4312 if(!first)
4313 strcat(className, ", ");
4314 if(lastParam + 1 != p)
4315 {
4316 strcat(className, param->name);
4317 strcat(className, " = ");
4318 }
4319 strcat(className, param->name);
4320 first = 0x0;
4321 lastParam = p;
4322 }
4323 p++;
4324 }
4325 if(!first)
4326 {
4327 int len = strlen(className);
4328
4329 if(className[len - 1] == '>')
4330 className[len++] = ' ';
4331 className[len++] = '>';
4332 className[len++] = '\0';
4333 }
4334 return MkClassType(className);
4335 }
4336 else
4337 {
4338 return MkClassType(_class->fullName);
4339 }
4340 }
4341
4342 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4343 {
4344 if(specs != (((void *)0)) && _class)
4345 {
4346 struct Specifier * spec;
4347
4348 for(spec = specs->first; spec; spec = spec->next)
4349 {
4350 if(spec->type == 0 && spec->specifier == THISCLASS)
4351 {
4352 spec->type = 1;
4353 spec->name = ReplaceThisClass(_class);
4354 spec->symbol = FindClass(spec->name);
4355 }
4356 }
4357 }
4358 }
4359
4360 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4361
4362 struct __ecereNameSpace__ecere__com__GlobalFunction
4363 {
4364 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4365 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4366 char *  name;
4367 int (*  function)();
4368 struct __ecereNameSpace__ecere__com__Instance * module;
4369 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4370 char *  dataTypeString;
4371 struct Type * dataType;
4372 void *  symbol;
4373 } __attribute__ ((gcc_struct));
4374
4375 extern struct Context * globalContext;
4376
4377 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4378
4379 struct FunctionImport
4380 {
4381 struct FunctionImport * prev;
4382 struct FunctionImport * next;
4383 char *  name;
4384 } __attribute__ ((gcc_struct));
4385
4386 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4387 {
4388 void * __ecereTemp1;
4389 struct Symbol * symbol = function->symbol;
4390
4391 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4392 {
4393 unsigned int imported = 0x0;
4394 unsigned int dllImport = 0x0;
4395
4396 if(!function->dataType)
4397 {
4398 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4399 if(!function->dataType->thisClass)
4400 function->dataType->staticMethod = 0x1;
4401 }
4402 if(inCompiler)
4403 {
4404 if(!symbol)
4405 {
4406 struct ModuleImport * module = FindModule(function->module);
4407
4408 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4409 if(module->name)
4410 {
4411 if(!function->dataType->dllExport)
4412 {
4413 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport), ((struct FunctionImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(function->name), ((struct FunctionImport *)__ecereTemp1));
4414 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4415 }
4416 }
4417 {
4418 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4419 if(!symbol->type->thisClass)
4420 symbol->type->staticMethod = 0x1;
4421 }
4422 }
4423 imported = symbol->_import ? 0x1 : 0x0;
4424 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1)
4425 dllImport = 0x1;
4426 }
4427 DeclareType(function->dataType, 0x1, 0x1);
4428 if(inCompiler)
4429 {
4430 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4431 {
4432 struct Declaration * decl;
4433 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4434 struct Declarator * d;
4435 struct Declarator * funcDecl;
4436 struct External * external;
4437
4438 specifiers = MkList();
4439 declarators = MkList();
4440 ListAdd(specifiers, MkSpecifier(EXTERN));
4441 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4442 if(dllImport)
4443 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4444 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4445 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType == 1)
4446 {
4447 struct Specifier * spec;
4448
4449 for(spec = (*specifiers).first; spec; spec = spec->next)
4450 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4451 {
4452 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4453 FreeSpecifier(spec);
4454 break;
4455 }
4456 }
4457 funcDecl = GetFuncDecl(d);
4458 if(funcDecl && !funcDecl->function.parameters)
4459 {
4460 funcDecl->function.parameters = MkList();
4461 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4462 }
4463 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4464 {
4465 struct Context * oldCtx = curContext;
4466
4467 curContext = globalContext;
4468 decl = MkDeclaration(specifiers, declarators);
4469 curContext = oldCtx;
4470 }
4471 if(symbol->pointerExternal)
4472 {
4473 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4474
4475 {
4476 *functionSymbol = *symbol;
4477 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4478 if(functionSymbol->type)
4479 functionSymbol->type->refCount++;
4480 }
4481 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4482 symbol->pointerExternal->symbol = functionSymbol;
4483 }
4484 external = MkExternalDeclaration(decl);
4485 if(curExternal)
4486 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4487 external->symbol = symbol;
4488 symbol->pointerExternal = external;
4489 }
4490 else
4491 {
4492 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4493 }
4494 if(curExternal)
4495 symbol->id = curExternal->symbol->idCode;
4496 }
4497 }
4498 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1) ? 0x1 : 0x0;
4499 }
4500
4501 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4502
4503 struct GlobalData
4504 {
4505 uintptr_t key;
4506 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4507 struct __ecereNameSpace__ecere__sys__BTNode * left;
4508 struct __ecereNameSpace__ecere__sys__BTNode * right;
4509 int depth;
4510 struct __ecereNameSpace__ecere__com__Instance * module;
4511 char *  dataTypeString;
4512 struct Type * dataType;
4513 void *  symbol;
4514 char *  fullName;
4515 } __attribute__ ((gcc_struct));
4516
4517 void DeclareGlobalData(struct GlobalData * data)
4518 {
4519 struct Symbol * symbol = data->symbol;
4520
4521 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4522 {
4523 if(inCompiler)
4524 {
4525 if(!symbol)
4526 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4527 }
4528 if(!data->dataType)
4529 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4530 DeclareType(data->dataType, 0x1, 0x1);
4531 if(inCompiler)
4532 {
4533 if(!symbol->pointerExternal)
4534 {
4535 struct Declaration * decl;
4536 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4537 struct Declarator * d;
4538 struct External * external;
4539
4540 specifiers = MkList();
4541 declarators = MkList();
4542 ListAdd(specifiers, MkSpecifier(EXTERN));
4543 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4544 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4545 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4546 decl = MkDeclaration(specifiers, declarators);
4547 external = MkExternalDeclaration(decl);
4548 if(curExternal)
4549 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4550 external->symbol = symbol;
4551 symbol->pointerExternal = external;
4552 }
4553 else
4554 {
4555 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4556 }
4557 if(curExternal)
4558 symbol->id = curExternal->symbol->idCode;
4559 }
4560 }
4561 }
4562
4563 struct Conversion
4564 {
4565 struct Conversion * prev, * next;
4566 struct __ecereNameSpace__ecere__com__Property * convert;
4567 unsigned int isGet;
4568 struct Type * resultType;
4569 } __attribute__ ((gcc_struct));
4570
4571 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4572
4573 extern void Compiler_Warning(char *  format, ...);
4574
4575 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4576
4577 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)
4578 {
4579 if(source && dest)
4580 {
4581 if(source->kind == 20 && dest->kind != 20)
4582 {
4583 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4584
4585 if(type)
4586 source = type;
4587 }
4588 if(dest->kind == 20 && source->kind != 20)
4589 {
4590 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4591
4592 if(type)
4593 dest = type;
4594 }
4595 if((dest->classObjectType == 2 && source->classObjectType != 3) || (dest->classObjectType == 3 && source->classObjectType != 2))
4596 {
4597 return 0x1;
4598 }
4599 if(source->classObjectType == 3 && dest->classObjectType != 2)
4600 {
4601 return 0x1;
4602 }
4603 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4604 {
4605 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4606 return 0x1;
4607 }
4608 if(dest->kind == 14 && source->kind != 0)
4609 return 0x1;
4610 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))
4611 return 0x1;
4612 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))
4613 return 0x1;
4614 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4615 {
4616 if(source->_class->registered && source->_class->registered->type == 3)
4617 {
4618 if(conversions != (((void *)0)))
4619 {
4620 if(source->_class->registered == dest->_class->registered)
4621 return 0x1;
4622 }
4623 else
4624 {
4625 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4626
4627 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4628 ;
4629 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4630 ;
4631 if(sourceBase == destBase)
4632 return 0x1;
4633 }
4634 }
4635 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))
4636 return 0x1;
4637 else
4638 {
4639 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4 && source->_class && source->_class->registered && source->_class->registered->type != 4)
4640 {
4641 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4642 {
4643 return 0x1;
4644 }
4645 }
4646 }
4647 }
4648 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4649 return 0x1;
4650 if(doConversion)
4651 {
4652 if(source->kind == 8)
4653 {
4654 struct __ecereNameSpace__ecere__com__Class * _class;
4655
4656 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4657 {
4658 struct __ecereNameSpace__ecere__com__Property * convert;
4659
4660 for(convert = _class->conversions.first; convert; convert = convert->next)
4661 {
4662 if(convert->memberAccess == 1 || _class->module == privateModule)
4663 {
4664 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4665
4666 if(!convert->dataType)
4667 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4668 if(MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x0, 0x1, 0x0, 0x1))
4669 {
4670 if(!conversions && !convert->Get)
4671 return 0x1;
4672 else if(conversions != (((void *)0)))
4673 {
4674 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))
4675 return 0x1;
4676 else
4677 {
4678 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4679
4680 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4681 return 0x1;
4682 }
4683 }
4684 }
4685 }
4686 }
4687 }
4688 }
4689 if(dest->kind == 8)
4690 {
4691 struct __ecereNameSpace__ecere__com__Class * _class;
4692
4693 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4694 {
4695 struct __ecereNameSpace__ecere__com__Property * convert;
4696
4697 for(convert = _class->conversions.first; convert; convert = convert->next)
4698 {
4699 if(convert->memberAccess == 1 || _class->module == privateModule)
4700 {
4701 if(!convert->dataType)
4702 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4703 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4704 {
4705 if(!conversions && !convert->Set)
4706 return 0x1;
4707 else if(conversions != (((void *)0)))
4708 {
4709 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))
4710 return 0x1;
4711 else
4712 {
4713 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4714
4715 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4716 return 0x1;
4717 }
4718 }
4719 }
4720 }
4721 }
4722 }
4723 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4724 {
4725 if(!dest->_class->registered->dataType)
4726 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4727 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4728 {
4729 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4730 {
4731 return 0x1;
4732 }
4733 }
4734 }
4735 }
4736 if(source->kind == 8)
4737 {
4738 struct __ecereNameSpace__ecere__com__Class * _class;
4739
4740 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4741 {
4742 struct __ecereNameSpace__ecere__com__Property * convert;
4743
4744 for(convert = _class->conversions.first; convert; convert = convert->next)
4745 {
4746 if(convert->memberAccess == 1 || _class->module == privateModule)
4747 {
4748 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4749
4750 if(!convert->dataType)
4751 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4752 if(convert->dataType != source && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x1))
4753 {
4754 if(!conversions && !convert->Get)
4755 return 0x1;
4756 else if(conversions != (((void *)0)))
4757 {
4758 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))
4759 return 0x1;
4760 else
4761 {
4762 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4763
4764 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4765 return 0x1;
4766 }
4767 }
4768 }
4769 }
4770 }
4771 }
4772 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4773 {
4774 if(!source->_class->registered->dataType)
4775 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4776 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4777 {
4778 return 0x1;
4779 }
4780 }
4781 }
4782 }
4783 if(source->kind == 8 || source->kind == 19)
4784 ;
4785 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
4786 return 0x1;
4787 else if(dest->kind == 7 && source->kind == 6)
4788 return 0x1;
4789 else if(dest->kind == 2 && source->kind == 1)
4790 return 0x1;
4791 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1 || source->kind == 23))
4792 return 0x1;
4793 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 22 || source->kind == 23))
4794 return 0x1;
4795 else if(dest->kind == 22 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 23 || source->kind == 4))
4796 return 0x1;
4797 else if(dest->kind == 23 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4 || source->kind == 22))
4798 return 0x1;
4799 else if(source->kind == 15 && (dest->kind == 3 || dest->kind == 2 || dest->kind == 1 || dest->kind == 5 || dest->kind == 4 || dest->kind == 22 || dest->kind == 23))
4800 return 0x1;
4801 else if(dest->kind == 15 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 5 || source->kind == 4 || source->kind == 22 || source->kind == 23))
4802 return 0x1;
4803 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)))
4804 {
4805 struct Type * paramSource, * paramDest;
4806
4807 if(dest->kind == 16)
4808 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
4809 if(source->kind == 16)
4810 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
4811 if(dest->kind == 13 && dest->type->kind == 11)
4812 dest = dest->type;
4813 if(source->kind == 13 && source->type->kind == 11)
4814 source = source->type;
4815 if(dest->kind == 16)
4816 dest = dest->method->dataType;
4817 if(source->kind == 16)
4818 source = source->method->dataType;
4819 paramSource = source->params.first;
4820 if(paramSource && paramSource->kind == 0)
4821 paramSource = (((void *)0));
4822 paramDest = dest->params.first;
4823 if(paramDest && paramDest->kind == 0)
4824 paramDest = (((void *)0));
4825 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
4826 {
4827 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))))
4828 {
4829 if(paramDest && paramDest->kind == 8)
4830 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
4831 else
4832 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class should not take an object\n", (((void *)0))));
4833 return 0x0;
4834 }
4835 paramDest = paramDest->next;
4836 }
4837 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
4838 {
4839 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
4840 {
4841 if(dest->thisClass)
4842 {
4843 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
4844 {
4845 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4846 return 0x0;
4847 }
4848 }
4849 else
4850 {
4851 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
4852 {
4853 if(owningClassDest)
4854 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
4855 else
4856 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "overriding class expected to be derived from method class\n", (((void *)0))));
4857 return 0x0;
4858 }
4859 }
4860 paramSource = paramSource->next;
4861 }
4862 else
4863 {
4864 if(dest->thisClass)
4865 {
4866 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
4867 {
4868 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4869 return 0x0;
4870 }
4871 }
4872 else
4873 {
4874 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
4875 {
4876 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
4877 return 0x0;
4878 }
4879 }
4880 }
4881 }
4882 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4883 {
4884 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible return type for function\n", (((void *)0))));
4885 return 0x0;
4886 }
4887 for(; paramDest; paramDest = paramDest->next)
4888 {
4889 if(!paramSource)
4890 {
4891 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough parameters\n", (((void *)0))));
4892 return 0x0;
4893 }
4894 {
4895 struct Type * paramDestType = paramDest;
4896 struct Type * paramSourceType = paramSource;
4897 struct Type * type = paramDestType;
4898
4899 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
4900 {
4901 int id = 0;
4902 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4903 struct __ecereNameSpace__ecere__com__Class * sClass;
4904
4905 for(sClass = owningClassSource; sClass; sClass = sClass->base)
4906 {
4907 id = 0;
4908 if(sClass->templateClass)
4909 sClass = sClass->templateClass;
4910 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4911 {
4912 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
4913 {
4914 for(sClass = sClass->base; sClass; sClass = sClass->base)
4915 {
4916 if(sClass->templateClass)
4917 sClass = sClass->templateClass;
4918 id += sClass->templateParams.count;
4919 }
4920 break;
4921 }
4922 id++;
4923 }
4924 if(curParam)
4925 break;
4926 }
4927 if(curParam)
4928 {
4929 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
4930
4931 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
4932 }
4933 }
4934 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)))
4935 {
4936 char type[1024];
4937
4938 type[0] = (char)0;
4939 PrintType(paramDest, type, 0x0, 0x1);
4940 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
4941 if(paramDestType != paramDest)
4942 FreeType(paramDestType);
4943 return 0x0;
4944 }
4945 if(paramDestType != paramDest)
4946 FreeType(paramDestType);
4947 }
4948 paramSource = paramSource->next;
4949 }
4950 if(paramSource)
4951 {
4952 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many parameters\n", (((void *)0))));
4953 return 0x0;
4954 }
4955 return 0x1;
4956 }
4957 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
4958 {
4959 return 0x1;
4960 }
4961 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
4962 {
4963 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4964 return 0x1;
4965 }
4966 }
4967 return 0x0;
4968 }
4969
4970 static void FreeConvert(struct Conversion * convert)
4971 {
4972 if(convert->resultType)
4973 FreeType(convert->resultType);
4974 }
4975
4976 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
4977
4978 struct __ecereNameSpace__ecere__com__BTNamedLink
4979 {
4980 char *  name;
4981 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
4982 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
4983 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
4984 int depth;
4985 void *  data;
4986 } __attribute__ ((gcc_struct));
4987
4988 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
4989
4990 struct __ecereNameSpace__ecere__com__EnumClassData
4991 {
4992 struct __ecereNameSpace__ecere__sys__OldList values;
4993 int largest;
4994 } __attribute__ ((gcc_struct));
4995
4996 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
4997
4998 struct __ecereNameSpace__ecere__sys__NamedLink
4999 {
5000 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
5001 struct __ecereNameSpace__ecere__sys__NamedLink * next;
5002 char *  name;
5003 void *  data;
5004 } __attribute__ ((gcc_struct));
5005
5006 extern void FreeExpContents(struct Expression * exp);
5007
5008 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
5009
5010 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
5011
5012 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
5013
5014 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
5015
5016 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
5017
5018 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5019 {
5020 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
5021
5022 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)))
5023 {
5024 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
5025
5026 if(_class->type == 4)
5027 {
5028 struct __ecereNameSpace__ecere__sys__OldList converts = 
5029 {
5030 0, 0, 0, 0, 0
5031 };
5032 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5033
5034 type->kind = 8;
5035 if(!_class->symbol)
5036 _class->symbol = FindClass(_class->fullName);
5037 type->_class = _class->symbol;
5038 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
5039 {
5040 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5041 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5042
5043 if(enumClass)
5044 {
5045 struct __ecereNameSpace__ecere__com__Class * baseClass;
5046
5047 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
5048 {
5049 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
5050
5051 for(value = e->values.first; value; value = value->next)
5052 {
5053 if(!strcmp(value->name, string))
5054 break;
5055 }
5056 if(value)
5057 {
5058 FreeExpContents(sourceExp);
5059 FreeType(sourceExp->expType);
5060 sourceExp->isConstant = 0x1;
5061 sourceExp->expType = MkClassType(baseClass->fullName);
5062 {
5063 char constant[256];
5064
5065 sourceExp->type = 2;
5066 if(!strcmp(baseClass->dataTypeString, "int"))
5067 sprintf(constant, "%d", value->data);
5068 else
5069 sprintf(constant, "0x%X", value->data);
5070 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5071 }
5072 while(converts.first)
5073 {
5074 struct Conversion * convert = converts.first;
5075
5076 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
5077 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
5078 }
5079 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5080 return 0x1;
5081 }
5082 }
5083 }
5084 }
5085 if(converts.first)
5086 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
5087 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5088 }
5089 }
5090 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)))
5091 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
5092 return 0x1;
5093 return 0x0;
5094 }
5095
5096 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
5097
5098 struct __ecereNameSpace__ecere__com__SubModule
5099 {
5100 struct __ecereNameSpace__ecere__com__SubModule * prev;
5101 struct __ecereNameSpace__ecere__com__SubModule * next;
5102 struct __ecereNameSpace__ecere__com__Instance * module;
5103 int importMode;
5104 } __attribute__ ((gcc_struct));
5105
5106 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
5107 {
5108 struct __ecereNameSpace__ecere__com__SubModule * subModule;
5109
5110 if(searchFor == searchIn)
5111 return 0x1;
5112 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
5113 {
5114 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->application)
5115 {
5116 if(ModuleVisibility(subModule->module, searchFor))
5117 return 0x1;
5118 }
5119 }
5120 return 0x0;
5121 }
5122
5123 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
5124
5125 struct __ecereNameSpace__ecere__com__Application
5126 {
5127 int argc;
5128 char * *  argv;
5129 int exitCode;
5130 unsigned int isGUIApp;
5131 struct __ecereNameSpace__ecere__sys__OldList allModules;
5132 char *  parsedCommand;
5133 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
5134 } __attribute__ ((gcc_struct));
5135
5136 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5137 {
5138 struct __ecereNameSpace__ecere__com__Instance * module;
5139
5140 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))
5141 return 0x1;
5142 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))
5143 return 0x1;
5144 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))
5145 return 0x1;
5146 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)
5147 {
5148 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5149 return 0x1;
5150 }
5151 return 0x0;
5152 }
5153
5154 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
5155
5156 void ReadString(char *  output, char *  string);
5157
5158 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
5159
5160 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
5161
5162 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
5163
5164 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
5165 {
5166 void * __ecereTemp1;
5167 struct Type * source = sourceExp->expType;
5168 struct Type * realDest = dest;
5169 struct Type * backupSourceExpType = (((void *)0));
5170
5171 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5172 return 0x1;
5173 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5174 {
5175 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5176 {
5177 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5178
5179 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5180 ;
5181 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5182 ;
5183 if(sourceBase == destBase)
5184 return 0x1;
5185 }
5186 }
5187 if(source)
5188 {
5189 struct __ecereNameSpace__ecere__sys__OldList * specs;
5190 unsigned int flag = 0x0;
5191 long long value = (((int)0x7fffffff));
5192
5193 source->refCount++;
5194 dest->refCount++;
5195 if(sourceExp->type == 2)
5196 {
5197 if(source->isSigned)
5198 value = strtoll(sourceExp->constant, (((void *)0)), 0);
5199 else
5200 value = strtoull(sourceExp->constant, (((void *)0)), 0);
5201 }
5202 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
5203 {
5204 if(source->isSigned)
5205 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
5206 else
5207 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
5208 }
5209 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5210 {
5211 FreeType(source);
5212 source = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->isSigned = 0x0, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
5213 }
5214 if(dest->kind == 8)
5215 {
5216 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5217
5218 if(_class && _class->type == 3)
5219 {
5220 if(source->kind != 8)
5221 {
5222 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5223 struct Type * tempDest, * tempSource;
5224
5225 for(; _class->base->type != 1000; _class = _class->base)
5226 ;
5227 tempSource = dest;
5228 tempDest = tempType;
5229 tempType->kind = 8;
5230 if(!_class->symbol)
5231 _class->symbol = FindClass(_class->fullName);
5232 tempType->_class = _class->symbol;
5233 tempType->truth = dest->truth;
5234 if(tempType->_class)
5235 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5236 backupSourceExpType = sourceExp->expType;
5237 sourceExp->expType = dest;
5238 dest->refCount++;
5239 flag = 0x1;
5240 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5241 }
5242 }
5243 if(_class && _class->type == 2 && source->kind != 8)
5244 {
5245 if(!dest->_class->registered->dataType)
5246 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5247 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5248 {
5249 FreeType(source);
5250 FreeType(sourceExp->expType);
5251 source = sourceExp->expType = MkClassType(dest->_class->string);
5252 source->refCount++;
5253 }
5254 }
5255 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5256 {
5257 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5258 struct Declarator * decl;
5259 char string[1024];
5260
5261 ReadString(string, sourceExp->string);
5262 decl = SpecDeclFromString(string, specs, (((void *)0)));
5263 FreeExpContents(sourceExp);
5264 FreeType(sourceExp->expType);
5265 sourceExp->type = 26;
5266 sourceExp->_classExp.specifiers = specs;
5267 sourceExp->_classExp.decl = decl;
5268 sourceExp->expType = dest;
5269 dest->refCount++;
5270 FreeType(source);
5271 FreeType(dest);
5272 if(backupSourceExpType)
5273 FreeType(backupSourceExpType);
5274 return 0x1;
5275 }
5276 }
5277 else if(source->kind == 8)
5278 {
5279 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5280
5281 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5282 {
5283 if(dest->kind != 8)
5284 {
5285 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5286 struct Type * tempDest, * tempSource;
5287
5288 if(!source->_class->registered->dataType)
5289 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5290 for(; _class->base->type != 1000; _class = _class->base)
5291 ;
5292 tempDest = source;
5293 tempSource = tempType;
5294 tempType->kind = 8;
5295 tempType->_class = FindClass(_class->fullName);
5296 tempType->truth = source->truth;
5297 tempType->classObjectType = source->classObjectType;
5298 if(tempType->_class)
5299 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5300 if(conversions->last)
5301 {
5302 ((struct Conversion *)conversions->last)->resultType = dest;
5303 dest->refCount++;
5304 }
5305 FreeType(sourceExp->expType);
5306 sourceExp->expType = MkClassType(_class->fullName);
5307 sourceExp->expType->truth = source->truth;
5308 sourceExp->expType->classObjectType = source->classObjectType;
5309 if(!sourceExp->destType)
5310 {
5311 FreeType(sourceExp->destType);
5312 sourceExp->destType = sourceExp->expType;
5313 if(sourceExp->expType)
5314 sourceExp->expType->refCount++;
5315 }
5316 if(!_class->dataType)
5317 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5318 FreeType(dest);
5319 dest = MkClassType(source->_class->string);
5320 dest->truth = source->truth;
5321 dest->classObjectType = source->classObjectType;
5322 FreeType(source);
5323 source = _class->dataType;
5324 source->refCount++;
5325 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5326 }
5327 }
5328 }
5329 if(!flag)
5330 {
5331 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5332 {
5333 FreeType(source);
5334 FreeType(dest);
5335 return 0x1;
5336 }
5337 }
5338 if(dest->kind == 8)
5339 {
5340 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5341
5342 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5343 {
5344 if(_class->type == 0 || _class->type == 5)
5345 {
5346 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5347
5348 *newExp = *sourceExp;
5349 if(sourceExp->destType)
5350 sourceExp->destType->refCount++;
5351 if(sourceExp->expType)
5352 sourceExp->expType->refCount++;
5353 sourceExp->type = 11;
5354 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5355 sourceExp->cast.exp = newExp;
5356 FreeType(sourceExp->expType);
5357 sourceExp->expType = (((void *)0));
5358 ProcessExpressionType(sourceExp);
5359 if(!inCompiler)
5360 {
5361 FreeType(sourceExp->expType);
5362 sourceExp->expType = dest;
5363 }
5364 FreeType(source);
5365 if(inCompiler)
5366 FreeType(dest);
5367 if(backupSourceExpType)
5368 FreeType(backupSourceExpType);
5369 return 0x1;
5370 }
5371 if(!_class->dataType)
5372 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5373 FreeType(dest);
5374 dest = _class->dataType;
5375 dest->refCount++;
5376 }
5377 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5378 {
5379 specs = MkListOne(MkSpecifier(DOUBLE));
5380 }
5381 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 7))
5382 {
5383 specs = MkListOne(MkSpecifier(FLOAT));
5384 }
5385 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5386 {
5387 specs = MkList();
5388 if(!dest->isSigned)
5389 ListAdd(specs, MkSpecifier(UNSIGNED));
5390 ListAdd(specs, MkSpecifier(INT64));
5391 }
5392 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5393 {
5394 specs = MkList();
5395 if(!dest->isSigned)
5396 ListAdd(specs, MkSpecifier(UNSIGNED));
5397 ListAdd(specs, MkSpecifier(INT));
5398 }
5399 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5400 {
5401 specs = MkList();
5402 if(!dest->isSigned)
5403 ListAdd(specs, MkSpecifier(UNSIGNED));
5404 ListAdd(specs, MkSpecifier(SHORT));
5405 }
5406 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5407 {
5408 specs = MkList();
5409 if(!dest->isSigned)
5410 ListAdd(specs, MkSpecifier(UNSIGNED));
5411 ListAdd(specs, MkSpecifier(CHAR));
5412 }
5413 else
5414 {
5415 FreeType(source);
5416 FreeType(dest);
5417 if(backupSourceExpType)
5418 {
5419 if(sourceExp->expType)
5420 FreeType(sourceExp->expType);
5421 sourceExp->expType = backupSourceExpType;
5422 }
5423 return 0x0;
5424 }
5425 }
5426 else if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || source->kind == 4 || source->kind == 3 || source->kind == 15 || source->kind == 2 || source->kind == 1))
5427 {
5428 specs = MkListOne(MkSpecifier(DOUBLE));
5429 }
5430 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5431 {
5432 specs = MkListOne(MkSpecifier(FLOAT));
5433 }
5434 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 15 || source->kind == 2 || source->kind == 3) && (dest->isSigned ? (value >= -128 && value <= 127) : (value >= 0 && value <= 255)))
5435 {
5436 specs = MkList();
5437 if(!dest->isSigned)
5438 ListAdd(specs, MkSpecifier(UNSIGNED));
5439 ListAdd(specs, MkSpecifier(CHAR));
5440 }
5441 else if(dest->kind == 2 && (source->kind == 15 || source->kind == 1 || source->kind == 2 || (source->kind == 3 && (dest->isSigned ? (value >= -32768 && value <= 32767) : (value >= 0 && value <= 65535)))))
5442 {
5443 specs = MkList();
5444 if(!dest->isSigned)
5445 ListAdd(specs, MkSpecifier(UNSIGNED));
5446 ListAdd(specs, MkSpecifier(SHORT));
5447 }
5448 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3))
5449 {
5450 specs = MkList();
5451 if(!dest->isSigned)
5452 ListAdd(specs, MkSpecifier(UNSIGNED));
5453 ListAdd(specs, MkSpecifier(INT));
5454 }
5455 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5456 {
5457 specs = MkList();
5458 if(!dest->isSigned)
5459 ListAdd(specs, MkSpecifier(UNSIGNED));
5460 ListAdd(specs, MkSpecifier(INT64));
5461 }
5462 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5463 {
5464 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5465 }
5466 else
5467 {
5468 FreeType(source);
5469 FreeType(dest);
5470 if(backupSourceExpType)
5471 {
5472 if(sourceExp->expType)
5473 FreeType(sourceExp->expType);
5474 sourceExp->expType = backupSourceExpType;
5475 }
5476 return 0x0;
5477 }
5478 if(!flag)
5479 {
5480 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5481
5482 *newExp = *sourceExp;
5483 newExp->prev = (((void *)0));
5484 newExp->next = (((void *)0));
5485 if(sourceExp->destType)
5486 sourceExp->destType->refCount++;
5487 if(sourceExp->expType)
5488 sourceExp->expType->refCount++;
5489 sourceExp->type = 11;
5490 if(realDest->kind == 8)
5491 {
5492 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5493 FreeList(specs, FreeSpecifier);
5494 }
5495 else
5496 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5497 if(newExp->type == 4)
5498 {
5499 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5500 }
5501 else
5502 sourceExp->cast.exp = newExp;
5503 FreeType(sourceExp->expType);
5504 sourceExp->expType = (((void *)0));
5505 ProcessExpressionType(sourceExp);
5506 }
5507 else
5508 FreeList(specs, FreeSpecifier);
5509 FreeType(dest);
5510 FreeType(source);
5511 if(backupSourceExpType)
5512 FreeType(backupSourceExpType);
5513 return 0x1;
5514 }
5515 else
5516 {
5517 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5518 sourceExp = (*sourceExp->list).last;
5519 if(sourceExp->type == 0)
5520 {
5521 struct Identifier * id = sourceExp->identifier;
5522
5523 if(dest->kind == 8)
5524 {
5525 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5526 {
5527 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5528 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5529
5530 if(enumClass)
5531 {
5532 for(; _class && _class->type == 4; _class = _class->base)
5533 {
5534 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5535 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5536
5537 for(value = e->values.first; value; value = value->next)
5538 {
5539 if(!strcmp(value->name, id->string))
5540 break;
5541 }
5542 if(value)
5543 {
5544 FreeExpContents(sourceExp);
5545 FreeType(sourceExp->expType);
5546 sourceExp->isConstant = 0x1;
5547 sourceExp->expType = MkClassType(_class->fullName);
5548 {
5549 char constant[256];
5550
5551 sourceExp->type = 2;
5552 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5553 sprintf(constant, "%d", value->data);
5554 else
5555 sprintf(constant, "0x%X", value->data);
5556 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5557 }
5558 return 0x1;
5559 }
5560 }
5561 }
5562 }
5563 }
5564 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5565 return 0x1;
5566 }
5567 }
5568 return 0x0;
5569 }
5570
5571 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5572 {
5573 int value2 = op2->i;
5574
5575 exp->type = 2;
5576 exp->string = PrintInt(op1->i + value2);
5577 if(!exp->expType)
5578 {
5579 exp->expType = op1->type;
5580 if(op1->type)
5581 op1->type->refCount++;
5582 }
5583 return 0x1;
5584 }
5585
5586 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5587 {
5588 unsigned int value2 = op2->ui;
5589
5590 exp->type = 2;
5591 exp->string = PrintUInt(op1->ui + value2);
5592 if(!exp->expType)
5593 {
5594 exp->expType = op1->type;
5595 if(op1->type)
5596 op1->type->refCount++;
5597 }
5598 return 0x1;
5599 }
5600
5601 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5602 {
5603 short value2 = op2->s;
5604
5605 exp->type = 2;
5606 exp->string = PrintShort(op1->s + value2);
5607 if(!exp->expType)
5608 {
5609 exp->expType = op1->type;
5610 if(op1->type)
5611 op1->type->refCount++;
5612 }
5613 return 0x1;
5614 }
5615
5616 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5617 {
5618 unsigned short value2 = op2->us;
5619
5620 exp->type = 2;
5621 exp->string = PrintUShort(op1->us + value2);
5622 if(!exp->expType)
5623 {
5624 exp->expType = op1->type;
5625 if(op1->type)
5626 op1->type->refCount++;
5627 }
5628 return 0x1;
5629 }
5630
5631 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5632 {
5633 char value2 = op2->c;
5634
5635 exp->type = 2;
5636 exp->string = PrintChar(op1->c + value2);
5637 if(!exp->expType)
5638 {
5639 exp->expType = op1->type;
5640 if(op1->type)
5641 op1->type->refCount++;
5642 }
5643 return 0x1;
5644 }
5645
5646 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5647 {
5648 unsigned char value2 = op2->uc;
5649
5650 exp->type = 2;
5651 exp->string = PrintUChar(op1->uc + value2);
5652 if(!exp->expType)
5653 {
5654 exp->expType = op1->type;
5655 if(op1->type)
5656 op1->type->refCount++;
5657 }
5658 return 0x1;
5659 }
5660
5661 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5662 {
5663 float value2 = op2->f;
5664
5665 exp->type = 2;
5666 exp->string = PrintFloat(op1->f + value2);
5667 if(!exp->expType)
5668 {
5669 exp->expType = op1->type;
5670 if(op1->type)
5671 op1->type->refCount++;
5672 }
5673 return 0x1;
5674 }
5675
5676 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5677 {
5678 double value2 = op2->d;
5679
5680 exp->type = 2;
5681 exp->string = PrintDouble(op1->d + value2);
5682 if(!exp->expType)
5683 {
5684 exp->expType = op1->type;
5685 if(op1->type)
5686 op1->type->refCount++;
5687 }
5688 return 0x1;
5689 }
5690
5691 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5692 {
5693 int value2 = op2->i;
5694
5695 exp->type = 2;
5696 exp->string = PrintInt(op1->i - value2);
5697 if(!exp->expType)
5698 {
5699 exp->expType = op1->type;
5700 if(op1->type)
5701 op1->type->refCount++;
5702 }
5703 return 0x1;
5704 }
5705
5706 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5707 {
5708 unsigned int value2 = op2->ui;
5709
5710 exp->type = 2;
5711 exp->string = PrintUInt(op1->ui - value2);
5712 if(!exp->expType)
5713 {
5714 exp->expType = op1->type;
5715 if(op1->type)
5716 op1->type->refCount++;
5717 }
5718 return 0x1;
5719 }
5720
5721 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5722 {
5723 short value2 = op2->s;
5724
5725 exp->type = 2;
5726 exp->string = PrintShort(op1->s - value2);
5727 if(!exp->expType)
5728 {
5729 exp->expType = op1->type;
5730 if(op1->type)
5731 op1->type->refCount++;
5732 }
5733 return 0x1;
5734 }
5735
5736 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5737 {
5738 unsigned short value2 = op2->us;
5739
5740 exp->type = 2;
5741 exp->string = PrintUShort(op1->us - value2);
5742 if(!exp->expType)
5743 {
5744 exp->expType = op1->type;
5745 if(op1->type)
5746 op1->type->refCount++;
5747 }
5748 return 0x1;
5749 }
5750
5751 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5752 {
5753 char value2 = op2->c;
5754
5755 exp->type = 2;
5756 exp->string = PrintChar(op1->c - value2);
5757 if(!exp->expType)
5758 {
5759 exp->expType = op1->type;
5760 if(op1->type)
5761 op1->type->refCount++;
5762 }
5763 return 0x1;
5764 }
5765
5766 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5767 {
5768 unsigned char value2 = op2->uc;
5769
5770 exp->type = 2;
5771 exp->string = PrintUChar(op1->uc - value2);
5772 if(!exp->expType)
5773 {
5774 exp->expType = op1->type;
5775 if(op1->type)
5776 op1->type->refCount++;
5777 }
5778 return 0x1;
5779 }
5780
5781 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5782 {
5783 float value2 = op2->f;
5784
5785 exp->type = 2;
5786 exp->string = PrintFloat(op1->f - value2);
5787 if(!exp->expType)
5788 {
5789 exp->expType = op1->type;
5790 if(op1->type)
5791 op1->type->refCount++;
5792 }
5793 return 0x1;
5794 }
5795
5796 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5797 {
5798 double value2 = op2->d;
5799
5800 exp->type = 2;
5801 exp->string = PrintDouble(op1->d - value2);
5802 if(!exp->expType)
5803 {
5804 exp->expType = op1->type;
5805 if(op1->type)
5806 op1->type->refCount++;
5807 }
5808 return 0x1;
5809 }
5810
5811 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5812 {
5813 int value2 = op2->i;
5814
5815 exp->type = 2;
5816 exp->string = PrintInt(op1->i * value2);
5817 if(!exp->expType)
5818 {
5819 exp->expType = op1->type;
5820 if(op1->type)
5821 op1->type->refCount++;
5822 }
5823 return 0x1;
5824 }
5825
5826 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5827 {
5828 unsigned int value2 = op2->ui;
5829
5830 exp->type = 2;
5831 exp->string = PrintUInt(op1->ui * value2);
5832 if(!exp->expType)
5833 {
5834 exp->expType = op1->type;
5835 if(op1->type)
5836 op1->type->refCount++;
5837 }
5838 return 0x1;
5839 }
5840
5841 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5842 {
5843 short value2 = op2->s;
5844
5845 exp->type = 2;
5846 exp->string = PrintShort(op1->s * value2);
5847 if(!exp->expType)
5848 {
5849 exp->expType = op1->type;
5850 if(op1->type)
5851 op1->type->refCount++;
5852 }
5853 return 0x1;
5854 }
5855
5856 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5857 {
5858 unsigned short value2 = op2->us;
5859
5860 exp->type = 2;
5861 exp->string = PrintUShort(op1->us * value2);
5862 if(!exp->expType)
5863 {
5864 exp->expType = op1->type;
5865 if(op1->type)
5866 op1->type->refCount++;
5867 }
5868 return 0x1;
5869 }
5870
5871 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5872 {
5873 char value2 = op2->c;
5874
5875 exp->type = 2;
5876 exp->string = PrintChar(op1->c * value2);
5877 if(!exp->expType)
5878 {
5879 exp->expType = op1->type;
5880 if(op1->type)
5881 op1->type->refCount++;
5882 }
5883 return 0x1;
5884 }
5885
5886 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5887 {
5888 unsigned char value2 = op2->uc;
5889
5890 exp->type = 2;
5891 exp->string = PrintUChar(op1->uc * value2);
5892 if(!exp->expType)
5893 {
5894 exp->expType = op1->type;
5895 if(op1->type)
5896 op1->type->refCount++;
5897 }
5898 return 0x1;
5899 }
5900
5901 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5902 {
5903 float value2 = op2->f;
5904
5905 exp->type = 2;
5906 exp->string = PrintFloat(op1->f * value2);
5907 if(!exp->expType)
5908 {
5909 exp->expType = op1->type;
5910 if(op1->type)
5911 op1->type->refCount++;
5912 }
5913 return 0x1;
5914 }
5915
5916 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5917 {
5918 double value2 = op2->d;
5919
5920 exp->type = 2;
5921 exp->string = PrintDouble(op1->d * value2);
5922 if(!exp->expType)
5923 {
5924 exp->expType = op1->type;
5925 if(op1->type)
5926 op1->type->refCount++;
5927 }
5928 return 0x1;
5929 }
5930
5931 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5932 {
5933 int value2 = op2->i;
5934
5935 exp->type = 2;
5936 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
5937 if(!exp->expType)
5938 {
5939 exp->expType = op1->type;
5940 if(op1->type)
5941 op1->type->refCount++;
5942 }
5943 return 0x1;
5944 }
5945
5946 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5947 {
5948 unsigned int value2 = op2->ui;
5949
5950 exp->type = 2;
5951 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
5952 if(!exp->expType)
5953 {
5954 exp->expType = op1->type;
5955 if(op1->type)
5956 op1->type->refCount++;
5957 }
5958 return 0x1;
5959 }
5960
5961 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5962 {
5963 short value2 = op2->s;
5964
5965 exp->type = 2;
5966 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
5967 if(!exp->expType)
5968 {
5969 exp->expType = op1->type;
5970 if(op1->type)
5971 op1->type->refCount++;
5972 }
5973 return 0x1;
5974 }
5975
5976 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5977 {
5978 unsigned short value2 = op2->us;
5979
5980 exp->type = 2;
5981 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
5982 if(!exp->expType)
5983 {
5984 exp->expType = op1->type;
5985 if(op1->type)
5986 op1->type->refCount++;
5987 }
5988 return 0x1;
5989 }
5990
5991 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5992 {
5993 char value2 = op2->c;
5994
5995 exp->type = 2;
5996 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
5997 if(!exp->expType)
5998 {
5999 exp->expType = op1->type;
6000 if(op1->type)
6001 op1->type->refCount++;
6002 }
6003 return 0x1;
6004 }
6005
6006 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6007 {
6008 unsigned char value2 = op2->uc;
6009
6010 exp->type = 2;
6011 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
6012 if(!exp->expType)
6013 {
6014 exp->expType = op1->type;
6015 if(op1->type)
6016 op1->type->refCount++;
6017 }
6018 return 0x1;
6019 }
6020
6021 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6022 {
6023 float value2 = op2->f;
6024
6025 exp->type = 2;
6026 exp->string = PrintFloat(value2 ? (op1->f / value2) : (float)0);
6027 if(!exp->expType)
6028 {
6029 exp->expType = op1->type;
6030 if(op1->type)
6031 op1->type->refCount++;
6032 }
6033 return 0x1;
6034 }
6035
6036 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6037 {
6038 double value2 = op2->d;
6039
6040 exp->type = 2;
6041 exp->string = PrintDouble(value2 ? (op1->d / value2) : (double)0);
6042 if(!exp->expType)
6043 {
6044 exp->expType = op1->type;
6045 if(op1->type)
6046 op1->type->refCount++;
6047 }
6048 return 0x1;
6049 }
6050
6051 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6052 {
6053 int value2 = op2->i;
6054
6055 exp->type = 2;
6056 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
6057 if(!exp->expType)
6058 {
6059 exp->expType = op1->type;
6060 if(op1->type)
6061 op1->type->refCount++;
6062 }
6063 return 0x1;
6064 }
6065
6066 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6067 {
6068 unsigned int value2 = op2->ui;
6069
6070 exp->type = 2;
6071 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
6072 if(!exp->expType)
6073 {
6074 exp->expType = op1->type;
6075 if(op1->type)
6076 op1->type->refCount++;
6077 }
6078 return 0x1;
6079 }
6080
6081 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6082 {
6083 short value2 = op2->s;
6084
6085 exp->type = 2;
6086 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
6087 if(!exp->expType)
6088 {
6089 exp->expType = op1->type;
6090 if(op1->type)
6091 op1->type->refCount++;
6092 }
6093 return 0x1;
6094 }
6095
6096 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6097 {
6098 unsigned short value2 = op2->us;
6099
6100 exp->type = 2;
6101 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
6102 if(!exp->expType)
6103 {
6104 exp->expType = op1->type;
6105 if(op1->type)
6106 op1->type->refCount++;
6107 }
6108 return 0x1;
6109 }
6110
6111 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6112 {
6113 char value2 = op2->c;
6114
6115 exp->type = 2;
6116 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
6117 if(!exp->expType)
6118 {
6119 exp->expType = op1->type;
6120 if(op1->type)
6121 op1->type->refCount++;
6122 }
6123 return 0x1;
6124 }
6125
6126 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6127 {
6128 unsigned char value2 = op2->uc;
6129
6130 exp->type = 2;
6131 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
6132 if(!exp->expType)
6133 {
6134 exp->expType = op1->type;
6135 if(op1->type)
6136 op1->type->refCount++;
6137 }
6138 return 0x1;
6139 }
6140
6141 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
6142 {
6143 exp->type = 2;
6144 exp->string = PrintInt(-op1->i);
6145 if(!exp->expType)
6146 {
6147 exp->expType = op1->type;
6148 if(op1->type)
6149 op1->type->refCount++;
6150 }
6151 return 0x1;
6152 }
6153
6154 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
6155 {
6156 exp->type = 2;
6157 exp->string = PrintUInt(-op1->ui);
6158 if(!exp->expType)
6159 {
6160 exp->expType = op1->type;
6161 if(op1->type)
6162 op1->type->refCount++;
6163 }
6164 return 0x1;
6165 }
6166
6167 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
6168 {
6169 exp->type = 2;
6170 exp->string = PrintShort(-op1->s);
6171 if(!exp->expType)
6172 {
6173 exp->expType = op1->type;
6174 if(op1->type)
6175 op1->type->refCount++;
6176 }
6177 return 0x1;
6178 }
6179
6180 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
6181 {
6182 exp->type = 2;
6183 exp->string = PrintUShort(-op1->us);
6184 if(!exp->expType)
6185 {
6186 exp->expType = op1->type;
6187 if(op1->type)
6188 op1->type->refCount++;
6189 }
6190 return 0x1;
6191 }
6192
6193 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
6194 {
6195 exp->type = 2;
6196 exp->string = PrintChar(-op1->c);
6197 if(!exp->expType)
6198 {
6199 exp->expType = op1->type;
6200 if(op1->type)
6201 op1->type->refCount++;
6202 }
6203 return 0x1;
6204 }
6205
6206 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
6207 {
6208 exp->type = 2;
6209 exp->string = PrintUChar(-op1->uc);
6210 if(!exp->expType)
6211 {
6212 exp->expType = op1->type;
6213 if(op1->type)
6214 op1->type->refCount++;
6215 }
6216 return 0x1;
6217 }
6218
6219 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
6220 {
6221 exp->type = 2;
6222 exp->string = PrintFloat(-op1->f);
6223 if(!exp->expType)
6224 {
6225 exp->expType = op1->type;
6226 if(op1->type)
6227 op1->type->refCount++;
6228 }
6229 return 0x1;
6230 }
6231
6232 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6233 {
6234 exp->type = 2;
6235 exp->string = PrintDouble(-op1->d);
6236 if(!exp->expType)
6237 {
6238 exp->expType = op1->type;
6239 if(op1->type)
6240 op1->type->refCount++;
6241 }
6242 return 0x1;
6243 }
6244
6245 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6246 {
6247 exp->type = 2;
6248 exp->string = PrintInt(++op1->i);
6249 if(!exp->expType)
6250 {
6251 exp->expType = op1->type;
6252 if(op1->type)
6253 op1->type->refCount++;
6254 }
6255 return 0x1;
6256 }
6257
6258 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6259 {
6260 exp->type = 2;
6261 exp->string = PrintUInt(++op1->ui);
6262 if(!exp->expType)
6263 {
6264 exp->expType = op1->type;
6265 if(op1->type)
6266 op1->type->refCount++;
6267 }
6268 return 0x1;
6269 }
6270
6271 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6272 {
6273 exp->type = 2;
6274 exp->string = PrintShort(++op1->s);
6275 if(!exp->expType)
6276 {
6277 exp->expType = op1->type;
6278 if(op1->type)
6279 op1->type->refCount++;
6280 }
6281 return 0x1;
6282 }
6283
6284 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6285 {
6286 exp->type = 2;
6287 exp->string = PrintUShort(++op1->us);
6288 if(!exp->expType)
6289 {
6290 exp->expType = op1->type;
6291 if(op1->type)
6292 op1->type->refCount++;
6293 }
6294 return 0x1;
6295 }
6296
6297 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6298 {
6299 exp->type = 2;
6300 exp->string = PrintChar(++op1->c);
6301 if(!exp->expType)
6302 {
6303 exp->expType = op1->type;
6304 if(op1->type)
6305 op1->type->refCount++;
6306 }
6307 return 0x1;
6308 }
6309
6310 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6311 {
6312 exp->type = 2;
6313 exp->string = PrintUChar(++op1->uc);
6314 if(!exp->expType)
6315 {
6316 exp->expType = op1->type;
6317 if(op1->type)
6318 op1->type->refCount++;
6319 }
6320 return 0x1;
6321 }
6322
6323 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6324 {
6325 exp->type = 2;
6326 exp->string = PrintFloat(++op1->f);
6327 if(!exp->expType)
6328 {
6329 exp->expType = op1->type;
6330 if(op1->type)
6331 op1->type->refCount++;
6332 }
6333 return 0x1;
6334 }
6335
6336 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6337 {
6338 exp->type = 2;
6339 exp->string = PrintDouble(++op1->d);
6340 if(!exp->expType)
6341 {
6342 exp->expType = op1->type;
6343 if(op1->type)
6344 op1->type->refCount++;
6345 }
6346 return 0x1;
6347 }
6348
6349 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6350 {
6351 exp->type = 2;
6352 exp->string = PrintInt(--op1->i);
6353 if(!exp->expType)
6354 {
6355 exp->expType = op1->type;
6356 if(op1->type)
6357 op1->type->refCount++;
6358 }
6359 return 0x1;
6360 }
6361
6362 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6363 {
6364 exp->type = 2;
6365 exp->string = PrintUInt(--op1->ui);
6366 if(!exp->expType)
6367 {
6368 exp->expType = op1->type;
6369 if(op1->type)
6370 op1->type->refCount++;
6371 }
6372 return 0x1;
6373 }
6374
6375 static unsigned int ShortDec(struct Expression * exp, struct Operand * op1)
6376 {
6377 exp->type = 2;
6378 exp->string = PrintShort(--op1->s);
6379 if(!exp->expType)
6380 {
6381 exp->expType = op1->type;
6382 if(op1->type)
6383 op1->type->refCount++;
6384 }
6385 return 0x1;
6386 }
6387
6388 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6389 {
6390 exp->type = 2;
6391 exp->string = PrintUShort(--op1->us);
6392 if(!exp->expType)
6393 {
6394 exp->expType = op1->type;
6395 if(op1->type)
6396 op1->type->refCount++;
6397 }
6398 return 0x1;
6399 }
6400
6401 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6402 {
6403 exp->type = 2;
6404 exp->string = PrintChar(--op1->c);
6405 if(!exp->expType)
6406 {
6407 exp->expType = op1->type;
6408 if(op1->type)
6409 op1->type->refCount++;
6410 }
6411 return 0x1;
6412 }
6413
6414 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6415 {
6416 exp->type = 2;
6417 exp->string = PrintUChar(--op1->uc);
6418 if(!exp->expType)
6419 {
6420 exp->expType = op1->type;
6421 if(op1->type)
6422 op1->type->refCount++;
6423 }
6424 return 0x1;
6425 }
6426
6427 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6428 {
6429 exp->type = 2;
6430 exp->string = PrintFloat(--op1->f);
6431 if(!exp->expType)
6432 {
6433 exp->expType = op1->type;
6434 if(op1->type)
6435 op1->type->refCount++;
6436 }
6437 return 0x1;
6438 }
6439
6440 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6441 {
6442 exp->type = 2;
6443 exp->string = PrintDouble(--op1->d);
6444 if(!exp->expType)
6445 {
6446 exp->expType = op1->type;
6447 if(op1->type)
6448 op1->type->refCount++;
6449 }
6450 return 0x1;
6451 }
6452
6453 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6454 {
6455 int value2 = op2->i;
6456
6457 exp->type = 2;
6458 exp->string = PrintInt(op1->i = value2);
6459 if(!exp->expType)
6460 {
6461 exp->expType = op1->type;
6462 if(op1->type)
6463 op1->type->refCount++;
6464 }
6465 return 0x1;
6466 }
6467
6468 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6469 {
6470 unsigned int value2 = op2->ui;
6471
6472 exp->type = 2;
6473 exp->string = PrintUInt(op1->ui = value2);
6474 if(!exp->expType)
6475 {
6476 exp->expType = op1->type;
6477 if(op1->type)
6478 op1->type->refCount++;
6479 }
6480 return 0x1;
6481 }
6482
6483 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6484 {
6485 short value2 = op2->s;
6486
6487 exp->type = 2;
6488 exp->string = PrintShort(op1->s = value2);
6489 if(!exp->expType)
6490 {
6491 exp->expType = op1->type;
6492 if(op1->type)
6493 op1->type->refCount++;
6494 }
6495 return 0x1;
6496 }
6497
6498 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6499 {
6500 unsigned short value2 = op2->us;
6501
6502 exp->type = 2;
6503 exp->string = PrintUShort(op1->us = value2);
6504 if(!exp->expType)
6505 {
6506 exp->expType = op1->type;
6507 if(op1->type)
6508 op1->type->refCount++;
6509 }
6510 return 0x1;
6511 }
6512
6513 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6514 {
6515 char value2 = op2->c;
6516
6517 exp->type = 2;
6518 exp->string = PrintChar(op1->c = value2);
6519 if(!exp->expType)
6520 {
6521 exp->expType = op1->type;
6522 if(op1->type)
6523 op1->type->refCount++;
6524 }
6525 return 0x1;
6526 }
6527
6528 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6529 {
6530 unsigned char value2 = op2->uc;
6531
6532 exp->type = 2;
6533 exp->string = PrintUChar(op1->uc = value2);
6534 if(!exp->expType)
6535 {
6536 exp->expType = op1->type;
6537 if(op1->type)
6538 op1->type->refCount++;
6539 }
6540 return 0x1;
6541 }
6542
6543 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6544 {
6545 float value2 = op2->f;
6546
6547 exp->type = 2;
6548 exp->string = PrintFloat(op1->f = value2);
6549 if(!exp->expType)
6550 {
6551 exp->expType = op1->type;
6552 if(op1->type)
6553 op1->type->refCount++;
6554 }
6555 return 0x1;
6556 }
6557
6558 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6559 {
6560 double value2 = op2->d;
6561
6562 exp->type = 2;
6563 exp->string = PrintDouble(op1->d = value2);
6564 if(!exp->expType)
6565 {
6566 exp->expType = op1->type;
6567 if(op1->type)
6568 op1->type->refCount++;
6569 }
6570 return 0x1;
6571 }
6572
6573 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6574 {
6575 int value2 = op2->i;
6576
6577 exp->type = 2;
6578 exp->string = PrintInt(op1->i += value2);
6579 if(!exp->expType)
6580 {
6581 exp->expType = op1->type;
6582 if(op1->type)
6583 op1->type->refCount++;
6584 }
6585 return 0x1;
6586 }
6587
6588 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6589 {
6590 unsigned int value2 = op2->ui;
6591
6592 exp->type = 2;
6593 exp->string = PrintUInt(op1->ui += value2);
6594 if(!exp->expType)
6595 {
6596 exp->expType = op1->type;
6597 if(op1->type)
6598 op1->type->refCount++;
6599 }
6600 return 0x1;
6601 }
6602
6603 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6604 {
6605 short value2 = op2->s;
6606
6607 exp->type = 2;
6608 exp->string = PrintShort(op1->s += value2);
6609 if(!exp->expType)
6610 {
6611 exp->expType = op1->type;
6612 if(op1->type)
6613 op1->type->refCount++;
6614 }
6615 return 0x1;
6616 }
6617
6618 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6619 {
6620 unsigned short value2 = op2->us;
6621
6622 exp->type = 2;
6623 exp->string = PrintUShort(op1->us += value2);
6624 if(!exp->expType)
6625 {
6626 exp->expType = op1->type;
6627 if(op1->type)
6628 op1->type->refCount++;
6629 }
6630 return 0x1;
6631 }
6632
6633 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6634 {
6635 char value2 = op2->c;
6636
6637 exp->type = 2;
6638 exp->string = PrintChar(op1->c += value2);
6639 if(!exp->expType)
6640 {
6641 exp->expType = op1->type;
6642 if(op1->type)
6643 op1->type->refCount++;
6644 }
6645 return 0x1;
6646 }
6647
6648 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6649 {
6650 unsigned char value2 = op2->uc;
6651
6652 exp->type = 2;
6653 exp->string = PrintUChar(op1->uc += value2);
6654 if(!exp->expType)
6655 {
6656 exp->expType = op1->type;
6657 if(op1->type)
6658 op1->type->refCount++;
6659 }
6660 return 0x1;
6661 }
6662
6663 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6664 {
6665 float value2 = op2->f;
6666
6667 exp->type = 2;
6668 exp->string = PrintFloat(op1->f += value2);
6669 if(!exp->expType)
6670 {
6671 exp->expType = op1->type;
6672 if(op1->type)
6673 op1->type->refCount++;
6674 }
6675 return 0x1;
6676 }
6677
6678 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6679 {
6680 double value2 = op2->d;
6681
6682 exp->type = 2;
6683 exp->string = PrintDouble(op1->d += value2);
6684 if(!exp->expType)
6685 {
6686 exp->expType = op1->type;
6687 if(op1->type)
6688 op1->type->refCount++;
6689 }
6690 return 0x1;
6691 }
6692
6693 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6694 {
6695 int value2 = op2->i;
6696
6697 exp->type = 2;
6698 exp->string = PrintInt(op1->i -= value2);
6699 if(!exp->expType)
6700 {
6701 exp->expType = op1->type;
6702 if(op1->type)
6703 op1->type->refCount++;
6704 }
6705 return 0x1;
6706 }
6707
6708 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6709 {
6710 unsigned int value2 = op2->ui;
6711
6712 exp->type = 2;
6713 exp->string = PrintUInt(op1->ui -= value2);
6714 if(!exp->expType)
6715 {
6716 exp->expType = op1->type;
6717 if(op1->type)
6718 op1->type->refCount++;
6719 }
6720 return 0x1;
6721 }
6722
6723 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6724 {
6725 short value2 = op2->s;
6726
6727 exp->type = 2;
6728 exp->string = PrintShort(op1->s -= value2);
6729 if(!exp->expType)
6730 {
6731 exp->expType = op1->type;
6732 if(op1->type)
6733 op1->type->refCount++;
6734 }
6735 return 0x1;
6736 }
6737
6738 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6739 {
6740 unsigned short value2 = op2->us;
6741
6742 exp->type = 2;
6743 exp->string = PrintUShort(op1->us -= value2);
6744 if(!exp->expType)
6745 {
6746 exp->expType = op1->type;
6747 if(op1->type)
6748 op1->type->refCount++;
6749 }
6750 return 0x1;
6751 }
6752
6753 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6754 {
6755 char value2 = op2->c;
6756
6757 exp->type = 2;
6758 exp->string = PrintChar(op1->c -= value2);
6759 if(!exp->expType)
6760 {
6761 exp->expType = op1->type;
6762 if(op1->type)
6763 op1->type->refCount++;
6764 }
6765 return 0x1;
6766 }
6767
6768 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6769 {
6770 unsigned char value2 = op2->uc;
6771
6772 exp->type = 2;
6773 exp->string = PrintUChar(op1->uc -= value2);
6774 if(!exp->expType)
6775 {
6776 exp->expType = op1->type;
6777 if(op1->type)
6778 op1->type->refCount++;
6779 }
6780 return 0x1;
6781 }
6782
6783 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6784 {
6785 float value2 = op2->f;
6786
6787 exp->type = 2;
6788 exp->string = PrintFloat(op1->f -= value2);
6789 if(!exp->expType)
6790 {
6791 exp->expType = op1->type;
6792 if(op1->type)
6793 op1->type->refCount++;
6794 }
6795 return 0x1;
6796 }
6797
6798 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6799 {
6800 double value2 = op2->d;
6801
6802 exp->type = 2;
6803 exp->string = PrintDouble(op1->d -= value2);
6804 if(!exp->expType)
6805 {
6806 exp->expType = op1->type;
6807 if(op1->type)
6808 op1->type->refCount++;
6809 }
6810 return 0x1;
6811 }
6812
6813 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6814 {
6815 int value2 = op2->i;
6816
6817 exp->type = 2;
6818 exp->string = PrintInt(op1->i *= value2);
6819 if(!exp->expType)
6820 {
6821 exp->expType = op1->type;
6822 if(op1->type)
6823 op1->type->refCount++;
6824 }
6825 return 0x1;
6826 }
6827
6828 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6829 {
6830 unsigned int value2 = op2->ui;
6831
6832 exp->type = 2;
6833 exp->string = PrintUInt(op1->ui *= value2);
6834 if(!exp->expType)
6835 {
6836 exp->expType = op1->type;
6837 if(op1->type)
6838 op1->type->refCount++;
6839 }
6840 return 0x1;
6841 }
6842
6843 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6844 {
6845 short value2 = op2->s;
6846
6847 exp->type = 2;
6848 exp->string = PrintShort(op1->s *= value2);
6849 if(!exp->expType)
6850 {
6851 exp->expType = op1->type;
6852 if(op1->type)
6853 op1->type->refCount++;
6854 }
6855 return 0x1;
6856 }
6857
6858 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6859 {
6860 unsigned short value2 = op2->us;
6861
6862 exp->type = 2;
6863 exp->string = PrintUShort(op1->us *= value2);
6864 if(!exp->expType)
6865 {
6866 exp->expType = op1->type;
6867 if(op1->type)
6868 op1->type->refCount++;
6869 }
6870 return 0x1;
6871 }
6872
6873 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6874 {
6875 char value2 = op2->c;
6876
6877 exp->type = 2;
6878 exp->string = PrintChar(op1->c *= value2);
6879 if(!exp->expType)
6880 {
6881 exp->expType = op1->type;
6882 if(op1->type)
6883 op1->type->refCount++;
6884 }
6885 return 0x1;
6886 }
6887
6888 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6889 {
6890 unsigned char value2 = op2->uc;
6891
6892 exp->type = 2;
6893 exp->string = PrintUChar(op1->uc *= value2);
6894 if(!exp->expType)
6895 {
6896 exp->expType = op1->type;
6897 if(op1->type)
6898 op1->type->refCount++;
6899 }
6900 return 0x1;
6901 }
6902
6903 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6904 {
6905 float value2 = op2->f;
6906
6907 exp->type = 2;
6908 exp->string = PrintFloat(op1->f *= value2);
6909 if(!exp->expType)
6910 {
6911 exp->expType = op1->type;
6912 if(op1->type)
6913 op1->type->refCount++;
6914 }
6915 return 0x1;
6916 }
6917
6918 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6919 {
6920 double value2 = op2->d;
6921
6922 exp->type = 2;
6923 exp->string = PrintDouble(op1->d *= value2);
6924 if(!exp->expType)
6925 {
6926 exp->expType = op1->type;
6927 if(op1->type)
6928 op1->type->refCount++;
6929 }
6930 return 0x1;
6931 }
6932
6933 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6934 {
6935 int value2 = op2->i;
6936
6937 exp->type = 2;
6938 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
6939 if(!exp->expType)
6940 {
6941 exp->expType = op1->type;
6942 if(op1->type)
6943 op1->type->refCount++;
6944 }
6945 return 0x1;
6946 }
6947
6948 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6949 {
6950 unsigned int value2 = op2->ui;
6951
6952 exp->type = 2;
6953 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
6954 if(!exp->expType)
6955 {
6956 exp->expType = op1->type;
6957 if(op1->type)
6958 op1->type->refCount++;
6959 }
6960 return 0x1;
6961 }
6962
6963 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6964 {
6965 short value2 = op2->s;
6966
6967 exp->type = 2;
6968 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
6969 if(!exp->expType)
6970 {
6971 exp->expType = op1->type;
6972 if(op1->type)
6973 op1->type->refCount++;
6974 }
6975 return 0x1;
6976 }
6977
6978 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6979 {
6980 unsigned short value2 = op2->us;
6981
6982 exp->type = 2;
6983 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
6984 if(!exp->expType)
6985 {
6986 exp->expType = op1->type;
6987 if(op1->type)
6988 op1->type->refCount++;
6989 }
6990 return 0x1;
6991 }
6992
6993 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6994 {
6995 char value2 = op2->c;
6996
6997 exp->type = 2;
6998 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
6999 if(!exp->expType)
7000 {
7001 exp->expType = op1->type;
7002 if(op1->type)
7003 op1->type->refCount++;
7004 }
7005 return 0x1;
7006 }
7007
7008 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7009 {
7010 unsigned char value2 = op2->uc;
7011
7012 exp->type = 2;
7013 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
7014 if(!exp->expType)
7015 {
7016 exp->expType = op1->type;
7017 if(op1->type)
7018 op1->type->refCount++;
7019 }
7020 return 0x1;
7021 }
7022
7023 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7024 {
7025 float value2 = op2->f;
7026
7027 exp->type = 2;
7028 exp->string = PrintFloat(value2 ? (op1->f /= value2) : (float)0);
7029 if(!exp->expType)
7030 {
7031 exp->expType = op1->type;
7032 if(op1->type)
7033 op1->type->refCount++;
7034 }
7035 return 0x1;
7036 }
7037
7038 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7039 {
7040 double value2 = op2->d;
7041
7042 exp->type = 2;
7043 exp->string = PrintDouble(value2 ? (op1->d /= value2) : (double)0);
7044 if(!exp->expType)
7045 {
7046 exp->expType = op1->type;
7047 if(op1->type)
7048 op1->type->refCount++;
7049 }
7050 return 0x1;
7051 }
7052
7053 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7054 {
7055 int value2 = op2->i;
7056
7057 exp->type = 2;
7058 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
7059 if(!exp->expType)
7060 {
7061 exp->expType = op1->type;
7062 if(op1->type)
7063 op1->type->refCount++;
7064 }
7065 return 0x1;
7066 }
7067
7068 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7069 {
7070 unsigned int value2 = op2->ui;
7071
7072 exp->type = 2;
7073 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
7074 if(!exp->expType)
7075 {
7076 exp->expType = op1->type;
7077 if(op1->type)
7078 op1->type->refCount++;
7079 }
7080 return 0x1;
7081 }
7082
7083 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7084 {
7085 short value2 = op2->s;
7086
7087 exp->type = 2;
7088 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
7089 if(!exp->expType)
7090 {
7091 exp->expType = op1->type;
7092 if(op1->type)
7093 op1->type->refCount++;
7094 }
7095 return 0x1;
7096 }
7097
7098 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7099 {
7100 unsigned short value2 = op2->us;
7101
7102 exp->type = 2;
7103 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
7104 if(!exp->expType)
7105 {
7106 exp->expType = op1->type;
7107 if(op1->type)
7108 op1->type->refCount++;
7109 }
7110 return 0x1;
7111 }
7112
7113 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7114 {
7115 char value2 = op2->c;
7116
7117 exp->type = 2;
7118 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
7119 if(!exp->expType)
7120 {
7121 exp->expType = op1->type;
7122 if(op1->type)
7123 op1->type->refCount++;
7124 }
7125 return 0x1;
7126 }
7127
7128 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7129 {
7130 unsigned char value2 = op2->uc;
7131
7132 exp->type = 2;
7133 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
7134 if(!exp->expType)
7135 {
7136 exp->expType = op1->type;
7137 if(op1->type)
7138 op1->type->refCount++;
7139 }
7140 return 0x1;
7141 }
7142
7143 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7144 {
7145 int value2 = op2->i;
7146
7147 exp->type = 2;
7148 exp->string = PrintInt(op1->i & value2);
7149 if(!exp->expType)
7150 {
7151 exp->expType = op1->type;
7152 if(op1->type)
7153 op1->type->refCount++;
7154 }
7155 return 0x1;
7156 }
7157
7158 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7159 {
7160 unsigned int value2 = op2->ui;
7161
7162 exp->type = 2;
7163 exp->string = PrintUInt(op1->ui & value2);
7164 if(!exp->expType)
7165 {
7166 exp->expType = op1->type;
7167 if(op1->type)
7168 op1->type->refCount++;
7169 }
7170 return 0x1;
7171 }
7172
7173 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7174 {
7175 short value2 = op2->s;
7176
7177 exp->type = 2;
7178 exp->string = PrintShort(op1->s & value2);
7179 if(!exp->expType)
7180 {
7181 exp->expType = op1->type;
7182 if(op1->type)
7183 op1->type->refCount++;
7184 }
7185 return 0x1;
7186 }
7187
7188 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7189 {
7190 unsigned short value2 = op2->us;
7191
7192 exp->type = 2;
7193 exp->string = PrintUShort(op1->us & value2);
7194 if(!exp->expType)
7195 {
7196 exp->expType = op1->type;
7197 if(op1->type)
7198 op1->type->refCount++;
7199 }
7200 return 0x1;
7201 }
7202
7203 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7204 {
7205 char value2 = op2->c;
7206
7207 exp->type = 2;
7208 exp->string = PrintChar(op1->c & value2);
7209 if(!exp->expType)
7210 {
7211 exp->expType = op1->type;
7212 if(op1->type)
7213 op1->type->refCount++;
7214 }
7215 return 0x1;
7216 }
7217
7218 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7219 {
7220 unsigned char value2 = op2->uc;
7221
7222 exp->type = 2;
7223 exp->string = PrintUChar(op1->uc & value2);
7224 if(!exp->expType)
7225 {
7226 exp->expType = op1->type;
7227 if(op1->type)
7228 op1->type->refCount++;
7229 }
7230 return 0x1;
7231 }
7232
7233 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7234 {
7235 int value2 = op2->i;
7236
7237 exp->type = 2;
7238 exp->string = PrintInt(op1->i | value2);
7239 if(!exp->expType)
7240 {
7241 exp->expType = op1->type;
7242 if(op1->type)
7243 op1->type->refCount++;
7244 }
7245 return 0x1;
7246 }
7247
7248 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7249 {
7250 unsigned int value2 = op2->ui;
7251
7252 exp->type = 2;
7253 exp->string = PrintUInt(op1->ui | value2);
7254 if(!exp->expType)
7255 {
7256 exp->expType = op1->type;
7257 if(op1->type)
7258 op1->type->refCount++;
7259 }
7260 return 0x1;
7261 }
7262
7263 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7264 {
7265 short value2 = op2->s;
7266
7267 exp->type = 2;
7268 exp->string = PrintShort(op1->s | value2);
7269 if(!exp->expType)
7270 {
7271 exp->expType = op1->type;
7272 if(op1->type)
7273 op1->type->refCount++;
7274 }
7275 return 0x1;
7276 }
7277
7278 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7279 {
7280 unsigned short value2 = op2->us;
7281
7282 exp->type = 2;
7283 exp->string = PrintUShort(op1->us | value2);
7284 if(!exp->expType)
7285 {
7286 exp->expType = op1->type;
7287 if(op1->type)
7288 op1->type->refCount++;
7289 }
7290 return 0x1;
7291 }
7292
7293 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7294 {
7295 char value2 = op2->c;
7296
7297 exp->type = 2;
7298 exp->string = PrintChar(op1->c | value2);
7299 if(!exp->expType)
7300 {
7301 exp->expType = op1->type;
7302 if(op1->type)
7303 op1->type->refCount++;
7304 }
7305 return 0x1;
7306 }
7307
7308 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7309 {
7310 unsigned char value2 = op2->uc;
7311
7312 exp->type = 2;
7313 exp->string = PrintUChar(op1->uc | value2);
7314 if(!exp->expType)
7315 {
7316 exp->expType = op1->type;
7317 if(op1->type)
7318 op1->type->refCount++;
7319 }
7320 return 0x1;
7321 }
7322
7323 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7324 {
7325 int value2 = op2->i;
7326
7327 exp->type = 2;
7328 exp->string = PrintInt(op1->i ^ value2);
7329 if(!exp->expType)
7330 {
7331 exp->expType = op1->type;
7332 if(op1->type)
7333 op1->type->refCount++;
7334 }
7335 return 0x1;
7336 }
7337
7338 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7339 {
7340 unsigned int value2 = op2->ui;
7341
7342 exp->type = 2;
7343 exp->string = PrintUInt(op1->ui ^ value2);
7344 if(!exp->expType)
7345 {
7346 exp->expType = op1->type;
7347 if(op1->type)
7348 op1->type->refCount++;
7349 }
7350 return 0x1;
7351 }
7352
7353 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7354 {
7355 short value2 = op2->s;
7356
7357 exp->type = 2;
7358 exp->string = PrintShort(op1->s ^ value2);
7359 if(!exp->expType)
7360 {
7361 exp->expType = op1->type;
7362 if(op1->type)
7363 op1->type->refCount++;
7364 }
7365 return 0x1;
7366 }
7367
7368 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7369 {
7370 unsigned short value2 = op2->us;
7371
7372 exp->type = 2;
7373 exp->string = PrintUShort(op1->us ^ value2);
7374 if(!exp->expType)
7375 {
7376 exp->expType = op1->type;
7377 if(op1->type)
7378 op1->type->refCount++;
7379 }
7380 return 0x1;
7381 }
7382
7383 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7384 {
7385 char value2 = op2->c;
7386
7387 exp->type = 2;
7388 exp->string = PrintChar(op1->c ^ value2);
7389 if(!exp->expType)
7390 {
7391 exp->expType = op1->type;
7392 if(op1->type)
7393 op1->type->refCount++;
7394 }
7395 return 0x1;
7396 }
7397
7398 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7399 {
7400 unsigned char value2 = op2->uc;
7401
7402 exp->type = 2;
7403 exp->string = PrintUChar(op1->uc ^ value2);
7404 if(!exp->expType)
7405 {
7406 exp->expType = op1->type;
7407 if(op1->type)
7408 op1->type->refCount++;
7409 }
7410 return 0x1;
7411 }
7412
7413 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7414 {
7415 int value2 = op2->i;
7416
7417 exp->type = 2;
7418 exp->string = PrintInt(op1->i << value2);
7419 if(!exp->expType)
7420 {
7421 exp->expType = op1->type;
7422 if(op1->type)
7423 op1->type->refCount++;
7424 }
7425 return 0x1;
7426 }
7427
7428 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7429 {
7430 unsigned int value2 = op2->ui;
7431
7432 exp->type = 2;
7433 exp->string = PrintUInt(op1->ui << value2);
7434 if(!exp->expType)
7435 {
7436 exp->expType = op1->type;
7437 if(op1->type)
7438 op1->type->refCount++;
7439 }
7440 return 0x1;
7441 }
7442
7443 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7444 {
7445 short value2 = op2->s;
7446
7447 exp->type = 2;
7448 exp->string = PrintShort(op1->s << value2);
7449 if(!exp->expType)
7450 {
7451 exp->expType = op1->type;
7452 if(op1->type)
7453 op1->type->refCount++;
7454 }
7455 return 0x1;
7456 }
7457
7458 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7459 {
7460 unsigned short value2 = op2->us;
7461
7462 exp->type = 2;
7463 exp->string = PrintUShort(op1->us << value2);
7464 if(!exp->expType)
7465 {
7466 exp->expType = op1->type;
7467 if(op1->type)
7468 op1->type->refCount++;
7469 }
7470 return 0x1;
7471 }
7472
7473 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7474 {
7475 char value2 = op2->c;
7476
7477 exp->type = 2;
7478 exp->string = PrintChar(op1->c << value2);
7479 if(!exp->expType)
7480 {
7481 exp->expType = op1->type;
7482 if(op1->type)
7483 op1->type->refCount++;
7484 }
7485 return 0x1;
7486 }
7487
7488 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7489 {
7490 unsigned char value2 = op2->uc;
7491
7492 exp->type = 2;
7493 exp->string = PrintUChar(op1->uc << value2);
7494 if(!exp->expType)
7495 {
7496 exp->expType = op1->type;
7497 if(op1->type)
7498 op1->type->refCount++;
7499 }
7500 return 0x1;
7501 }
7502
7503 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7504 {
7505 int value2 = op2->i;
7506
7507 exp->type = 2;
7508 exp->string = PrintInt(op1->i >> value2);
7509 if(!exp->expType)
7510 {
7511 exp->expType = op1->type;
7512 if(op1->type)
7513 op1->type->refCount++;
7514 }
7515 return 0x1;
7516 }
7517
7518 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7519 {
7520 unsigned int value2 = op2->ui;
7521
7522 exp->type = 2;
7523 exp->string = PrintUInt(op1->ui >> value2);
7524 if(!exp->expType)
7525 {
7526 exp->expType = op1->type;
7527 if(op1->type)
7528 op1->type->refCount++;
7529 }
7530 return 0x1;
7531 }
7532
7533 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7534 {
7535 short value2 = op2->s;
7536
7537 exp->type = 2;
7538 exp->string = PrintShort(op1->s >> value2);
7539 if(!exp->expType)
7540 {
7541 exp->expType = op1->type;
7542 if(op1->type)
7543 op1->type->refCount++;
7544 }
7545 return 0x1;
7546 }
7547
7548 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7549 {
7550 unsigned short value2 = op2->us;
7551
7552 exp->type = 2;
7553 exp->string = PrintUShort(op1->us >> value2);
7554 if(!exp->expType)
7555 {
7556 exp->expType = op1->type;
7557 if(op1->type)
7558 op1->type->refCount++;
7559 }
7560 return 0x1;
7561 }
7562
7563 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7564 {
7565 char value2 = op2->c;
7566
7567 exp->type = 2;
7568 exp->string = PrintChar(op1->c >> value2);
7569 if(!exp->expType)
7570 {
7571 exp->expType = op1->type;
7572 if(op1->type)
7573 op1->type->refCount++;
7574 }
7575 return 0x1;
7576 }
7577
7578 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7579 {
7580 unsigned char value2 = op2->uc;
7581
7582 exp->type = 2;
7583 exp->string = PrintUChar(op1->uc >> value2);
7584 if(!exp->expType)
7585 {
7586 exp->expType = op1->type;
7587 if(op1->type)
7588 op1->type->refCount++;
7589 }
7590 return 0x1;
7591 }
7592
7593 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
7594 {
7595 exp->type = 2;
7596 exp->string = PrintInt(~op1->i);
7597 if(!exp->expType)
7598 {
7599 exp->expType = op1->type;
7600 if(op1->type)
7601 op1->type->refCount++;
7602 }
7603 return 0x1;
7604 }
7605
7606 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
7607 {
7608 exp->type = 2;
7609 exp->string = PrintUInt(~op1->ui);
7610 if(!exp->expType)
7611 {
7612 exp->expType = op1->type;
7613 if(op1->type)
7614 op1->type->refCount++;
7615 }
7616 return 0x1;
7617 }
7618
7619 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
7620 {
7621 exp->type = 2;
7622 exp->string = PrintShort(~op1->s);
7623 if(!exp->expType)
7624 {
7625 exp->expType = op1->type;
7626 if(op1->type)
7627 op1->type->refCount++;
7628 }
7629 return 0x1;
7630 }
7631
7632 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
7633 {
7634 exp->type = 2;
7635 exp->string = PrintUShort(~op1->us);
7636 if(!exp->expType)
7637 {
7638 exp->expType = op1->type;
7639 if(op1->type)
7640 op1->type->refCount++;
7641 }
7642 return 0x1;
7643 }
7644
7645 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
7646 {
7647 exp->type = 2;
7648 exp->string = PrintChar(~op1->c);
7649 if(!exp->expType)
7650 {
7651 exp->expType = op1->type;
7652 if(op1->type)
7653 op1->type->refCount++;
7654 }
7655 return 0x1;
7656 }
7657
7658 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
7659 {
7660 exp->type = 2;
7661 exp->string = PrintUChar(~op1->uc);
7662 if(!exp->expType)
7663 {
7664 exp->expType = op1->type;
7665 if(op1->type)
7666 op1->type->refCount++;
7667 }
7668 return 0x1;
7669 }
7670
7671 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7672 {
7673 int value2 = op2->i;
7674
7675 exp->type = 2;
7676 exp->string = PrintInt(op1->i &= value2);
7677 if(!exp->expType)
7678 {
7679 exp->expType = op1->type;
7680 if(op1->type)
7681 op1->type->refCount++;
7682 }
7683 return 0x1;
7684 }
7685
7686 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7687 {
7688 unsigned int value2 = op2->ui;
7689
7690 exp->type = 2;
7691 exp->string = PrintUInt(op1->ui &= value2);
7692 if(!exp->expType)
7693 {
7694 exp->expType = op1->type;
7695 if(op1->type)
7696 op1->type->refCount++;
7697 }
7698 return 0x1;
7699 }
7700
7701 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7702 {
7703 short value2 = op2->s;
7704
7705 exp->type = 2;
7706 exp->string = PrintShort(op1->s &= value2);
7707 if(!exp->expType)
7708 {
7709 exp->expType = op1->type;
7710 if(op1->type)
7711 op1->type->refCount++;
7712 }
7713 return 0x1;
7714 }
7715
7716 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7717 {
7718 unsigned short value2 = op2->us;
7719
7720 exp->type = 2;
7721 exp->string = PrintUShort(op1->us &= value2);
7722 if(!exp->expType)
7723 {
7724 exp->expType = op1->type;
7725 if(op1->type)
7726 op1->type->refCount++;
7727 }
7728 return 0x1;
7729 }
7730
7731 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7732 {
7733 char value2 = op2->c;
7734
7735 exp->type = 2;
7736 exp->string = PrintChar(op1->c &= value2);
7737 if(!exp->expType)
7738 {
7739 exp->expType = op1->type;
7740 if(op1->type)
7741 op1->type->refCount++;
7742 }
7743 return 0x1;
7744 }
7745
7746 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7747 {
7748 unsigned char value2 = op2->uc;
7749
7750 exp->type = 2;
7751 exp->string = PrintUChar(op1->uc &= value2);
7752 if(!exp->expType)
7753 {
7754 exp->expType = op1->type;
7755 if(op1->type)
7756 op1->type->refCount++;
7757 }
7758 return 0x1;
7759 }
7760
7761 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7762 {
7763 int value2 = op2->i;
7764
7765 exp->type = 2;
7766 exp->string = PrintInt(op1->i |= value2);
7767 if(!exp->expType)
7768 {
7769 exp->expType = op1->type;
7770 if(op1->type)
7771 op1->type->refCount++;
7772 }
7773 return 0x1;
7774 }
7775
7776 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7777 {
7778 unsigned int value2 = op2->ui;
7779
7780 exp->type = 2;
7781 exp->string = PrintUInt(op1->ui |= value2);
7782 if(!exp->expType)
7783 {
7784 exp->expType = op1->type;
7785 if(op1->type)
7786 op1->type->refCount++;
7787 }
7788 return 0x1;
7789 }
7790
7791 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7792 {
7793 short value2 = op2->s;
7794
7795 exp->type = 2;
7796 exp->string = PrintShort(op1->s |= value2);
7797 if(!exp->expType)
7798 {
7799 exp->expType = op1->type;
7800 if(op1->type)
7801 op1->type->refCount++;
7802 }
7803 return 0x1;
7804 }
7805
7806 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7807 {
7808 unsigned short value2 = op2->us;
7809
7810 exp->type = 2;
7811 exp->string = PrintUShort(op1->us |= value2);
7812 if(!exp->expType)
7813 {
7814 exp->expType = op1->type;
7815 if(op1->type)
7816 op1->type->refCount++;
7817 }
7818 return 0x1;
7819 }
7820
7821 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7822 {
7823 char value2 = op2->c;
7824
7825 exp->type = 2;
7826 exp->string = PrintChar(op1->c |= value2);
7827 if(!exp->expType)
7828 {
7829 exp->expType = op1->type;
7830 if(op1->type)
7831 op1->type->refCount++;
7832 }
7833 return 0x1;
7834 }
7835
7836 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7837 {
7838 unsigned char value2 = op2->uc;
7839
7840 exp->type = 2;
7841 exp->string = PrintUChar(op1->uc |= value2);
7842 if(!exp->expType)
7843 {
7844 exp->expType = op1->type;
7845 if(op1->type)
7846 op1->type->refCount++;
7847 }
7848 return 0x1;
7849 }
7850
7851 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7852 {
7853 int value2 = op2->i;
7854
7855 exp->type = 2;
7856 exp->string = PrintInt(op1->i ^= value2);
7857 if(!exp->expType)
7858 {
7859 exp->expType = op1->type;
7860 if(op1->type)
7861 op1->type->refCount++;
7862 }
7863 return 0x1;
7864 }
7865
7866 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7867 {
7868 unsigned int value2 = op2->ui;
7869
7870 exp->type = 2;
7871 exp->string = PrintUInt(op1->ui ^= value2);
7872 if(!exp->expType)
7873 {
7874 exp->expType = op1->type;
7875 if(op1->type)
7876 op1->type->refCount++;
7877 }
7878 return 0x1;
7879 }
7880
7881 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7882 {
7883 short value2 = op2->s;
7884
7885 exp->type = 2;
7886 exp->string = PrintShort(op1->s ^= value2);
7887 if(!exp->expType)
7888 {
7889 exp->expType = op1->type;
7890 if(op1->type)
7891 op1->type->refCount++;
7892 }
7893 return 0x1;
7894 }
7895
7896 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7897 {
7898 unsigned short value2 = op2->us;
7899
7900 exp->type = 2;
7901 exp->string = PrintUShort(op1->us ^= value2);
7902 if(!exp->expType)
7903 {
7904 exp->expType = op1->type;
7905 if(op1->type)
7906 op1->type->refCount++;
7907 }
7908 return 0x1;
7909 }
7910
7911 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7912 {
7913 char value2 = op2->c;
7914
7915 exp->type = 2;
7916 exp->string = PrintChar(op1->c ^= value2);
7917 if(!exp->expType)
7918 {
7919 exp->expType = op1->type;
7920 if(op1->type)
7921 op1->type->refCount++;
7922 }
7923 return 0x1;
7924 }
7925
7926 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7927 {
7928 unsigned char value2 = op2->uc;
7929
7930 exp->type = 2;
7931 exp->string = PrintUChar(op1->uc ^= value2);
7932 if(!exp->expType)
7933 {
7934 exp->expType = op1->type;
7935 if(op1->type)
7936 op1->type->refCount++;
7937 }
7938 return 0x1;
7939 }
7940
7941 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7942 {
7943 int value2 = op2->i;
7944
7945 exp->type = 2;
7946 exp->string = PrintInt(op1->i <<= value2);
7947 if(!exp->expType)
7948 {
7949 exp->expType = op1->type;
7950 if(op1->type)
7951 op1->type->refCount++;
7952 }
7953 return 0x1;
7954 }
7955
7956 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7957 {
7958 unsigned int value2 = op2->ui;
7959
7960 exp->type = 2;
7961 exp->string = PrintUInt(op1->ui <<= value2);
7962 if(!exp->expType)
7963 {
7964 exp->expType = op1->type;
7965 if(op1->type)
7966 op1->type->refCount++;
7967 }
7968 return 0x1;
7969 }
7970
7971 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7972 {
7973 short value2 = op2->s;
7974
7975 exp->type = 2;
7976 exp->string = PrintShort(op1->s <<= value2);
7977 if(!exp->expType)
7978 {
7979 exp->expType = op1->type;
7980 if(op1->type)
7981 op1->type->refCount++;
7982 }
7983 return 0x1;
7984 }
7985
7986 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7987 {
7988 unsigned short value2 = op2->us;
7989
7990 exp->type = 2;
7991 exp->string = PrintUShort(op1->us <<= value2);
7992 if(!exp->expType)
7993 {
7994 exp->expType = op1->type;
7995 if(op1->type)
7996 op1->type->refCount++;
7997 }
7998 return 0x1;
7999 }
8000
8001 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8002 {
8003 char value2 = op2->c;
8004
8005 exp->type = 2;
8006 exp->string = PrintChar(op1->c <<= value2);
8007 if(!exp->expType)
8008 {
8009 exp->expType = op1->type;
8010 if(op1->type)
8011 op1->type->refCount++;
8012 }
8013 return 0x1;
8014 }
8015
8016 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8017 {
8018 unsigned char value2 = op2->uc;
8019
8020 exp->type = 2;
8021 exp->string = PrintUChar(op1->uc <<= value2);
8022 if(!exp->expType)
8023 {
8024 exp->expType = op1->type;
8025 if(op1->type)
8026 op1->type->refCount++;
8027 }
8028 return 0x1;
8029 }
8030
8031 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8032 {
8033 int value2 = op2->i;
8034
8035 exp->type = 2;
8036 exp->string = PrintInt(op1->i >>= value2);
8037 if(!exp->expType)
8038 {
8039 exp->expType = op1->type;
8040 if(op1->type)
8041 op1->type->refCount++;
8042 }
8043 return 0x1;
8044 }
8045
8046 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8047 {
8048 unsigned int value2 = op2->ui;
8049
8050 exp->type = 2;
8051 exp->string = PrintUInt(op1->ui >>= value2);
8052 if(!exp->expType)
8053 {
8054 exp->expType = op1->type;
8055 if(op1->type)
8056 op1->type->refCount++;
8057 }
8058 return 0x1;
8059 }
8060
8061 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8062 {
8063 short value2 = op2->s;
8064
8065 exp->type = 2;
8066 exp->string = PrintShort(op1->s >>= value2);
8067 if(!exp->expType)
8068 {
8069 exp->expType = op1->type;
8070 if(op1->type)
8071 op1->type->refCount++;
8072 }
8073 return 0x1;
8074 }
8075
8076 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8077 {
8078 unsigned short value2 = op2->us;
8079
8080 exp->type = 2;
8081 exp->string = PrintUShort(op1->us >>= value2);
8082 if(!exp->expType)
8083 {
8084 exp->expType = op1->type;
8085 if(op1->type)
8086 op1->type->refCount++;
8087 }
8088 return 0x1;
8089 }
8090
8091 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8092 {
8093 char value2 = op2->c;
8094
8095 exp->type = 2;
8096 exp->string = PrintChar(op1->c >>= value2);
8097 if(!exp->expType)
8098 {
8099 exp->expType = op1->type;
8100 if(op1->type)
8101 op1->type->refCount++;
8102 }
8103 return 0x1;
8104 }
8105
8106 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8107 {
8108 unsigned char value2 = op2->uc;
8109
8110 exp->type = 2;
8111 exp->string = PrintUChar(op1->uc >>= value2);
8112 if(!exp->expType)
8113 {
8114 exp->expType = op1->type;
8115 if(op1->type)
8116 op1->type->refCount++;
8117 }
8118 return 0x1;
8119 }
8120
8121 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
8122 {
8123 exp->type = 2;
8124 exp->string = PrintInt(!op1->i);
8125 if(!exp->expType)
8126 {
8127 exp->expType = op1->type;
8128 if(op1->type)
8129 op1->type->refCount++;
8130 }
8131 return 0x1;
8132 }
8133
8134 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
8135 {
8136 exp->type = 2;
8137 exp->string = PrintUInt(!op1->ui);
8138 if(!exp->expType)
8139 {
8140 exp->expType = op1->type;
8141 if(op1->type)
8142 op1->type->refCount++;
8143 }
8144 return 0x1;
8145 }
8146
8147 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
8148 {
8149 exp->type = 2;
8150 exp->string = PrintShort(!op1->s);
8151 if(!exp->expType)
8152 {
8153 exp->expType = op1->type;
8154 if(op1->type)
8155 op1->type->refCount++;
8156 }
8157 return 0x1;
8158 }
8159
8160 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
8161 {
8162 exp->type = 2;
8163 exp->string = PrintUShort(!op1->us);
8164 if(!exp->expType)
8165 {
8166 exp->expType = op1->type;
8167 if(op1->type)
8168 op1->type->refCount++;
8169 }
8170 return 0x1;
8171 }
8172
8173 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
8174 {
8175 exp->type = 2;
8176 exp->string = PrintChar(!op1->c);
8177 if(!exp->expType)
8178 {
8179 exp->expType = op1->type;
8180 if(op1->type)
8181 op1->type->refCount++;
8182 }
8183 return 0x1;
8184 }
8185
8186 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
8187 {
8188 exp->type = 2;
8189 exp->string = PrintUChar(!op1->uc);
8190 if(!exp->expType)
8191 {
8192 exp->expType = op1->type;
8193 if(op1->type)
8194 op1->type->refCount++;
8195 }
8196 return 0x1;
8197 }
8198
8199 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8200 {
8201 int value2 = op2->i;
8202
8203 exp->type = 2;
8204 exp->string = PrintInt(op1->i == value2);
8205 if(!exp->expType)
8206 {
8207 exp->expType = op1->type;
8208 if(op1->type)
8209 op1->type->refCount++;
8210 }
8211 return 0x1;
8212 }
8213
8214 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8215 {
8216 unsigned int value2 = op2->ui;
8217
8218 exp->type = 2;
8219 exp->string = PrintUInt(op1->ui == value2);
8220 if(!exp->expType)
8221 {
8222 exp->expType = op1->type;
8223 if(op1->type)
8224 op1->type->refCount++;
8225 }
8226 return 0x1;
8227 }
8228
8229 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8230 {
8231 short value2 = op2->s;
8232
8233 exp->type = 2;
8234 exp->string = PrintShort(op1->s == value2);
8235 if(!exp->expType)
8236 {
8237 exp->expType = op1->type;
8238 if(op1->type)
8239 op1->type->refCount++;
8240 }
8241 return 0x1;
8242 }
8243
8244 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8245 {
8246 unsigned short value2 = op2->us;
8247
8248 exp->type = 2;
8249 exp->string = PrintUShort(op1->us == value2);
8250 if(!exp->expType)
8251 {
8252 exp->expType = op1->type;
8253 if(op1->type)
8254 op1->type->refCount++;
8255 }
8256 return 0x1;
8257 }
8258
8259 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8260 {
8261 char value2 = op2->c;
8262
8263 exp->type = 2;
8264 exp->string = PrintChar(op1->c == value2);
8265 if(!exp->expType)
8266 {
8267 exp->expType = op1->type;
8268 if(op1->type)
8269 op1->type->refCount++;
8270 }
8271 return 0x1;
8272 }
8273
8274 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8275 {
8276 unsigned char value2 = op2->uc;
8277
8278 exp->type = 2;
8279 exp->string = PrintUChar(op1->uc == value2);
8280 if(!exp->expType)
8281 {
8282 exp->expType = op1->type;
8283 if(op1->type)
8284 op1->type->refCount++;
8285 }
8286 return 0x1;
8287 }
8288
8289 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8290 {
8291 float value2 = op2->f;
8292
8293 exp->type = 2;
8294 exp->string = PrintFloat(op1->f == value2);
8295 if(!exp->expType)
8296 {
8297 exp->expType = op1->type;
8298 if(op1->type)
8299 op1->type->refCount++;
8300 }
8301 return 0x1;
8302 }
8303
8304 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8305 {
8306 double value2 = op2->d;
8307
8308 exp->type = 2;
8309 exp->string = PrintDouble(op1->d == value2);
8310 if(!exp->expType)
8311 {
8312 exp->expType = op1->type;
8313 if(op1->type)
8314 op1->type->refCount++;
8315 }
8316 return 0x1;
8317 }
8318
8319 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8320 {
8321 int value2 = op2->i;
8322
8323 exp->type = 2;
8324 exp->string = PrintInt(op1->i != value2);
8325 if(!exp->expType)
8326 {
8327 exp->expType = op1->type;
8328 if(op1->type)
8329 op1->type->refCount++;
8330 }
8331 return 0x1;
8332 }
8333
8334 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8335 {
8336 unsigned int value2 = op2->ui;
8337
8338 exp->type = 2;
8339 exp->string = PrintUInt(op1->ui != value2);
8340 if(!exp->expType)
8341 {
8342 exp->expType = op1->type;
8343 if(op1->type)
8344 op1->type->refCount++;
8345 }
8346 return 0x1;
8347 }
8348
8349 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8350 {
8351 short value2 = op2->s;
8352
8353 exp->type = 2;
8354 exp->string = PrintShort(op1->s != value2);
8355 if(!exp->expType)
8356 {
8357 exp->expType = op1->type;
8358 if(op1->type)
8359 op1->type->refCount++;
8360 }
8361 return 0x1;
8362 }
8363
8364 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8365 {
8366 unsigned short value2 = op2->us;
8367
8368 exp->type = 2;
8369 exp->string = PrintUShort(op1->us != value2);
8370 if(!exp->expType)
8371 {
8372 exp->expType = op1->type;
8373 if(op1->type)
8374 op1->type->refCount++;
8375 }
8376 return 0x1;
8377 }
8378
8379 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8380 {
8381 char value2 = op2->c;
8382
8383 exp->type = 2;
8384 exp->string = PrintChar(op1->c != value2);
8385 if(!exp->expType)
8386 {
8387 exp->expType = op1->type;
8388 if(op1->type)
8389 op1->type->refCount++;
8390 }
8391 return 0x1;
8392 }
8393
8394 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8395 {
8396 unsigned char value2 = op2->uc;
8397
8398 exp->type = 2;
8399 exp->string = PrintUChar(op1->uc != value2);
8400 if(!exp->expType)
8401 {
8402 exp->expType = op1->type;
8403 if(op1->type)
8404 op1->type->refCount++;
8405 }
8406 return 0x1;
8407 }
8408
8409 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8410 {
8411 float value2 = op2->f;
8412
8413 exp->type = 2;
8414 exp->string = PrintFloat(op1->f != value2);
8415 if(!exp->expType)
8416 {
8417 exp->expType = op1->type;
8418 if(op1->type)
8419 op1->type->refCount++;
8420 }
8421 return 0x1;
8422 }
8423
8424 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8425 {
8426 double value2 = op2->d;
8427
8428 exp->type = 2;
8429 exp->string = PrintDouble(op1->d != value2);
8430 if(!exp->expType)
8431 {
8432 exp->expType = op1->type;
8433 if(op1->type)
8434 op1->type->refCount++;
8435 }
8436 return 0x1;
8437 }
8438
8439 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8440 {
8441 int value2 = op2->i;
8442
8443 exp->type = 2;
8444 exp->string = PrintInt(op1->i && value2);
8445 if(!exp->expType)
8446 {
8447 exp->expType = op1->type;
8448 if(op1->type)
8449 op1->type->refCount++;
8450 }
8451 return 0x1;
8452 }
8453
8454 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8455 {
8456 unsigned int value2 = op2->ui;
8457
8458 exp->type = 2;
8459 exp->string = PrintUInt(op1->ui && value2);
8460 if(!exp->expType)
8461 {
8462 exp->expType = op1->type;
8463 if(op1->type)
8464 op1->type->refCount++;
8465 }
8466 return 0x1;
8467 }
8468
8469 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8470 {
8471 short value2 = op2->s;
8472
8473 exp->type = 2;
8474 exp->string = PrintShort(op1->s && value2);
8475 if(!exp->expType)
8476 {
8477 exp->expType = op1->type;
8478 if(op1->type)
8479 op1->type->refCount++;
8480 }
8481 return 0x1;
8482 }
8483
8484 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8485 {
8486 unsigned short value2 = op2->us;
8487
8488 exp->type = 2;
8489 exp->string = PrintUShort(op1->us && value2);
8490 if(!exp->expType)
8491 {
8492 exp->expType = op1->type;
8493 if(op1->type)
8494 op1->type->refCount++;
8495 }
8496 return 0x1;
8497 }
8498
8499 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8500 {
8501 char value2 = op2->c;
8502
8503 exp->type = 2;
8504 exp->string = PrintChar(op1->c && value2);
8505 if(!exp->expType)
8506 {
8507 exp->expType = op1->type;
8508 if(op1->type)
8509 op1->type->refCount++;
8510 }
8511 return 0x1;
8512 }
8513
8514 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8515 {
8516 unsigned char value2 = op2->uc;
8517
8518 exp->type = 2;
8519 exp->string = PrintUChar(op1->uc && value2);
8520 if(!exp->expType)
8521 {
8522 exp->expType = op1->type;
8523 if(op1->type)
8524 op1->type->refCount++;
8525 }
8526 return 0x1;
8527 }
8528
8529 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8530 {
8531 float value2 = op2->f;
8532
8533 exp->type = 2;
8534 exp->string = PrintFloat(op1->f && value2);
8535 if(!exp->expType)
8536 {
8537 exp->expType = op1->type;
8538 if(op1->type)
8539 op1->type->refCount++;
8540 }
8541 return 0x1;
8542 }
8543
8544 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8545 {
8546 double value2 = op2->d;
8547
8548 exp->type = 2;
8549 exp->string = PrintDouble(op1->d && value2);
8550 if(!exp->expType)
8551 {
8552 exp->expType = op1->type;
8553 if(op1->type)
8554 op1->type->refCount++;
8555 }
8556 return 0x1;
8557 }
8558
8559 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8560 {
8561 int value2 = op2->i;
8562
8563 exp->type = 2;
8564 exp->string = PrintInt(op1->i || value2);
8565 if(!exp->expType)
8566 {
8567 exp->expType = op1->type;
8568 if(op1->type)
8569 op1->type->refCount++;
8570 }
8571 return 0x1;
8572 }
8573
8574 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8575 {
8576 unsigned int value2 = op2->ui;
8577
8578 exp->type = 2;
8579 exp->string = PrintUInt(op1->ui || value2);
8580 if(!exp->expType)
8581 {
8582 exp->expType = op1->type;
8583 if(op1->type)
8584 op1->type->refCount++;
8585 }
8586 return 0x1;
8587 }
8588
8589 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8590 {
8591 short value2 = op2->s;
8592
8593 exp->type = 2;
8594 exp->string = PrintShort(op1->s || value2);
8595 if(!exp->expType)
8596 {
8597 exp->expType = op1->type;
8598 if(op1->type)
8599 op1->type->refCount++;
8600 }
8601 return 0x1;
8602 }
8603
8604 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8605 {
8606 unsigned short value2 = op2->us;
8607
8608 exp->type = 2;
8609 exp->string = PrintUShort(op1->us || value2);
8610 if(!exp->expType)
8611 {
8612 exp->expType = op1->type;
8613 if(op1->type)
8614 op1->type->refCount++;
8615 }
8616 return 0x1;
8617 }
8618
8619 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8620 {
8621 char value2 = op2->c;
8622
8623 exp->type = 2;
8624 exp->string = PrintChar(op1->c || value2);
8625 if(!exp->expType)
8626 {
8627 exp->expType = op1->type;
8628 if(op1->type)
8629 op1->type->refCount++;
8630 }
8631 return 0x1;
8632 }
8633
8634 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8635 {
8636 unsigned char value2 = op2->uc;
8637
8638 exp->type = 2;
8639 exp->string = PrintUChar(op1->uc || value2);
8640 if(!exp->expType)
8641 {
8642 exp->expType = op1->type;
8643 if(op1->type)
8644 op1->type->refCount++;
8645 }
8646 return 0x1;
8647 }
8648
8649 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8650 {
8651 float value2 = op2->f;
8652
8653 exp->type = 2;
8654 exp->string = PrintFloat(op1->f || value2);
8655 if(!exp->expType)
8656 {
8657 exp->expType = op1->type;
8658 if(op1->type)
8659 op1->type->refCount++;
8660 }
8661 return 0x1;
8662 }
8663
8664 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8665 {
8666 double value2 = op2->d;
8667
8668 exp->type = 2;
8669 exp->string = PrintDouble(op1->d || value2);
8670 if(!exp->expType)
8671 {
8672 exp->expType = op1->type;
8673 if(op1->type)
8674 op1->type->refCount++;
8675 }
8676 return 0x1;
8677 }
8678
8679 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8680 {
8681 int value2 = op2->i;
8682
8683 exp->type = 2;
8684 exp->string = PrintInt(op1->i > value2);
8685 if(!exp->expType)
8686 {
8687 exp->expType = op1->type;
8688 if(op1->type)
8689 op1->type->refCount++;
8690 }
8691 return 0x1;
8692 }
8693
8694 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8695 {
8696 unsigned int value2 = op2->ui;
8697
8698 exp->type = 2;
8699 exp->string = PrintUInt(op1->ui > value2);
8700 if(!exp->expType)
8701 {
8702 exp->expType = op1->type;
8703 if(op1->type)
8704 op1->type->refCount++;
8705 }
8706 return 0x1;
8707 }
8708
8709 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8710 {
8711 short value2 = op2->s;
8712
8713 exp->type = 2;
8714 exp->string = PrintShort(op1->s > value2);
8715 if(!exp->expType)
8716 {
8717 exp->expType = op1->type;
8718 if(op1->type)
8719 op1->type->refCount++;
8720 }
8721 return 0x1;
8722 }
8723
8724 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8725 {
8726 unsigned short value2 = op2->us;
8727
8728 exp->type = 2;
8729 exp->string = PrintUShort(op1->us > value2);
8730 if(!exp->expType)
8731 {
8732 exp->expType = op1->type;
8733 if(op1->type)
8734 op1->type->refCount++;
8735 }
8736 return 0x1;
8737 }
8738
8739 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8740 {
8741 char value2 = op2->c;
8742
8743 exp->type = 2;
8744 exp->string = PrintChar(op1->c > value2);
8745 if(!exp->expType)
8746 {
8747 exp->expType = op1->type;
8748 if(op1->type)
8749 op1->type->refCount++;
8750 }
8751 return 0x1;
8752 }
8753
8754 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8755 {
8756 unsigned char value2 = op2->uc;
8757
8758 exp->type = 2;
8759 exp->string = PrintUChar(op1->uc > value2);
8760 if(!exp->expType)
8761 {
8762 exp->expType = op1->type;
8763 if(op1->type)
8764 op1->type->refCount++;
8765 }
8766 return 0x1;
8767 }
8768
8769 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8770 {
8771 float value2 = op2->f;
8772
8773 exp->type = 2;
8774 exp->string = PrintFloat(op1->f > value2);
8775 if(!exp->expType)
8776 {
8777 exp->expType = op1->type;
8778 if(op1->type)
8779 op1->type->refCount++;
8780 }
8781 return 0x1;
8782 }
8783
8784 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8785 {
8786 double value2 = op2->d;
8787
8788 exp->type = 2;
8789 exp->string = PrintDouble(op1->d > value2);
8790 if(!exp->expType)
8791 {
8792 exp->expType = op1->type;
8793 if(op1->type)
8794 op1->type->refCount++;
8795 }
8796 return 0x1;
8797 }
8798
8799 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8800 {
8801 int value2 = op2->i;
8802
8803 exp->type = 2;
8804 exp->string = PrintInt(op1->i < value2);
8805 if(!exp->expType)
8806 {
8807 exp->expType = op1->type;
8808 if(op1->type)
8809 op1->type->refCount++;
8810 }
8811 return 0x1;
8812 }
8813
8814 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8815 {
8816 unsigned int value2 = op2->ui;
8817
8818 exp->type = 2;
8819 exp->string = PrintUInt(op1->ui < value2);
8820 if(!exp->expType)
8821 {
8822 exp->expType = op1->type;
8823 if(op1->type)
8824 op1->type->refCount++;
8825 }
8826 return 0x1;
8827 }
8828
8829 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8830 {
8831 short value2 = op2->s;
8832
8833 exp->type = 2;
8834 exp->string = PrintShort(op1->s < value2);
8835 if(!exp->expType)
8836 {
8837 exp->expType = op1->type;
8838 if(op1->type)
8839 op1->type->refCount++;
8840 }
8841 return 0x1;
8842 }
8843
8844 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8845 {
8846 unsigned short value2 = op2->us;
8847
8848 exp->type = 2;
8849 exp->string = PrintUShort(op1->us < value2);
8850 if(!exp->expType)
8851 {
8852 exp->expType = op1->type;
8853 if(op1->type)
8854 op1->type->refCount++;
8855 }
8856 return 0x1;
8857 }
8858
8859 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8860 {
8861 char value2 = op2->c;
8862
8863 exp->type = 2;
8864 exp->string = PrintChar(op1->c < value2);
8865 if(!exp->expType)
8866 {
8867 exp->expType = op1->type;
8868 if(op1->type)
8869 op1->type->refCount++;
8870 }
8871 return 0x1;
8872 }
8873
8874 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8875 {
8876 unsigned char value2 = op2->uc;
8877
8878 exp->type = 2;
8879 exp->string = PrintUChar(op1->uc < value2);
8880 if(!exp->expType)
8881 {
8882 exp->expType = op1->type;
8883 if(op1->type)
8884 op1->type->refCount++;
8885 }
8886 return 0x1;
8887 }
8888
8889 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8890 {
8891 float value2 = op2->f;
8892
8893 exp->type = 2;
8894 exp->string = PrintFloat(op1->f < value2);
8895 if(!exp->expType)
8896 {
8897 exp->expType = op1->type;
8898 if(op1->type)
8899 op1->type->refCount++;
8900 }
8901 return 0x1;
8902 }
8903
8904 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8905 {
8906 double value2 = op2->d;
8907
8908 exp->type = 2;
8909 exp->string = PrintDouble(op1->d < value2);
8910 if(!exp->expType)
8911 {
8912 exp->expType = op1->type;
8913 if(op1->type)
8914 op1->type->refCount++;
8915 }
8916 return 0x1;
8917 }
8918
8919 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8920 {
8921 int value2 = op2->i;
8922
8923 exp->type = 2;
8924 exp->string = PrintInt(op1->i >= value2);
8925 if(!exp->expType)
8926 {
8927 exp->expType = op1->type;
8928 if(op1->type)
8929 op1->type->refCount++;
8930 }
8931 return 0x1;
8932 }
8933
8934 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8935 {
8936 unsigned int value2 = op2->ui;
8937
8938 exp->type = 2;
8939 exp->string = PrintUInt(op1->ui >= value2);
8940 if(!exp->expType)
8941 {
8942 exp->expType = op1->type;
8943 if(op1->type)
8944 op1->type->refCount++;
8945 }
8946 return 0x1;
8947 }
8948
8949 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8950 {
8951 short value2 = op2->s;
8952
8953 exp->type = 2;
8954 exp->string = PrintShort(op1->s >= value2);
8955 if(!exp->expType)
8956 {
8957 exp->expType = op1->type;
8958 if(op1->type)
8959 op1->type->refCount++;
8960 }
8961 return 0x1;
8962 }
8963
8964 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8965 {
8966 unsigned short value2 = op2->us;
8967
8968 exp->type = 2;
8969 exp->string = PrintUShort(op1->us >= value2);
8970 if(!exp->expType)
8971 {
8972 exp->expType = op1->type;
8973 if(op1->type)
8974 op1->type->refCount++;
8975 }
8976 return 0x1;
8977 }
8978
8979 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8980 {
8981 char value2 = op2->c;
8982
8983 exp->type = 2;
8984 exp->string = PrintChar(op1->c >= value2);
8985 if(!exp->expType)
8986 {
8987 exp->expType = op1->type;
8988 if(op1->type)
8989 op1->type->refCount++;
8990 }
8991 return 0x1;
8992 }
8993
8994 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8995 {
8996 unsigned char value2 = op2->uc;
8997
8998 exp->type = 2;
8999 exp->string = PrintUChar(op1->uc >= value2);
9000 if(!exp->expType)
9001 {
9002 exp->expType = op1->type;
9003 if(op1->type)
9004 op1->type->refCount++;
9005 }
9006 return 0x1;
9007 }
9008
9009 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9010 {
9011 float value2 = op2->f;
9012
9013 exp->type = 2;
9014 exp->string = PrintFloat(op1->f >= value2);
9015 if(!exp->expType)
9016 {
9017 exp->expType = op1->type;
9018 if(op1->type)
9019 op1->type->refCount++;
9020 }
9021 return 0x1;
9022 }
9023
9024 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9025 {
9026 double value2 = op2->d;
9027
9028 exp->type = 2;
9029 exp->string = PrintDouble(op1->d >= value2);
9030 if(!exp->expType)
9031 {
9032 exp->expType = op1->type;
9033 if(op1->type)
9034 op1->type->refCount++;
9035 }
9036 return 0x1;
9037 }
9038
9039 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9040 {
9041 int value2 = op2->i;
9042
9043 exp->type = 2;
9044 exp->string = PrintInt(op1->i <= value2);
9045 if(!exp->expType)
9046 {
9047 exp->expType = op1->type;
9048 if(op1->type)
9049 op1->type->refCount++;
9050 }
9051 return 0x1;
9052 }
9053
9054 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9055 {
9056 unsigned int value2 = op2->ui;
9057
9058 exp->type = 2;
9059 exp->string = PrintUInt(op1->ui <= value2);
9060 if(!exp->expType)
9061 {
9062 exp->expType = op1->type;
9063 if(op1->type)
9064 op1->type->refCount++;
9065 }
9066 return 0x1;
9067 }
9068
9069 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9070 {
9071 short value2 = op2->s;
9072
9073 exp->type = 2;
9074 exp->string = PrintShort(op1->s <= value2);
9075 if(!exp->expType)
9076 {
9077 exp->expType = op1->type;
9078 if(op1->type)
9079 op1->type->refCount++;
9080 }
9081 return 0x1;
9082 }
9083
9084 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9085 {
9086 unsigned short value2 = op2->us;
9087
9088 exp->type = 2;
9089 exp->string = PrintUShort(op1->us <= value2);
9090 if(!exp->expType)
9091 {
9092 exp->expType = op1->type;
9093 if(op1->type)
9094 op1->type->refCount++;
9095 }
9096 return 0x1;
9097 }
9098
9099 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9100 {
9101 char value2 = op2->c;
9102
9103 exp->type = 2;
9104 exp->string = PrintChar(op1->c <= value2);
9105 if(!exp->expType)
9106 {
9107 exp->expType = op1->type;
9108 if(op1->type)
9109 op1->type->refCount++;
9110 }
9111 return 0x1;
9112 }
9113
9114 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9115 {
9116 unsigned char value2 = op2->uc;
9117
9118 exp->type = 2;
9119 exp->string = PrintUChar(op1->uc <= value2);
9120 if(!exp->expType)
9121 {
9122 exp->expType = op1->type;
9123 if(op1->type)
9124 op1->type->refCount++;
9125 }
9126 return 0x1;
9127 }
9128
9129 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9130 {
9131 float value2 = op2->f;
9132
9133 exp->type = 2;
9134 exp->string = PrintFloat(op1->f <= value2);
9135 if(!exp->expType)
9136 {
9137 exp->expType = op1->type;
9138 if(op1->type)
9139 op1->type->refCount++;
9140 }
9141 return 0x1;
9142 }
9143
9144 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9145 {
9146 double value2 = op2->d;
9147
9148 exp->type = 2;
9149 exp->string = PrintDouble(op1->d <= value2);
9150 if(!exp->expType)
9151 {
9152 exp->expType = op1->type;
9153 if(op1->type)
9154 op1->type->refCount++;
9155 }
9156 return 0x1;
9157 }
9158
9159 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9160 {
9161 exp->type = 2;
9162 exp->string = PrintInt(op1->i ? op2->i : op3->i);
9163 if(!exp->expType)
9164 {
9165 exp->expType = op1->type;
9166 if(op1->type)
9167 op1->type->refCount++;
9168 }
9169 return 0x1;
9170 }
9171
9172 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9173 {
9174 exp->type = 2;
9175 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
9176 if(!exp->expType)
9177 {
9178 exp->expType = op1->type;
9179 if(op1->type)
9180 op1->type->refCount++;
9181 }
9182 return 0x1;
9183 }
9184
9185 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9186 {
9187 exp->type = 2;
9188 exp->string = PrintShort(op1->s ? op2->s : op3->s);
9189 if(!exp->expType)
9190 {
9191 exp->expType = op1->type;
9192 if(op1->type)
9193 op1->type->refCount++;
9194 }
9195 return 0x1;
9196 }
9197
9198 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9199 {
9200 exp->type = 2;
9201 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
9202 if(!exp->expType)
9203 {
9204 exp->expType = op1->type;
9205 if(op1->type)
9206 op1->type->refCount++;
9207 }
9208 return 0x1;
9209 }
9210
9211 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9212 {
9213 exp->type = 2;
9214 exp->string = PrintChar(op1->c ? op2->c : op3->c);
9215 if(!exp->expType)
9216 {
9217 exp->expType = op1->type;
9218 if(op1->type)
9219 op1->type->refCount++;
9220 }
9221 return 0x1;
9222 }
9223
9224 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9225 {
9226 exp->type = 2;
9227 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
9228 if(!exp->expType)
9229 {
9230 exp->expType = op1->type;
9231 if(op1->type)
9232 op1->type->refCount++;
9233 }
9234 return 0x1;
9235 }
9236
9237 static unsigned int FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9238 {
9239 exp->type = 2;
9240 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
9241 if(!exp->expType)
9242 {
9243 exp->expType = op1->type;
9244 if(op1->type)
9245 op1->type->refCount++;
9246 }
9247 return 0x1;
9248 }
9249
9250 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9251 {
9252 exp->type = 2;
9253 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
9254 if(!exp->expType)
9255 {
9256 exp->expType = op1->type;
9257 if(op1->type)
9258 op1->type->refCount++;
9259 }
9260 return 0x1;
9261 }
9262
9263 struct OpTable intOps = 
9264 {
9265 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
9266 };
9267
9268 struct OpTable uintOps = 
9269 {
9270 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
9271 };
9272
9273 struct OpTable shortOps = 
9274 {
9275 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
9276 };
9277
9278 struct OpTable ushortOps = 
9279 {
9280 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
9281 };
9282
9283 struct OpTable floatOps = 
9284 {
9285 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
9286 };
9287
9288 struct OpTable doubleOps = 
9289 {
9290 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
9291 };
9292
9293 struct OpTable charOps = 
9294 {
9295 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
9296 };
9297
9298 struct OpTable ucharOps = 
9299 {
9300 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
9301 };
9302
9303 void ReadString(char * output, char * string)
9304 {
9305 int len = strlen(string);
9306 int c, d = 0;
9307 unsigned int quoted = 0x0, escaped = 0x0;
9308
9309 for(c = 0; c < len; c++)
9310 {
9311 char ch = string[c];
9312
9313 if(escaped)
9314 {
9315 switch(ch)
9316 {
9317 case 'n':
9318 output[d] = '\n';
9319 break;
9320 case 't':
9321 output[d] = '\t';
9322 break;
9323 case 'a':
9324 output[d] = '\a';
9325 break;
9326 case 'b':
9327 output[d] = '\b';
9328 break;
9329 case 'f':
9330 output[d] = '\f';
9331 break;
9332 case 'r':
9333 output[d] = '\r';
9334 break;
9335 case 'v':
9336 output[d] = '\v';
9337 break;
9338 case '\\':
9339 output[d] = '\\';
9340 break;
9341 case '\"':
9342 output[d] = '\"';
9343 break;
9344 default:
9345 output[d++] = '\\';
9346 output[d] = ch;
9347 }
9348 d++;
9349 escaped = 0x0;
9350 }
9351 else
9352 {
9353 if(ch == '\"')
9354 quoted ^= 0x1;
9355 else if(quoted)
9356 {
9357 if(ch == '\\')
9358 escaped = 0x1;
9359 else
9360 output[d++] = ch;
9361 }
9362 }
9363 }
9364 output[d] = '\0';
9365 }
9366
9367 extern long long __ecereNameSpace__ecere__com___strtoi64(char *  string, char * *  endString, int base);
9368
9369 extern uint64 __ecereNameSpace__ecere__com___strtoui64(char *  string, char * *  endString, int base);
9370
9371 extern double strtod(char * , char * * );
9372
9373 struct Operand GetOperand(struct Expression * exp)
9374 {
9375 struct Operand op = 
9376 {
9377 0, 0, 0, 0, 
9378 {
9379 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
9380 }
9381 };
9382 struct Type * type = exp->expType;
9383
9384 if(type)
9385 {
9386 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9387 {
9388 if(!type->_class->registered->dataType)
9389 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9390 type = type->_class->registered->dataType;
9391 }
9392 op.kind = type->kind;
9393 op.type = exp->expType;
9394 if(exp->isConstant && exp->type == 2)
9395 {
9396 switch(op.kind)
9397 {
9398 case 1:
9399 {
9400 if(exp->constant[0] == '\'')
9401 op.c = exp->constant[1];
9402 else if(type->isSigned)
9403 {
9404 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9405 op.ops = charOps;
9406 }
9407 else
9408 {
9409 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9410 op.ops = ucharOps;
9411 }
9412 break;
9413 }
9414 case 2:
9415 if(type->isSigned)
9416 {
9417 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9418 op.ops = shortOps;
9419 }
9420 else
9421 {
9422 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9423 op.ops = ushortOps;
9424 }
9425 break;
9426 case 3:
9427 case 5:
9428 if(type->isSigned)
9429 {
9430 op.i = strtol(exp->constant, (((void *)0)), 0);
9431 op.ops = intOps;
9432 }
9433 else
9434 {
9435 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9436 op.ops = uintOps;
9437 }
9438 op.kind = 3;
9439 break;
9440 case 4:
9441 if(type->isSigned)
9442 {
9443 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9444 op.ops = intOps;
9445 }
9446 else
9447 {
9448 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9449 op.ops = uintOps;
9450 }
9451 op.kind = 3;
9452 break;
9453 case 22:
9454 if(type->isSigned)
9455 {
9456 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9457 op.ops = intOps;
9458 }
9459 else
9460 {
9461 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9462 op.ops = uintOps;
9463 }
9464 op.kind = 3;
9465 break;
9466 case 23:
9467 if(type->isSigned)
9468 {
9469 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9470 op.ops = intOps;
9471 }
9472 else
9473 {
9474 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9475 op.ops = uintOps;
9476 }
9477 op.kind = 3;
9478 break;
9479 case 6:
9480 op.f = (float)strtod(exp->constant, (((void *)0)));
9481 op.ops = floatOps;
9482 break;
9483 case 7:
9484 op.d = (double)strtod(exp->constant, (((void *)0)));
9485 op.ops = doubleOps;
9486 break;
9487 case 12:
9488 case 13:
9489 case 8:
9490 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9491 op.kind = 13;
9492 op.ops = uintOps;
9493 break;
9494 }
9495 }
9496 }
9497 return op;
9498 }
9499
9500 int __ecereVMethodID_class_OnGetString;
9501
9502 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9503
9504 static void UnusedFunction()
9505 {
9506 int a;
9507
9508 ((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);
9509 }
9510
9511 extern int __ecereVMethodID_class_OnGetString;
9512
9513 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9514 {
9515 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9516
9517 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9518 {
9519 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9520 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9521 else
9522 {
9523 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9524 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9525 struct Type * type;
9526 void * ptr = inst->data + dataMember->offset + offset;
9527 char * result = (((void *)0));
9528
9529 exp->loc = member->loc = inst->loc;
9530 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9531 if(!dataMember->dataType)
9532 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9533 type = dataMember->dataType;
9534 if(type->kind == 8)
9535 {
9536 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9537
9538 if(_class->type == 4)
9539 {
9540 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9541
9542 if(enumClass)
9543 {
9544 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9545 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9546
9547 for(item = e->values.first; item; item = item->next)
9548 {
9549 if((int)item->data == *(int *)ptr)
9550 {
9551 result = item->name;
9552 break;
9553 }
9554 }
9555 if(result)
9556 {
9557 exp->identifier = MkIdentifier(result);
9558 exp->type = 0;
9559 exp->destType = MkClassType(_class->fullName);
9560 ProcessExpressionType(exp);
9561 }
9562 }
9563 }
9564 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9565 {
9566 if(!_class->dataType)
9567 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9568 type = _class->dataType;
9569 }
9570 }
9571 if(!result)
9572 {
9573 switch(type->kind)
9574 {
9575 case 6:
9576 {
9577 FreeExpContents(exp);
9578 exp->constant = PrintFloat(*(float *)ptr);
9579 exp->type = 2;
9580 break;
9581 }
9582 case 7:
9583 {
9584 FreeExpContents(exp);
9585 exp->constant = PrintDouble(*(double *)ptr);
9586 exp->type = 2;
9587 break;
9588 }
9589 case 3:
9590 {
9591 FreeExpContents(exp);
9592 exp->constant = PrintInt(*(int *)ptr);
9593 exp->type = 2;
9594 break;
9595 }
9596 case 4:
9597 {
9598 FreeExpContents(exp);
9599 exp->constant = PrintInt64(*(long long *)ptr);
9600 exp->type = 2;
9601 break;
9602 }
9603 case 22:
9604 {
9605 FreeExpContents(exp);
9606 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9607 exp->type = 2;
9608 break;
9609 }
9610 case 23:
9611 {
9612 FreeExpContents(exp);
9613 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9614 exp->type = 2;
9615 break;
9616 }
9617 default:
9618 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9619 }
9620 }
9621 ListAdd(memberList, member);
9622 }
9623 if(parentDataMember->type == 1)
9624 break;
9625 }
9626 }
9627
9628 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9629
9630 void PopulateInstance(struct Instantiation * inst)
9631 {
9632 struct Symbol * classSym = inst->_class->symbol;
9633 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9634 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9635 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9636
9637 inst->members = MkListOne(MkMembersInitList(memberList));
9638 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9639 {
9640 if(!dataMember->isProperty)
9641 {
9642 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9643 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9644 else
9645 {
9646 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9647 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9648 struct Type * type;
9649 void * ptr = inst->data + dataMember->offset;
9650 char * result = (((void *)0));
9651
9652 exp->loc = member->loc = inst->loc;
9653 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9654 if(!dataMember->dataType)
9655 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9656 type = dataMember->dataType;
9657 if(type->kind == 8)
9658 {
9659 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9660
9661 if(_class->type == 4)
9662 {
9663 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9664
9665 if(enumClass)
9666 {
9667 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9668 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9669
9670 for(item = e->values.first; item; item = item->next)
9671 {
9672 if((int)item->data == *(int *)ptr)
9673 {
9674 result = item->name;
9675 break;
9676 }
9677 }
9678 }
9679 if(result)
9680 {
9681 exp->identifier = MkIdentifier(result);
9682 exp->type = 0;
9683 exp->destType = MkClassType(_class->fullName);
9684 ProcessExpressionType(exp);
9685 }
9686 }
9687 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9688 {
9689 if(!_class->dataType)
9690 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9691 type = _class->dataType;
9692 }
9693 }
9694 if(!result)
9695 {
9696 switch(type->kind)
9697 {
9698 case 6:
9699 {
9700 exp->constant = PrintFloat(*(float *)ptr);
9701 exp->type = 2;
9702 break;
9703 }
9704 case 7:
9705 {
9706 exp->constant = PrintDouble(*(double *)ptr);
9707 exp->type = 2;
9708 break;
9709 }
9710 case 3:
9711 {
9712 exp->constant = PrintInt(*(int *)ptr);
9713 exp->type = 2;
9714 break;
9715 }
9716 case 4:
9717 {
9718 exp->constant = PrintInt64(*(long long *)ptr);
9719 exp->type = 2;
9720 break;
9721 }
9722 case 22:
9723 {
9724 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9725 exp->type = 2;
9726 break;
9727 }
9728 default:
9729 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9730 }
9731 }
9732 ListAdd(memberList, member);
9733 }
9734 }
9735 }
9736 }
9737
9738 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);
9739
9740 extern void FreeInstance(struct Instantiation * inst);
9741
9742 void ComputeInstantiation(struct Expression * exp)
9743 {
9744 struct Instantiation * inst = exp->instance;
9745 struct MembersInit * members;
9746 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9747 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9748 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9749 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9750 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9751 int subMemberStackPos = 0;
9752 uint64 bits = 0;
9753
9754 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9755 {
9756 if(inst->data)
9757 return ;
9758 if(_class->type == 0 || _class->type == 5)
9759 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9760 else
9761 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9762 }
9763 if(inst->members)
9764 {
9765 for(members = (*inst->members).first; members; members = members->next)
9766 {
9767 switch(members->type)
9768 {
9769 case 0:
9770 {
9771 if(members->dataMembers)
9772 {
9773 struct MemberInit * member;
9774
9775 for(member = (*members->dataMembers).first; member; member = member->next)
9776 {
9777 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9778 unsigned int found = 0x0;
9779 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9780 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9781 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9782 unsigned int dataMemberOffset;
9783
9784 if(!ident)
9785 {
9786 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9787 if(curMember)
9788 {
9789 if(curMember->isProperty)
9790 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9791 else
9792 {
9793 dataMember = curMember;
9794 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9795 }
9796 found = 0x1;
9797 }
9798 }
9799 else
9800 {
9801 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9802 if(prop)
9803 {
9804 found = 0x1;
9805 if(prop->memberAccess == 1)
9806 {
9807 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9808 curClass = prop->_class;
9809 }
9810 }
9811 else
9812 {
9813 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9814 int _subMemberStackPos = 0;
9815
9816 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9817 if(dataMember)
9818 {
9819 found = 0x1;
9820 if(dataMember->memberAccess == 1)
9821 {
9822 curMember = dataMember;
9823 curClass = dataMember->_class;
9824 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
9825 subMemberStackPos = _subMemberStackPos;
9826 }
9827 }
9828 }
9829 }
9830 if(found && member->initializer && member->initializer->type == 0)
9831 {
9832 struct Expression * value = member->initializer->exp;
9833 struct Type * type = (((void *)0));
9834
9835 if(prop)
9836 {
9837 type = prop->dataType;
9838 }
9839 else if(dataMember)
9840 {
9841 if(!dataMember->dataType)
9842 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9843 type = dataMember->dataType;
9844 }
9845 if(ident && ident->next)
9846 {
9847 for(ident = ident->next; ident && type; ident = ident->next)
9848 {
9849 if(type->kind == 8)
9850 {
9851 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9852 if(prop)
9853 type = prop->dataType;
9854 else
9855 {
9856 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9857 if(dataMember)
9858 type = dataMember->dataType;
9859 }
9860 }
9861 else if(type->kind == 9 || type->kind == 10)
9862 {
9863 struct Type * memberType;
9864
9865 for(memberType = type->members.first; memberType; memberType = memberType->next)
9866 {
9867 if(!strcmp(memberType->name, ident->string))
9868 {
9869 type = memberType;
9870 break;
9871 }
9872 }
9873 }
9874 }
9875 }
9876 if(value)
9877 {
9878 FreeType(value->destType);
9879 value->destType = type;
9880 if(type)
9881 type->refCount++;
9882 ComputeExpression(value);
9883 }
9884 if(value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9885 {
9886 if(type->kind == 8)
9887 {
9888 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9889
9890 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9891 {
9892 if(!_class->dataType)
9893 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9894 type = _class->dataType;
9895 }
9896 }
9897 if(dataMember)
9898 {
9899 void * ptr = inst->data + dataMemberOffset;
9900
9901 if(value->type == 2)
9902 {
9903 switch(type->kind)
9904 {
9905 case 3:
9906 {
9907 GetInt(value, (int *)ptr);
9908 break;
9909 }
9910 case 4:
9911 {
9912 GetInt64(value, (long long *)ptr);
9913 break;
9914 }
9915 case 22:
9916 {
9917 GetIntPtr(value, (intptr_t *)ptr);
9918 break;
9919 }
9920 case 23:
9921 {
9922 GetIntSize(value, (ssize_t *)ptr);
9923 break;
9924 }
9925 case 6:
9926 {
9927 GetFloat(value, (float *)ptr);
9928 break;
9929 }
9930 case 7:
9931 {
9932 GetDouble(value, (double *)ptr);
9933 break;
9934 }
9935 }
9936 }
9937 else if(value->type == 1)
9938 {
9939 if(type->kind == 8)
9940 {
9941 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9942
9943 if(_class->type == 1)
9944 {
9945 ComputeTypeSize(type);
9946 if(value->instance->data)
9947 memcpy(ptr, value->instance->data, type->size);
9948 }
9949 }
9950 }
9951 }
9952 else if(prop)
9953 {
9954 if(value->type == 1 && value->instance->data)
9955 {
9956 void (* Set)(void *, void *) = (void *)prop->Set;
9957
9958 Set(inst->data, value->instance->data);
9959 PopulateInstance(inst);
9960 }
9961 else if(value->type == 2)
9962 {
9963 switch(type->kind)
9964 {
9965 case 7:
9966 {
9967 void (* Set)(void *, double) = (void *)prop->Set;
9968
9969 Set(inst->data, strtod(value->constant, (((void *)0))));
9970 break;
9971 }
9972 case 6:
9973 {
9974 void (* Set)(void *, float) = (void *)prop->Set;
9975
9976 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
9977 break;
9978 }
9979 case 3:
9980 {
9981 void (* Set)(void *, int) = (void *)prop->Set;
9982
9983 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
9984 break;
9985 }
9986 case 4:
9987 {
9988 void (* Set)(void *, long long) = (void *)prop->Set;
9989
9990 Set(inst->data, __ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
9991 break;
9992 }
9993 case 22:
9994 {
9995 void (* Set)(void *, intptr_t) = (void *)prop->Set;
9996
9997 Set(inst->data, (intptr_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
9998 break;
9999 }
10000 case 23:
10001 {
10002 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10003
10004 Set(inst->data, (ssize_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10005 break;
10006 }
10007 }
10008 }
10009 else if(value->type == 3)
10010 {
10011 char temp[1024];
10012
10013 ReadString(temp, value->string);
10014 ((void (*)(void *, void *))(void *)prop->Set)(inst->data, temp);
10015 }
10016 }
10017 }
10018 else if(_class->type == 3)
10019 {
10020 if(prop)
10021 {
10022 if(value->type == 2)
10023 {
10024 if(type->kind == 8)
10025 {
10026 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10027
10028 if(_class->type == 3)
10029 {
10030 if(!_class->dataType)
10031 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10032 type = _class->dataType;
10033 }
10034 }
10035 switch(type->kind)
10036 {
10037 case 6:
10038 {
10039 float fValue;
10040 float (* Set)(float) = (void *)prop->Set;
10041
10042 GetFloat(member->initializer->exp, &fValue);
10043 exp->constant = PrintFloat(Set(fValue));
10044 exp->type = 2;
10045 break;
10046 }
10047 case 7:
10048 {
10049 double dValue;
10050 double (* Set)(double) = (void *)prop->Set;
10051
10052 GetDouble(member->initializer->exp, &dValue);
10053 exp->constant = PrintDouble(Set(dValue));
10054 exp->type = 2;
10055 break;
10056 }
10057 }
10058 }
10059 }
10060 }
10061 else if(_class->type == 2)
10062 {
10063 if(prop)
10064 {
10065 if(value->type == 1 && value->instance->data)
10066 {
10067 unsigned int (* Set)(void *) = (void *)prop->Set;
10068
10069 bits = Set(value->instance->data);
10070 }
10071 else if(value->type == 2)
10072 {
10073 }
10074 }
10075 else if(dataMember)
10076 {
10077 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
10078 struct Type * type;
10079 int part = 0;
10080
10081 GetInt(value, &part);
10082 bits = (bits & ~bitMember->mask);
10083 if(!bitMember->dataType)
10084 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
10085 type = bitMember->dataType;
10086 if(type->kind == 8 && type->_class && type->_class->registered)
10087 {
10088 if(!type->_class->registered->dataType)
10089 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
10090 type = type->_class->registered->dataType;
10091 }
10092 switch(type->kind)
10093 {
10094 case 1:
10095 if(type->isSigned)
10096 bits |= ((char)part << bitMember->pos);
10097 else
10098 bits |= ((unsigned char)part << bitMember->pos);
10099 break;
10100 case 2:
10101 if(type->isSigned)
10102 bits |= ((short)part << bitMember->pos);
10103 else
10104 bits |= ((unsigned short)part << bitMember->pos);
10105 break;
10106 case 3:
10107 case 5:
10108 if(type->isSigned)
10109 bits |= (part << bitMember->pos);
10110 else
10111 bits |= ((unsigned int)part << bitMember->pos);
10112 break;
10113 case 4:
10114 if(type->isSigned)
10115 bits |= ((long long)part << bitMember->pos);
10116 else
10117 bits |= ((uint64)part << bitMember->pos);
10118 break;
10119 case 22:
10120 if(type->isSigned)
10121 {
10122 bits |= ((intptr_t)part << bitMember->pos);
10123 }
10124 else
10125 {
10126 bits |= ((uintptr_t)part << bitMember->pos);
10127 }
10128 break;
10129 case 23:
10130 if(type->isSigned)
10131 {
10132 bits |= ((ssize_t)part << bitMember->pos);
10133 }
10134 else
10135 {
10136 bits |= ((size_t)part << bitMember->pos);
10137 }
10138 break;
10139 }
10140 }
10141 }
10142 }
10143 else
10144 {
10145 if(_class && _class->type == 3)
10146 {
10147 ComputeExpression(member->initializer->exp);
10148 exp->constant = member->initializer->exp->constant;
10149 exp->type = 2;
10150 member->initializer->exp->constant = (((void *)0));
10151 }
10152 }
10153 }
10154 }
10155 break;
10156 }
10157 }
10158 }
10159 }
10160 if(_class && _class->type == 2)
10161 {
10162 exp->constant = PrintHexUInt(bits);
10163 exp->type = 2;
10164 }
10165 if(exp->type != 1)
10166 {
10167 FreeInstance(inst);
10168 }
10169 }
10170
10171 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
10172 {
10173 if(exp->op.op == SIZEOF)
10174 {
10175 FreeExpContents(exp);
10176 exp->type = 2;
10177 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
10178 }
10179 else
10180 {
10181 if(!exp->op.exp1)
10182 {
10183 switch(exp->op.op)
10184 {
10185 case '+':
10186 {
10187 struct Expression * exp2 = exp->op.exp2;
10188
10189 exp->op.exp2 = (((void *)0));
10190 FreeExpContents(exp);
10191 FreeType(exp->expType);
10192 FreeType(exp->destType);
10193 *exp = *exp2;
10194 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
10195 break;
10196 }
10197 case '-':
10198 if(op1->ops.Neg)
10199 {
10200 FreeExpContents(exp);
10201 op1->ops.Neg(exp, op1);
10202 }
10203 break;
10204 case '~':
10205 if(op1->ops.BitNot)
10206 {
10207 FreeExpContents(exp);
10208 op1->ops.BitNot(exp, op1);
10209 }
10210 break;
10211 case '!':
10212 if(op1->ops.Not)
10213 {
10214 FreeExpContents(exp);
10215 op1->ops.Not(exp, op1);
10216 }
10217 break;
10218 }
10219 }
10220 else
10221 {
10222 switch(exp->op.op)
10223 {
10224 case '+':
10225 if(op1->ops.Add)
10226 {
10227 FreeExpContents(exp);
10228 op1->ops.Add(exp, op1, op2);
10229 }
10230 break;
10231 case '-':
10232 if(op1->ops.Sub)
10233 {
10234 FreeExpContents(exp);
10235 op1->ops.Sub(exp, op1, op2);
10236 }
10237 break;
10238 case '*':
10239 if(op1->ops.Mul)
10240 {
10241 FreeExpContents(exp);
10242 op1->ops.Mul(exp, op1, op2);
10243 }
10244 break;
10245 case '/':
10246 if(op1->ops.Div)
10247 {
10248 FreeExpContents(exp);
10249 op1->ops.Div(exp, op1, op2);
10250 }
10251 break;
10252 case '%':
10253 if(op1->ops.Mod)
10254 {
10255 FreeExpContents(exp);
10256 op1->ops.Mod(exp, op1, op2);
10257 }
10258 break;
10259 case '&':
10260 if(exp->op.exp2)
10261 {
10262 if(op1->ops.BitAnd)
10263 {
10264 FreeExpContents(exp);
10265 op1->ops.BitAnd(exp, op1, op2);
10266 }
10267 }
10268 break;
10269 case '|':
10270 if(op1->ops.BitOr)
10271 {
10272 FreeExpContents(exp);
10273 op1->ops.BitOr(exp, op1, op2);
10274 }
10275 break;
10276 case '^':
10277 if(op1->ops.BitXor)
10278 {
10279 FreeExpContents(exp);
10280 op1->ops.BitXor(exp, op1, op2);
10281 }
10282 break;
10283 case LEFT_OP:
10284 if(op1->ops.LShift)
10285 {
10286 FreeExpContents(exp);
10287 op1->ops.LShift(exp, op1, op2);
10288 }
10289 break;
10290 case RIGHT_OP:
10291 if(op1->ops.RShift)
10292 {
10293 FreeExpContents(exp);
10294 op1->ops.RShift(exp, op1, op2);
10295 }
10296 break;
10297 case EQ_OP:
10298 if(op1->ops.Equ)
10299 {
10300 FreeExpContents(exp);
10301 op1->ops.Equ(exp, op1, op2);
10302 }
10303 break;
10304 case NE_OP:
10305 if(op1->ops.Nqu)
10306 {
10307 FreeExpContents(exp);
10308 op1->ops.Nqu(exp, op1, op2);
10309 }
10310 break;
10311 case AND_OP:
10312 if(op1->ops.And)
10313 {
10314 FreeExpContents(exp);
10315 op1->ops.And(exp, op1, op2);
10316 }
10317 break;
10318 case OR_OP:
10319 if(op1->ops.Or)
10320 {
10321 FreeExpContents(exp);
10322 op1->ops.Or(exp, op1, op2);
10323 }
10324 break;
10325 case '>':
10326 if(op1->ops.Grt)
10327 {
10328 FreeExpContents(exp);
10329 op1->ops.Grt(exp, op1, op2);
10330 }
10331 break;
10332 case '<':
10333 if(op1->ops.Sma)
10334 {
10335 FreeExpContents(exp);
10336 op1->ops.Sma(exp, op1, op2);
10337 }
10338 break;
10339 case GE_OP:
10340 if(op1->ops.GrtEqu)
10341 {
10342 FreeExpContents(exp);
10343 op1->ops.GrtEqu(exp, op1, op2);
10344 }
10345 break;
10346 case LE_OP:
10347 if(op1->ops.SmaEqu)
10348 {
10349 FreeExpContents(exp);
10350 op1->ops.SmaEqu(exp, op1, op2);
10351 }
10352 break;
10353 }
10354 }
10355 }
10356 }
10357
10358 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10359
10360 void ComputeExpression(struct Expression * exp)
10361 {
10362 char expString[10240];
10363
10364 expString[0] = '\0';
10365 switch(exp->type)
10366 {
10367 case 1:
10368 {
10369 ComputeInstantiation(exp);
10370 break;
10371 }
10372 case 4:
10373 {
10374 struct Expression * exp1, * exp2 = (((void *)0));
10375 struct Operand op1 = 
10376 {
10377 0, 0, 0, 0, 
10378 {
10379 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10380 }
10381 };
10382 struct Operand op2 = 
10383 {
10384 0, 0, 0, 0, 
10385 {
10386 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10387 }
10388 };
10389
10390 if(exp->op.exp2)
10391 ComputeExpression(exp->op.exp2);
10392 if(exp->op.exp1)
10393 {
10394 ComputeExpression(exp->op.exp1);
10395 exp1 = exp->op.exp1;
10396 exp2 = exp->op.exp2;
10397 op1 = GetOperand(exp1);
10398 if(op1.type)
10399 op1.type->refCount++;
10400 if(exp2)
10401 {
10402 op2 = GetOperand(exp2);
10403 if(op2.type)
10404 op2.type->refCount++;
10405 }
10406 }
10407 else
10408 {
10409 exp1 = exp->op.exp2;
10410 op1 = GetOperand(exp1);
10411 if(op1.type)
10412 op1.type->refCount++;
10413 }
10414 CallOperator(exp, exp1, exp2, &op1, &op2);
10415 if(op1.type)
10416 FreeType(op1.type);
10417 if(op2.type)
10418 FreeType(op2.type);
10419 break;
10420 }
10421 case 5:
10422 case 34:
10423 {
10424 struct Expression * e, * n;
10425
10426 for(e = (*exp->list).first; e; e = n)
10427 {
10428 n = e->next;
10429 if(!n)
10430 {
10431 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10432
10433 ComputeExpression(e);
10434 FreeType(exp->expType);
10435 FreeType(exp->destType);
10436 *exp = *e;
10437 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10438 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10439 }
10440 else
10441 {
10442 FreeExpression(e);
10443 }
10444 }
10445 break;
10446 }
10447 case 8:
10448 {
10449 struct Expression * memberExp = exp->member.exp;
10450 struct Identifier * memberID = exp->member.member;
10451 struct Type * type;
10452
10453 ComputeExpression(exp->member.exp);
10454 type = exp->member.exp->expType;
10455 if(type)
10456 {
10457 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)));
10458 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10459 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10460 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10461
10462 if(type->kind == 19 && exp->member.exp->type == 26)
10463 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10464 if(!_class)
10465 {
10466 char string[256];
10467 struct Symbol * classSym;
10468
10469 string[0] = '\0';
10470 PrintType(type, string, 0x0, 0x1);
10471 classSym = FindClass(string);
10472 _class = classSym ? classSym->registered : (((void *)0));
10473 }
10474 if(exp->member.member)
10475 {
10476 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10477 if(!prop)
10478 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10479 }
10480 if(!prop && !member && _class && exp->member.member)
10481 {
10482 struct Symbol * classSym = FindClass(exp->member.member->string);
10483
10484 convertTo = _class;
10485 _class = classSym ? classSym->registered : (((void *)0));
10486 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10487 }
10488 if(prop)
10489 {
10490 if(prop->compiled)
10491 {
10492 struct Type * type = prop->dataType;
10493
10494 if(_class->type == 3)
10495 {
10496 if(type->kind == 8)
10497 {
10498 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10499
10500 if(_class->type == 3)
10501 {
10502 if(!_class->dataType)
10503 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10504 type = _class->dataType;
10505 }
10506 }
10507 switch(type->kind)
10508 {
10509 case 6:
10510 {
10511 float value;
10512 float (* Get)(float) = (void *)prop->Get;
10513
10514 GetFloat(exp->member.exp, &value);
10515 exp->constant = PrintFloat(Get ? Get(value) : value);
10516 exp->type = 2;
10517 break;
10518 }
10519 case 7:
10520 {
10521 double value;
10522 double (* Get)(double);
10523
10524 GetDouble(exp->member.exp, &value);
10525 if(convertTo)
10526 Get = (void *)prop->Set;
10527 else
10528 Get = (void *)prop->Get;
10529 exp->constant = PrintDouble(Get ? Get(value) : value);
10530 exp->type = 2;
10531 break;
10532 }
10533 }
10534 }
10535 else
10536 {
10537 if(convertTo)
10538 {
10539 struct Expression * value = exp->member.exp;
10540 struct Type * type;
10541
10542 if(!prop->dataType)
10543 ProcessPropertyType(prop);
10544 type = prop->dataType;
10545 if(!type)
10546 {
10547 }
10548 else if(_class->type == 1)
10549 {
10550 switch(type->kind)
10551 {
10552 case 8:
10553 {
10554 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10555
10556 if(propertyClass->type == 1 && value->type == 1)
10557 {
10558 void (* Set)(void *, void *) = (void *)prop->Set;
10559
10560 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10561 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10562 exp->instance->_class = MkSpecifierName(_class->fullName);
10563 exp->instance->loc = exp->loc;
10564 exp->type = 1;
10565 Set(exp->instance->data, value->instance->data);
10566 PopulateInstance(exp->instance);
10567 }
10568 break;
10569 }
10570 case 3:
10571 {
10572 int intValue;
10573 void (* Set)(void *, int) = (void *)prop->Set;
10574
10575 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10576 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10577 exp->instance->_class = MkSpecifierName(_class->fullName);
10578 exp->instance->loc = exp->loc;
10579 exp->type = 1;
10580 GetInt(value, &intValue);
10581 Set(exp->instance->data, intValue);
10582 PopulateInstance(exp->instance);
10583 break;
10584 }
10585 case 4:
10586 {
10587 long long intValue;
10588 void (* Set)(void *, long long) = (void *)prop->Set;
10589
10590 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10591 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10592 exp->instance->_class = MkSpecifierName(_class->fullName);
10593 exp->instance->loc = exp->loc;
10594 exp->type = 1;
10595 GetInt64(value, &intValue);
10596 Set(exp->instance->data, intValue);
10597 PopulateInstance(exp->instance);
10598 break;
10599 }
10600 case 22:
10601 {
10602 intptr_t intValue;
10603 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10604
10605 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10606 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10607 exp->instance->_class = MkSpecifierName(_class->fullName);
10608 exp->instance->loc = exp->loc;
10609 exp->type = 1;
10610 GetIntPtr(value, &intValue);
10611 Set(exp->instance->data, intValue);
10612 PopulateInstance(exp->instance);
10613 break;
10614 }
10615 case 23:
10616 {
10617 ssize_t intValue;
10618 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10619
10620 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10621 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10622 exp->instance->_class = MkSpecifierName(_class->fullName);
10623 exp->instance->loc = exp->loc;
10624 exp->type = 1;
10625 GetIntSize(value, &intValue);
10626 Set(exp->instance->data, intValue);
10627 PopulateInstance(exp->instance);
10628 break;
10629 }
10630 case 7:
10631 {
10632 double doubleValue;
10633 void (* Set)(void *, double) = (void *)prop->Set;
10634
10635 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10636 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10637 exp->instance->_class = MkSpecifierName(_class->fullName);
10638 exp->instance->loc = exp->loc;
10639 exp->type = 1;
10640 GetDouble(value, &doubleValue);
10641 Set(exp->instance->data, doubleValue);
10642 PopulateInstance(exp->instance);
10643 break;
10644 }
10645 }
10646 }
10647 else if(_class->type == 2)
10648 {
10649 switch(type->kind)
10650 {
10651 case 8:
10652 {
10653 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10654
10655 if(propertyClass->type == 1 && value->instance->data)
10656 {
10657 unsigned int (* Set)(void *) = (void *)prop->Set;
10658 unsigned int bits = Set(value->instance->data);
10659
10660 exp->constant = PrintHexUInt(bits);
10661 exp->type = 2;
10662 break;
10663 }
10664 else if(_class->type == 2)
10665 {
10666 unsigned int value;
10667 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10668 unsigned int bits;
10669
10670 GetUInt(exp->member.exp, &value);
10671 bits = Set(value);
10672 exp->constant = PrintHexUInt(bits);
10673 exp->type = 2;
10674 }
10675 }
10676 }
10677 }
10678 }
10679 else
10680 {
10681 if(_class->type == 2)
10682 {
10683 unsigned int value;
10684
10685 GetUInt(exp->member.exp, &value);
10686 switch(type->kind)
10687 {
10688 case 8:
10689 {
10690 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10691
10692 if(_class->type == 1)
10693 {
10694 void (* Get)(unsigned int, void *) = (void *)prop->Get;
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 Get(value, exp->instance->data);
10702 PopulateInstance(exp->instance);
10703 }
10704 else if(_class->type == 2)
10705 {
10706 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10707 uint64 bits = Get(value);
10708
10709 exp->constant = PrintHexUInt64(bits);
10710 exp->type = 2;
10711 }
10712 break;
10713 }
10714 }
10715 }
10716 else if(_class->type == 1)
10717 {
10718 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10719
10720 switch(type->kind)
10721 {
10722 case 8:
10723 {
10724 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10725
10726 if(_class->type == 1 && value)
10727 {
10728 void (* Get)(void *, void *) = (void *)prop->Get;
10729
10730 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10731 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10732 exp->instance->_class = MkSpecifierName(_class->fullName);
10733 exp->instance->loc = exp->loc;
10734 exp->type = 1;
10735 Get(value, exp->instance->data);
10736 PopulateInstance(exp->instance);
10737 }
10738 break;
10739 }
10740 }
10741 }
10742 }
10743 }
10744 }
10745 else
10746 {
10747 exp->isConstant = 0x0;
10748 }
10749 }
10750 else if(member)
10751 {
10752 }
10753 }
10754 if(exp->type != 8)
10755 {
10756 FreeExpression(memberExp);
10757 FreeIdentifier(memberID);
10758 }
10759 break;
10760 }
10761 case 10:
10762 {
10763 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10764
10765 FreeExpContents(exp);
10766 exp->constant = PrintUInt(ComputeTypeSize(type));
10767 exp->type = 2;
10768 FreeType(type);
10769 break;
10770 }
10771 case 15:
10772 {
10773 struct Symbol * classSym = exp->_class->symbol;
10774
10775 if(classSym && classSym->registered)
10776 {
10777 if(classSym->registered->fixed)
10778 {
10779 FreeSpecifier(exp->_class);
10780 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10781 exp->type = 2;
10782 }
10783 else
10784 {
10785 char className[1024];
10786
10787 strcpy(className, "__ecereClass_");
10788 FullClassNameCat(className, classSym->string, 0x1);
10789 MangleClassName(className);
10790 FreeExpContents(exp);
10791 exp->type = 9;
10792 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10793 exp->member.member = MkIdentifier("structSize");
10794 }
10795 }
10796 break;
10797 }
10798 case 11:
10799 {
10800 struct Type * type;
10801 struct Expression * e = exp;
10802
10803 if(exp->type == 11)
10804 {
10805 if(exp->cast.exp)
10806 ComputeExpression(exp->cast.exp);
10807 e = exp->cast.exp;
10808 }
10809 if(e && exp->expType)
10810 {
10811 type = exp->expType;
10812 if(type->kind == 8)
10813 {
10814 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10815
10816 if(_class && (_class->type == 3 || _class->type == 2))
10817 {
10818 if(!_class->dataType)
10819 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10820 type = _class->dataType;
10821 }
10822 }
10823 switch(type->kind)
10824 {
10825 case 1:
10826 if(type->isSigned)
10827 {
10828 char value;
10829
10830 GetChar(e, &value);
10831 FreeExpContents(exp);
10832 exp->constant = PrintChar(value);
10833 exp->type = 2;
10834 }
10835 else
10836 {
10837 unsigned char value;
10838
10839 GetUChar(e, &value);
10840 FreeExpContents(exp);
10841 exp->constant = PrintUChar(value);
10842 exp->type = 2;
10843 }
10844 break;
10845 case 2:
10846 if(type->isSigned)
10847 {
10848 short value;
10849
10850 GetShort(e, &value);
10851 FreeExpContents(exp);
10852 exp->constant = PrintShort(value);
10853 exp->type = 2;
10854 }
10855 else
10856 {
10857 unsigned short value;
10858
10859 GetUShort(e, &value);
10860 FreeExpContents(exp);
10861 exp->constant = PrintUShort(value);
10862 exp->type = 2;
10863 }
10864 break;
10865 case 3:
10866 if(type->isSigned)
10867 {
10868 int value;
10869
10870 GetInt(e, &value);
10871 FreeExpContents(exp);
10872 exp->constant = PrintInt(value);
10873 exp->type = 2;
10874 }
10875 else
10876 {
10877 unsigned int value;
10878
10879 GetUInt(e, &value);
10880 FreeExpContents(exp);
10881 exp->constant = PrintUInt(value);
10882 exp->type = 2;
10883 }
10884 break;
10885 case 4:
10886 if(type->isSigned)
10887 {
10888 long long value;
10889
10890 GetInt64(e, &value);
10891 FreeExpContents(exp);
10892 exp->constant = PrintInt64(value);
10893 exp->type = 2;
10894 }
10895 else
10896 {
10897 uint64 value;
10898
10899 GetUInt64(e, &value);
10900 FreeExpContents(exp);
10901 exp->constant = PrintUInt64(value);
10902 exp->type = 2;
10903 }
10904 break;
10905 case 22:
10906 if(type->isSigned)
10907 {
10908 intptr_t value;
10909
10910 GetIntPtr(e, &value);
10911 FreeExpContents(exp);
10912 exp->constant = PrintInt64((long long)value);
10913 exp->type = 2;
10914 }
10915 else
10916 {
10917 uintptr_t value;
10918
10919 GetUIntPtr(e, &value);
10920 FreeExpContents(exp);
10921 exp->constant = PrintUInt64((uint64)value);
10922 exp->type = 2;
10923 }
10924 break;
10925 case 23:
10926 if(type->isSigned)
10927 {
10928 ssize_t value;
10929
10930 GetIntSize(e, &value);
10931 FreeExpContents(exp);
10932 exp->constant = PrintInt64((long long)value);
10933 exp->type = 2;
10934 }
10935 else
10936 {
10937 size_t value;
10938
10939 GetUIntSize(e, &value);
10940 FreeExpContents(exp);
10941 exp->constant = PrintUInt64((uint64)value);
10942 exp->type = 2;
10943 }
10944 break;
10945 case 6:
10946 {
10947 float value;
10948
10949 GetFloat(e, &value);
10950 FreeExpContents(exp);
10951 exp->constant = PrintFloat(value);
10952 exp->type = 2;
10953 break;
10954 }
10955 case 7:
10956 {
10957 double value;
10958
10959 GetDouble(e, &value);
10960 FreeExpContents(exp);
10961 exp->constant = PrintDouble(value);
10962 exp->type = 2;
10963 break;
10964 }
10965 }
10966 }
10967 break;
10968 }
10969 case 12:
10970 {
10971 struct Operand op1 = 
10972 {
10973 0, 0, 0, 0, 
10974 {
10975 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10976 }
10977 };
10978 struct Operand op2 = 
10979 {
10980 0, 0, 0, 0, 
10981 {
10982 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10983 }
10984 };
10985 struct Operand op3 = 
10986 {
10987 0, 0, 0, 0, 
10988 {
10989 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10990 }
10991 };
10992
10993 if(exp->cond.exp)
10994 ComputeExpression((*exp->cond.exp).last);
10995 if(exp->cond.elseExp)
10996 ComputeExpression(exp->cond.elseExp);
10997 if(exp->cond.cond)
10998 ComputeExpression(exp->cond.cond);
10999 op1 = GetOperand(exp->cond.cond);
11000 if(op1.type)
11001 op1.type->refCount++;
11002 op2 = GetOperand((*exp->cond.exp).last);
11003 if(op2.type)
11004 op2.type->refCount++;
11005 op3 = GetOperand(exp->cond.elseExp);
11006 if(op3.type)
11007 op3.type->refCount++;
11008 if(op1.ops.Cond)
11009 {
11010 FreeExpContents(exp);
11011 op1.ops.Cond(exp, &op1, &op2, &op3);
11012 }
11013 if(op1.type)
11014 FreeType(op1.type);
11015 if(op2.type)
11016 FreeType(op2.type);
11017 if(op3.type)
11018 FreeType(op3.type);
11019 break;
11020 }
11021 }
11022 }
11023
11024 void ApplyAnyObjectLogic(struct Expression * e);
11025
11026 extern void CopyTypeInto(struct Type * type, struct Type * src);
11027
11028 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
11029 {
11030 unsigned int result = 0x1;
11031
11032 if(destType)
11033 {
11034 struct __ecereNameSpace__ecere__sys__OldList converts = 
11035 {
11036 0, 0, 0, 0, 0
11037 };
11038 struct Conversion * convert;
11039
11040 if(destType->kind == 0)
11041 return 0x0;
11042 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
11043 result = 0x0;
11044 if(converts.count)
11045 {
11046 for(convert = converts.first; convert; convert = convert->next)
11047 {
11048 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
11049
11050 if(!empty)
11051 {
11052 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11053 int objectType = exp->expType ? exp->expType->classObjectType : 0;
11054
11055 *newExp = *exp;
11056 newExp->destType = (((void *)0));
11057 if(convert->isGet)
11058 {
11059 exp->type = 8;
11060 exp->addedThis = 0x1;
11061 exp->member.exp = newExp;
11062 FreeType(exp->member.exp->expType);
11063 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
11064 exp->member.exp->expType->classObjectType = objectType;
11065 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
11066 exp->member.memberType = 1;
11067 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11068 exp->needCast = 0x1;
11069 if(exp->expType)
11070 exp->expType->refCount++;
11071 ApplyAnyObjectLogic(exp->member.exp);
11072 }
11073 else
11074 {
11075 {
11076 exp->type = 8;
11077 exp->addedThis = 0x1;
11078 exp->member.exp = newExp;
11079 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
11080 {
11081 newExp->byReference = 0x1;
11082 }
11083 FreeType(exp->member.exp->expType);
11084 exp->member.exp->expType = (((void *)0));
11085 if(convert->convert->dataType)
11086 {
11087 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11088 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
11089 exp->member.exp->expType->refCount = 1;
11090 exp->member.exp->expType->classObjectType = objectType;
11091 ApplyAnyObjectLogic(exp->member.exp);
11092 }
11093 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
11094 exp->member.memberType = 4;
11095 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11096 exp->needCast = 0x1;
11097 if(convert->resultType)
11098 convert->resultType->refCount++;
11099 }
11100 }
11101 }
11102 else
11103 {
11104 FreeType(exp->expType);
11105 if(convert->isGet)
11106 {
11107 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11108 exp->needCast = 0x1;
11109 if(exp->expType)
11110 exp->expType->refCount++;
11111 }
11112 else
11113 {
11114 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11115 exp->needCast = 0x1;
11116 if(convert->resultType)
11117 convert->resultType->refCount++;
11118 }
11119 }
11120 }
11121 if(exp->isConstant && inCompiler)
11122 ComputeExpression(exp);
11123 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
11124 }
11125 if(!result && exp->expType && converts.count)
11126 {
11127 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
11128 }
11129 if(!result && exp->expType && exp->destType)
11130 {
11131 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))
11132 result = 0x1;
11133 }
11134 }
11135 return result;
11136 }
11137
11138 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
11139
11140 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
11141
11142 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
11143
11144 void CheckTemplateTypes(struct Expression * exp)
11145 {
11146 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
11147 {
11148 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11149 struct Statement * compound;
11150 struct Context * context;
11151
11152 *newExp = *exp;
11153 if(exp->destType)
11154 exp->destType->refCount++;
11155 if(exp->expType)
11156 exp->expType->refCount++;
11157 newExp->prev = (((void *)0));
11158 newExp->next = (((void *)0));
11159 switch(exp->expType->kind)
11160 {
11161 case 7:
11162 if(exp->destType->classObjectType)
11163 {
11164 if(exp->destType)
11165 exp->destType->refCount--;
11166 if(exp->expType)
11167 exp->expType->refCount--;
11168 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11169 }
11170 else
11171 {
11172 struct __ecereNameSpace__ecere__sys__OldList * specs;
11173 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11174 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11175
11176 context = PushContext();
11177 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11178 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11179 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11180 exp->type = 25;
11181 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11182 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
11183 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
11184 exp->compound->compound.context = context;
11185 PopContext(context);
11186 }
11187 break;
11188 default:
11189 exp->type = 11;
11190 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
11191 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11192 break;
11193 }
11194 }
11195 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
11196 {
11197 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11198 struct Statement * compound;
11199 struct Context * context;
11200
11201 *newExp = *exp;
11202 if(exp->destType)
11203 exp->destType->refCount++;
11204 if(exp->expType)
11205 exp->expType->refCount++;
11206 newExp->prev = (((void *)0));
11207 newExp->next = (((void *)0));
11208 switch(exp->expType->kind)
11209 {
11210 case 7:
11211 if(exp->destType->classObjectType)
11212 {
11213 if(exp->destType)
11214 exp->destType->refCount--;
11215 if(exp->expType)
11216 exp->expType->refCount--;
11217 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11218 }
11219 else
11220 {
11221 struct __ecereNameSpace__ecere__sys__OldList * specs;
11222 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11223 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11224
11225 context = PushContext();
11226 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11227 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11228 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11229 exp->type = 25;
11230 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11231 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
11232 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
11233 exp->compound->compound.context = context;
11234 PopContext(context);
11235 }
11236 break;
11237 case 8:
11238 {
11239 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
11240 {
11241 exp->type = 5;
11242 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
11243 ProcessExpressionType((*exp->list).first);
11244 break;
11245 }
11246 else
11247 {
11248 exp->type = 5;
11249 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
11250 newExp->needCast = 0x1;
11251 ProcessExpressionType((*exp->list).first);
11252 break;
11253 }
11254 }
11255 default:
11256 {
11257 if(exp->expType->kind == 20)
11258 {
11259 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
11260
11261 if(type)
11262 {
11263 FreeType(exp->destType);
11264 FreeType(exp->expType);
11265 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11266 break;
11267 }
11268 }
11269 if(newExp->type == 8 && newExp->member.memberType == 3)
11270 {
11271 exp->type = 4;
11272 exp->op.op = '*';
11273 exp->op.exp1 = (((void *)0));
11274 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
11275 }
11276 else
11277 {
11278 char typeString[1024];
11279 struct Declarator * decl;
11280 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11281
11282 typeString[0] = '\0';
11283 PrintType(exp->expType, typeString, 0x0, 0x0);
11284 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11285 exp->type = 11;
11286 exp->cast.typeName = MkTypeName(specs, decl);
11287 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11288 exp->cast.exp->needCast = 0x1;
11289 }
11290 break;
11291 }
11292 }
11293 }
11294 }
11295
11296 extern int strncmp(const char * , const char * , size_t n);
11297
11298 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
11299
11300 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
11301 {
11302 int nsLen = strlen(nameSpace);
11303 struct Symbol * symbol;
11304
11305 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)))
11306 {
11307 char * s = symbol->string;
11308
11309 if(!strncmp(s, nameSpace, nsLen))
11310 {
11311 int c;
11312 char * namePart;
11313
11314 for(c = strlen(s) - 1; c >= 0; c--)
11315 if(s[c] == ':')
11316 break;
11317 namePart = s + c + 1;
11318 if(!strcmp(namePart, name))
11319 {
11320 return symbol;
11321 }
11322 }
11323 else
11324 break;
11325 }
11326 return (((void *)0));
11327 }
11328
11329 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
11330 {
11331 int c;
11332 char nameSpace[1024];
11333 char * namePart;
11334 unsigned int gotColon = 0x0;
11335
11336 nameSpace[0] = '\0';
11337 for(c = strlen(name) - 1; c >= 0; c--)
11338 if(name[c] == ':')
11339 {
11340 gotColon = 0x1;
11341 break;
11342 }
11343 namePart = name + c + 1;
11344 while(c >= 0 && name[c] == ':')
11345 c--;
11346 if(c >= 0)
11347 {
11348 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
11349
11350 if(symbol)
11351 return symbol;
11352 memcpy(nameSpace, name, c + 1);
11353 nameSpace[c + 1] = (char)0;
11354 return ScanWithNameSpace(tree, nameSpace, namePart);
11355 }
11356 else if(gotColon)
11357 {
11358 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11359
11360 return symbol;
11361 }
11362 else
11363 {
11364 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11365
11366 if(symbol)
11367 return symbol;
11368 return ScanWithNameSpace(tree, "", namePart);
11369 }
11370 return (((void *)0));
11371 }
11372
11373 static void ProcessDeclaration(struct Declaration * decl);
11374
11375 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
11376 {
11377 struct Context * ctx;
11378 struct Symbol * symbol = (((void *)0));
11379
11380 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
11381 {
11382 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
11383 {
11384 symbol = (((void *)0));
11385 if(thisNameSpace)
11386 {
11387 char curName[1024];
11388
11389 strcpy(curName, thisNameSpace);
11390 strcat(curName, "::");
11391 strcat(curName, name);
11392 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
11393 }
11394 if(!symbol)
11395 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
11396 }
11397 else
11398 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
11399 if(symbol || ctx == endContext)
11400 break;
11401 }
11402 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
11403 {
11404 if(symbol->pointerExternal->type == 0)
11405 {
11406 struct FunctionDefinition * function = symbol->pointerExternal->function;
11407 struct Context * tmpContext = curContext;
11408
11409 curContext = (((void *)0));
11410 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
11411 curContext = tmpContext;
11412 symbol->pointerExternal->symbol = symbol;
11413 DeclareType(symbol->type, 0x1, 0x1);
11414 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
11415 symbol->id = curExternal->symbol->idCode;
11416 }
11417 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
11418 {
11419 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
11420 symbol->id = curExternal->symbol->idCode;
11421 }
11422 }
11423 return symbol;
11424 }
11425
11426 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
11427 {
11428 if(!type->isSigned && type->kind != 22 && type->kind != 23)
11429 ListAdd(specs, MkSpecifier(UNSIGNED));
11430 switch(type->kind)
11431 {
11432 case 8:
11433 {
11434 if(type->_class->registered)
11435 {
11436 if(!type->_class->registered->dataType)
11437 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11438 GetTypeSpecs(type->_class->registered->dataType, specs);
11439 }
11440 break;
11441 }
11442 case 7:
11443 ListAdd(specs, MkSpecifier(DOUBLE));
11444 break;
11445 case 6:
11446 ListAdd(specs, MkSpecifier(FLOAT));
11447 break;
11448 case 1:
11449 ListAdd(specs, MkSpecifier(CHAR));
11450 break;
11451 case 2:
11452 ListAdd(specs, MkSpecifier(SHORT));
11453 break;
11454 case 4:
11455 ListAdd(specs, MkSpecifier(INT64));
11456 break;
11457 case 22:
11458 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
11459 break;
11460 case 23:
11461 ListAdd(specs, MkSpecifierName(type->isSigned ? "intsize" : "uintsize"));
11462 break;
11463 case 3:
11464 default:
11465 ListAdd(specs, MkSpecifier(INT));
11466 break;
11467 }
11468 }
11469
11470 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
11471
11472 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int printFunction, unsigned int fullName)
11473 {
11474 if(type)
11475 {
11476 switch(type->kind)
11477 {
11478 case 8:
11479 if(type->_class && type->_class->string)
11480 {
11481 if(type->classObjectType == 2)
11482 strcat(string, "typed_object");
11483 else if(fullName)
11484 strcat(string, type->_class->string);
11485 else
11486 {
11487 if(type->_class->registered)
11488 strcat(string, type->_class->registered->name);
11489 else
11490 strcat(string, type->_class->string);
11491 }
11492 }
11493 break;
11494 case 13:
11495 {
11496 {
11497 _PrintType(type->type, string, 0x0, printFunction, fullName);
11498 strcat(string, " *");
11499 }
11500 break;
11501 }
11502 case 0:
11503 strcat(string, "void");
11504 break;
11505 case 3:
11506 strcat(string, type->isSigned ? "int" : "uint");
11507 break;
11508 case 4:
11509 strcat(string, type->isSigned ? "int64" : "uint64");
11510 break;
11511 case 22:
11512 strcat(string, type->isSigned ? "intptr" : "uintptr");
11513 break;
11514 case 23:
11515 strcat(string, type->isSigned ? "intsize" : "uintsize");
11516 break;
11517 case 1:
11518 strcat(string, type->isSigned ? "char" : "byte");
11519 break;
11520 case 2:
11521 strcat(string, type->isSigned ? "short" : "uint16");
11522 break;
11523 case 6:
11524 strcat(string, "float");
11525 break;
11526 case 7:
11527 strcat(string, "double");
11528 break;
11529 case 9:
11530 if(type->enumName)
11531 {
11532 strcat(string, "struct ");
11533 strcat(string, type->enumName);
11534 }
11535 else if(type->typeName)
11536 {
11537 strcat(string, type->typeName);
11538 }
11539 else
11540 {
11541 struct Type * member;
11542
11543 strcat(string, "struct {");
11544 for(member = type->members.first; member; member = member->next)
11545 {
11546 PrintType(member, string, 0x1, fullName);
11547 strcat(string, "; ");
11548 }
11549 strcat(string, "}");
11550 }
11551 break;
11552 case 10:
11553 if(type->enumName)
11554 {
11555 strcat(string, "union ");
11556 strcat(string, type->enumName);
11557 }
11558 else if(type->typeName)
11559 {
11560 strcat(string, type->typeName);
11561 }
11562 else
11563 {
11564 strcat(string, "union ");
11565 strcat(string, "(unnamed)");
11566 }
11567 break;
11568 case 15:
11569 if(type->enumName)
11570 {
11571 strcat(string, "enum ");
11572 strcat(string, type->enumName);
11573 }
11574 else if(type->typeName)
11575 {
11576 strcat(string, type->typeName);
11577 }
11578 else
11579 strcat(string, "enum");
11580 break;
11581 case 11:
11582 {
11583 if(printFunction)
11584 {
11585 if(type->dllExport)
11586 strcat(string, "dllexport ");
11587 PrintType(type->returnType, string, 0x0, fullName);
11588 strcat(string, " ");
11589 }
11590 if(printName)
11591 {
11592 if(type->name)
11593 {
11594 if(fullName)
11595 strcat(string, type->name);
11596 else
11597 {
11598 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11599
11600 if(name)
11601 name += 2;
11602 else
11603 name = type->name;
11604 strcat(string, name);
11605 }
11606 }
11607 }
11608 if(printFunction)
11609 {
11610 struct Type * param;
11611
11612 strcat(string, "(");
11613 for(param = type->params.first; param; param = param->next)
11614 {
11615 PrintType(param, string, 0x1, fullName);
11616 if(param->next)
11617 strcat(string, ", ");
11618 }
11619 strcat(string, ")");
11620 }
11621 break;
11622 }
11623 case 12:
11624 {
11625 {
11626 char baseType[1024], size[256];
11627 struct Type * arrayType = type;
11628
11629 baseType[0] = '\0';
11630 size[0] = '\0';
11631 while(arrayType->kind == 12)
11632 {
11633 strcat(size, "[");
11634 if(arrayType->enumClass)
11635 strcat(size, arrayType->enumClass->string);
11636 else if(arrayType->arraySizeExp)
11637 PrintExpression(arrayType->arraySizeExp, size);
11638 strcat(size, "]");
11639 arrayType = arrayType->arrayType;
11640 }
11641 _PrintType(arrayType, baseType, printName, printFunction, fullName);
11642 strcat(string, baseType);
11643 strcat(string, size);
11644 }
11645 printName = 0x0;
11646 break;
11647 }
11648 case 14:
11649 strcat(string, "...");
11650 break;
11651 case 16:
11652 _PrintType(type->method->dataType, string, 0x0, printFunction, fullName);
11653 break;
11654 case 19:
11655 strcat(string, "subclass(");
11656 strcat(string, type->_class ? type->_class->string : "int");
11657 strcat(string, ")");
11658 break;
11659 case 20:
11660 strcat(string, type->templateParameter->identifier->string);
11661 break;
11662 case 21:
11663 strcat(string, "thisclass");
11664 break;
11665 case 17:
11666 strcat(string, "__builtin_va_list");
11667 break;
11668 }
11669 if(type->name && printName && type->kind != 11 && (type->kind != 13 || type->type->kind != 11))
11670 {
11671 strcat(string, " ");
11672 strcat(string, type->name);
11673 }
11674 }
11675 }
11676
11677 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11678 {
11679 struct Type * funcType;
11680
11681 for(funcType = type; funcType && (funcType->kind == 13 || funcType->kind == 12); funcType = funcType->type)
11682 ;
11683 if(funcType && funcType->kind == 11 && type != funcType)
11684 {
11685 char typeString[1024];
11686 struct Type * param;
11687
11688 PrintType(funcType->returnType, string, 0x0, fullName);
11689 strcat(string, "(");
11690 _PrintType(type, string, printName, 0x0, fullName);
11691 strcat(string, ")");
11692 strcat(string, "(");
11693 for(param = funcType->params.first; param; param = param->next)
11694 {
11695 PrintType(param, string, 0x1, fullName);
11696 if(param->next)
11697 strcat(string, ", ");
11698 }
11699 strcat(string, ")");
11700 }
11701 else
11702 _PrintType(type, string, printName, 0x1, fullName);
11703 if(type->bitFieldCount)
11704 {
11705 char count[100];
11706
11707 sprintf(count, ":%d", type->bitFieldCount);
11708 strcat(string, count);
11709 }
11710 }
11711
11712 static struct Type * FindMember(struct Type * type, char * string)
11713 {
11714 struct Type * memberType;
11715
11716 for(memberType = type->members.first; memberType; memberType = memberType->next)
11717 {
11718 if(!memberType->name)
11719 {
11720 struct Type * subType = FindMember(memberType, string);
11721
11722 if(subType)
11723 return subType;
11724 }
11725 else if(!strcmp(memberType->name, string))
11726 return memberType;
11727 }
11728 return (((void *)0));
11729 }
11730
11731 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11732 {
11733 struct Type * memberType;
11734
11735 for(memberType = type->members.first; memberType; memberType = memberType->next)
11736 {
11737 if(!memberType->name)
11738 {
11739 struct Type * subType = FindMember(memberType, string);
11740
11741 if(subType)
11742 {
11743 *offset += memberType->offset;
11744 return subType;
11745 }
11746 }
11747 else if(!strcmp(memberType->name, string))
11748 {
11749 *offset += memberType->offset;
11750 return memberType;
11751 }
11752 }
11753 return (((void *)0));
11754 }
11755
11756 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11757
11758 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11759
11760 struct Expression * ParseExpressionString(char * expression)
11761 {
11762 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11763 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, expression, 1, strlen(expression));
11764 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11765 echoOn = 0x0;
11766 parsedExpression = (((void *)0));
11767 resetScanner();
11768 expression_yyparse();
11769 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11770 return parsedExpression;
11771 }
11772
11773 extern char *  QMkString(char *  source);
11774
11775 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11776 {
11777 void * __ecereTemp1;
11778 struct Identifier * id = exp->identifier;
11779 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11780 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11781 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11782 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11783
11784 if(_class && _class->type == 4)
11785 {
11786 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11787 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11788
11789 if(enumClass)
11790 {
11791 struct __ecereNameSpace__ecere__com__Class * baseClass;
11792
11793 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11794 {
11795 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11796
11797 for(value = e->values.first; value; value = value->next)
11798 {
11799 if(!strcmp(value->name, id->string))
11800 break;
11801 }
11802 if(value)
11803 {
11804 char constant[256];
11805
11806 FreeExpContents(exp);
11807 exp->type = 2;
11808 exp->isConstant = 0x1;
11809 if(!strcmp(baseClass->dataTypeString, "int"))
11810 sprintf(constant, "%d", value->data);
11811 else
11812 sprintf(constant, "0x%X", value->data);
11813 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11814 exp->expType = MkClassType(baseClass->fullName);
11815 break;
11816 }
11817 }
11818 }
11819 if(value)
11820 return 0x1;
11821 }
11822 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11823 {
11824 ProcessMethodType(method);
11825 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 16, ((struct Type *)__ecereTemp1)->method = method, ((struct Type *)__ecereTemp1)->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), ((struct Type *)__ecereTemp1));
11826 return 0x1;
11827 }
11828 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11829 {
11830 if(!prop->dataType)
11831 ProcessPropertyType(prop);
11832 exp->expType = prop->dataType;
11833 if(prop->dataType)
11834 prop->dataType->refCount++;
11835 return 0x1;
11836 }
11837 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11838 {
11839 if(!member->dataType)
11840 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11841 exp->expType = member->dataType;
11842 if(member->dataType)
11843 member->dataType->refCount++;
11844 return 0x1;
11845 }
11846 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11847 {
11848 if(!classProp->dataType)
11849 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11850 if(classProp->constant)
11851 {
11852 FreeExpContents(exp);
11853 exp->isConstant = 0x1;
11854 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
11855 {
11856 exp->type = 3;
11857 exp->constant = QMkString((char *)classProp->Get(_class));
11858 }
11859 else
11860 {
11861 char constant[256];
11862
11863 exp->type = 2;
11864 sprintf(constant, "%d", (int)classProp->Get(_class));
11865 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11866 }
11867 }
11868 else
11869 {
11870 }
11871 exp->expType = classProp->dataType;
11872 if(classProp->dataType)
11873 classProp->dataType->refCount++;
11874 return 0x1;
11875 }
11876 return 0x0;
11877 }
11878
11879 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
11880 {
11881 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
11882 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
11883 struct __ecereNameSpace__ecere__com__NameSpace * child;
11884
11885 if(!data)
11886 {
11887 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)))
11888 {
11889 data = ScanGlobalData(child, name);
11890 if(data)
11891 break;
11892 }
11893 }
11894 return data;
11895 }
11896
11897 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
11898
11899 extern char *  strncpy(char * , const char * , size_t n);
11900
11901 static struct GlobalData * FindGlobalData(char * name)
11902 {
11903 int start = 0, c;
11904 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
11905
11906 nameSpace = globalData;
11907 for(c = 0; name[c]; c++)
11908 {
11909 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
11910 {
11911 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
11912 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
11913
11914 strncpy(spaceName, name + start, c - start);
11915 spaceName[c - start] = '\0';
11916 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
11917 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
11918 if(!newSpace)
11919 return (((void *)0));
11920 nameSpace = newSpace;
11921 if(name[c] == ':')
11922 c++;
11923 start = c + 1;
11924 }
11925 }
11926 if(c - start)
11927 {
11928 return ScanGlobalData(nameSpace, name + start);
11929 }
11930 return (((void *)0));
11931 }
11932
11933 static int definedExpStackPos;
11934
11935 static void * definedExpStack[512];
11936
11937 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
11938 {
11939 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
11940
11941 FreeExpContents(checkedExp);
11942 FreeType(checkedExp->expType);
11943 FreeType(checkedExp->destType);
11944 *checkedExp = *newExp;
11945 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11946 checkedExp->prev = prev;
11947 checkedExp->next = next;
11948 }
11949
11950 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
11951
11952 extern int printf(char * , ...);
11953
11954 void __ecereMethod_Expression_Clear();
11955
11956 void ApplyAnyObjectLogic(struct Expression * e)
11957 {
11958 struct Type * destType = e->destType;
11959
11960 if(destType && (destType->classObjectType == 3))
11961 {
11962 if(e && e->expType)
11963 {
11964 struct Type * type = e->expType;
11965 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
11966
11967 if(type->kind == 8 && type->_class && type->_class->registered)
11968 {
11969 _class = type->_class->registered;
11970 }
11971 else if(type->kind == 19)
11972 {
11973 _class = FindClass("ecere::com::Class")->registered;
11974 }
11975 else
11976 {
11977 char string[1024] = "";
11978 struct Symbol * classSym;
11979
11980 PrintType(type, string, 0x0, 0x1);
11981 classSym = FindClass(string);
11982 if(classSym)
11983 _class = classSym->registered;
11984 }
11985 if((_class && (_class->type == 4 || _class->type == 3 || _class->type == 2 || _class->type == 1000) && strcmp(_class->fullName, "class") && strcmp(_class->fullName, "ecere::com::Class")) || (!e->expType->classObjectType && (((type->kind != 13 && type->kind != 19 && (type->kind != 8 || !type->_class || !type->_class->registered || type->_class->registered->type == 1))) || destType->byReference)))
11986 {
11987 if(!_class || strcmp(_class->fullName, "char *"))
11988 {
11989 struct Expression * checkedExp = e, * newExp;
11990
11991 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
11992 {
11993 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
11994 {
11995 if(checkedExp->type == 25)
11996 {
11997 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
11998 }
11999 else
12000 checkedExp = (*checkedExp->list).last;
12001 }
12002 else if(checkedExp->type == 11)
12003 checkedExp = checkedExp->cast.exp;
12004 }
12005 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
12006 {
12007 newExp = checkedExp->op.exp2;
12008 checkedExp->op.exp2 = (((void *)0));
12009 FreeExpContents(checkedExp);
12010 if(e->expType && e->expType->passAsTemplate)
12011 {
12012 char size[100];
12013
12014 ComputeTypeSize(e->expType);
12015 sprintf(size, "%d", e->expType->size);
12016 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))))));
12017 }
12018 ReplaceExpContents(checkedExp, newExp);
12019 e->byReference = 0x1;
12020 }
12021 else if(!e->byReference || (_class && _class->type == 5))
12022 {
12023 struct Expression * checkedExp, * newExp;
12024
12025 {
12026 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;
12027
12028 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
12029 {
12030 struct Context * context = PushContext();
12031 struct Declarator * decl;
12032 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12033 char typeString[1024];
12034 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12035
12036 typeString[0] = '\0';
12037 *newExp = *e;
12038 newExp->prev = (((void *)0));
12039 newExp->next = (((void *)0));
12040 newExp->expType = (((void *)0));
12041 PrintType(e->expType, typeString, 0x0, 0x1);
12042 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12043 newExp->destType = ProcessType(specs, decl);
12044 curContext = context;
12045 e->type = 25;
12046 if(curCompound)
12047 {
12048 char name[100];
12049 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
12050
12051 sprintf(name, "__internalValue%03X", internalValueCounter++);
12052 if(!curCompound->compound.declarations)
12053 curCompound->compound.declarations = MkList();
12054 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
12055 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
12056 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
12057 e->compound = MkCompoundStmt((((void *)0)), stmts);
12058 }
12059 else
12060 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
12061 {
12062 struct Type * type = e->destType;
12063
12064 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12065 CopyTypeInto(e->destType, type);
12066 e->destType->refCount = 1;
12067 e->destType->classObjectType = 0;
12068 FreeType(type);
12069 }
12070 e->compound->compound.context = context;
12071 PopContext(context);
12072 curContext = context->parent;
12073 }
12074 }
12075 checkedExp = e;
12076 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12077 {
12078 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12079 {
12080 if(checkedExp->type == 25)
12081 {
12082 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12083 }
12084 else
12085 checkedExp = (*checkedExp->list).last;
12086 }
12087 else if(checkedExp->type == 11)
12088 checkedExp = checkedExp->cast.exp;
12089 }
12090 {
12091 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12092
12093 *operand = *checkedExp;
12094 checkedExp->destType = (((void *)0));
12095 checkedExp->expType = (((void *)0));
12096 __ecereMethod_Expression_Clear(checkedExp);
12097 checkedExp->type = 4;
12098 checkedExp->op.op = '&';
12099 checkedExp->op.exp1 = (((void *)0));
12100 checkedExp->op.exp2 = operand;
12101 }
12102 }
12103 }
12104 }
12105 }
12106 }
12107 {
12108 }
12109 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))))
12110 {
12111 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && !strcmp(e->expType->_class->registered->name, "class"))
12112 {
12113 return ;
12114 }
12115 else
12116 {
12117 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12118
12119 *thisExp = *e;
12120 thisExp->prev = (((void *)0));
12121 thisExp->next = (((void *)0));
12122 __ecereMethod_Expression_Clear(e);
12123 e->type = 5;
12124 e->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpBrackets(MkListOne(thisExp))));
12125 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
12126 ((struct Expression *)(*e->list).first)->byReference = 0x1;
12127 {
12128 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12129 CopyTypeInto(e->expType, thisExp->expType);
12130 e->expType->byReference = 0x0;
12131 e->expType->refCount = 1;
12132 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))
12133 {
12134 e->expType->classObjectType = 0;
12135 }
12136 }
12137 }
12138 }
12139 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
12140 {
12141 if(destType->kind == 14)
12142 {
12143 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unspecified type\n", (((void *)0))));
12144 }
12145 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
12146 {
12147 unsigned int byReference = e->expType->byReference;
12148 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12149 struct Declarator * decl;
12150 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12151 char typeString[1024];
12152 struct Type * type;
12153 int backupClassObjectType;
12154
12155 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
12156 type = e->expType;
12157 else
12158 type = destType;
12159 backupClassObjectType = type->classObjectType;
12160 type->classObjectType = 0;
12161 typeString[0] = '\0';
12162 PrintType(type, typeString, 0x0, 0x1);
12163 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12164 type->classObjectType = backupClassObjectType;
12165 *thisExp = *e;
12166 thisExp->prev = (((void *)0));
12167 thisExp->next = (((void *)0));
12168 __ecereMethod_Expression_Clear(e);
12169 if((type->kind == 8 && type->_class && type->_class->registered && strcmp(type->_class->registered->fullName, "ecere::com::Instance") && (type->_class->registered->type == 1000 || type->_class->registered->type == 2 || type->_class->registered->type == 4 || type->_class->registered->type == 3)) || (type->kind != 13 && type->kind != 12 && type->kind != 8) || (!destType->byReference && byReference && (destType->kind != 13 || type->kind != 13)))
12170 {
12171 e->type = 4;
12172 e->op.op = '*';
12173 e->op.exp1 = (((void *)0));
12174 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
12175 }
12176 else
12177 {
12178 e->type = 11;
12179 e->cast.typeName = MkTypeName(specs, decl);
12180 e->cast.exp = thisExp;
12181 e->byReference = 0x1;
12182 }
12183 e->expType = type;
12184 e->destType = destType;
12185 type->refCount++;
12186 destType->refCount++;
12187 }
12188 }
12189 }
12190
12191 extern char *  strstr(const char * , const char * );
12192
12193 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
12194
12195 struct __ecereNameSpace__ecere__com__DefinedExpression
12196 {
12197 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
12198 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
12199 char *  name;
12200 char *  value;
12201 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
12202 } __attribute__ ((gcc_struct));
12203
12204 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12205
12206 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12207
12208 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
12209
12210 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
12211
12212 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
12213
12214 extern struct Expression * CopyExpression(struct Expression * exp);
12215
12216 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
12217
12218 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
12219
12220 static void ProcessStatement(struct Statement * stmt);
12221
12222 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
12223
12224 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
12225
12226 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
12227
12228 extern char *  sourceFile;
12229
12230 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
12231
12232 void ProcessExpressionType(struct Expression * exp)
12233 {
12234 void * __ecereTemp2;
12235 void * __ecereTemp1;
12236 unsigned int unresolved = 0x0;
12237 struct Location oldyylloc = yylloc;
12238 unsigned int notByReference = 0x0;
12239
12240 if(!exp || exp->expType)
12241 return ;
12242 yylloc = exp->loc;
12243 switch(exp->type)
12244 {
12245 case 0:
12246 {
12247 struct Identifier * id = exp->identifier;
12248
12249 if(!id)
12250 return ;
12251 if(id->_class && id->_class->name)
12252 {
12253 id->classSym = id->_class->symbol;
12254 }
12255 if(strstr(id->string, "__ecereClass") == id->string)
12256 {
12257 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
12258 break;
12259 }
12260 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
12261 {
12262 ReplaceClassMembers(exp, thisClass);
12263 if(exp->type != 0)
12264 {
12265 ProcessExpressionType(exp);
12266 break;
12267 }
12268 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
12269 break;
12270 }
12271 else
12272 {
12273 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12274
12275 if(!symbol)
12276 {
12277 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
12278 break;
12279 else
12280 {
12281 if(thisClass)
12282 {
12283 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
12284 if(exp->type != 0)
12285 {
12286 ProcessExpressionType(exp);
12287 break;
12288 }
12289 }
12290 else if(currentClass && !id->_class)
12291 {
12292 if(ResolveIdWithClass(exp, currentClass, 0x1))
12293 break;
12294 }
12295 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12296 }
12297 }
12298 if(symbol)
12299 {
12300 struct Type * type = symbol->type;
12301 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
12302
12303 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
12304 {
12305 struct Context * context = SetupTemplatesContext(_class);
12306
12307 type = ReplaceThisClassType(_class);
12308 FinishTemplatesContext(context);
12309 if(type)
12310 type->refCount = 0;
12311 }
12312 FreeSpecifier(id->_class);
12313 id->_class = (((void *)0));
12314 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12315 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
12316 id->classSym = (((void *)0));
12317 exp->expType = type;
12318 if(type)
12319 type->refCount++;
12320 if(type && (type->kind == 15 || (_class && _class->type == 4)))
12321 exp->isConstant = 0x1;
12322 if(symbol->isParam || !strcmp(id->string, "this"))
12323 {
12324 if(_class && _class->type == 1)
12325 exp->byReference = 0x1;
12326 }
12327 if(symbol->isIterator)
12328 {
12329 if(symbol->isIterator == 3)
12330 {
12331 exp->type = 5;
12332 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
12333 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
12334 exp->expType = (((void *)0));
12335 ProcessExpressionType(exp);
12336 }
12337 else if(symbol->isIterator != 4)
12338 {
12339 exp->type = 8;
12340 exp->member.exp = MkExpIdentifier(exp->identifier);
12341 exp->member.exp->expType = exp->expType;
12342 exp->member.member = MkIdentifier("data");
12343 exp->expType = (((void *)0));
12344 ProcessExpressionType(exp);
12345 }
12346 }
12347 break;
12348 }
12349 else
12350 {
12351 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
12352
12353 if(thisNameSpace && !(id->_class && !id->_class->name))
12354 {
12355 char name[1024];
12356
12357 strcpy(name, thisNameSpace);
12358 strcat(name, "::");
12359 strcat(name, id->string);
12360 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
12361 }
12362 if(!definedExp)
12363 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
12364 if(definedExp)
12365 {
12366 int c;
12367
12368 for(c = 0; c < definedExpStackPos; c++)
12369 if(definedExpStack[c] == definedExp)
12370 break;
12371 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
12372 {
12373 struct Location backupYylloc = yylloc;
12374
12375 definedExpStack[definedExpStackPos++] = definedExp;
12376 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
12377 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, definedExp->value, 1, strlen(definedExp->value));
12378 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
12379 echoOn = 0x0;
12380 parsedExpression = (((void *)0));
12381 resetScanner();
12382 expression_yyparse();
12383 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
12384 yylloc = backupYylloc;
12385 if(parsedExpression)
12386 {
12387 FreeIdentifier(id);
12388 exp->type = 5;
12389 exp->list = MkListOne(parsedExpression);
12390 parsedExpression->loc = yylloc;
12391 ProcessExpressionType(exp);
12392 definedExpStackPos--;
12393 return ;
12394 }
12395 definedExpStackPos--;
12396 }
12397 else
12398 {
12399 if(inCompiler)
12400 {
12401 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
12402 }
12403 }
12404 }
12405 else
12406 {
12407 struct GlobalData * data = (((void *)0));
12408
12409 if(thisNameSpace && !(id->_class && !id->_class->name))
12410 {
12411 char name[1024];
12412
12413 strcpy(name, thisNameSpace);
12414 strcat(name, "::");
12415 strcat(name, id->string);
12416 data = FindGlobalData(name);
12417 }
12418 if(!data)
12419 data = FindGlobalData(id->string);
12420 if(data)
12421 {
12422 DeclareGlobalData(data);
12423 exp->expType = data->dataType;
12424 if(data->dataType)
12425 data->dataType->refCount++;
12426 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12427 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12428 FreeSpecifier(id->_class);
12429 id->_class = (((void *)0));
12430 break;
12431 }
12432 else
12433 {
12434 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
12435
12436 if(thisNameSpace && !(id->_class && !id->_class->name))
12437 {
12438 char name[1024];
12439
12440 strcpy(name, thisNameSpace);
12441 strcat(name, "::");
12442 strcat(name, id->string);
12443 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12444 }
12445 if(!function)
12446 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12447 if(function)
12448 {
12449 char name[1024];
12450
12451 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12452 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12453 name[0] = (char)0;
12454 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12455 strcpy(name, "__ecereFunction_");
12456 FullClassNameCat(name, id->string, 0x0);
12457 if(DeclareFunction(function, name))
12458 {
12459 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12460 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12461 }
12462 exp->expType = function->dataType;
12463 if(function->dataType)
12464 function->dataType->refCount++;
12465 FreeSpecifier(id->_class);
12466 id->_class = (((void *)0));
12467 break;
12468 }
12469 }
12470 }
12471 }
12472 }
12473 unresolved = 0x1;
12474 break;
12475 }
12476 case 1:
12477 {
12478 struct __ecereNameSpace__ecere__com__Class * _class;
12479
12480 if(!exp->instance->_class)
12481 {
12482 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12483 {
12484 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12485 }
12486 }
12487 ProcessInstantiationType(exp->instance);
12488 exp->isConstant = exp->instance->isConstant;
12489 if(exp->instance->_class)
12490 {
12491 exp->expType = MkClassType(exp->instance->_class->name);
12492 }
12493 break;
12494 }
12495 case 2:
12496 {
12497 if(!exp->expType)
12498 {
12499 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12500
12501 exp->expType = type;
12502 if(exp->constant[0] == '\'')
12503 {
12504 if((int)((unsigned char *)exp->constant)[1] > 127)
12505 {
12506 int nb;
12507 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12508
12509 if(nb < 2)
12510 ch = exp->constant[1];
12511 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12512 exp->constant = PrintUInt(ch);
12513 type->kind = 8;
12514 type->_class = FindClass("unichar");
12515 type->isSigned = 0x0;
12516 }
12517 else
12518 {
12519 type->kind = 1;
12520 type->isSigned = 0x1;
12521 }
12522 }
12523 else if(strchr(exp->constant, '.'))
12524 {
12525 char ch = exp->constant[strlen(exp->constant) - 1];
12526
12527 if(ch == 'f')
12528 type->kind = 6;
12529 else
12530 type->kind = 7;
12531 type->isSigned = 0x1;
12532 }
12533 else
12534 {
12535 if(exp->constant[0] == '0' && exp->constant[1])
12536 type->isSigned = 0x0;
12537 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12538 type->isSigned = 0x0;
12539 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12540 type->isSigned = 0x0;
12541 else
12542 type->isSigned = 0x1;
12543 type->kind = 3;
12544 }
12545 exp->isConstant = 0x1;
12546 }
12547 break;
12548 }
12549 case 3:
12550 {
12551 exp->isConstant = 0x1;
12552 exp->expType = (__ecereTemp2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp2)->refCount = 1, ((struct Type *)__ecereTemp2)->kind = 13, ((struct Type *)__ecereTemp2)->type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 1, ((struct Type *)__ecereTemp1)->constant = 0x1, ((struct Type *)__ecereTemp1)), ((struct Type *)__ecereTemp2));
12553 break;
12554 }
12555 case 13:
12556 case 28:
12557 ProcessExpressionType(exp->_new.size);
12558 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = ProcessType(exp->_new.typeName->qualifiers, exp->_new.typeName->declarator), ((struct Type *)__ecereTemp1));
12559 DeclareType(exp->expType->type, 0x0, 0x0);
12560 break;
12561 case 14:
12562 case 29:
12563 ProcessExpressionType(exp->_renew.size);
12564 ProcessExpressionType(exp->_renew.exp);
12565 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), ((struct Type *)__ecereTemp1));
12566 DeclareType(exp->expType->type, 0x0, 0x0);
12567 break;
12568 case 4:
12569 {
12570 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12571 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12572 unsigned int useDestType = 0x0, useSideType = 0x0;
12573 struct Location oldyylloc = yylloc;
12574 unsigned int useSideUnit = 0x0;
12575 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
12576
12577 switch(exp->op.op)
12578 {
12579 case '=':
12580 case MUL_ASSIGN:
12581 case DIV_ASSIGN:
12582 case MOD_ASSIGN:
12583 case ADD_ASSIGN:
12584 case SUB_ASSIGN:
12585 case LEFT_ASSIGN:
12586 case RIGHT_ASSIGN:
12587 case AND_ASSIGN:
12588 case XOR_ASSIGN:
12589 case OR_ASSIGN:
12590 assign = 0x1;
12591 break;
12592 case '!':
12593 break;
12594 case AND_OP:
12595 case OR_OP:
12596 boolOps = 0x1;
12597 boolResult = 0x1;
12598 break;
12599 case EQ_OP:
12600 case '<':
12601 case '>':
12602 case LE_OP:
12603 case GE_OP:
12604 case NE_OP:
12605 boolResult = 0x1;
12606 useSideType = 0x1;
12607 break;
12608 case '+':
12609 case '-':
12610 useSideUnit = 0x1;
12611 case '|':
12612 case '&':
12613 case '^':
12614 case '/':
12615 case '%':
12616 case '*':
12617 if(exp->op.op != '*' || exp->op.exp1)
12618 {
12619 useSideType = 0x1;
12620 useDestType = 0x1;
12621 }
12622 break;
12623 }
12624 if(exp->op.op == '&')
12625 {
12626 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12627 {
12628 struct Identifier * id = exp->op.exp2->identifier;
12629 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12630
12631 if(symbol && symbol->isIterator == 2)
12632 {
12633 exp->type = 8;
12634 exp->member.exp = exp->op.exp2;
12635 exp->member.member = MkIdentifier("key");
12636 exp->expType = (((void *)0));
12637 exp->op.exp2->expType = symbol->type;
12638 symbol->type->refCount++;
12639 ProcessExpressionType(exp);
12640 FreeType(dummy);
12641 break;
12642 }
12643 }
12644 }
12645 if(exp->op.exp1)
12646 {
12647 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))
12648 {
12649 if(exp->op.exp1->destType)
12650 FreeType(exp->op.exp1->destType);
12651 exp->op.exp1->destType = exp->destType;
12652 if(exp->destType)
12653 exp->destType->refCount++;
12654 }
12655 else if(!assign)
12656 {
12657 if(exp->op.exp1->destType)
12658 FreeType(exp->op.exp1->destType);
12659 exp->op.exp1->destType = dummy;
12660 dummy->refCount++;
12661 }
12662 if(exp->op.exp1->destType && exp->op.op != '=')
12663 exp->op.exp1->destType->count++;
12664 ProcessExpressionType(exp->op.exp1);
12665 if(exp->op.exp1->destType && exp->op.op != '=')
12666 exp->op.exp1->destType->count--;
12667 if(exp->op.exp1->destType == dummy)
12668 {
12669 FreeType(dummy);
12670 exp->op.exp1->destType = (((void *)0));
12671 }
12672 type1 = exp->op.exp1->expType;
12673 }
12674 if(exp->op.exp2)
12675 {
12676 char expString[10240];
12677
12678 expString[0] = '\0';
12679 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12680 {
12681 if(exp->op.exp1)
12682 {
12683 exp->op.exp2->destType = exp->op.exp1->expType;
12684 if(exp->op.exp1->expType)
12685 exp->op.exp1->expType->refCount++;
12686 }
12687 else
12688 {
12689 exp->op.exp2->destType = exp->destType;
12690 if(exp->destType)
12691 exp->destType->refCount++;
12692 }
12693 if(type1)
12694 type1->refCount++;
12695 exp->expType = type1;
12696 }
12697 else if(assign)
12698 {
12699 if(inCompiler)
12700 PrintExpression(exp->op.exp2, expString);
12701 if(type1 && type1->kind == 13)
12702 {
12703 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)
12704 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12705 else if(exp->op.op == '=')
12706 {
12707 if(exp->op.exp2->destType)
12708 FreeType(exp->op.exp2->destType);
12709 exp->op.exp2->destType = type1;
12710 if(type1)
12711 type1->refCount++;
12712 }
12713 }
12714 else
12715 {
12716 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)
12717 ;
12718 else
12719 {
12720 if(exp->op.exp2->destType)
12721 FreeType(exp->op.exp2->destType);
12722 exp->op.exp2->destType = type1;
12723 if(type1)
12724 type1->refCount++;
12725 }
12726 }
12727 if(type1)
12728 type1->refCount++;
12729 exp->expType = type1;
12730 }
12731 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)))
12732 {
12733 if(exp->op.exp2->destType)
12734 FreeType(exp->op.exp2->destType);
12735 exp->op.exp2->destType = exp->destType;
12736 if(exp->destType)
12737 exp->destType->refCount++;
12738 }
12739 else
12740 {
12741 if(exp->op.exp2->destType)
12742 FreeType(exp->op.exp2->destType);
12743 exp->op.exp2->destType = dummy;
12744 dummy->refCount++;
12745 }
12746 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12747 {
12748 FreeType(exp->op.exp2->destType);
12749 exp->op.exp2->destType = type1;
12750 type1->refCount++;
12751 }
12752 if(exp->op.exp2->destType && exp->op.op != '=')
12753 exp->op.exp2->destType->count++;
12754 ProcessExpressionType(exp->op.exp2);
12755 if(exp->op.exp2->destType && exp->op.op != '=')
12756 exp->op.exp2->destType->count--;
12757 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12758 {
12759 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)
12760 {
12761 if(exp->op.op != '=' && type1->type->kind == 0)
12762 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12763 }
12764 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)))
12765 {
12766 if(exp->op.op == ADD_ASSIGN)
12767 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12768 }
12769 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))
12770 {
12771 if(exp->op.op == ADD_ASSIGN)
12772 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12773 }
12774 else if(inCompiler)
12775 {
12776 char type1String[1024];
12777 char type2String[1024];
12778
12779 type1String[0] = '\0';
12780 type2String[0] = '\0';
12781 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12782 PrintType(type1, type2String, 0x0, 0x1);
12783 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12784 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12785 }
12786 }
12787 if(exp->op.exp2->destType == dummy)
12788 {
12789 FreeType(dummy);
12790 exp->op.exp2->destType = (((void *)0));
12791 }
12792 type2 = exp->op.exp2->expType;
12793 }
12794 dummy->kind = 0;
12795 if(exp->op.op == SIZEOF)
12796 {
12797 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
12798 exp->isConstant = 0x1;
12799 }
12800 else if(exp->op.op == '*' && !exp->op.exp1)
12801 {
12802 exp->expType = Dereference(type2);
12803 if(type2 && type2->kind == 8)
12804 notByReference = 0x1;
12805 }
12806 else if(exp->op.op == '&' && !exp->op.exp1)
12807 exp->expType = Reference(type2);
12808 else if(!assign)
12809 {
12810 if(boolOps)
12811 {
12812 if(exp->op.exp1)
12813 {
12814 if(exp->op.exp1->destType)
12815 FreeType(exp->op.exp1->destType);
12816 exp->op.exp1->destType = MkClassType("bool");
12817 exp->op.exp1->destType->truth = 0x1;
12818 if(!exp->op.exp1->expType)
12819 ProcessExpressionType(exp->op.exp1);
12820 else
12821 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12822 FreeType(exp->op.exp1->expType);
12823 exp->op.exp1->expType = MkClassType("bool");
12824 exp->op.exp1->expType->truth = 0x1;
12825 }
12826 if(exp->op.exp2)
12827 {
12828 if(exp->op.exp2->destType)
12829 FreeType(exp->op.exp2->destType);
12830 exp->op.exp2->destType = MkClassType("bool");
12831 exp->op.exp2->destType->truth = 0x1;
12832 if(!exp->op.exp2->expType)
12833 ProcessExpressionType(exp->op.exp2);
12834 else
12835 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12836 FreeType(exp->op.exp2->expType);
12837 exp->op.exp2->expType = MkClassType("bool");
12838 exp->op.exp2->expType->truth = 0x1;
12839 }
12840 }
12841 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")))))
12842 {
12843 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
12844 {
12845 if(exp->op.exp2->destType)
12846 FreeType(exp->op.exp2->destType);
12847 exp->op.exp2->destType = type1;
12848 type1->refCount++;
12849 if(exp->op.exp1->destType)
12850 FreeType(exp->op.exp1->destType);
12851 exp->op.exp1->destType = type2;
12852 type2->refCount++;
12853 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)
12854 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);
12855 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
12856 {
12857 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12858
12859 if(argExp)
12860 {
12861 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12862
12863 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
12864 ProcessExpressionType(exp->op.exp1);
12865 if(type2->kind != 13)
12866 {
12867 ProcessExpressionType(classExp);
12868 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"))))))));
12869 if(!exp->op.exp2->expType)
12870 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
12871 ProcessExpressionType(exp->op.exp2);
12872 }
12873 }
12874 }
12875 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)))
12876 {
12877 if(type1->kind != 8 && type1->type->kind == 0)
12878 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12879 exp->expType = type1;
12880 if(type1)
12881 type1->refCount++;
12882 }
12883 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)))
12884 {
12885 if(type2->kind != 8 && type2->type->kind == 0)
12886 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12887 exp->expType = type2;
12888 if(type2)
12889 type2->refCount++;
12890 }
12891 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))
12892 {
12893 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
12894 }
12895 else
12896 {
12897 unsigned int success = 0x0;
12898
12899 if(type1->kind == 13 && type2->kind == 13)
12900 {
12901 if(exp->op.op == '+')
12902 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12903 else if(exp->op.op == '-')
12904 {
12905 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
12906 {
12907 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
12908 success = 0x1;
12909 if(type1->type->kind == 20)
12910 {
12911 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12912
12913 if(argExp)
12914 {
12915 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12916
12917 ProcessExpressionType(classExp);
12918 exp->type = 5;
12919 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")))))));
12920 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
12921 FreeType(dummy);
12922 return ;
12923 }
12924 }
12925 }
12926 }
12927 }
12928 if(!success && exp->op.exp1->type == 2)
12929 {
12930 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12931 {
12932 if(exp->expType)
12933 FreeType(exp->expType);
12934 exp->expType = exp->op.exp1->destType;
12935 if(exp->op.exp1->destType)
12936 exp->op.exp1->destType->refCount++;
12937 success = 0x1;
12938 }
12939 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12940 {
12941 if(exp->expType)
12942 FreeType(exp->expType);
12943 exp->expType = exp->op.exp2->destType;
12944 if(exp->op.exp2->destType)
12945 exp->op.exp2->destType->refCount++;
12946 success = 0x1;
12947 }
12948 }
12949 else if(!success)
12950 {
12951 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12952 {
12953 if(exp->expType)
12954 FreeType(exp->expType);
12955 exp->expType = exp->op.exp2->destType;
12956 if(exp->op.exp2->destType)
12957 exp->op.exp2->destType->refCount++;
12958 success = 0x1;
12959 }
12960 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12961 {
12962 if(exp->expType)
12963 FreeType(exp->expType);
12964 exp->expType = exp->op.exp1->destType;
12965 if(exp->op.exp1->destType)
12966 exp->op.exp1->destType->refCount++;
12967 success = 0x1;
12968 }
12969 }
12970 if(!success)
12971 {
12972 char expString1[10240];
12973 char expString2[10240];
12974 char type1[1024];
12975 char type2[1024];
12976
12977 expString1[0] = '\0';
12978 expString2[0] = '\0';
12979 type1[0] = '\0';
12980 type2[0] = '\0';
12981 if(inCompiler)
12982 {
12983 PrintExpression(exp->op.exp1, expString1);
12984 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12985 PrintExpression(exp->op.exp2, expString2);
12986 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12987 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
12988 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
12989 }
12990 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
12991 }
12992 }
12993 }
12994 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12995 {
12996 if(exp->op.exp1->destType)
12997 FreeType(exp->op.exp1->destType);
12998 exp->op.exp1->destType = type2->_class->registered->dataType;
12999 if(type2->_class->registered->dataType)
13000 type2->_class->registered->dataType->refCount++;
13001 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13002 exp->expType = type2;
13003 if(type2)
13004 type2->refCount++;
13005 }
13006 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13007 {
13008 if(exp->op.exp2->destType)
13009 FreeType(exp->op.exp2->destType);
13010 exp->op.exp2->destType = type1->_class->registered->dataType;
13011 if(type1->_class->registered->dataType)
13012 type1->_class->registered->dataType->refCount++;
13013 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13014 exp->expType = type1;
13015 if(type1)
13016 type1->refCount++;
13017 }
13018 else if(type1)
13019 {
13020 unsigned int valid = 0x0;
13021
13022 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
13023 {
13024 if(exp->op.exp2->destType)
13025 FreeType(exp->op.exp2->destType);
13026 if(!type1->_class->registered->dataType)
13027 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
13028 exp->op.exp2->destType = type1->_class->registered->dataType;
13029 exp->op.exp2->destType->refCount++;
13030 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13031 type2 = exp->op.exp2->destType;
13032 exp->expType = type2;
13033 type2->refCount++;
13034 }
13035 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
13036 {
13037 if(exp->op.exp1->destType)
13038 FreeType(exp->op.exp1->destType);
13039 if(!type2->_class->registered->dataType)
13040 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
13041 exp->op.exp1->destType = type2->_class->registered->dataType;
13042 exp->op.exp1->destType->refCount++;
13043 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13044 type1 = exp->op.exp1->destType;
13045 exp->expType = type1;
13046 type1->refCount++;
13047 }
13048 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
13049 {
13050 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
13051 {
13052 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
13053 {
13054 if(exp->expType)
13055 FreeType(exp->expType);
13056 exp->expType = exp->op.exp1->expType;
13057 if(exp->op.exp2->expType)
13058 exp->op.exp1->expType->refCount++;
13059 valid = 0x1;
13060 }
13061 }
13062 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
13063 {
13064 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
13065 {
13066 if(exp->expType)
13067 FreeType(exp->expType);
13068 exp->expType = exp->op.exp2->expType;
13069 if(exp->op.exp2->expType)
13070 exp->op.exp2->expType->refCount++;
13071 valid = 0x1;
13072 }
13073 }
13074 }
13075 if(!valid)
13076 {
13077 if(exp->op.exp2->destType)
13078 FreeType(exp->op.exp2->destType);
13079 exp->op.exp2->destType = type1;
13080 type1->refCount++;
13081 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13082 {
13083 if(exp->expType)
13084 FreeType(exp->expType);
13085 exp->expType = exp->op.exp2->destType;
13086 if(exp->op.exp2->destType)
13087 exp->op.exp2->destType->refCount++;
13088 }
13089 else if(type1 && type2)
13090 {
13091 char expString1[10240];
13092 char expString2[10240];
13093 char type1String[1024];
13094 char type2String[1024];
13095
13096 expString1[0] = '\0';
13097 expString2[0] = '\0';
13098 type1String[0] = '\0';
13099 type2String[0] = '\0';
13100 if(inCompiler)
13101 {
13102 PrintExpression(exp->op.exp1, expString1);
13103 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13104 PrintExpression(exp->op.exp2, expString2);
13105 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13106 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
13107 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
13108 }
13109 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
13110 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
13111 {
13112 exp->expType = exp->op.exp1->expType;
13113 if(exp->op.exp1->expType)
13114 exp->op.exp1->expType->refCount++;
13115 }
13116 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13117 {
13118 exp->expType = exp->op.exp2->expType;
13119 if(exp->op.exp2->expType)
13120 exp->op.exp2->expType->refCount++;
13121 }
13122 }
13123 }
13124 }
13125 else if(type2)
13126 {
13127 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13128 {
13129 struct Type * oldType = exp->op.exp1->expType;
13130
13131 exp->op.exp1->expType = (((void *)0));
13132 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13133 FreeType(oldType);
13134 else
13135 exp->op.exp1->expType = oldType;
13136 }
13137 if(exp->op.exp1->destType)
13138 FreeType(exp->op.exp1->destType);
13139 exp->op.exp1->destType = type2;
13140 type2->refCount++;
13141 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13142 {
13143 if(exp->expType)
13144 FreeType(exp->expType);
13145 exp->expType = exp->op.exp1->destType;
13146 if(exp->op.exp1->destType)
13147 exp->op.exp1->destType->refCount++;
13148 }
13149 }
13150 }
13151 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
13152 {
13153 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13154 {
13155 if(exp->op.exp1->destType)
13156 FreeType(exp->op.exp1->destType);
13157 exp->op.exp1->destType = type2->_class->registered->dataType;
13158 if(type2->_class->registered->dataType)
13159 type2->_class->registered->dataType->refCount++;
13160 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13161 }
13162 if(exp->op.op == '!')
13163 {
13164 exp->expType = MkClassType("bool");
13165 exp->expType->truth = 0x1;
13166 }
13167 else
13168 {
13169 exp->expType = type2;
13170 if(type2)
13171 type2->refCount++;
13172 }
13173 }
13174 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
13175 {
13176 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13177 {
13178 if(exp->op.exp2->destType)
13179 FreeType(exp->op.exp2->destType);
13180 exp->op.exp2->destType = type1->_class->registered->dataType;
13181 if(type1->_class->registered->dataType)
13182 type1->_class->registered->dataType->refCount++;
13183 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13184 }
13185 exp->expType = type1;
13186 if(type1)
13187 type1->refCount++;
13188 }
13189 }
13190 yylloc = exp->loc;
13191 if(exp->op.exp1 && !exp->op.exp1->expType)
13192 {
13193 char expString[10000];
13194
13195 expString[0] = '\0';
13196 if(inCompiler)
13197 {
13198 PrintExpression(exp->op.exp1, expString);
13199 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13200 }
13201 if(expString[0])
13202 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13203 }
13204 if(exp->op.exp2 && !exp->op.exp2->expType)
13205 {
13206 char expString[10240];
13207
13208 expString[0] = '\0';
13209 if(inCompiler)
13210 {
13211 PrintExpression(exp->op.exp2, expString);
13212 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13213 }
13214 if(expString[0])
13215 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13216 }
13217 if(boolResult)
13218 {
13219 FreeType(exp->expType);
13220 exp->expType = MkClassType("bool");
13221 exp->expType->truth = 0x1;
13222 }
13223 if(exp->op.op != SIZEOF)
13224 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
13225 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
13226 {
13227 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
13228 }
13229 yylloc = oldyylloc;
13230 FreeType(dummy);
13231 break;
13232 }
13233 case 5:
13234 case 34:
13235 {
13236 struct Expression * e;
13237
13238 exp->isConstant = 0x1;
13239 for(e = (*exp->list).first; e; e = e->next)
13240 {
13241 unsigned int inced = 0x0;
13242
13243 if(!e->next)
13244 {
13245 FreeType(e->destType);
13246 e->destType = exp->destType;
13247 if(e->destType)
13248 {
13249 exp->destType->refCount++;
13250 e->destType->count++;
13251 inced = 0x1;
13252 }
13253 }
13254 ProcessExpressionType(e);
13255 if(inced)
13256 exp->destType->count--;
13257 if(!exp->expType && !e->next)
13258 {
13259 exp->expType = e->expType;
13260 if(e->expType)
13261 e->expType->refCount++;
13262 }
13263 if(!e->isConstant)
13264 exp->isConstant = 0x0;
13265 }
13266 e = (*exp->list).first;
13267 if(!e->next && e->type == 8)
13268 {
13269 struct Expression * next = exp->next, * prev = exp->prev;
13270
13271 FreeType(exp->expType);
13272 FreeType(exp->destType);
13273 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
13274 *exp = *e;
13275 exp->prev = prev;
13276 exp->next = next;
13277 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
13278 ProcessExpressionType(exp);
13279 }
13280 break;
13281 }
13282 case 6:
13283 {
13284 struct Expression * e;
13285
13286 exp->isConstant = 0x1;
13287 ProcessExpressionType(exp->index.exp);
13288 if(!exp->index.exp->isConstant)
13289 exp->isConstant = 0x0;
13290 if(exp->index.exp->expType)
13291 {
13292 struct Type * source = exp->index.exp->expType;
13293
13294 if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass) && source->_class->registered->templateArgs)
13295 {
13296 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
13297
13298 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
13299 if(exp->index.index && (*exp->index.index).last)
13300 {
13301 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
13302 }
13303 }
13304 }
13305 for(e = (*exp->index.index).first; e; e = e->next)
13306 {
13307 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
13308 {
13309 if(e->destType)
13310 FreeType(e->destType);
13311 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
13312 }
13313 ProcessExpressionType(e);
13314 if(!e->next)
13315 {
13316 }
13317 if(!e->isConstant)
13318 exp->isConstant = 0x0;
13319 }
13320 if(!exp->expType)
13321 exp->expType = Dereference(exp->index.exp->expType);
13322 if(exp->expType)
13323 DeclareType(exp->expType, 0x0, 0x0);
13324 break;
13325 }
13326 case 7:
13327 {
13328 struct Expression * e;
13329 struct Type * functionType;
13330 struct Type * methodType = (((void *)0));
13331 char name[1024];
13332
13333 name[0] = '\0';
13334 if(inCompiler)
13335 {
13336 PrintExpression(exp->call.exp, name);
13337 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
13338 {
13339 PrintExpression(exp->call.exp, name);
13340 }
13341 }
13342 if(exp->call.exp->type == 0)
13343 {
13344 struct Expression * idExp = exp->call.exp;
13345 struct Identifier * id = idExp->identifier;
13346
13347 if(!strcmp(id->string, "__builtin_frame_address"))
13348 {
13349 exp->expType = ProcessTypeString("void *", 0x1);
13350 if(exp->call.arguments && (*exp->call.arguments).first)
13351 ProcessExpressionType((*exp->call.arguments).first);
13352 break;
13353 }
13354 else if(!strcmp(id->string, "__ENDIAN_PAD"))
13355 {
13356 exp->expType = ProcessTypeString("int", 0x1);
13357 if(exp->call.arguments && (*exp->call.arguments).first)
13358 ProcessExpressionType((*exp->call.arguments).first);
13359 break;
13360 }
13361 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
13362 {
13363 struct Expression * a = (((void *)0));
13364 struct Expression * b = (((void *)0));
13365 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
13366
13367 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
13368 {
13369 a = (*exp->call.arguments).first;
13370 b = (*exp->call.arguments).last;
13371 tempExp1 = a;
13372 tempExp2 = b;
13373 }
13374 else if((*exp->call.arguments).count == 1)
13375 {
13376 a = (*exp->call.arguments).first;
13377 tempExp1 = a;
13378 }
13379 if(a)
13380 {
13381 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
13382 idExp->identifier = (((void *)0));
13383 FreeExpContents(exp);
13384 ProcessExpressionType(a);
13385 if(b)
13386 ProcessExpressionType(b);
13387 exp->type = 5;
13388 exp->list = MkList();
13389 if(a->expType && (!b || b->expType))
13390 {
13391 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
13392 {
13393 if(inCompiler)
13394 {
13395 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13396 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
13397 struct Declaration * decl;
13398 char temp1[1024], temp2[1024];
13399
13400 GetTypeSpecs(a->expType, specs);
13401 if(a && !a->isConstant && a->type != 0)
13402 {
13403 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
13404 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
13405 tempExp1 = QMkExpId(temp1);
13406 tempExp1->expType = a->expType;
13407 if(a->expType)
13408 a->expType->refCount++;
13409 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
13410 }
13411 if(b && !b->isConstant && b->type != 0)
13412 {
13413 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
13414 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
13415 tempExp2 = QMkExpId(temp2);
13416 tempExp2->expType = b->expType;
13417 if(b->expType)
13418 b->expType->refCount++;
13419 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
13420 }
13421 decl = MkDeclaration(specs, decls);
13422 if(!curCompound->compound.declarations)
13423 curCompound->compound.declarations = MkList();
13424 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
13425 }
13426 }
13427 }
13428 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13429 {
13430 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13431
13432 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13433 exp->expType = a->expType;
13434 if(a->expType)
13435 a->expType->refCount++;
13436 }
13437 else if(!strcmp(id->string, "Abs"))
13438 {
13439 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13440 exp->expType = a->expType;
13441 if(a->expType)
13442 a->expType->refCount++;
13443 }
13444 else if(!strcmp(id->string, "Sgn"))
13445 {
13446 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"))))));
13447 exp->expType = ProcessTypeString("int", 0x0);
13448 }
13449 FreeExpression(tempExp1);
13450 if(tempExp2)
13451 FreeExpression(tempExp2);
13452 FreeIdentifier(id);
13453 break;
13454 }
13455 }
13456 }
13457 {
13458 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
13459
13460 if(!exp->call.exp->destType)
13461 {
13462 exp->call.exp->destType = dummy;
13463 dummy->refCount++;
13464 }
13465 ProcessExpressionType(exp->call.exp);
13466 if(exp->call.exp->destType == dummy)
13467 {
13468 FreeType(dummy);
13469 exp->call.exp->destType = (((void *)0));
13470 }
13471 FreeType(dummy);
13472 }
13473 functionType = exp->call.exp->expType;
13474 if(functionType && functionType->kind == 16)
13475 {
13476 methodType = functionType;
13477 functionType = methodType->method->dataType;
13478 if(exp->call.exp->expType->usedClass)
13479 {
13480 char typeString[1024];
13481
13482 typeString[0] = '\0';
13483 PrintType(functionType, typeString, 0x1, 0x1);
13484 if(strstr(typeString, "thisclass"))
13485 {
13486 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13487 struct Declarator * decl;
13488
13489 {
13490 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13491
13492 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13493 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13494 thisClassParams = 0x0;
13495 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13496 {
13497 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13498
13499 thisClass = exp->call.exp->expType->usedClass;
13500 ProcessDeclarator(decl);
13501 thisClass = backupThisClass;
13502 }
13503 thisClassParams = 0x1;
13504 functionType = ProcessType(specs, decl);
13505 functionType->refCount = 0;
13506 FinishTemplatesContext(context);
13507 }
13508 FreeList(specs, FreeSpecifier);
13509 FreeDeclarator(decl);
13510 }
13511 }
13512 }
13513 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13514 {
13515 struct Type * type = functionType->type;
13516
13517 if(!functionType->refCount)
13518 {
13519 functionType->type = (((void *)0));
13520 FreeType(functionType);
13521 }
13522 functionType = type;
13523 }
13524 if(functionType && functionType->kind != 11)
13525 {
13526 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13527 }
13528 else if(functionType)
13529 {
13530 unsigned int emptyParams = 0x0, noParams = 0x0;
13531 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13532 struct Type * type = functionType->params.first;
13533 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13534 int extra = 0;
13535 struct Location oldyylloc = yylloc;
13536
13537 if(!type)
13538 emptyParams = 0x1;
13539 if(functionType->extraParam && e && functionType->thisClass)
13540 {
13541 e->destType = MkClassType(functionType->thisClass->string);
13542 e = e->next;
13543 }
13544 if(!functionType->staticMethod)
13545 {
13546 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13547 {
13548 type = MkClassType(memberExp->member.exp->expType->_class->string);
13549 if(e)
13550 {
13551 e->destType = type;
13552 e = e->next;
13553 type = functionType->params.first;
13554 }
13555 else
13556 type->refCount = 0;
13557 }
13558 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13559 {
13560 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13561 if(e)
13562 {
13563 e->destType = type;
13564 e = e->next;
13565 type = functionType->params.first;
13566 }
13567 else
13568 type->refCount = 0;
13569 }
13570 }
13571 if(type && type->kind == 0)
13572 {
13573 noParams = 0x1;
13574 if(!type->refCount)
13575 FreeType(type);
13576 type = (((void *)0));
13577 }
13578 for(; e; e = e->next)
13579 {
13580 if(!type && !emptyParams)
13581 {
13582 yylloc = e->loc;
13583 if(methodType && methodType->methodClass)
13584 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);
13585 else
13586 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);
13587 break;
13588 }
13589 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13590 {
13591 struct Type * templatedType = (((void *)0));
13592 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13593 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13594 int id = 0;
13595
13596 if(_class && _class->templateArgs)
13597 {
13598 struct __ecereNameSpace__ecere__com__Class * sClass;
13599
13600 for(sClass = _class; sClass; sClass = sClass->base)
13601 {
13602 if(sClass->templateClass)
13603 sClass = sClass->templateClass;
13604 id = 0;
13605 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13606 {
13607 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13608 {
13609 struct __ecereNameSpace__ecere__com__Class * nextClass;
13610
13611 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13612 {
13613 if(nextClass->templateClass)
13614 nextClass = nextClass->templateClass;
13615 id += nextClass->templateParams.count;
13616 }
13617 break;
13618 }
13619 id++;
13620 }
13621 if(curParam)
13622 break;
13623 }
13624 }
13625 if(curParam && _class->templateArgs[id].dataTypeString)
13626 {
13627 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13628
13629 {
13630 struct Context * context = SetupTemplatesContext(_class);
13631
13632 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13633 FinishTemplatesContext(context);
13634 }
13635 e->destType = templatedType;
13636 if(templatedType)
13637 {
13638 templatedType->passAsTemplate = 0x1;
13639 }
13640 }
13641 else
13642 {
13643 e->destType = type;
13644 if(type)
13645 type->refCount++;
13646 }
13647 }
13648 else
13649 {
13650 if(type && type->kind == 14 && type->prev && type->prev->kind == 8 && type->prev->classObjectType)
13651 {
13652 e->destType = type->prev;
13653 e->destType->refCount++;
13654 }
13655 else
13656 {
13657 e->destType = type;
13658 if(type)
13659 type->refCount++;
13660 }
13661 }
13662 if(type && type->kind != 14)
13663 {
13664 struct Type * next = type->next;
13665
13666 if(!type->refCount)
13667 FreeType(type);
13668 type = next;
13669 }
13670 }
13671 if(type && type->kind != 14)
13672 {
13673 if(methodType && methodType->methodClass)
13674 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);
13675 else
13676 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);
13677 }
13678 yylloc = oldyylloc;
13679 if(type && !type->refCount)
13680 FreeType(type);
13681 }
13682 else
13683 {
13684 functionType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 0, ((struct Type *)__ecereTemp1)->kind = 11, ((struct Type *)__ecereTemp1));
13685 if(exp->call.exp->type == 0)
13686 {
13687 char * string = exp->call.exp->identifier->string;
13688
13689 if(inCompiler)
13690 {
13691 struct Symbol * symbol;
13692 struct Location oldyylloc = yylloc;
13693
13694 yylloc = exp->call.exp->identifier->loc;
13695 if(strstr(string, "__builtin_") == string)
13696 ;
13697 else
13698 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13699 symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->string = __ecereNameSpace__ecere__sys__CopyString(string), ((struct Symbol *)__ecereTemp1)->type = ProcessTypeString("int()", 0x1), ((struct Symbol *)__ecereTemp1));
13700 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13701 if(strstr(symbol->string, "::"))
13702 globalContext->hasNameSpace = 0x1;
13703 yylloc = oldyylloc;
13704 }
13705 }
13706 else if(exp->call.exp->type == 8)
13707 {
13708 }
13709 else
13710 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13711 if(!functionType->returnType)
13712 {
13713 functionType->returnType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
13714 }
13715 }
13716 if(functionType && functionType->kind == 11)
13717 {
13718 exp->expType = functionType->returnType;
13719 if(functionType->returnType)
13720 functionType->returnType->refCount++;
13721 if(!functionType->refCount)
13722 FreeType(functionType);
13723 }
13724 if(exp->call.arguments)
13725 {
13726 for(e = (*exp->call.arguments).first; e; e = e->next)
13727 {
13728 struct Type * destType = e->destType;
13729
13730 ProcessExpressionType(e);
13731 }
13732 }
13733 break;
13734 }
13735 case 8:
13736 {
13737 struct Type * type;
13738 struct Location oldyylloc = yylloc;
13739 unsigned int thisPtr = (exp->member.exp && exp->member.exp->type == 0 && !strcmp(exp->member.exp->identifier->string, "this"));
13740
13741 exp->thisPtr = thisPtr;
13742 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13743 {
13744 exp->member.member->classSym = exp->member.member->_class->symbol;
13745 }
13746 ProcessExpressionType(exp->member.exp);
13747 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)
13748 {
13749 exp->isConstant = 0x0;
13750 }
13751 else
13752 exp->isConstant = exp->member.exp->isConstant;
13753 type = exp->member.exp->expType;
13754 yylloc = exp->loc;
13755 if(type && (type->kind == 20))
13756 {
13757 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13758 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13759
13760 if(_class)
13761 {
13762 for(param = _class->templateParams.first; param; param = param->next)
13763 {
13764 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
13765 break;
13766 }
13767 }
13768 if(param && param->defaultArg.member)
13769 {
13770 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
13771
13772 if(argExp)
13773 {
13774 struct Expression * expMember = exp->member.exp;
13775 struct Declarator * decl;
13776 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13777 char thisClassTypeString[1024];
13778
13779 FreeIdentifier(exp->member.member);
13780 ProcessExpressionType(argExp);
13781 {
13782 char * colon = strstr(param->defaultArg.memberString, "::");
13783
13784 if(colon)
13785 {
13786 char className[1024];
13787 struct __ecereNameSpace__ecere__com__Class * sClass;
13788
13789 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
13790 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
13791 }
13792 else
13793 strcpy(thisClassTypeString, _class->fullName);
13794 }
13795 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
13796 exp->expType = ProcessType(specs, decl);
13797 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
13798 {
13799 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13800 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13801 int c;
13802 int paramCount = 0;
13803 int lastParam = -1;
13804 char templateString[1024];
13805 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13806
13807 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13808 for(cClass = expClass; cClass; cClass = cClass->base)
13809 {
13810 int p = 0;
13811
13812 for(param = cClass->templateParams.first; param; param = param->next)
13813 {
13814 int id = p;
13815 struct __ecereNameSpace__ecere__com__Class * sClass;
13816 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13817
13818 for(sClass = cClass->base; sClass; sClass = sClass->base)
13819 id += sClass->templateParams.count;
13820 arg = expClass->templateArgs[id];
13821 for(sClass = _class; sClass; sClass = sClass->base)
13822 {
13823 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
13824 int p = 0;
13825 struct __ecereNameSpace__ecere__com__Class * nextClass;
13826
13827 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13828 p += nextClass->templateParams.count;
13829 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
13830 {
13831 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
13832 {
13833 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13834 {
13835 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
13836 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
13837 break;
13838 }
13839 }
13840 }
13841 }
13842 {
13843 char argument[256];
13844
13845 argument[0] = '\0';
13846 switch(param->type)
13847 {
13848 case 2:
13849 {
13850 char expString[1024];
13851 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13852 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13853 struct Expression * exp;
13854 char * string = PrintHexUInt64(arg.expression.ui64);
13855
13856 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13857 ProcessExpressionType(exp);
13858 ComputeExpression(exp);
13859 expString[0] = '\0';
13860 PrintExpression(exp, expString);
13861 strcat(argument, expString);
13862 FreeExpression(exp);
13863 break;
13864 }
13865 case 1:
13866 {
13867 strcat(argument, arg.member->name);
13868 break;
13869 }
13870 case 0:
13871 {
13872 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13873 {
13874 if(!strcmp(arg.dataTypeString, "thisclass"))
13875 strcat(argument, thisClassTypeString);
13876 else
13877 strcat(argument, arg.dataTypeString);
13878 }
13879 break;
13880 }
13881 }
13882 if(argument[0])
13883 {
13884 if(paramCount)
13885 strcat(templateString, ", ");
13886 if(lastParam != p - 1)
13887 {
13888 strcat(templateString, param->name);
13889 strcat(templateString, " = ");
13890 }
13891 strcat(templateString, argument);
13892 paramCount++;
13893 lastParam = p;
13894 }
13895 p++;
13896 }
13897 }
13898 }
13899 {
13900 int len = strlen(templateString);
13901
13902 if(templateString[len - 1] == '>')
13903 templateString[len++] = ' ';
13904 templateString[len++] = '>';
13905 templateString[len++] = '\0';
13906 }
13907 {
13908 struct Context * context = SetupTemplatesContext(_class);
13909
13910 FreeType(exp->expType);
13911 exp->expType = ProcessTypeString(templateString, 0x0);
13912 FinishTemplatesContext(context);
13913 }
13914 }
13915 exp->type = 5;
13916 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")))))))));
13917 }
13918 }
13919 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
13920 {
13921 type = ProcessTemplateParameterType(type->templateParameter);
13922 }
13923 }
13924 if(type && (type->kind == 20))
13925 ;
13926 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13927 {
13928 struct Identifier * id = exp->member.member;
13929 int typeKind = type->kind;
13930 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));
13931
13932 if(typeKind == 19 && exp->member.exp->type == 26)
13933 {
13934 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
13935 typeKind = 8;
13936 }
13937 if(id && (typeKind == 3 || typeKind == 15))
13938 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
13939 if(_class && id)
13940 {
13941 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
13942 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
13943 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
13944 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
13945 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
13946
13947 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
13948 exp->member.memberType = 1;
13949 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
13950 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
13951 if(typeKind != 19)
13952 {
13953 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
13954 {
13955 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13956 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
13957 {
13958 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13959 if(prop)
13960 member = (((void *)0));
13961 }
13962 if(!member && !prop)
13963 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13964 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
13965 exp->member.thisPtr = 0x1;
13966 }
13967 else
13968 {
13969 if(!id->classSym)
13970 {
13971 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
13972 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13973 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
13974 }
13975 if(!prop && !member)
13976 {
13977 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
13978 if(!method)
13979 {
13980 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13981 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13982 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13983 }
13984 }
13985 if(member && prop)
13986 {
13987 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
13988 prop = (((void *)0));
13989 else
13990 member = (((void *)0));
13991 }
13992 }
13993 }
13994 if(!prop && !member)
13995 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
13996 if(!prop && !member && !method)
13997 {
13998 if(typeKind == 19)
13999 {
14000 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
14001 if(classProp)
14002 {
14003 exp->member.memberType = 5;
14004 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
14005 }
14006 else
14007 {
14008 char structName[1024];
14009 struct Identifier * id = exp->member.member;
14010 struct Expression * classExp = exp->member.exp;
14011
14012 type->refCount++;
14013 FreeType(classExp->expType);
14014 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
14015 strcpy(structName, "__ecereClassData_");
14016 FullClassNameCat(structName, type->_class->string, 0x0);
14017 exp->type = 9;
14018 exp->member.member = id;
14019 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"))))))));
14020 FreeType(type);
14021 ProcessExpressionType(exp);
14022 return ;
14023 }
14024 }
14025 else
14026 {
14027 struct Symbol * classSym = FindClass(id->string);
14028
14029 if(classSym)
14030 {
14031 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
14032
14033 if(convertClass)
14034 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
14035 }
14036 }
14037 }
14038 if(prop)
14039 {
14040 exp->member.memberType = 1;
14041 if(!prop->dataType)
14042 ProcessPropertyType(prop);
14043 exp->expType = prop->dataType;
14044 if(prop->dataType)
14045 prop->dataType->refCount++;
14046 }
14047 else if(member)
14048 {
14049 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14050 {
14051 FreeExpContents(exp);
14052 exp->type = 0;
14053 exp->identifier = MkIdentifier("class");
14054 ProcessExpressionType(exp);
14055 return ;
14056 }
14057 exp->member.memberType = 3;
14058 DeclareStruct(_class->fullName, 0x0);
14059 if(!member->dataType)
14060 {
14061 struct Context * context = SetupTemplatesContext(_class);
14062
14063 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
14064 FinishTemplatesContext(context);
14065 }
14066 exp->expType = member->dataType;
14067 if(member->dataType)
14068 member->dataType->refCount++;
14069 }
14070 else if(revConvert)
14071 {
14072 exp->member.memberType = 4;
14073 exp->expType = MkClassType(revConvert->_class->fullName);
14074 }
14075 else if(method)
14076 {
14077 if(inCompiler)
14078 {
14079 exp->member.memberType = 2;
14080 }
14081 if(!method->dataType)
14082 ProcessMethodType(method);
14083 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 16, ((struct Type *)__ecereTemp1)->method = method, ((struct Type *)__ecereTemp1));
14084 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
14085 exp->expType->usedClass = _class;
14086 }
14087 else if(!classProp)
14088 {
14089 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14090 {
14091 FreeExpContents(exp);
14092 exp->type = 0;
14093 exp->identifier = MkIdentifier("class");
14094 ProcessExpressionType(exp);
14095 return ;
14096 }
14097 yylloc = exp->member.member->loc;
14098 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
14099 if(inCompiler)
14100 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
14101 }
14102 if(_class && exp->expType)
14103 {
14104 struct __ecereNameSpace__ecere__com__Class * tClass;
14105
14106 tClass = _class;
14107 while(tClass && !tClass->templateClass)
14108 tClass = tClass->base;
14109 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
14110 {
14111 int id = 0;
14112 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14113 struct __ecereNameSpace__ecere__com__Class * sClass;
14114
14115 for(sClass = tClass; sClass; sClass = sClass->base)
14116 {
14117 id = 0;
14118 if(sClass->templateClass)
14119 sClass = sClass->templateClass;
14120 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14121 {
14122 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
14123 {
14124 for(sClass = sClass->base; sClass; sClass = sClass->base)
14125 id += sClass->templateParams.count;
14126 break;
14127 }
14128 id++;
14129 }
14130 if(curParam)
14131 break;
14132 }
14133 if(curParam && tClass->templateArgs[id].dataTypeString)
14134 {
14135 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14136 struct Context * context = SetupTemplatesContext(tClass);
14137
14138 FreeType(exp->expType);
14139 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
14140 if(exp->expType)
14141 {
14142 if(exp->expType->kind == 21)
14143 {
14144 FreeType(exp->expType);
14145 exp->expType = ReplaceThisClassType(_class);
14146 }
14147 if(tClass->templateClass)
14148 exp->expType->passAsTemplate = 0x1;
14149 if(!exp->destType)
14150 {
14151 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
14152 if(exp->destType->kind == 21)
14153 {
14154 FreeType(exp->destType);
14155 exp->destType = ReplaceThisClassType(_class);
14156 }
14157 }
14158 }
14159 FinishTemplatesContext(context);
14160 }
14161 }
14162 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
14163 {
14164 int id = 0;
14165 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14166 struct __ecereNameSpace__ecere__com__Class * sClass;
14167
14168 for(sClass = tClass; sClass; sClass = sClass->base)
14169 {
14170 id = 0;
14171 if(sClass->templateClass)
14172 sClass = sClass->templateClass;
14173 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14174 {
14175 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
14176 {
14177 for(sClass = sClass->base; sClass; sClass = sClass->base)
14178 id += sClass->templateParams.count;
14179 break;
14180 }
14181 id++;
14182 }
14183 if(curParam)
14184 break;
14185 }
14186 if(curParam)
14187 {
14188 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14189 struct Context * context = SetupTemplatesContext(tClass);
14190 struct Type * basicType;
14191
14192 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
14193 if(basicType)
14194 {
14195 if(basicType->kind == 21)
14196 {
14197 FreeType(basicType);
14198 basicType = ReplaceThisClassType(_class);
14199 }
14200 FreeType(exp->expType);
14201 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = basicType, ((struct Type *)__ecereTemp1));
14202 if(!exp->destType)
14203 {
14204 exp->destType = exp->expType;
14205 exp->destType->refCount++;
14206 }
14207 {
14208 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14209 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14210 struct Declarator * decl;
14211
14212 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
14213 *newExp = *exp;
14214 if(exp->destType)
14215 exp->destType->refCount++;
14216 if(exp->expType)
14217 exp->expType->refCount++;
14218 exp->type = 11;
14219 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
14220 exp->cast.exp = newExp;
14221 }
14222 }
14223 FinishTemplatesContext(context);
14224 }
14225 }
14226 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
14227 {
14228 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
14229
14230 if(expClass)
14231 {
14232 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
14233 int c;
14234 int p = 0;
14235 int paramCount = 0;
14236 int lastParam = -1;
14237 char templateString[1024];
14238 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
14239
14240 sprintf(templateString, "%s<", expClass->templateClass->fullName);
14241 while(cClass != expClass)
14242 {
14243 struct __ecereNameSpace__ecere__com__Class * sClass;
14244
14245 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
14246 ;
14247 cClass = sClass;
14248 for(param = cClass->templateParams.first; param; param = param->next)
14249 {
14250 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
14251 int c;
14252 int cp = 0;
14253 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
14254 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
14255
14256 while(cClassCur != tClass && !paramCur)
14257 {
14258 struct __ecereNameSpace__ecere__com__Class * sClassCur;
14259
14260 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
14261 ;
14262 cClassCur = sClassCur;
14263 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
14264 {
14265 if(!strcmp(paramCur->name, param->name))
14266 {
14267 break;
14268 }
14269 cp++;
14270 }
14271 }
14272 if(paramCur && paramCur->type == 0)
14273 arg = tClass->templateArgs[cp];
14274 else
14275 arg = expClass->templateArgs[p];
14276 {
14277 char argument[256];
14278
14279 argument[0] = '\0';
14280 switch(param->type)
14281 {
14282 case 2:
14283 {
14284 char expString[1024];
14285 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14286 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14287 struct Expression * exp;
14288 char * string = PrintHexUInt64(arg.expression.ui64);
14289
14290 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14291 ProcessExpressionType(exp);
14292 ComputeExpression(exp);
14293 expString[0] = '\0';
14294 PrintExpression(exp, expString);
14295 strcat(argument, expString);
14296 FreeExpression(exp);
14297 break;
14298 }
14299 case 1:
14300 {
14301 strcat(argument, arg.member->name);
14302 break;
14303 }
14304 case 0:
14305 {
14306 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14307 strcat(argument, arg.dataTypeString);
14308 break;
14309 }
14310 }
14311 if(argument[0])
14312 {
14313 if(paramCount)
14314 strcat(templateString, ", ");
14315 if(lastParam != p - 1)
14316 {
14317 strcat(templateString, param->name);
14318 strcat(templateString, " = ");
14319 }
14320 strcat(templateString, argument);
14321 paramCount++;
14322 lastParam = p;
14323 }
14324 }
14325 p++;
14326 }
14327 }
14328 {
14329 int len = strlen(templateString);
14330
14331 if(templateString[len - 1] == '>')
14332 templateString[len++] = ' ';
14333 templateString[len++] = '>';
14334 templateString[len++] = '\0';
14335 }
14336 FreeType(exp->expType);
14337 {
14338 struct Context * context = SetupTemplatesContext(tClass);
14339
14340 exp->expType = ProcessTypeString(templateString, 0x0);
14341 FinishTemplatesContext(context);
14342 }
14343 }
14344 }
14345 }
14346 }
14347 else
14348 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)");
14349 }
14350 else if(type && (type->kind == 9 || type->kind == 10))
14351 {
14352 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
14353
14354 if(memberType)
14355 {
14356 exp->expType = memberType;
14357 if(memberType)
14358 memberType->refCount++;
14359 }
14360 }
14361 else
14362 {
14363 char expString[10240];
14364
14365 expString[0] = '\0';
14366 if(inCompiler)
14367 {
14368 PrintExpression(exp, expString);
14369 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14370 }
14371 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
14372 }
14373 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
14374 {
14375 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
14376 {
14377 struct Identifier * id = exp->member.member;
14378 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));
14379
14380 if(_class)
14381 {
14382 FreeType(exp->expType);
14383 exp->expType = ReplaceThisClassType(_class);
14384 }
14385 }
14386 }
14387 yylloc = oldyylloc;
14388 break;
14389 }
14390 case 9:
14391 {
14392 struct Type * destType = exp->destType;
14393
14394 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
14395 {
14396 exp->member.member->classSym = exp->member.member->_class->symbol;
14397 }
14398 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
14399 exp->type = 8;
14400 if(destType)
14401 destType->count++;
14402 ProcessExpressionType(exp);
14403 if(destType)
14404 destType->count--;
14405 break;
14406 }
14407 case 15:
14408 {
14409 struct Symbol * classSym = exp->_class->symbol;
14410
14411 if(classSym && classSym->registered)
14412 {
14413 if(classSym->registered->type == 5)
14414 {
14415 char name[1024];
14416
14417 name[0] = '\0';
14418 DeclareStruct(classSym->string, 0x0);
14419 FreeSpecifier(exp->_class);
14420 exp->type = 10;
14421 FullClassNameCat(name, classSym->string, 0x0);
14422 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
14423 }
14424 else
14425 {
14426 if(classSym->registered->fixed)
14427 {
14428 FreeSpecifier(exp->_class);
14429 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
14430 exp->type = 2;
14431 }
14432 else
14433 {
14434 char className[1024];
14435
14436 strcpy(className, "__ecereClass_");
14437 FullClassNameCat(className, classSym->string, 0x1);
14438 MangleClassName(className);
14439 DeclareClass(classSym, className);
14440 FreeExpContents(exp);
14441 exp->type = 9;
14442 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14443 exp->member.member = MkIdentifier("structSize");
14444 }
14445 }
14446 }
14447 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14448 break;
14449 }
14450 case 10:
14451 {
14452 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
14453
14454 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14455 exp->isConstant = 0x1;
14456 DeclareType(type, 0x0, 0x0);
14457 FreeType(type);
14458 break;
14459 }
14460 case 11:
14461 {
14462 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14463
14464 type->count = (unsigned int)1;
14465 FreeType(exp->cast.exp->destType);
14466 exp->cast.exp->destType = type;
14467 type->refCount++;
14468 ProcessExpressionType(exp->cast.exp);
14469 type->count = (unsigned int)0;
14470 exp->expType = type;
14471 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14472 {
14473 void * prev = exp->prev, * next = exp->next;
14474 struct Type * expType = exp->cast.exp->destType;
14475 struct Expression * castExp = exp->cast.exp;
14476 struct Type * destType = exp->destType;
14477
14478 if(expType)
14479 expType->refCount++;
14480 FreeType(exp->expType);
14481 FreeTypeName(exp->cast.typeName);
14482 *exp = *castExp;
14483 FreeType(exp->expType);
14484 FreeType(exp->destType);
14485 exp->expType = expType;
14486 exp->destType = destType;
14487 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14488 exp->prev = prev;
14489 exp->next = next;
14490 }
14491 else
14492 {
14493 exp->isConstant = exp->cast.exp->isConstant;
14494 }
14495 break;
14496 }
14497 case 35:
14498 {
14499 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14500
14501 type->refCount++;
14502 exp->expType = type;
14503 break;
14504 }
14505 case 36:
14506 {
14507 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14508
14509 ProcessExpressionType(exp->vaArg.exp);
14510 type->refCount++;
14511 exp->expType = type;
14512 break;
14513 }
14514 case 12:
14515 {
14516 struct Expression * e;
14517
14518 exp->isConstant = 0x1;
14519 FreeType(exp->cond.cond->destType);
14520 exp->cond.cond->destType = MkClassType("bool");
14521 exp->cond.cond->destType->truth = 0x1;
14522 ProcessExpressionType(exp->cond.cond);
14523 if(!exp->cond.cond->isConstant)
14524 exp->isConstant = 0x0;
14525 for(e = (*exp->cond.exp).first; e; e = e->next)
14526 {
14527 if(!e->next)
14528 {
14529 FreeType(e->destType);
14530 e->destType = exp->destType;
14531 if(e->destType)
14532 e->destType->refCount++;
14533 }
14534 ProcessExpressionType(e);
14535 if(!e->next)
14536 {
14537 exp->expType = e->expType;
14538 if(e->expType)
14539 e->expType->refCount++;
14540 }
14541 if(!e->isConstant)
14542 exp->isConstant = 0x0;
14543 }
14544 FreeType(exp->cond.elseExp->destType);
14545 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14546 if(exp->cond.elseExp->destType)
14547 exp->cond.elseExp->destType->refCount++;
14548 ProcessExpressionType(exp->cond.elseExp);
14549 if(!exp->cond.elseExp->isConstant)
14550 exp->isConstant = 0x0;
14551 break;
14552 }
14553 case 25:
14554 {
14555 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14556 {
14557 struct Statement * last = (*exp->compound->compound.statements).last;
14558
14559 if(last->type == 3 && last->expressions && (*last->expressions).last)
14560 {
14561 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14562 if(exp->destType)
14563 exp->destType->refCount++;
14564 }
14565 ProcessStatement(exp->compound);
14566 exp->expType = ((struct Expression *)(*last->expressions).last)->expType;
14567 if(((struct Expression *)(*last->expressions).last)->expType)
14568 exp->expType->refCount++;
14569 }
14570 break;
14571 }
14572 case 26:
14573 {
14574 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14575
14576 if(spec && spec->type == 1)
14577 {
14578 exp->expType = MkClassType(spec->name);
14579 exp->expType->kind = 19;
14580 exp->byReference = 0x1;
14581 }
14582 else
14583 {
14584 exp->expType = MkClassType("ecere::com::Class");
14585 exp->byReference = 0x1;
14586 }
14587 break;
14588 }
14589 case 27:
14590 {
14591 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14592
14593 if(_class)
14594 {
14595 struct Identifier * id = exp->classData.id;
14596 char structName[1024];
14597 struct Expression * classExp;
14598
14599 strcpy(structName, "__ecereClassData_");
14600 FullClassNameCat(structName, _class->fullName, 0x0);
14601 exp->type = 9;
14602 exp->member.member = id;
14603 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14604 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14605 else
14606 classExp = MkExpIdentifier(MkIdentifier("class"));
14607 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"))))))));
14608 ProcessExpressionType(exp);
14609 return ;
14610 }
14611 break;
14612 }
14613 case 37:
14614 {
14615 struct Type * type = (((void *)0));
14616 char * typeString = (((void *)0));
14617 char typeStringBuf[1024];
14618
14619 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))
14620 {
14621 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14622
14623 typeString = templateClass->templateArgs[2].dataTypeString;
14624 }
14625 else if(exp->list)
14626 {
14627 struct Expression * e;
14628
14629 for(e = (*exp->list).first; e; e = e->next)
14630 {
14631 ProcessExpressionType(e);
14632 if(e->expType)
14633 {
14634 if(!type)
14635 {
14636 type = e->expType;
14637 type->refCount++;
14638 }
14639 else
14640 {
14641 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14642 {
14643 FreeType(type);
14644 type = e->expType;
14645 e->expType = (((void *)0));
14646 e = (*exp->list).first;
14647 ProcessExpressionType(e);
14648 if(e->expType)
14649 {
14650 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14651 {
14652 FreeType(e->expType);
14653 e->expType = (((void *)0));
14654 FreeType(type);
14655 type = (((void *)0));
14656 break;
14657 }
14658 }
14659 }
14660 }
14661 if(e->expType)
14662 {
14663 FreeType(e->expType);
14664 e->expType = (((void *)0));
14665 }
14666 }
14667 }
14668 if(type)
14669 {
14670 typeStringBuf[0] = '\0';
14671 PrintType(type, typeStringBuf, 0x0, 0x1);
14672 typeString = typeStringBuf;
14673 FreeType(type);
14674 type = (((void *)0));
14675 }
14676 }
14677 if(typeString)
14678 {
14679 char templateString[1024];
14680 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14681 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14682 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14683 struct Expression * expExt;
14684 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14685
14686 sprintf(templateString, "Container<%s>", typeString);
14687 if(exp->list)
14688 {
14689 struct Expression * e;
14690
14691 type = ProcessTypeString(typeString, 0x0);
14692 while(e = (*exp->list).first)
14693 {
14694 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14695 e->destType = type;
14696 type->refCount++;
14697 ProcessExpressionType(e);
14698 ListAdd(initializers, MkInitializerAssignment(e));
14699 }
14700 FreeType(type);
14701 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14702 }
14703 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
14704 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
14705 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14706 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
14707 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14708 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
14709 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14710 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
14711 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14712 ListAdd(structInitializers, MkInitializerAssignment((__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression), ((struct Expression *)__ecereTemp1)->type = 2, ((struct Expression *)__ecereTemp1)->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, (void *)0), ((struct Expression *)__ecereTemp1))));
14713 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14714 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
14715 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14716 exp->expType = ProcessTypeString(templateString, 0x0);
14717 exp->type = 5;
14718 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
14719 ProcessExpressionType(expExt);
14720 }
14721 else
14722 {
14723 exp->expType = ProcessTypeString("Container", 0x0);
14724 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
14725 }
14726 break;
14727 }
14728 }
14729 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
14730 {
14731 FreeType(exp->expType);
14732 exp->expType = ReplaceThisClassType(thisClass);
14733 }
14734 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
14735 {
14736 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
14737
14738 if(symbol)
14739 {
14740 if(exp->expType->kind != 15)
14741 {
14742 struct Type * member;
14743 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
14744
14745 FreeType(exp->expType);
14746 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14747 exp->expType->kind = symbol->type->kind;
14748 exp->expType->refCount++;
14749 exp->expType->enumName = enumName;
14750 exp->expType->members = symbol->type->members;
14751 for(member = symbol->type->members.first; member; member = member->next)
14752 member->refCount++;
14753 }
14754 else
14755 {
14756 struct __ecereNameSpace__ecere__sys__NamedLink * member;
14757
14758 for(member = symbol->type->members.first; member; member = member->next)
14759 {
14760 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(structSize_NamedLink), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
14761
14762 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
14763 }
14764 }
14765 }
14766 }
14767 yylloc = exp->loc;
14768 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
14769 ;
14770 else if(exp->destType && !exp->destType->keepCast)
14771 {
14772 if(!CheckExpressionType(exp, exp->destType, 0x0))
14773 {
14774 if(!exp->destType->count || unresolved)
14775 {
14776 if(!exp->expType)
14777 {
14778 yylloc = exp->loc;
14779 if(exp->destType->kind != 14)
14780 {
14781 char type2[1024];
14782
14783 type2[0] = '\0';
14784 if(inCompiler)
14785 {
14786 char expString[10240];
14787
14788 expString[0] = '\0';
14789 PrintType(exp->destType, type2, 0x0, 0x1);
14790 if(inCompiler)
14791 {
14792 PrintExpression(exp, expString);
14793 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14794 }
14795 if(unresolved)
14796 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
14797 else if(exp->type != 16)
14798 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
14799 }
14800 }
14801 else
14802 {
14803 char expString[10240];
14804
14805 expString[0] = '\0';
14806 if(inCompiler)
14807 {
14808 PrintExpression(exp, expString);
14809 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14810 }
14811 if(unresolved)
14812 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
14813 else if(exp->type != 16)
14814 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14815 }
14816 }
14817 else
14818 {
14819 char type1[1024];
14820 char type2[1024];
14821
14822 type1[0] = '\0';
14823 type2[0] = '\0';
14824 if(inCompiler)
14825 {
14826 PrintType(exp->expType, type1, 0x0, 0x1);
14827 PrintType(exp->destType, type2, 0x0, 0x1);
14828 }
14829 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)))
14830 ;
14831 else
14832 {
14833 char expString[10240];
14834
14835 expString[0] = '\0';
14836 if(inCompiler)
14837 {
14838 PrintExpression(exp, expString);
14839 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14840 }
14841 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
14842 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
14843 FreeType(exp->expType);
14844 exp->destType->refCount++;
14845 exp->expType = exp->destType;
14846 }
14847 }
14848 }
14849 }
14850 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
14851 {
14852 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14853 char typeString[1024];
14854 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14855 struct Declarator * decl;
14856
14857 typeString[0] = '\0';
14858 *newExp = *exp;
14859 if(exp->expType)
14860 exp->expType->refCount++;
14861 if(exp->expType)
14862 exp->expType->refCount++;
14863 exp->type = 11;
14864 newExp->destType = exp->expType;
14865 PrintType(exp->expType, typeString, 0x0, 0x0);
14866 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14867 exp->cast.typeName = MkTypeName(specs, decl);
14868 exp->cast.exp = newExp;
14869 }
14870 }
14871 else if(unresolved)
14872 {
14873 if(exp->identifier->_class && exp->identifier->_class->name)
14874 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
14875 else if(exp->identifier->string && exp->identifier->string[0])
14876 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
14877 }
14878 else if(!exp->expType && exp->type != 16)
14879 {
14880 char expString[10240];
14881
14882 expString[0] = '\0';
14883 if(inCompiler)
14884 {
14885 PrintExpression(exp, expString);
14886 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14887 }
14888 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14889 }
14890 ApplyAnyObjectLogic(exp);
14891 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5)
14892 {
14893 exp->byReference = 0x1;
14894 }
14895 yylloc = oldyylloc;
14896 }
14897
14898 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)
14899 {
14900 if(*curMember)
14901 {
14902 *curMember = (*curMember)->next;
14903 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
14904 {
14905 *curMember = subMemberStack[--(*subMemberStackPos)];
14906 *curMember = (*curMember)->next;
14907 }
14908 while((*curMember) && (*curMember)->isProperty)
14909 *curMember = (*curMember)->next;
14910 if(subMemberStackPos)
14911 {
14912 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14913 {
14914 subMemberStack[(*subMemberStackPos)++] = *curMember;
14915 *curMember = (*curMember)->members.first;
14916 while(*curMember && (*curMember)->isProperty)
14917 *curMember = (*curMember)->next;
14918 }
14919 }
14920 }
14921 while(!*curMember)
14922 {
14923 if(!*curMember)
14924 {
14925 if(subMemberStackPos && *subMemberStackPos)
14926 {
14927 *curMember = subMemberStack[--(*subMemberStackPos)];
14928 *curMember = (*curMember)->next;
14929 }
14930 else
14931 {
14932 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
14933
14934 if(*curClass == _class)
14935 break;
14936 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
14937 ;
14938 *curMember = (*curClass)->membersAndProperties.first;
14939 }
14940 while((*curMember) && (*curMember)->isProperty)
14941 *curMember = (*curMember)->next;
14942 if(subMemberStackPos)
14943 {
14944 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14945 {
14946 subMemberStack[(*subMemberStackPos)++] = *curMember;
14947 *curMember = (*curMember)->members.first;
14948 while(*curMember && (*curMember)->isProperty)
14949 *curMember = (*curMember)->next;
14950 }
14951 }
14952 }
14953 }
14954 }
14955
14956 static void ProcessInitializer(struct Initializer * init, struct Type * type)
14957 {
14958 switch(init->type)
14959 {
14960 case 0:
14961 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
14962 {
14963 if(init->exp && !init->exp->destType)
14964 {
14965 FreeType(init->exp->destType);
14966 init->exp->destType = type;
14967 if(type)
14968 type->refCount++;
14969 }
14970 if(init->exp)
14971 {
14972 ProcessExpressionType(init->exp);
14973 init->isConstant = init->exp->isConstant;
14974 }
14975 break;
14976 }
14977 else
14978 {
14979 struct Expression * exp = init->exp;
14980 struct Instantiation * inst = exp->instance;
14981 struct MembersInit * members;
14982
14983 init->type = 1;
14984 init->list = MkList();
14985 if(inst->members)
14986 {
14987 for(members = (*inst->members).first; members; members = members->next)
14988 {
14989 if(members->type == 0)
14990 {
14991 struct MemberInit * member;
14992
14993 for(member = (*members->dataMembers).first; member; member = member->next)
14994 {
14995 ListAdd(init->list, member->initializer);
14996 member->initializer = (((void *)0));
14997 }
14998 }
14999 }
15000 }
15001 FreeExpression(exp);
15002 }
15003 case 1:
15004 {
15005 struct Initializer * i;
15006 struct Type * initializerType = (((void *)0));
15007 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
15008 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
15009 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
15010 int subMemberStackPos = 0;
15011
15012 if(type && type->kind == 12)
15013 initializerType = Dereference(type);
15014 else if(type && (type->kind == 9 || type->kind == 10))
15015 initializerType = type->members.first;
15016 for(i = (*init->list).first; i; i = i->next)
15017 {
15018 if(type && type->kind == 8 && type->_class && type->_class->registered)
15019 {
15020 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
15021 if(curMember)
15022 {
15023 if(!curMember->dataType)
15024 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
15025 initializerType = curMember->dataType;
15026 }
15027 }
15028 ProcessInitializer(i, initializerType);
15029 if(initializerType && type && (type->kind == 9 || type->kind == 10))
15030 initializerType = initializerType->next;
15031 if(!i->isConstant)
15032 init->isConstant = 0x0;
15033 }
15034 if(type && type->kind == 12)
15035 FreeType(initializerType);
15036 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
15037 {
15038 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
15039 }
15040 break;
15041 }
15042 }
15043 }
15044
15045 extern struct Symbol * FindType(struct Context * ctx, char *  name);
15046
15047 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
15048
15049 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
15050 {
15051 switch(spec->type)
15052 {
15053 case 0:
15054 {
15055 if(spec->specifier == THISCLASS)
15056 {
15057 if(thisClass)
15058 {
15059 spec->type = 1;
15060 spec->name = ReplaceThisClass(thisClass);
15061 spec->symbol = FindClass(spec->name);
15062 ProcessSpecifier(spec, declareStruct);
15063 }
15064 }
15065 break;
15066 }
15067 case 1:
15068 {
15069 struct Symbol * symbol = FindType(curContext, spec->name);
15070
15071 if(symbol)
15072 DeclareType(symbol->type, 0x1, 0x1);
15073 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
15074 DeclareStruct(spec->name, 0x0);
15075 break;
15076 }
15077 case 2:
15078 {
15079 struct Enumerator * e;
15080
15081 if(spec->list)
15082 {
15083 for(e = (*spec->list).first; e; e = e->next)
15084 {
15085 if(e->exp)
15086 ProcessExpressionType(e->exp);
15087 }
15088 }
15089 break;
15090 }
15091 case 3:
15092 case 4:
15093 {
15094 if(spec->definitions)
15095 {
15096 struct ClassDef * def;
15097 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
15098
15099 ProcessClass(spec->definitions, symbol);
15100 }
15101 break;
15102 }
15103 }
15104 }
15105
15106 static void ProcessDeclarator(struct Declarator * decl)
15107 {
15108 switch(decl->type)
15109 {
15110 case 1:
15111 if(decl->identifier->classSym)
15112 {
15113 FreeSpecifier(decl->identifier->_class);
15114 decl->identifier->_class = (((void *)0));
15115 }
15116 break;
15117 case 3:
15118 if(decl->array.exp)
15119 ProcessExpressionType(decl->array.exp);
15120 case 0:
15121 case 2:
15122 case 4:
15123 case 5:
15124 case 6:
15125 case 7:
15126 if(decl->declarator)
15127 ProcessDeclarator(decl->declarator);
15128 if(decl->type == 4)
15129 {
15130 struct Identifier * id = GetDeclId(decl);
15131
15132 if(id && id->_class)
15133 {
15134 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
15135
15136 if(!decl->function.parameters)
15137 decl->function.parameters = MkList();
15138 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
15139 id->_class = (((void *)0));
15140 }
15141 if(decl->function.parameters)
15142 {
15143 struct TypeName * param;
15144
15145 for(param = (*decl->function.parameters).first; param; param = param->next)
15146 {
15147 if(param->qualifiers && (*param->qualifiers).first)
15148 {
15149 struct Specifier * spec = (*param->qualifiers).first;
15150
15151 if(spec && spec->specifier == TYPED_OBJECT)
15152 {
15153 struct Declarator * d = param->declarator;
15154 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);
15155
15156 FreeList(param->qualifiers, FreeSpecifier);
15157 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
15158 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
15159 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
15160 param = newParam;
15161 }
15162 else if(spec && spec->specifier == ANY_OBJECT)
15163 {
15164 struct Declarator * d = param->declarator;
15165
15166 FreeList(param->qualifiers, FreeSpecifier);
15167 param->qualifiers = MkListOne(MkSpecifier(VOID));
15168 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
15169 }
15170 else if(spec->specifier == THISCLASS)
15171 {
15172 if(thisClass)
15173 {
15174 spec->type = 1;
15175 spec->name = ReplaceThisClass(thisClass);
15176 spec->symbol = FindClass(spec->name);
15177 ProcessSpecifier(spec, 0x0);
15178 }
15179 }
15180 }
15181 if(param->declarator)
15182 ProcessDeclarator(param->declarator);
15183 }
15184 }
15185 }
15186 break;
15187 }
15188 }
15189
15190 extern struct Identifier * CopyIdentifier(struct Identifier * id);
15191
15192 extern void FreeInitDeclarator(struct InitDeclarator * decl);
15193
15194 static void ProcessDeclaration(struct Declaration * decl)
15195 {
15196 yylloc = decl->loc;
15197 switch(decl->type)
15198 {
15199 case 1:
15200 {
15201 unsigned int declareStruct = 0x0;
15202
15203 if(decl->declarators)
15204 {
15205 struct InitDeclarator * d;
15206
15207 for(d = (*decl->declarators).first; d; d = d->next)
15208 {
15209 struct Type * type, * subType;
15210
15211 ProcessDeclarator(d->declarator);
15212 type = ProcessType(decl->specifiers, d->declarator);
15213 if(d->initializer)
15214 {
15215 ProcessInitializer(d->initializer, type);
15216 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
15217 {
15218 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
15219 {
15220 struct Instantiation * inst = d->initializer->exp->instance;
15221
15222 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
15223 d->initializer->exp->instance = (((void *)0));
15224 if(decl->specifiers)
15225 FreeList(decl->specifiers, FreeSpecifier);
15226 FreeList(decl->declarators, FreeInitDeclarator);
15227 d = (((void *)0));
15228 decl->type = 2;
15229 decl->inst = inst;
15230 }
15231 }
15232 }
15233 for(subType = type; subType; )
15234 {
15235 if(subType->kind == 8)
15236 {
15237 declareStruct = 0x1;
15238 break;
15239 }
15240 else if(subType->kind == 13)
15241 break;
15242 else if(subType->kind == 12)
15243 subType = subType->arrayType;
15244 else
15245 break;
15246 }
15247 FreeType(type);
15248 if(!d)
15249 break;
15250 }
15251 }
15252 if(decl->specifiers)
15253 {
15254 struct Specifier * s;
15255
15256 for(s = (*decl->specifiers).first; s; s = s->next)
15257 {
15258 ProcessSpecifier(s, declareStruct);
15259 }
15260 }
15261 break;
15262 }
15263 case 2:
15264 {
15265 ProcessInstantiationType(decl->inst);
15266 break;
15267 }
15268 case 0:
15269 {
15270 struct Specifier * spec;
15271 struct Declarator * d;
15272 unsigned int declareStruct = 0x0;
15273
15274 if(decl->declarators)
15275 {
15276 for(d = (*decl->declarators).first; d; d = d->next)
15277 {
15278 struct Type * type = ProcessType(decl->specifiers, d->declarator);
15279 struct Type * subType;
15280
15281 ProcessDeclarator(d);
15282 for(subType = type; subType; )
15283 {
15284 if(subType->kind == 8)
15285 {
15286 declareStruct = 0x1;
15287 break;
15288 }
15289 else if(subType->kind == 13)
15290 break;
15291 else if(subType->kind == 12)
15292 subType = subType->arrayType;
15293 else
15294 break;
15295 }
15296 FreeType(type);
15297 }
15298 }
15299 if(decl->specifiers)
15300 {
15301 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
15302 ProcessSpecifier(spec, declareStruct);
15303 }
15304 break;
15305 }
15306 }
15307 }
15308
15309 static struct FunctionDefinition * curFunction;
15310
15311 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
15312 {
15313 char propName[1024], propNameM[1024];
15314 char getName[1024], setName[1024];
15315 struct __ecereNameSpace__ecere__sys__OldList * args;
15316
15317 DeclareProperty(prop, setName, getName);
15318 strcpy(propName, "__ecereProp_");
15319 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15320 strcat(propName, "_");
15321 FullClassNameCat(propName, prop->name, 0x1);
15322 MangleClassName(propName);
15323 strcpy(propNameM, "__ecerePropM_");
15324 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
15325 strcat(propNameM, "_");
15326 FullClassNameCat(propNameM, prop->name, 0x1);
15327 MangleClassName(propNameM);
15328 if(prop->isWatchable)
15329 {
15330 args = MkList();
15331 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15332 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15333 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15334 args = MkList();
15335 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15336 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15337 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15338 }
15339 {
15340 args = MkList();
15341 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15342 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15343 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15344 args = MkList();
15345 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15346 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15347 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15348 }
15349 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15350 curFunction->propSet->fireWatchersDone = 0x1;
15351 }
15352
15353 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
15354
15355 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
15356
15357 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
15358
15359 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
15360
15361 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
15362
15363 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
15364
15365 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
15366
15367 extern void FreePropertyWatch(struct PropertyWatch * watcher);
15368
15369 static void ProcessStatement(struct Statement * stmt)
15370 {
15371 yylloc = stmt->loc;
15372 switch(stmt->type)
15373 {
15374 case 0:
15375 ProcessStatement(stmt->labeled.stmt);
15376 break;
15377 case 1:
15378 if(stmt->caseStmt.exp)
15379 {
15380 FreeType(stmt->caseStmt.exp->destType);
15381 stmt->caseStmt.exp->destType = curSwitchType;
15382 if(curSwitchType)
15383 curSwitchType->refCount++;
15384 ProcessExpressionType(stmt->caseStmt.exp);
15385 ComputeExpression(stmt->caseStmt.exp);
15386 }
15387 if(stmt->caseStmt.stmt)
15388 ProcessStatement(stmt->caseStmt.stmt);
15389 break;
15390 case 2:
15391 {
15392 if(stmt->compound.context)
15393 {
15394 struct Declaration * decl;
15395 struct Statement * s;
15396 struct Statement * prevCompound = curCompound;
15397 struct Context * prevContext = curContext;
15398
15399 if(!stmt->compound.isSwitch)
15400 {
15401 curCompound = stmt;
15402 curContext = stmt->compound.context;
15403 }
15404 if(stmt->compound.declarations)
15405 {
15406 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
15407 ProcessDeclaration(decl);
15408 }
15409 if(stmt->compound.statements)
15410 {
15411 for(s = (*stmt->compound.statements).first; s; s = s->next)
15412 ProcessStatement(s);
15413 }
15414 curContext = prevContext;
15415 curCompound = prevCompound;
15416 }
15417 break;
15418 }
15419 case 3:
15420 {
15421 struct Expression * exp;
15422
15423 if(stmt->expressions)
15424 {
15425 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15426 ProcessExpressionType(exp);
15427 }
15428 break;
15429 }
15430 case 4:
15431 {
15432 struct Expression * exp;
15433
15434 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15435 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15436 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15437 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15438 {
15439 ProcessExpressionType(exp);
15440 }
15441 if(stmt->ifStmt.stmt)
15442 ProcessStatement(stmt->ifStmt.stmt);
15443 if(stmt->ifStmt.elseStmt)
15444 ProcessStatement(stmt->ifStmt.elseStmt);
15445 break;
15446 }
15447 case 5:
15448 {
15449 struct Type * oldSwitchType = curSwitchType;
15450
15451 if(stmt->switchStmt.exp)
15452 {
15453 struct Expression * exp;
15454
15455 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15456 {
15457 if(!exp->next)
15458 {
15459 ProcessExpressionType(exp);
15460 }
15461 if(!exp->next)
15462 curSwitchType = exp->expType;
15463 }
15464 }
15465 ProcessStatement(stmt->switchStmt.stmt);
15466 curSwitchType = oldSwitchType;
15467 break;
15468 }
15469 case 6:
15470 {
15471 if(stmt->whileStmt.exp)
15472 {
15473 struct Expression * exp;
15474
15475 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15476 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15477 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15478 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15479 {
15480 ProcessExpressionType(exp);
15481 }
15482 }
15483 if(stmt->whileStmt.stmt)
15484 ProcessStatement(stmt->whileStmt.stmt);
15485 break;
15486 }
15487 case 7:
15488 {
15489 if(stmt->doWhile.exp)
15490 {
15491 struct Expression * exp;
15492
15493 if((*stmt->doWhile.exp).last)
15494 {
15495 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15496 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15497 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15498 }
15499 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15500 {
15501 ProcessExpressionType(exp);
15502 }
15503 }
15504 if(stmt->doWhile.stmt)
15505 ProcessStatement(stmt->doWhile.stmt);
15506 break;
15507 }
15508 case 8:
15509 {
15510 struct Expression * exp;
15511
15512 if(stmt->forStmt.init)
15513 ProcessStatement(stmt->forStmt.init);
15514 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15515 {
15516 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15517 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15518 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15519 }
15520 if(stmt->forStmt.check)
15521 ProcessStatement(stmt->forStmt.check);
15522 if(stmt->forStmt.increment)
15523 {
15524 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15525 ProcessExpressionType(exp);
15526 }
15527 if(stmt->forStmt.stmt)
15528 ProcessStatement(stmt->forStmt.stmt);
15529 break;
15530 }
15531 case 18:
15532 {
15533 struct Identifier * id = stmt->forEachStmt.id;
15534 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15535 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15536 struct Statement * block = stmt->forEachStmt.stmt;
15537 char iteratorType[1024];
15538 struct Type * source;
15539 struct Expression * e;
15540 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));
15541 struct Expression * arrayExp;
15542 char * typeString = (((void *)0));
15543 int builtinCount = 0;
15544
15545 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15546 {
15547 if(!e->next)
15548 {
15549 FreeType(e->destType);
15550 e->destType = ProcessTypeString("Container", 0x0);
15551 }
15552 if(!isBuiltin || e->next)
15553 ProcessExpressionType(e);
15554 }
15555 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15556 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15557 {
15558 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15559 struct Symbol * symbol;
15560 struct Expression * expIt = (((void *)0));
15561 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15562 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15563 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15564 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15565
15566 stmt->type = 2;
15567 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15568 stmt->compound.context->parent = curContext;
15569 curContext = stmt->compound.context;
15570 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15571 {
15572 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15573 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15574
15575 isCustomAVLTree = 0x1;
15576 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15577 isAVLTree = 0x1;
15578 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15579 isMap = 0x1;
15580 }
15581 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15582 isArray = 0x1;
15583 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15584 {
15585 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15586
15587 isLinkList = 0x1;
15588 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15589 }
15590 if(isArray)
15591 {
15592 struct Declarator * decl;
15593 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15594
15595 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15596 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15597 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15598 }
15599 else if(isBuiltin)
15600 {
15601 struct Type * type = (((void *)0));
15602 char typeStringBuf[1024];
15603
15604 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15605 if(((struct Expression *)(*exp).last)->type == 11)
15606 {
15607 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15608
15609 if(typeName)
15610 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15611 }
15612 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)
15613 {
15614 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15615
15616 typeString = templateClass->templateArgs[2].dataTypeString;
15617 }
15618 else if(arrayExp->list)
15619 {
15620 struct Expression * e;
15621
15622 for(e = (*arrayExp->list).first; e; e = e->next)
15623 {
15624 ProcessExpressionType(e);
15625 if(e->expType)
15626 {
15627 if(!type)
15628 {
15629 type = e->expType;
15630 type->refCount++;
15631 }
15632 else
15633 {
15634 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15635 {
15636 FreeType(type);
15637 type = e->expType;
15638 e->expType = (((void *)0));
15639 e = (*arrayExp->list).first;
15640 ProcessExpressionType(e);
15641 if(e->expType)
15642 {
15643 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15644 {
15645 FreeType(e->expType);
15646 e->expType = (((void *)0));
15647 FreeType(type);
15648 type = (((void *)0));
15649 break;
15650 }
15651 }
15652 }
15653 }
15654 if(e->expType)
15655 {
15656 FreeType(e->expType);
15657 e->expType = (((void *)0));
15658 }
15659 }
15660 }
15661 if(type)
15662 {
15663 typeStringBuf[0] = '\0';
15664 PrintType(type, typeStringBuf, 0x0, 0x1);
15665 typeString = typeStringBuf;
15666 FreeType(type);
15667 }
15668 }
15669 if(typeString)
15670 {
15671 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15672 struct Declarator * decl;
15673 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15674
15675 if(arrayExp->list)
15676 {
15677 struct Expression * e;
15678
15679 builtinCount = (*arrayExp->list).count;
15680 type = ProcessTypeString(typeString, 0x0);
15681 while(e = (*arrayExp->list).first)
15682 {
15683 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15684 e->destType = type;
15685 type->refCount++;
15686 ProcessExpressionType(e);
15687 ListAdd(initializers, MkInitializerAssignment(e));
15688 }
15689 FreeType(type);
15690 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15691 }
15692 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15693 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15694 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorArray(PlugDeclarator(decl, MkDeclaratorIdentifier(MkIdentifier("__internalArray"))), (((void *)0))), MkInitializerList(initializers)))));
15695 FreeList(exp, FreeExpression);
15696 }
15697 else
15698 {
15699 arrayExp->expType = ProcessTypeString("Container", 0x0);
15700 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15701 }
15702 }
15703 else if(isLinkList && !isList)
15704 {
15705 struct Declarator * decl;
15706 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15707
15708 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15709 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15710 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15711 }
15712 else if(_class->templateArgs)
15713 {
15714 if(isMap)
15715 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15716 else
15717 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
15718 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
15719 }
15720 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
15721 if(block && block->type == 2 && block->compound.context)
15722 {
15723 block->compound.context->parent = stmt->compound.context;
15724 }
15725 if(filter)
15726 {
15727 block = MkIfStmt(filter, block, (((void *)0)));
15728 }
15729 if(isArray)
15730 {
15731 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));
15732 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15733 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15734 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15735 }
15736 else if(isBuiltin)
15737 {
15738 char count[128];
15739
15740 sprintf(count, "%d", builtinCount);
15741 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));
15742 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15743 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15744 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15745 }
15746 else if(isLinkList && !isList)
15747 {
15748 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
15749 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
15750
15751 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
15752 {
15753 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));
15754 }
15755 else
15756 {
15757 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15758 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
15759
15760 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));
15761 }
15762 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15763 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15764 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15765 }
15766 else
15767 {
15768 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
15769 }
15770 ProcessExpressionType(expIt);
15771 if((*stmt->compound.declarations).first)
15772 ProcessDeclaration((*stmt->compound.declarations).first);
15773 if(symbol)
15774 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
15775 ProcessStatement(stmt);
15776 curContext = stmt->compound.context->parent;
15777 break;
15778 }
15779 else
15780 {
15781 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
15782 }
15783 break;
15784 }
15785 case 9:
15786 break;
15787 case 10:
15788 break;
15789 case 11:
15790 break;
15791 case 12:
15792 {
15793 struct Expression * exp;
15794
15795 if(stmt->expressions)
15796 {
15797 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15798 {
15799 if(!exp->next)
15800 {
15801 if(curFunction && !curFunction->type)
15802 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
15803 FreeType(exp->destType);
15804 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
15805 if(exp->destType)
15806 exp->destType->refCount++;
15807 }
15808 ProcessExpressionType(exp);
15809 }
15810 }
15811 break;
15812 }
15813 case 14:
15814 {
15815 ProcessDeclaration(stmt->decl);
15816 break;
15817 }
15818 case 13:
15819 {
15820 struct AsmField * field;
15821
15822 if(stmt->asmStmt.inputFields)
15823 {
15824 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
15825 if(field->expression)
15826 ProcessExpressionType(field->expression);
15827 }
15828 if(stmt->asmStmt.outputFields)
15829 {
15830 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
15831 if(field->expression)
15832 ProcessExpressionType(field->expression);
15833 }
15834 if(stmt->asmStmt.clobberedFields)
15835 {
15836 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
15837 {
15838 if(field->expression)
15839 ProcessExpressionType(field->expression);
15840 }
15841 }
15842 break;
15843 }
15844 case 17:
15845 {
15846 struct PropertyWatch * propWatch;
15847 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15848 struct Expression * object = stmt->_watch.object;
15849 struct Expression * watcher = stmt->_watch.watcher;
15850
15851 if(watcher)
15852 ProcessExpressionType(watcher);
15853 if(object)
15854 ProcessExpressionType(object);
15855 if(inCompiler)
15856 {
15857 if(watcher || thisClass)
15858 {
15859 struct External * external = curExternal;
15860 struct Context * context = curContext;
15861
15862 stmt->type = 3;
15863 stmt->expressions = MkList();
15864 curExternal = external->prev;
15865 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15866 {
15867 struct ClassFunction * func;
15868 char watcherName[1024];
15869 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
15870 struct External * createdExternal;
15871 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
15872
15873 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
15874 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
15875 if(propWatch->deleteWatch)
15876 strcat(watcherName, "_delete");
15877 else
15878 {
15879 struct Identifier * propID;
15880
15881 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15882 {
15883 strcat(watcherName, "_");
15884 strcat(watcherName, propID->string);
15885 }
15886 }
15887 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
15888 {
15889 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
15890 ProcessClassFunctionBody(func, propWatch->compound);
15891 propWatch->compound = (((void *)0));
15892 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
15893 createdExternal->symbol->idCode = external->symbol->idCode;
15894 curExternal = createdExternal;
15895 ProcessFunction(createdExternal->function);
15896 {
15897 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
15898
15899 externalDecl->declaration = decl;
15900 if(decl->symbol && !decl->symbol->pointerExternal)
15901 decl->symbol->pointerExternal = externalDecl;
15902 }
15903 if(propWatch->deleteWatch)
15904 {
15905 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15906
15907 ListAdd(args, CopyExpression(object));
15908 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15909 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15910 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
15911 }
15912 else
15913 {
15914 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
15915 struct Identifier * propID;
15916
15917 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15918 {
15919 char propName[1024];
15920 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15921
15922 if(prop)
15923 {
15924 char getName[1024], setName[1024];
15925 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15926
15927 DeclareProperty(prop, setName, getName);
15928 strcpy(propName, "__ecereProp_");
15929 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15930 strcat(propName, "_");
15931 FullClassNameCat(propName, prop->name, 0x1);
15932 ListAdd(args, CopyExpression(object));
15933 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15934 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15935 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15936 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
15937 }
15938 else
15939 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
15940 }
15941 }
15942 }
15943 else
15944 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
15945 }
15946 curExternal = external;
15947 curContext = context;
15948 if(watcher)
15949 FreeExpression(watcher);
15950 if(object)
15951 FreeExpression(object);
15952 FreeList(watches, FreePropertyWatch);
15953 }
15954 else
15955 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
15956 }
15957 else
15958 {
15959 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15960 {
15961 ProcessStatement(propWatch->compound);
15962 }
15963 }
15964 break;
15965 }
15966 case 15:
15967 {
15968 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15969 struct Expression * object = stmt->_watch.object;
15970 struct __ecereNameSpace__ecere__com__Class * _class;
15971
15972 if(object)
15973 ProcessExpressionType(object);
15974 if(inCompiler)
15975 {
15976 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
15977 if(_class)
15978 {
15979 struct Identifier * propID;
15980
15981 stmt->type = 3;
15982 stmt->expressions = MkList();
15983 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15984 {
15985 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
15986 }
15987 else if(!watches)
15988 {
15989 }
15990 if(watches)
15991 {
15992 for(propID = (*watches).first; propID; propID = propID->next)
15993 {
15994 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15995
15996 if(prop)
15997 {
15998 CreateFireWatcher(prop, object, stmt);
15999 }
16000 else
16001 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
16002 }
16003 }
16004 else
16005 {
16006 struct __ecereNameSpace__ecere__com__Property * prop;
16007 struct __ecereNameSpace__ecere__com__Class * base;
16008
16009 for(base = _class; base; base = base->base)
16010 {
16011 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
16012 {
16013 if(prop->isProperty && prop->isWatchable)
16014 {
16015 CreateFireWatcher(prop, object, stmt);
16016 }
16017 }
16018 }
16019 }
16020 if(object)
16021 FreeExpression(object);
16022 FreeList(watches, FreeIdentifier);
16023 }
16024 else
16025 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16026 }
16027 break;
16028 }
16029 case 16:
16030 {
16031 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16032 struct Expression * object = stmt->_watch.object;
16033 struct Expression * watcher = stmt->_watch.watcher;
16034 struct __ecereNameSpace__ecere__com__Class * _class;
16035
16036 if(object)
16037 ProcessExpressionType(object);
16038 if(watcher)
16039 ProcessExpressionType(watcher);
16040 if(inCompiler)
16041 {
16042 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
16043 if(watcher || thisClass)
16044 {
16045 if(_class)
16046 {
16047 struct Identifier * propID;
16048
16049 stmt->type = 3;
16050 stmt->expressions = MkList();
16051 if(!watches)
16052 {
16053 struct __ecereNameSpace__ecere__sys__OldList * args;
16054
16055 args = MkList();
16056 ListAdd(args, CopyExpression(object));
16057 ListAdd(args, MkExpConstant("0"));
16058 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16059 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16060 }
16061 else
16062 {
16063 for(propID = (*watches).first; propID; propID = propID->next)
16064 {
16065 char propName[1024];
16066 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16067
16068 if(prop)
16069 {
16070 char getName[1024], setName[1024];
16071 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16072
16073 DeclareProperty(prop, setName, getName);
16074 strcpy(propName, "__ecereProp_");
16075 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16076 strcat(propName, "_");
16077 FullClassNameCat(propName, prop->name, 0x1);
16078 MangleClassName(propName);
16079 ListAdd(args, CopyExpression(object));
16080 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16081 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16082 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16083 }
16084 else
16085 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16086 }
16087 }
16088 if(object)
16089 FreeExpression(object);
16090 if(watcher)
16091 FreeExpression(watcher);
16092 FreeList(watches, FreeIdentifier);
16093 }
16094 else
16095 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16096 }
16097 else
16098 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
16099 }
16100 break;
16101 }
16102 }
16103 }
16104
16105 extern struct Expression * QBrackets(struct Expression * exp);
16106
16107 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
16108
16109 extern struct Declarator * QMkPtrDecl(char *  id);
16110
16111 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
16112
16113 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
16114
16115 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
16116
16117 static void ProcessFunction(struct FunctionDefinition * function)
16118 {
16119 void * __ecereTemp2;
16120 void * __ecereTemp1;
16121 struct Identifier * id = GetDeclId(function->declarator);
16122 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
16123 struct Type * type = symbol ? symbol->type : (((void *)0));
16124 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
16125 struct Context * oldTopContext = topContext;
16126
16127 yylloc = function->loc;
16128 if(type && type->thisClass)
16129 {
16130 struct Symbol * classSym = type->thisClass;
16131 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
16132 char className[1024];
16133 char structName[1024];
16134 struct Declarator * funcDecl;
16135 struct Symbol * thisSymbol;
16136 unsigned int typedObject = 0x0;
16137
16138 if(_class && !_class->base)
16139 {
16140 _class = currentClass;
16141 if(_class && !_class->symbol)
16142 _class->symbol = FindClass(_class->fullName);
16143 classSym = _class ? _class->symbol : (((void *)0));
16144 typedObject = 0x1;
16145 }
16146 thisClass = _class;
16147 if(inCompiler && _class)
16148 {
16149 if(type->kind == 11)
16150 {
16151 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
16152 {
16153 struct Type * param = symbol->type->params.first;
16154
16155 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
16156 FreeType(param);
16157 }
16158 if(type->classObjectType != 1)
16159 {
16160 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
16161 symbol->type->staticMethod = 0x1;
16162 symbol->type->thisClass = (((void *)0));
16163 symbol->type->extraParam = 0x0;
16164 }
16165 }
16166 strcpy(className, "__ecereClass_");
16167 FullClassNameCat(className, _class->fullName, 0x1);
16168 MangleClassName(className);
16169 structName[0] = (char)0;
16170 FullClassNameCat(structName, _class->fullName, 0x0);
16171 funcDecl = GetFuncDecl(function->declarator);
16172 if(funcDecl)
16173 {
16174 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16175 {
16176 struct TypeName * param = (*funcDecl->function.parameters).first;
16177
16178 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16179 {
16180 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16181 FreeTypeName(param);
16182 }
16183 }
16184 if(!function->propertyNoThis)
16185 {
16186 struct TypeName * thisParam;
16187
16188 if(type->classObjectType != 1)
16189 {
16190 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16191 if(!funcDecl->function.parameters)
16192 funcDecl->function.parameters = MkList();
16193 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16194 }
16195 if(typedObject)
16196 {
16197 if(type->classObjectType != 1)
16198 {
16199 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
16200 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
16201 }
16202 thisParam = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), ((struct TypeName *)__ecereTemp1)->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), ((struct TypeName *)__ecereTemp1)->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), ((struct TypeName *)__ecereTemp1));
16203 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16204 }
16205 }
16206 }
16207 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16208 {
16209 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16210
16211 funcDecl = GetFuncDecl(initDecl->declarator);
16212 if(funcDecl)
16213 {
16214 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16215 {
16216 struct TypeName * param = (*funcDecl->function.parameters).first;
16217
16218 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16219 {
16220 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16221 FreeTypeName(param);
16222 }
16223 }
16224 if(type->classObjectType != 1)
16225 {
16226 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
16227 {
16228 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16229
16230 if(!funcDecl->function.parameters)
16231 funcDecl->function.parameters = MkList();
16232 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16233 }
16234 }
16235 }
16236 }
16237 }
16238 if(function->body)
16239 {
16240 if(type->classObjectType != 1)
16241 {
16242 thisSymbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->string = __ecereNameSpace__ecere__sys__CopyString("this"), ((struct Symbol *)__ecereTemp1)->type = classSym ? MkClassType(classSym->string) : (((void *)0)), ((struct Symbol *)__ecereTemp1));
16243 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16244 if(typedObject && thisSymbol->type)
16245 {
16246 thisSymbol->type->classObjectType = 2;
16247 thisSymbol->type->byReference = type->byReference;
16248 }
16249 }
16250 }
16251 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
16252 {
16253 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
16254
16255 {
16256 struct __ecereNameSpace__ecere__com__Class * base;
16257
16258 for(base = _class; base && base->type != 1000; base = base->next)
16259 {
16260 for(member = base->membersAndProperties.first; member; member = member->next)
16261 if(!member->isProperty)
16262 break;
16263 if(member)
16264 break;
16265 }
16266 }
16267 for(member = _class->membersAndProperties.first; member; member = member->next)
16268 if(!member->isProperty)
16269 break;
16270 if(member)
16271 {
16272 char pointerName[1024];
16273 struct Declaration * decl;
16274 struct Initializer * initializer;
16275 struct Expression * exp, * bytePtr;
16276
16277 strcpy(pointerName, "__ecerePointer_");
16278 FullClassNameCat(pointerName, _class->fullName, 0x0);
16279 {
16280 char className[1024];
16281
16282 strcpy(className, "__ecereClass_");
16283 FullClassNameCat(className, classSym->string, 0x1);
16284 MangleClassName(className);
16285 DeclareClass(classSym, className);
16286 }
16287 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
16288 if(_class->fixed)
16289 {
16290 char string[256];
16291
16292 sprintf(string, "%d", _class->offset);
16293 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
16294 }
16295 else
16296 {
16297 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
16298 }
16299 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
16300 exp->expType = (__ecereTemp2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp2)->refCount = 1, ((struct Type *)__ecereTemp2)->kind = 13, ((struct Type *)__ecereTemp2)->type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 0, ((struct Type *)__ecereTemp1)), ((struct Type *)__ecereTemp2));
16301 if(function->body)
16302 {
16303 yylloc = function->body->loc;
16304 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
16305 {
16306 struct Context * prevContext = curContext;
16307
16308 curContext = function->body->compound.context;
16309 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
16310 curContext = prevContext;
16311 }
16312 decl->symbol = (((void *)0));
16313 if(!function->body->compound.declarations)
16314 function->body->compound.declarations = MkList();
16315 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
16316 }
16317 }
16318 }
16319 }
16320 else
16321 thisClass = (((void *)0));
16322 if(id)
16323 {
16324 FreeSpecifier(id->_class);
16325 id->_class = (((void *)0));
16326 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16327 {
16328 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16329
16330 id = GetDeclId(initDecl->declarator);
16331 FreeSpecifier(id->_class);
16332 id->_class = (((void *)0));
16333 }
16334 }
16335 if(function->body)
16336 topContext = function->body->compound.context;
16337 {
16338 struct FunctionDefinition * oldFunction = curFunction;
16339
16340 curFunction = function;
16341 if(function->body)
16342 ProcessStatement(function->body);
16343 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
16344 {
16345 struct Statement * prevCompound = curCompound;
16346 struct Context * prevContext = curContext;
16347 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
16348
16349 if(!function->body->compound.statements)
16350 function->body->compound.statements = MkList();
16351 ListAdd(function->body->compound.statements, fireWatchers);
16352 curCompound = function->body;
16353 curContext = function->body->compound.context;
16354 ProcessStatement(fireWatchers);
16355 curContext = prevContext;
16356 curCompound = prevCompound;
16357 }
16358 curFunction = oldFunction;
16359 }
16360 if(function->declarator)
16361 {
16362 ProcessDeclarator(function->declarator);
16363 }
16364 topContext = oldTopContext;
16365 thisClass = oldThisClass;
16366 }
16367
16368 extern void FreeSymbol(struct Symbol * symbol);
16369
16370 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
16371
16372 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
16373 {
16374 struct ClassDef * def;
16375 struct External * external = curExternal;
16376 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
16377
16378 for(def = definitions->first; def; def = def->next)
16379 {
16380 if(def->type == 0)
16381 {
16382 if(def->function->declarator)
16383 curExternal = def->function->declarator->symbol->pointerExternal;
16384 else
16385 curExternal = external;
16386 ProcessFunction((struct FunctionDefinition *)def->function);
16387 }
16388 else if(def->type == 2)
16389 {
16390 if(def->decl->type == 2)
16391 {
16392 thisClass = regClass;
16393 ProcessInstantiationType(def->decl->inst);
16394 thisClass = (((void *)0));
16395 }
16396 else
16397 {
16398 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
16399
16400 if(regClass)
16401 thisClass = regClass;
16402 ProcessDeclaration(def->decl);
16403 thisClass = backThisClass;
16404 }
16405 }
16406 else if(def->type == 1 && def->defProperties)
16407 {
16408 struct MemberInit * defProperty;
16409 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);
16410
16411 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16412 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
16413 {
16414 thisClass = regClass;
16415 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
16416 thisClass = (((void *)0));
16417 }
16418 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16419 FreeSymbol(thisSymbol);
16420 }
16421 else if(def->type == 3 && def->propertyDef)
16422 {
16423 struct PropertyDef * prop = def->propertyDef;
16424
16425 thisClass = regClass;
16426 if(prop->setStmt)
16427 {
16428 if(regClass)
16429 {
16430 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16431
16432 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16433 }
16434 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16435 ProcessStatement(prop->setStmt);
16436 }
16437 if(prop->getStmt)
16438 {
16439 if(regClass)
16440 {
16441 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16442
16443 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16444 }
16445 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16446 ProcessStatement(prop->getStmt);
16447 }
16448 if(prop->issetStmt)
16449 {
16450 if(regClass)
16451 {
16452 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16453
16454 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16455 }
16456 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16457 ProcessStatement(prop->issetStmt);
16458 }
16459 thisClass = (((void *)0));
16460 }
16461 else if(def->type == 4 && def->propertyWatch)
16462 {
16463 struct PropertyWatch * propertyWatch = def->propertyWatch;
16464
16465 thisClass = regClass;
16466 if(propertyWatch->compound)
16467 {
16468 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);
16469
16470 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16471 curExternal = (((void *)0));
16472 ProcessStatement(propertyWatch->compound);
16473 }
16474 thisClass = (((void *)0));
16475 }
16476 }
16477 }
16478
16479 void DeclareFunctionUtil(char * s)
16480 {
16481 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
16482
16483 if(function)
16484 {
16485 char name[1024];
16486
16487 name[0] = (char)0;
16488 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
16489 strcpy(name, "__ecereFunction_");
16490 FullClassNameCat(name, s, 0x0);
16491 DeclareFunction(function, name);
16492 }
16493 }
16494
16495 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16496
16497 void ComputeDataTypes()
16498 {
16499 void * __ecereTemp1;
16500 struct External * external;
16501 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16502 struct External * after = (((void *)0));
16503
16504 currentClass = (((void *)0));
16505 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16506 for(external = (*ast).first; external; external = external->next)
16507 {
16508 if(external->type == 1)
16509 {
16510 struct Declaration * decl = external->declaration;
16511
16512 if(decl)
16513 {
16514 struct __ecereNameSpace__ecere__sys__OldList * decls = decl->declarators;
16515
16516 if(decls)
16517 {
16518 struct InitDeclarator * initDecl = (*decls).first;
16519
16520 if(initDecl)
16521 {
16522 struct Declarator * declarator = initDecl->declarator;
16523
16524 if(declarator && declarator->type == 1)
16525 {
16526 struct Identifier * id = declarator->identifier;
16527
16528 if(id && id->string)
16529 {
16530 if(!strcmp(id->string, "uintptr_t") || !strcmp(id->string, "intptr_t") || !strcmp(id->string, "size_t") || !strcmp(id->string, "ssize_t"))
16531 {
16532 external->symbol->id = -1001, external->symbol->idCode = -1001;
16533 after = external;
16534 }
16535 }
16536 }
16537 }
16538 }
16539 }
16540 }
16541 }
16542 temp->symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->id = -1000, ((struct Symbol *)__ecereTemp1)->idCode = -1000, ((struct Symbol *)__ecereTemp1));
16543 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), after, temp);
16544 curExternal = temp;
16545 DeclareFunctionUtil("eSystem_New");
16546 DeclareFunctionUtil("eSystem_New0");
16547 DeclareFunctionUtil("eSystem_Renew");
16548 DeclareFunctionUtil("eSystem_Renew0");
16549 DeclareFunctionUtil("eClass_GetProperty");
16550 DeclareStruct("ecere::com::Class", 0x0);
16551 DeclareStruct("ecere::com::Instance", 0x0);
16552 DeclareStruct("ecere::com::Property", 0x0);
16553 DeclareStruct("ecere::com::DataMember", 0x0);
16554 DeclareStruct("ecere::com::Method", 0x0);
16555 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16556 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16557 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16558 for(external = (*ast).first; external; external = external->next)
16559 {
16560 afterExternal = curExternal = external;
16561 if(external->type == 0)
16562 {
16563 currentClass = external->function->_class;
16564 ProcessFunction(external->function);
16565 }
16566 else if(external->type == 1)
16567 {
16568 currentClass = (((void *)0));
16569 ProcessDeclaration(external->declaration);
16570 }
16571 else if(external->type == 2)
16572 {
16573 struct ClassDefinition * _class = external->_class;
16574
16575 currentClass = external->symbol->registered;
16576 if(_class->definitions)
16577 {
16578 ProcessClass(_class->definitions, _class->symbol);
16579 }
16580 if(inCompiler)
16581 {
16582 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16583 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16584 }
16585 }
16586 else if(external->type == 4)
16587 {
16588 thisNameSpace = external->id->string;
16589 }
16590 }
16591 currentClass = (((void *)0));
16592 thisNameSpace = (((void *)0));
16593 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16594 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16595 }
16596
16597 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);
16598
16599 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, char *  name, char *  baseName, int size, int sizeClass, unsigned int (* )(void * ), void (* )(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
16600
16601 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16602 {
16603 struct __ecereNameSpace__ecere__com__Class * class;
16604
16605 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16606 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16607 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16608 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16609 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16610 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16611 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16612 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16613 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16614 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16615 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16616 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16617 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16618 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16619 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16620 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16621 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16622 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16623 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16624 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16625 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16626 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16627 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
16628 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
16629 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntSize", "bool GetIntSize(Expression exp, intsize * value2)", GetIntSize, module, 1);
16630 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntSize", "bool GetUIntSize(Expression exp, uintsize * value2)", GetUIntSize, module, 1);
16631 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16632 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16633 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16634 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16635 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16636 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16637 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16638 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16639 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16640 __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);
16641 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16642 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16643 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16644 __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);
16645 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16646 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16647 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16648 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16649 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16650 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16651 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16652 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16653 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16654 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16655 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16656 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16657 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16658 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
16659 __ecereClass_Conversion = class;
16660 __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);
16661 __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);
16662 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16663 __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);
16664 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16665 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16666 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16667 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16668 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16669 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16670 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16671 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16672 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16673 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16674 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16675 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16676 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16677 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16678 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16679 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
16680 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16681 }
16682
16683 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16684 {
16685
16686 }
16687