313b6174b98aa7ac7514d75b0c32e317d474798c
[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 maxSize -= _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2780 }
2781 }
2782 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2783 {
2784 if(!member->isProperty)
2785 {
2786 switch(member->type)
2787 {
2788 case 0:
2789 {
2790 if(member->dataTypeString)
2791 {
2792 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2793 struct Declarator * decl;
2794
2795 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2796 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2797 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2798 if(!member->dataType)
2799 member->dataType = ProcessType(specs, decl);
2800 ReplaceThisClassSpecifiers(specs, topClass);
2801 {
2802 struct Type * type = ProcessType(specs, decl);
2803
2804 DeclareType(member->dataType, 0x0, 0x0);
2805 FreeType(type);
2806 }
2807 ComputeTypeSize(member->dataType);
2808 size = member->dataType->size;
2809 alignment = member->dataType->alignment;
2810 if(alignment)
2811 {
2812 if(totalSize % alignment)
2813 totalSize += alignment - (totalSize % alignment);
2814 }
2815 totalSize += size;
2816 }
2817 break;
2818 }
2819 case 1:
2820 case 2:
2821 {
2822 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2823
2824 size = 0;
2825 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass, (((void *)0)));
2826 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
2827 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
2828 alignment = member->structAlignment;
2829 if(alignment)
2830 {
2831 if(totalSize % alignment)
2832 totalSize += alignment - (totalSize % alignment);
2833 }
2834 totalSize += size;
2835 break;
2836 }
2837 }
2838 }
2839 }
2840 if(retSize)
2841 {
2842 unsigned int __simpleStruct0;
2843
2844 if(topMember && topMember->type == 1)
2845 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
2846 else
2847 *retSize += totalSize;
2848 }
2849 else if(totalSize < maxSize && _class->type != 1000)
2850 {
2851 int autoPadding = 0;
2852
2853 if(!isMember && _class->structAlignment && totalSize % _class->structAlignment)
2854 autoPadding = _class->structAlignment - (totalSize % _class->structAlignment);
2855 if(totalSize + autoPadding < maxSize)
2856 {
2857 char sizeString[50];
2858
2859 sprintf(sizeString, "%d", maxSize - totalSize);
2860 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
2861 if(addedPadding)
2862 *addedPadding = 0x1;
2863 }
2864 }
2865 if(context)
2866 FinishTemplatesContext(context);
2867 return topMember ? topMember->memberID : _class->memberID;
2868 }
2869
2870 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2871 {
2872 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2873 unsigned int totalSize = 0;
2874 struct __ecereNameSpace__ecere__com__DataMember * member;
2875 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2876
2877 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
2878 DeclareMembers(_class->base, 0x0);
2879 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2880 {
2881 if(!member->isProperty)
2882 {
2883 switch(member->type)
2884 {
2885 case 0:
2886 {
2887 if(!member->dataType && member->dataTypeString)
2888 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
2889 if(member->dataType)
2890 DeclareType(member->dataType, 0x0, 0x0);
2891 break;
2892 }
2893 case 1:
2894 case 2:
2895 {
2896 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
2897 break;
2898 }
2899 }
2900 }
2901 }
2902 if(context)
2903 FinishTemplatesContext(context);
2904 return topMember ? topMember->memberID : _class->memberID;
2905 }
2906
2907 extern struct Symbol * FindClass(char *  name);
2908
2909 extern char *  strchr(const char * , int);
2910
2911 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
2912
2913 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (* )(void * ));
2914
2915 extern void FreeClassDef(struct ClassDef * def);
2916
2917 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
2918
2919 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
2920
2921 extern char *  strcpy(char * , const char * );
2922
2923 extern void MangleClassName(char *  className);
2924
2925 extern void DeclareClass(struct Symbol * classSym, char *  className);
2926
2927 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
2928
2929 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
2930
2931 void DeclareStruct(char * name, unsigned int skipNoHead)
2932 {
2933 struct External * external = (((void *)0));
2934 struct Symbol * classSym = FindClass(name);
2935
2936 if(!inCompiler || !classSym)
2937 return ;
2938 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
2939 return ;
2940 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
2941 {
2942 struct Declaration * decl;
2943 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2944 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
2945 char structName[1024];
2946
2947 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
2948 classSym->declaring++;
2949 if(strchr(classSym->string, '<'))
2950 {
2951 if(classSym->registered->templateClass)
2952 {
2953 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
2954 classSym->declaring--;
2955 }
2956 return ;
2957 }
2958 DeclareMembers(classSym->registered, 0x0);
2959 structName[0] = (char)0;
2960 FullClassNameCat(structName, name, 0x0);
2961 if(!skipNoHead)
2962 {
2963 unsigned int addedPadding = 0x0;
2964
2965 classSym->declaredStructSym = 0x1;
2966 declarations = MkList();
2967 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered, &addedPadding);
2968 if(!(*declarations).count || ((*declarations).count == 1 && addedPadding))
2969 {
2970 FreeList(declarations, FreeClassDef);
2971 declarations = (((void *)0));
2972 }
2973 }
2974 if(skipNoHead || declarations)
2975 {
2976 if(external && external->declaration)
2977 {
2978 ((struct Specifier *)(*external->declaration->specifiers).first)->definitions = declarations;
2979 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2980 {
2981 if(classSym->structExternal)
2982 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2983 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2984 classSym->id = curExternal->symbol->idCode;
2985 classSym->idCode = curExternal->symbol->idCode;
2986 }
2987 }
2988 else
2989 {
2990 if(!external)
2991 external = MkExternalDeclaration((((void *)0)));
2992 specifiers = MkList();
2993 declarators = MkList();
2994 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
2995 external->declaration = decl = MkDeclaration(specifiers, declarators);
2996 if(decl->symbol && !decl->symbol->pointerExternal)
2997 decl->symbol->pointerExternal = external;
2998 if(classSym->registered && classSym->registered->type == 1)
2999 {
3000 char className[1024];
3001
3002 strcpy(className, "__ecereClass_");
3003 FullClassNameCat(className, classSym->string, 0x1);
3004 MangleClassName(className);
3005 DeclareClass(classSym, className);
3006 external->symbol = classSym;
3007 classSym->pointerExternal = external;
3008 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3009 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3010 }
3011 else
3012 {
3013 char className[1024];
3014
3015 strcpy(className, "__ecereClass_");
3016 FullClassNameCat(className, classSym->string, 0x1);
3017 MangleClassName(className);
3018 classSym->structExternal = external;
3019 DeclareClass(classSym, className);
3020 external->symbol = classSym;
3021 }
3022 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
3023 }
3024 }
3025 classSym->declaring--;
3026 }
3027 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3028 {
3029 classSym->declaring++;
3030 {
3031 if(classSym->registered)
3032 DeclareMembers(classSym->registered, 0x0);
3033 }
3034 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
3035 {
3036 if(classSym->structExternal)
3037 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3038 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3039 classSym->id = curExternal->symbol->idCode;
3040 classSym->idCode = curExternal->symbol->idCode;
3041 }
3042 classSym->declaring--;
3043 }
3044 }
3045
3046 extern char *  strcat(char * , const char * );
3047
3048 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
3049
3050 extern struct ModuleImport * mainModule;
3051
3052 extern struct Specifier * MkSpecifierName(char *  name);
3053
3054 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
3055
3056 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
3057
3058 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
3059
3060 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
3061
3062 extern void FreeDeclarator(struct Declarator * decl);
3063
3064 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
3065
3066 struct PropertyImport
3067 {
3068 struct PropertyImport * prev;
3069 struct PropertyImport * next;
3070 char *  name;
3071 unsigned int isVirtual;
3072 unsigned int hasSet;
3073 unsigned int hasGet;
3074 } __attribute__ ((gcc_struct));
3075
3076 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3077
3078 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
3079 {
3080 void * __ecereTemp1;
3081 struct Symbol * symbol = prop->symbol;
3082 char propName[1024];
3083
3084 strcpy(setName, "__ecereProp_");
3085 FullClassNameCat(setName, prop->_class->fullName, 0x0);
3086 strcat(setName, "_Set_");
3087 FullClassNameCat(setName, prop->name, 0x1);
3088 strcpy(getName, "__ecereProp_");
3089 FullClassNameCat(getName, prop->_class->fullName, 0x0);
3090 strcat(getName, "_Get_");
3091 FullClassNameCat(getName, prop->name, 0x1);
3092 strcpy(propName, "__ecereProp_");
3093 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3094 strcat(propName, "_");
3095 FullClassNameCat(propName, prop->name, 0x1);
3096 MangleClassName(getName);
3097 MangleClassName(setName);
3098 MangleClassName(propName);
3099 if(prop->_class->type == 1)
3100 DeclareStruct(prop->_class->fullName, 0x0);
3101 if(!symbol || curExternal->symbol->idCode < symbol->id)
3102 {
3103 unsigned int imported = 0x0;
3104 unsigned int dllImport = 0x0;
3105
3106 if(!symbol || symbol->_import)
3107 {
3108 if(!symbol)
3109 {
3110 struct Symbol * classSym;
3111
3112 if(!prop->_class->symbol)
3113 prop->_class->symbol = FindClass(prop->_class->fullName);
3114 classSym = prop->_class->symbol;
3115 if(classSym && !classSym->_import)
3116 {
3117 struct ModuleImport * module;
3118
3119 if(prop->_class->module)
3120 module = FindModule(prop->_class->module);
3121 else
3122 module = mainModule;
3123 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));
3124 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3125 }
3126 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3127 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));
3128 if(classSym)
3129 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
3130 }
3131 imported = 0x1;
3132 if(prop->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + structSize_Instance)))->importType != 1)
3133 dllImport = 0x1;
3134 }
3135 if(!symbol->type)
3136 {
3137 struct Context * context = SetupTemplatesContext(prop->_class);
3138
3139 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
3140 FinishTemplatesContext(context);
3141 }
3142 if(prop->Get)
3143 {
3144 if(!symbol->externalGet || symbol->externalGet->type == 0)
3145 {
3146 struct Declaration * decl;
3147 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3148 struct Declarator * d;
3149 struct __ecereNameSpace__ecere__sys__OldList * params;
3150 struct Specifier * spec;
3151 struct External * external;
3152 struct Declarator * typeDecl;
3153 unsigned int simple = 0x0;
3154
3155 specifiers = MkList();
3156 declarators = MkList();
3157 params = MkList();
3158 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3159 d = MkDeclaratorIdentifier(MkIdentifier(getName));
3160 if(dllImport)
3161 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3162 {
3163 struct Context * context = SetupTemplatesContext(prop->_class);
3164
3165 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
3166 FinishTemplatesContext(context);
3167 }
3168 for(spec = (*specifiers).first; spec; spec = spec->next)
3169 {
3170 if(spec->type == 1)
3171 {
3172 if((!typeDecl || typeDecl->type == 1))
3173 {
3174 struct Symbol * classSym = spec->symbol;
3175
3176 symbol->_class = classSym->registered;
3177 if(classSym->registered && classSym->registered->type == 1)
3178 {
3179 DeclareStruct(spec->name, 0x0);
3180 simple = 0x1;
3181 }
3182 }
3183 }
3184 }
3185 if(!simple)
3186 d = PlugDeclarator(typeDecl, d);
3187 else
3188 {
3189 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3190 specifiers = MkList();
3191 }
3192 d = MkDeclaratorFunction(d, params);
3193 if(dllImport)
3194 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3195 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3196 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3197 if(simple)
3198 ListAdd(specifiers, MkSpecifier(VOID));
3199 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3200 decl = MkDeclaration(specifiers, declarators);
3201 external = MkExternalDeclaration(decl);
3202 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3203 external->symbol = symbol;
3204 symbol->externalGet = external;
3205 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3206 if(typeDecl)
3207 FreeDeclarator(typeDecl);
3208 }
3209 else
3210 {
3211 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3212 }
3213 }
3214 if(prop->Set)
3215 {
3216 if(!symbol->externalSet || symbol->externalSet->type == 0)
3217 {
3218 struct Declaration * decl;
3219 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3220 struct Declarator * d;
3221 struct __ecereNameSpace__ecere__sys__OldList * params;
3222 struct Specifier * spec;
3223 struct External * external;
3224 struct Declarator * typeDecl;
3225
3226 declarators = MkList();
3227 params = MkList();
3228 if(!prop->conversion || prop->_class->type == 1)
3229 {
3230 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3231 }
3232 specifiers = MkList();
3233 {
3234 struct Context * context = SetupTemplatesContext(prop->_class);
3235
3236 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3237 FinishTemplatesContext(context);
3238 }
3239 ListAdd(params, MkTypeName(specifiers, d));
3240 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3241 if(dllImport)
3242 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3243 d = MkDeclaratorFunction(d, params);
3244 for(spec = (*specifiers).first; spec; spec = spec->next)
3245 {
3246 if(spec->type == 1)
3247 {
3248 if((!typeDecl || typeDecl->type == 1))
3249 {
3250 struct Symbol * classSym = spec->symbol;
3251
3252 symbol->_class = classSym->registered;
3253 if(classSym->registered && classSym->registered->type == 1)
3254 DeclareStruct(spec->name, 0x0);
3255 }
3256 }
3257 }
3258 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3259 specifiers = MkList();
3260 if(dllImport)
3261 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3262 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3263 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3264 if(!prop->conversion || prop->_class->type == 1)
3265 ListAdd(specifiers, MkSpecifier(VOID));
3266 else
3267 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3268 decl = MkDeclaration(specifiers, declarators);
3269 external = MkExternalDeclaration(decl);
3270 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3271 external->symbol = symbol;
3272 symbol->externalSet = external;
3273 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3274 }
3275 else
3276 {
3277 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3278 }
3279 }
3280 if(!symbol->externalPtr)
3281 {
3282 struct Declaration * decl;
3283 struct External * external;
3284 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3285
3286 if(imported)
3287 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3288 else
3289 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3290 ListAdd(specifiers, MkSpecifierName("Property"));
3291 {
3292 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3293
3294 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3295 if(!imported)
3296 {
3297 strcpy(propName, "__ecerePropM_");
3298 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3299 strcat(propName, "_");
3300 FullClassNameCat(propName, prop->name, 0x1);
3301 MangleClassName(propName);
3302 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3303 }
3304 decl = MkDeclaration(specifiers, list);
3305 }
3306 external = MkExternalDeclaration(decl);
3307 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3308 external->symbol = symbol;
3309 symbol->externalPtr = external;
3310 }
3311 else
3312 {
3313 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3314 }
3315 symbol->id = curExternal->symbol->idCode;
3316 }
3317 }
3318
3319 struct Type * Dereference(struct Type * source)
3320 {
3321 void * __ecereTemp1;
3322 struct Type * type = (((void *)0));
3323
3324 if(source)
3325 {
3326 if(source->kind == 13 || source->kind == 12)
3327 {
3328 type = source->type;
3329 source->type->refCount++;
3330 }
3331 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3332 {
3333 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 1, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
3334 }
3335 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3336 {
3337 type = source;
3338 source->refCount++;
3339 }
3340 else
3341 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot dereference type\n", (((void *)0))));
3342 }
3343 return type;
3344 }
3345
3346 static struct Type * Reference(struct Type * source)
3347 {
3348 void * __ecereTemp1;
3349 struct Type * type = (((void *)0));
3350
3351 if(source)
3352 {
3353 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));
3354 source->refCount++;
3355 }
3356 return type;
3357 }
3358
3359 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);
3360
3361 extern void *  memcpy(void * , const void * , size_t size);
3362
3363 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3364
3365 extern void FreeExpression(struct Expression * exp);
3366
3367 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3368
3369 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);
3370
3371 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3372
3373 extern struct Type * MkClassType(char *  name);
3374
3375 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);
3376
3377 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)
3378 {
3379 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3380 unsigned int found = 0x0;
3381 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3382 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3383 unsigned int freeType = 0x0;
3384
3385 yylloc = member->loc;
3386 if(!ident)
3387 {
3388 if(curMember)
3389 {
3390 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3391 if(*curMember)
3392 {
3393 found = 0x1;
3394 dataMember = *curMember;
3395 }
3396 }
3397 }
3398 else
3399 {
3400 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3401 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3402 int _subMemberStackPos = 0;
3403
3404 if(!thisMember)
3405 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3406 if(thisMember)
3407 {
3408 dataMember = thisMember;
3409 if(curMember && thisMember->memberAccess == 1)
3410 {
3411 *curMember = thisMember;
3412 *curClass = thisMember->_class;
3413 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
3414 *subMemberStackPos = _subMemberStackPos;
3415 }
3416 found = 0x1;
3417 }
3418 else
3419 {
3420 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3421 if(method && method->type == 1)
3422 found = 0x1;
3423 else
3424 method = (((void *)0));
3425 }
3426 }
3427 if(found)
3428 {
3429 struct Type * type = (((void *)0));
3430
3431 if(dataMember)
3432 {
3433 if(!dataMember->dataType && dataMember->dataTypeString)
3434 {
3435 struct Context * context = SetupTemplatesContext(_class);
3436
3437 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3438 FinishTemplatesContext(context);
3439 }
3440 type = dataMember->dataType;
3441 }
3442 else if(method)
3443 {
3444 if(!method->dataType)
3445 ProcessMethodType(method);
3446 type = method->dataType;
3447 }
3448 if(ident && ident->next)
3449 {
3450 for(ident = ident->next; ident && type; ident = ident->next)
3451 {
3452 if(type->kind == 8)
3453 {
3454 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3455 if(!dataMember)
3456 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3457 if(dataMember)
3458 type = dataMember->dataType;
3459 }
3460 else if(type->kind == 9 || type->kind == 10)
3461 {
3462 struct Type * memberType;
3463
3464 for(memberType = type->members.first; memberType; memberType = memberType->next)
3465 {
3466 if(!strcmp(memberType->name, ident->string))
3467 {
3468 type = memberType;
3469 break;
3470 }
3471 }
3472 }
3473 }
3474 }
3475 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3476 {
3477 int id = 0;
3478 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3479 struct __ecereNameSpace__ecere__com__Class * sClass;
3480
3481 for(sClass = _class; sClass; sClass = sClass->base)
3482 {
3483 id = 0;
3484 if(sClass->templateClass)
3485 sClass = sClass->templateClass;
3486 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3487 {
3488 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3489 {
3490 for(sClass = sClass->base; sClass; sClass = sClass->base)
3491 {
3492 if(sClass->templateClass)
3493 sClass = sClass->templateClass;
3494 id += sClass->templateParams.count;
3495 }
3496 break;
3497 }
3498 id++;
3499 }
3500 if(curParam)
3501 break;
3502 }
3503 if(curParam)
3504 {
3505 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3506
3507 if(arg.dataTypeString)
3508 {
3509 type = ProcessTypeString(arg.dataTypeString, 0x0);
3510 freeType = 0x1;
3511 if(type && _class->templateClass)
3512 type->passAsTemplate = 0x1;
3513 if(type)
3514 {
3515 }
3516 }
3517 }
3518 }
3519 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3520 {
3521 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3522 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3523 int c;
3524 int paramCount = 0;
3525 int lastParam = -1;
3526 char templateString[1024];
3527 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3528
3529 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3530 for(cClass = expClass; cClass; cClass = cClass->base)
3531 {
3532 int p = 0;
3533
3534 if(cClass->templateClass)
3535 cClass = cClass->templateClass;
3536 for(param = cClass->templateParams.first; param; param = param->next)
3537 {
3538 int id = p;
3539 struct __ecereNameSpace__ecere__com__Class * sClass;
3540 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3541
3542 for(sClass = cClass->base; sClass; sClass = sClass->base)
3543 {
3544 if(sClass->templateClass)
3545 sClass = sClass->templateClass;
3546 id += sClass->templateParams.count;
3547 }
3548 arg = expClass->templateArgs[id];
3549 for(sClass = _class; sClass; sClass = sClass->base)
3550 {
3551 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3552 int p = 0;
3553 struct __ecereNameSpace__ecere__com__Class * nextClass;
3554
3555 if(sClass->templateClass)
3556 sClass = sClass->templateClass;
3557 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3558 {
3559 if(nextClass->templateClass)
3560 nextClass = nextClass->templateClass;
3561 p += nextClass->templateParams.count;
3562 }
3563 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3564 {
3565 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3566 {
3567 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3568 {
3569 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3570 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3571 break;
3572 }
3573 }
3574 }
3575 }
3576 {
3577 char argument[256];
3578
3579 argument[0] = '\0';
3580 switch(param->type)
3581 {
3582 case 2:
3583 {
3584 char expString[1024];
3585 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3586 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3587 struct Expression * exp;
3588 char * string = PrintHexUInt64(arg.expression.ui64);
3589
3590 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3591 ProcessExpressionType(exp);
3592 ComputeExpression(exp);
3593 expString[0] = '\0';
3594 PrintExpression(exp, expString);
3595 strcat(argument, expString);
3596 FreeExpression(exp);
3597 break;
3598 }
3599 case 1:
3600 {
3601 strcat(argument, arg.member->name);
3602 break;
3603 }
3604 case 0:
3605 {
3606 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3607 strcat(argument, arg.dataTypeString);
3608 break;
3609 }
3610 }
3611 if(argument[0])
3612 {
3613 if(paramCount)
3614 strcat(templateString, ", ");
3615 if(lastParam != p - 1)
3616 {
3617 strcat(templateString, param->name);
3618 strcat(templateString, " = ");
3619 }
3620 strcat(templateString, argument);
3621 paramCount++;
3622 lastParam = p;
3623 }
3624 p++;
3625 }
3626 }
3627 }
3628 {
3629 int len = strlen(templateString);
3630
3631 if(templateString[len - 1] == '<')
3632 len--;
3633 else
3634 {
3635 if(templateString[len - 1] == '>')
3636 templateString[len++] = ' ';
3637 templateString[len++] = '>';
3638 }
3639 templateString[len++] = '\0';
3640 }
3641 {
3642 struct Context * context = SetupTemplatesContext(_class);
3643
3644 if(freeType)
3645 FreeType(type);
3646 type = ProcessTypeString(templateString, 0x0);
3647 freeType = 0x1;
3648 FinishTemplatesContext(context);
3649 }
3650 }
3651 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3652 {
3653 ProcessExpressionType(member->initializer->exp);
3654 if(!member->initializer->exp->expType)
3655 {
3656 if(inCompiler)
3657 {
3658 char expString[10240];
3659
3660 expString[0] = '\0';
3661 PrintExpression(member->initializer->exp, expString);
3662 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3663 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3664 }
3665 }
3666 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3667 {
3668 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible instance method %s\n", (((void *)0))), ident->string);
3669 }
3670 }
3671 else if(member->initializer)
3672 {
3673 ProcessInitializer(member->initializer, type);
3674 }
3675 if(freeType)
3676 FreeType(type);
3677 }
3678 else
3679 {
3680 if(_class && _class->type == 3)
3681 {
3682 if(member->initializer)
3683 {
3684 struct Type * type = MkClassType(_class->fullName);
3685
3686 ProcessInitializer(member->initializer, type);
3687 FreeType(type);
3688 }
3689 }
3690 else
3691 {
3692 if(member->initializer)
3693 {
3694 ProcessInitializer(member->initializer, (((void *)0)));
3695 }
3696 if(ident)
3697 {
3698 if(method)
3699 {
3700 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3701 }
3702 else if(_class)
3703 {
3704 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3705 if(inCompiler)
3706 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3707 }
3708 }
3709 else if(_class)
3710 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3711 }
3712 }
3713 }
3714
3715 extern struct Identifier * GetDeclId(struct Declarator * decl);
3716
3717 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);
3718
3719 extern void FreeSpecifier(struct Specifier * spec);
3720
3721 static void ProcessFunction(struct FunctionDefinition * function);
3722
3723 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (* )(void * ));
3724
3725 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3726
3727 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3728
3729 extern void FreeClassFunction(struct ClassFunction * func);
3730
3731 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3732
3733 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3734
3735 void ProcessInstantiationType(struct Instantiation * inst)
3736 {
3737 yylloc = inst->loc;
3738 if(inst->_class)
3739 {
3740 struct MembersInit * members;
3741 struct Symbol * classSym;
3742 struct __ecereNameSpace__ecere__com__Class * _class;
3743
3744 classSym = inst->_class->symbol;
3745 _class = classSym ? classSym->registered : (((void *)0));
3746 if(!_class || _class->type != 5)
3747 DeclareStruct(inst->_class->name, 0x0);
3748 afterExternal = afterExternal ? afterExternal : curExternal;
3749 if(inst->exp)
3750 ProcessExpressionType(inst->exp);
3751 inst->isConstant = 0x1;
3752 if(inst->members)
3753 {
3754 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3755 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3756 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3757 int subMemberStackPos = 0;
3758
3759 for(members = (*inst->members).first; members; members = members->next)
3760 {
3761 switch(members->type)
3762 {
3763 case 1:
3764 {
3765 char name[1024];
3766 static unsigned int instMethodID = 0;
3767 struct External * external = curExternal;
3768 struct Context * context = curContext;
3769 struct Declarator * declarator = members->function->declarator;
3770 struct Identifier * nameID = GetDeclId(declarator);
3771 char * unmangled = nameID ? nameID->string : (((void *)0));
3772 struct Expression * exp;
3773 struct External * createdExternal = (((void *)0));
3774
3775 if(inCompiler)
3776 {
3777 char number[16];
3778
3779 strcpy(name, "__ecereInstMeth_");
3780 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3781 strcat(name, "_");
3782 strcat(name, nameID->string);
3783 strcat(name, "_");
3784 sprintf(number, "_%08d", instMethodID++);
3785 strcat(name, number);
3786 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3787 }
3788 if(declarator)
3789 {
3790 struct Symbol * symbol = declarator->symbol;
3791 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3792
3793 if(method && method->type == 1)
3794 {
3795 symbol->method = method;
3796 ProcessMethodType(method);
3797 if(!symbol->type->thisClass)
3798 {
3799 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3800 {
3801 if(!currentClass->symbol)
3802 currentClass->symbol = FindClass(currentClass->fullName);
3803 symbol->type->thisClass = currentClass->symbol;
3804 }
3805 else
3806 {
3807 if(!_class->symbol)
3808 _class->symbol = FindClass(_class->fullName);
3809 symbol->type->thisClass = _class->symbol;
3810 }
3811 }
3812 DeclareType(symbol->type, 0x1, 0x1);
3813 }
3814 else if(classSym)
3815 {
3816 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
3817 }
3818 }
3819 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
3820 if(nameID)
3821 {
3822 FreeSpecifier(nameID->_class);
3823 nameID->_class = (((void *)0));
3824 }
3825 if(inCompiler)
3826 {
3827 struct Type * type = declarator->symbol->type;
3828 struct External * oldExternal = curExternal;
3829
3830 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
3831 {
3832 struct External * externalDecl;
3833
3834 externalDecl = MkExternalDeclaration((((void *)0)));
3835 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
3836 if(createdExternal->function)
3837 {
3838 ProcessFunction(createdExternal->function);
3839 {
3840 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
3841
3842 externalDecl->declaration = decl;
3843 if(decl->symbol && !decl->symbol->pointerExternal)
3844 decl->symbol->pointerExternal = externalDecl;
3845 declarator->symbol->pointerExternal = externalDecl;
3846 }
3847 }
3848 }
3849 }
3850 else if(declarator)
3851 {
3852 curExternal = declarator->symbol->pointerExternal;
3853 ProcessFunction((struct FunctionDefinition *)members->function);
3854 }
3855 curExternal = external;
3856 curContext = context;
3857 if(inCompiler)
3858 {
3859 FreeClassFunction(members->function);
3860 exp = QMkExpId(name);
3861 members->type = 0;
3862 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
3863 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
3864 }
3865 break;
3866 }
3867 case 0:
3868 {
3869 if(members->dataMembers && classSym)
3870 {
3871 struct MemberInit * member;
3872 struct Location oldyyloc = yylloc;
3873
3874 for(member = (*members->dataMembers).first; member; member = member->next)
3875 {
3876 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
3877 if(member->initializer && !member->initializer->isConstant)
3878 inst->isConstant = 0x0;
3879 }
3880 yylloc = oldyyloc;
3881 }
3882 break;
3883 }
3884 }
3885 }
3886 }
3887 }
3888 }
3889
3890 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
3891 {
3892 if(inCompiler)
3893 {
3894 if(type->kind == 11)
3895 {
3896 struct Type * param;
3897
3898 if(declareParams)
3899 {
3900 for(param = type->params.first; param; param = param->next)
3901 DeclareType(param, declarePointers, 0x1);
3902 }
3903 DeclareType(type->returnType, declarePointers, 0x1);
3904 }
3905 else if(type->kind == 13 && declarePointers)
3906 DeclareType(type->type, declarePointers, 0x0);
3907 else if(type->kind == 8)
3908 {
3909 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
3910 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
3911 }
3912 else if(type->kind == 9 || type->kind == 10)
3913 {
3914 struct Type * member;
3915
3916 for(member = type->members.first; member; member = member->next)
3917 DeclareType(member, 0x0, 0x0);
3918 }
3919 else if(type->kind == 12)
3920 DeclareType(type->arrayType, declarePointers, 0x0);
3921 }
3922 }
3923
3924 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
3925
3926 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
3927 {
3928 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
3929 int id = 0;
3930 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3931 struct __ecereNameSpace__ecere__com__Class * sClass;
3932
3933 for(sClass = _class; sClass; sClass = sClass->base)
3934 {
3935 id = 0;
3936 if(sClass->templateClass)
3937 sClass = sClass->templateClass;
3938 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3939 {
3940 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
3941 {
3942 for(sClass = sClass->base; sClass; sClass = sClass->base)
3943 {
3944 if(sClass->templateClass)
3945 sClass = sClass->templateClass;
3946 id += sClass->templateParams.count;
3947 }
3948 break;
3949 }
3950 id++;
3951 }
3952 if(curParam)
3953 break;
3954 }
3955 if(curParam)
3956 {
3957 arg = &_class->templateArgs[id];
3958 if(arg && param->type == 0)
3959 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
3960 }
3961 return arg;
3962 }
3963
3964 extern struct Context * PushContext(void);
3965
3966 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
3967
3968 struct TemplatedType
3969 {
3970 uintptr_t key;
3971 struct __ecereNameSpace__ecere__sys__BTNode * parent;
3972 struct __ecereNameSpace__ecere__sys__BTNode * left;
3973 struct __ecereNameSpace__ecere__sys__BTNode * right;
3974 int depth;
3975 struct TemplateParameter * param;
3976 } __attribute__ ((gcc_struct));
3977
3978 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
3979
3980 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
3981 {
3982 void * __ecereTemp1;
3983 struct Context * context = PushContext();
3984
3985 context->templateTypesOnly = 0x1;
3986 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
3987 {
3988 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
3989
3990 for(; param; param = param->next)
3991 {
3992 if(param->type == 0 && param->identifier)
3993 {
3994 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (uintptr_t)param->identifier->string, type->param = param, type);
3995
3996 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
3997 }
3998 }
3999 }
4000 else if(_class)
4001 {
4002 struct __ecereNameSpace__ecere__com__Class * sClass;
4003
4004 for(sClass = _class; sClass; sClass = sClass->base)
4005 {
4006 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
4007
4008 for(p = sClass->templateParams.first; p; p = p->next)
4009 {
4010 if(p->type == 0)
4011 {
4012 struct TemplateParameter * param = p->param;
4013 struct TemplatedType * type;
4014
4015 if(!param)
4016 {
4017 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));
4018 }
4019 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));
4020 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4021 }
4022 }
4023 }
4024 }
4025 return context;
4026 }
4027
4028 extern void PopContext(struct Context * ctx);
4029
4030 extern void FreeContext(struct Context * context);
4031
4032 void FinishTemplatesContext(struct Context * context)
4033 {
4034 PopContext(context);
4035 FreeContext(context);
4036 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
4037 }
4038
4039 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
4040 {
4041 if(!method->dataType)
4042 {
4043 struct Context * context = SetupTemplatesContext(method->_class);
4044
4045 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4046 FinishTemplatesContext(context);
4047 if(method->type != 1 && method->dataType)
4048 {
4049 if(!method->dataType->thisClass && !method->dataType->staticMethod)
4050 {
4051 if(!method->_class->symbol)
4052 method->_class->symbol = FindClass(method->_class->fullName);
4053 method->dataType->thisClass = method->_class->symbol;
4054 }
4055 }
4056 }
4057 }
4058
4059 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
4060 {
4061 if(!prop->dataType)
4062 {
4063 struct Context * context = SetupTemplatesContext(prop->_class);
4064
4065 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
4066 FinishTemplatesContext(context);
4067 }
4068 }
4069
4070 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
4071
4072 extern void FreeTypeName(struct TypeName * typeName);
4073
4074 static void ProcessDeclarator(struct Declarator * decl);
4075
4076 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
4077
4078 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
4079
4080 struct MethodImport
4081 {
4082 struct MethodImport * prev;
4083 struct MethodImport * next;
4084 char *  name;
4085 unsigned int isVirtual;
4086 } __attribute__ ((gcc_struct));
4087
4088 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
4089
4090 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
4091 {
4092 void * __ecereTemp1;
4093 struct Symbol * symbol = method->symbol;
4094
4095 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
4096 {
4097 unsigned int imported = 0x0;
4098 unsigned int dllImport = 0x0;
4099
4100 if(!method->dataType)
4101 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4102 if(!symbol || symbol->_import || method->type == 1)
4103 {
4104 if(!symbol || method->type == 1)
4105 {
4106 struct Symbol * classSym;
4107
4108 if(!method->_class->symbol)
4109 method->_class->symbol = FindClass(method->_class->fullName);
4110 classSym = method->_class->symbol;
4111 if(!classSym->_import)
4112 {
4113 struct ModuleImport * module;
4114
4115 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->name)
4116 module = FindModule(method->_class->module);
4117 else
4118 module = mainModule;
4119 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));
4120 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
4121 }
4122 if(!symbol)
4123 {
4124 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4125 }
4126 if(!symbol->_import)
4127 {
4128 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));
4129 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
4130 }
4131 if(!symbol)
4132 {
4133 symbol->type = method->dataType;
4134 if(symbol->type)
4135 symbol->type->refCount++;
4136 }
4137 }
4138 if(!method->dataType->dllExport)
4139 {
4140 imported = 0x1;
4141 if(method->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->importType != 1)
4142 dllImport = 0x1;
4143 }
4144 }
4145 if(method->type != 1 && method->dataType)
4146 DeclareType(method->dataType, 0x1, 0x1);
4147 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4148 {
4149 struct Declaration * decl;
4150 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4151 struct Declarator * d;
4152 struct Declarator * funcDecl;
4153 struct External * external;
4154
4155 specifiers = MkList();
4156 declarators = MkList();
4157 if(dllImport)
4158 ListAdd(specifiers, MkSpecifier(EXTERN));
4159 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
4160 ListAdd(specifiers, MkSpecifier(STATIC));
4161 if(method->type == 1)
4162 {
4163 ListAdd(specifiers, MkSpecifier(INT));
4164 d = MkDeclaratorIdentifier(MkIdentifier(name));
4165 }
4166 else
4167 {
4168 d = MkDeclaratorIdentifier(MkIdentifier(name));
4169 if(dllImport)
4170 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4171 {
4172 struct Context * context = SetupTemplatesContext(method->_class);
4173
4174 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
4175 FinishTemplatesContext(context);
4176 }
4177 funcDecl = GetFuncDecl(d);
4178 if(dllImport)
4179 {
4180 struct Specifier * spec, * next;
4181
4182 for(spec = (*specifiers).first; spec; spec = next)
4183 {
4184 next = spec->next;
4185 if(spec->type == 5)
4186 {
4187 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4188 FreeSpecifier(spec);
4189 }
4190 }
4191 }
4192 if(method->dataType && !method->dataType->staticMethod)
4193 {
4194 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4195 {
4196 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4197 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")));
4198 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4199 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4200
4201 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4202 {
4203 struct TypeName * param = (*funcDecl->function.parameters).first;
4204
4205 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4206 FreeTypeName(param);
4207 }
4208 if(!funcDecl->function.parameters)
4209 funcDecl->function.parameters = MkList();
4210 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4211 }
4212 }
4213 }
4214 ProcessDeclarator(d);
4215 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4216 decl = MkDeclaration(specifiers, declarators);
4217 ReplaceThisClassSpecifiers(specifiers, method->_class);
4218 if(symbol->pointerExternal)
4219 {
4220 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4221
4222 {
4223 *functionSymbol = *symbol;
4224 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4225 if(functionSymbol->type)
4226 functionSymbol->type->refCount++;
4227 }
4228 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4229 symbol->pointerExternal->symbol = functionSymbol;
4230 }
4231 external = MkExternalDeclaration(decl);
4232 if(curExternal)
4233 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4234 external->symbol = symbol;
4235 symbol->pointerExternal = external;
4236 }
4237 else if(ast)
4238 {
4239 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4240 }
4241 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4242 }
4243 }
4244
4245 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4246 {
4247 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4248 {
4249 unsigned int first = 0x1;
4250 int p = 0;
4251 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4252 int lastParam = -1;
4253 char className[1024];
4254
4255 strcpy(className, _class->fullName);
4256 for(param = _class->templateParams.first; param; param = param->next)
4257 {
4258 {
4259 if(first)
4260 strcat(className, "<");
4261 if(!first)
4262 strcat(className, ", ");
4263 if(lastParam + 1 != p)
4264 {
4265 strcat(className, param->name);
4266 strcat(className, " = ");
4267 }
4268 strcat(className, param->name);
4269 first = 0x0;
4270 lastParam = p;
4271 }
4272 p++;
4273 }
4274 if(!first)
4275 {
4276 int len = strlen(className);
4277
4278 if(className[len - 1] == '>')
4279 className[len++] = ' ';
4280 className[len++] = '>';
4281 className[len++] = '\0';
4282 }
4283 return __ecereNameSpace__ecere__sys__CopyString(className);
4284 }
4285 else
4286 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4287 }
4288
4289 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4290 {
4291 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4292 {
4293 unsigned int first = 0x1;
4294 int p = 0;
4295 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4296 int lastParam = -1;
4297 char className[1024];
4298
4299 strcpy(className, _class->fullName);
4300 for(param = _class->templateParams.first; param; param = param->next)
4301 {
4302 {
4303 if(first)
4304 strcat(className, "<");
4305 if(!first)
4306 strcat(className, ", ");
4307 if(lastParam + 1 != p)
4308 {
4309 strcat(className, param->name);
4310 strcat(className, " = ");
4311 }
4312 strcat(className, param->name);
4313 first = 0x0;
4314 lastParam = p;
4315 }
4316 p++;
4317 }
4318 if(!first)
4319 {
4320 int len = strlen(className);
4321
4322 if(className[len - 1] == '>')
4323 className[len++] = ' ';
4324 className[len++] = '>';
4325 className[len++] = '\0';
4326 }
4327 return MkClassType(className);
4328 }
4329 else
4330 {
4331 return MkClassType(_class->fullName);
4332 }
4333 }
4334
4335 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4336 {
4337 if(specs != (((void *)0)) && _class)
4338 {
4339 struct Specifier * spec;
4340
4341 for(spec = specs->first; spec; spec = spec->next)
4342 {
4343 if(spec->type == 0 && spec->specifier == THISCLASS)
4344 {
4345 spec->type = 1;
4346 spec->name = ReplaceThisClass(_class);
4347 spec->symbol = FindClass(spec->name);
4348 }
4349 }
4350 }
4351 }
4352
4353 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4354
4355 struct __ecereNameSpace__ecere__com__GlobalFunction
4356 {
4357 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4358 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4359 char *  name;
4360 int (*  function)();
4361 struct __ecereNameSpace__ecere__com__Instance * module;
4362 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4363 char *  dataTypeString;
4364 struct Type * dataType;
4365 void *  symbol;
4366 } __attribute__ ((gcc_struct));
4367
4368 extern struct Context * globalContext;
4369
4370 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4371
4372 struct FunctionImport
4373 {
4374 struct FunctionImport * prev;
4375 struct FunctionImport * next;
4376 char *  name;
4377 } __attribute__ ((gcc_struct));
4378
4379 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4380 {
4381 void * __ecereTemp1;
4382 struct Symbol * symbol = function->symbol;
4383
4384 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4385 {
4386 unsigned int imported = 0x0;
4387 unsigned int dllImport = 0x0;
4388
4389 if(!function->dataType)
4390 {
4391 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4392 if(!function->dataType->thisClass)
4393 function->dataType->staticMethod = 0x1;
4394 }
4395 if(inCompiler)
4396 {
4397 if(!symbol)
4398 {
4399 struct ModuleImport * module = FindModule(function->module);
4400
4401 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4402 if(module->name)
4403 {
4404 if(!function->dataType->dllExport)
4405 {
4406 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));
4407 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4408 }
4409 }
4410 {
4411 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4412 if(!symbol->type->thisClass)
4413 symbol->type->staticMethod = 0x1;
4414 }
4415 }
4416 imported = symbol->_import ? 0x1 : 0x0;
4417 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1)
4418 dllImport = 0x1;
4419 }
4420 DeclareType(function->dataType, 0x1, 0x1);
4421 if(inCompiler)
4422 {
4423 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4424 {
4425 struct Declaration * decl;
4426 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4427 struct Declarator * d;
4428 struct Declarator * funcDecl;
4429 struct External * external;
4430
4431 specifiers = MkList();
4432 declarators = MkList();
4433 ListAdd(specifiers, MkSpecifier(EXTERN));
4434 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4435 if(dllImport)
4436 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4437 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4438 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType == 1)
4439 {
4440 struct Specifier * spec;
4441
4442 for(spec = (*specifiers).first; spec; spec = spec->next)
4443 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4444 {
4445 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4446 FreeSpecifier(spec);
4447 break;
4448 }
4449 }
4450 funcDecl = GetFuncDecl(d);
4451 if(funcDecl && !funcDecl->function.parameters)
4452 {
4453 funcDecl->function.parameters = MkList();
4454 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4455 }
4456 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4457 {
4458 struct Context * oldCtx = curContext;
4459
4460 curContext = globalContext;
4461 decl = MkDeclaration(specifiers, declarators);
4462 curContext = oldCtx;
4463 }
4464 if(symbol->pointerExternal)
4465 {
4466 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4467
4468 {
4469 *functionSymbol = *symbol;
4470 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4471 if(functionSymbol->type)
4472 functionSymbol->type->refCount++;
4473 }
4474 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4475 symbol->pointerExternal->symbol = functionSymbol;
4476 }
4477 external = MkExternalDeclaration(decl);
4478 if(curExternal)
4479 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4480 external->symbol = symbol;
4481 symbol->pointerExternal = external;
4482 }
4483 else
4484 {
4485 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4486 }
4487 if(curExternal)
4488 symbol->id = curExternal->symbol->idCode;
4489 }
4490 }
4491 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1) ? 0x1 : 0x0;
4492 }
4493
4494 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4495
4496 struct GlobalData
4497 {
4498 uintptr_t key;
4499 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4500 struct __ecereNameSpace__ecere__sys__BTNode * left;
4501 struct __ecereNameSpace__ecere__sys__BTNode * right;
4502 int depth;
4503 struct __ecereNameSpace__ecere__com__Instance * module;
4504 char *  dataTypeString;
4505 struct Type * dataType;
4506 void *  symbol;
4507 char *  fullName;
4508 } __attribute__ ((gcc_struct));
4509
4510 void DeclareGlobalData(struct GlobalData * data)
4511 {
4512 struct Symbol * symbol = data->symbol;
4513
4514 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4515 {
4516 if(inCompiler)
4517 {
4518 if(!symbol)
4519 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4520 }
4521 if(!data->dataType)
4522 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4523 DeclareType(data->dataType, 0x1, 0x1);
4524 if(inCompiler)
4525 {
4526 if(!symbol->pointerExternal)
4527 {
4528 struct Declaration * decl;
4529 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4530 struct Declarator * d;
4531 struct External * external;
4532
4533 specifiers = MkList();
4534 declarators = MkList();
4535 ListAdd(specifiers, MkSpecifier(EXTERN));
4536 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4537 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4538 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4539 decl = MkDeclaration(specifiers, declarators);
4540 external = MkExternalDeclaration(decl);
4541 if(curExternal)
4542 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4543 external->symbol = symbol;
4544 symbol->pointerExternal = external;
4545 }
4546 else
4547 {
4548 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4549 }
4550 if(curExternal)
4551 symbol->id = curExternal->symbol->idCode;
4552 }
4553 }
4554 }
4555
4556 struct Conversion
4557 {
4558 struct Conversion * prev, * next;
4559 struct __ecereNameSpace__ecere__com__Property * convert;
4560 unsigned int isGet;
4561 struct Type * resultType;
4562 } __attribute__ ((gcc_struct));
4563
4564 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4565
4566 extern void Compiler_Warning(char *  format, ...);
4567
4568 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4569
4570 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)
4571 {
4572 if(source && dest)
4573 {
4574 if(source->kind == 20 && dest->kind != 20)
4575 {
4576 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4577
4578 if(type)
4579 source = type;
4580 }
4581 if(dest->kind == 20 && source->kind != 20)
4582 {
4583 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4584
4585 if(type)
4586 dest = type;
4587 }
4588 if((dest->classObjectType == 2 && source->classObjectType != 3) || (dest->classObjectType == 3 && source->classObjectType != 2))
4589 {
4590 return 0x1;
4591 }
4592 if(source->classObjectType == 3 && dest->classObjectType != 2)
4593 {
4594 return 0x1;
4595 }
4596 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4597 {
4598 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4599 return 0x1;
4600 }
4601 if(dest->kind == 14 && source->kind != 0)
4602 return 0x1;
4603 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))
4604 return 0x1;
4605 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))
4606 return 0x1;
4607 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4608 {
4609 if(source->_class->registered && source->_class->registered->type == 3)
4610 {
4611 if(conversions != (((void *)0)))
4612 {
4613 if(source->_class->registered == dest->_class->registered)
4614 return 0x1;
4615 }
4616 else
4617 {
4618 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4619
4620 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4621 ;
4622 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4623 ;
4624 if(sourceBase == destBase)
4625 return 0x1;
4626 }
4627 }
4628 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))
4629 return 0x1;
4630 else
4631 {
4632 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4 && source->_class && source->_class->registered && source->_class->registered->type != 4)
4633 {
4634 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4635 {
4636 return 0x1;
4637 }
4638 }
4639 }
4640 }
4641 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4642 return 0x1;
4643 if(doConversion)
4644 {
4645 if(source->kind == 8)
4646 {
4647 struct __ecereNameSpace__ecere__com__Class * _class;
4648
4649 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4650 {
4651 struct __ecereNameSpace__ecere__com__Property * convert;
4652
4653 for(convert = _class->conversions.first; convert; convert = convert->next)
4654 {
4655 if(convert->memberAccess == 1 || _class->module == privateModule)
4656 {
4657 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4658
4659 if(!convert->dataType)
4660 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4661 if(MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x0, 0x1, 0x0, 0x1))
4662 {
4663 if(!conversions && !convert->Get)
4664 return 0x1;
4665 else if(conversions != (((void *)0)))
4666 {
4667 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))
4668 return 0x1;
4669 else
4670 {
4671 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4672
4673 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4674 return 0x1;
4675 }
4676 }
4677 }
4678 }
4679 }
4680 }
4681 }
4682 if(dest->kind == 8)
4683 {
4684 struct __ecereNameSpace__ecere__com__Class * _class;
4685
4686 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4687 {
4688 struct __ecereNameSpace__ecere__com__Property * convert;
4689
4690 for(convert = _class->conversions.first; convert; convert = convert->next)
4691 {
4692 if(convert->memberAccess == 1 || _class->module == privateModule)
4693 {
4694 if(!convert->dataType)
4695 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4696 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4697 {
4698 if(!conversions && !convert->Set)
4699 return 0x1;
4700 else if(conversions != (((void *)0)))
4701 {
4702 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))
4703 return 0x1;
4704 else
4705 {
4706 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4707
4708 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4709 return 0x1;
4710 }
4711 }
4712 }
4713 }
4714 }
4715 }
4716 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4717 {
4718 if(!dest->_class->registered->dataType)
4719 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4720 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4721 {
4722 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4723 {
4724 return 0x1;
4725 }
4726 }
4727 }
4728 }
4729 if(source->kind == 8)
4730 {
4731 struct __ecereNameSpace__ecere__com__Class * _class;
4732
4733 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4734 {
4735 struct __ecereNameSpace__ecere__com__Property * convert;
4736
4737 for(convert = _class->conversions.first; convert; convert = convert->next)
4738 {
4739 if(convert->memberAccess == 1 || _class->module == privateModule)
4740 {
4741 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4742
4743 if(!convert->dataType)
4744 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4745 if(convert->dataType != source && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x1))
4746 {
4747 if(!conversions && !convert->Get)
4748 return 0x1;
4749 else if(conversions != (((void *)0)))
4750 {
4751 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))
4752 return 0x1;
4753 else
4754 {
4755 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4756
4757 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4758 return 0x1;
4759 }
4760 }
4761 }
4762 }
4763 }
4764 }
4765 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4766 {
4767 if(!source->_class->registered->dataType)
4768 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4769 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4770 {
4771 return 0x1;
4772 }
4773 }
4774 }
4775 }
4776 if(source->kind == 8 || source->kind == 19)
4777 ;
4778 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
4779 return 0x1;
4780 else if(dest->kind == 7 && source->kind == 6)
4781 return 0x1;
4782 else if(dest->kind == 2 && source->kind == 1)
4783 return 0x1;
4784 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1 || source->kind == 23))
4785 return 0x1;
4786 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 22 || source->kind == 23))
4787 return 0x1;
4788 else if(dest->kind == 22 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 23 || source->kind == 4))
4789 return 0x1;
4790 else if(dest->kind == 23 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4 || source->kind == 22))
4791 return 0x1;
4792 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))
4793 return 0x1;
4794 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))
4795 return 0x1;
4796 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)))
4797 {
4798 struct Type * paramSource, * paramDest;
4799
4800 if(dest->kind == 16)
4801 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
4802 if(source->kind == 16)
4803 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
4804 if(dest->kind == 13 && dest->type->kind == 11)
4805 dest = dest->type;
4806 if(source->kind == 13 && source->type->kind == 11)
4807 source = source->type;
4808 if(dest->kind == 16)
4809 dest = dest->method->dataType;
4810 if(source->kind == 16)
4811 source = source->method->dataType;
4812 paramSource = source->params.first;
4813 if(paramSource && paramSource->kind == 0)
4814 paramSource = (((void *)0));
4815 paramDest = dest->params.first;
4816 if(paramDest && paramDest->kind == 0)
4817 paramDest = (((void *)0));
4818 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
4819 {
4820 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))))
4821 {
4822 if(paramDest && paramDest->kind == 8)
4823 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
4824 else
4825 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class should not take an object\n", (((void *)0))));
4826 return 0x0;
4827 }
4828 paramDest = paramDest->next;
4829 }
4830 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
4831 {
4832 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
4833 {
4834 if(dest->thisClass)
4835 {
4836 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
4837 {
4838 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4839 return 0x0;
4840 }
4841 }
4842 else
4843 {
4844 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
4845 {
4846 if(owningClassDest)
4847 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
4848 else
4849 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "overriding class expected to be derived from method class\n", (((void *)0))));
4850 return 0x0;
4851 }
4852 }
4853 paramSource = paramSource->next;
4854 }
4855 else
4856 {
4857 if(dest->thisClass)
4858 {
4859 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
4860 {
4861 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4862 return 0x0;
4863 }
4864 }
4865 else
4866 {
4867 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
4868 {
4869 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
4870 return 0x0;
4871 }
4872 }
4873 }
4874 }
4875 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4876 {
4877 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible return type for function\n", (((void *)0))));
4878 return 0x0;
4879 }
4880 for(; paramDest; paramDest = paramDest->next)
4881 {
4882 if(!paramSource)
4883 {
4884 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough parameters\n", (((void *)0))));
4885 return 0x0;
4886 }
4887 {
4888 struct Type * paramDestType = paramDest;
4889 struct Type * paramSourceType = paramSource;
4890 struct Type * type = paramDestType;
4891
4892 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
4893 {
4894 int id = 0;
4895 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4896 struct __ecereNameSpace__ecere__com__Class * sClass;
4897
4898 for(sClass = owningClassSource; sClass; sClass = sClass->base)
4899 {
4900 id = 0;
4901 if(sClass->templateClass)
4902 sClass = sClass->templateClass;
4903 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4904 {
4905 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
4906 {
4907 for(sClass = sClass->base; sClass; sClass = sClass->base)
4908 {
4909 if(sClass->templateClass)
4910 sClass = sClass->templateClass;
4911 id += sClass->templateParams.count;
4912 }
4913 break;
4914 }
4915 id++;
4916 }
4917 if(curParam)
4918 break;
4919 }
4920 if(curParam)
4921 {
4922 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
4923
4924 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
4925 }
4926 }
4927 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)))
4928 {
4929 char type[1024];
4930
4931 type[0] = (char)0;
4932 PrintType(paramDest, type, 0x0, 0x1);
4933 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
4934 if(paramDestType != paramDest)
4935 FreeType(paramDestType);
4936 return 0x0;
4937 }
4938 if(paramDestType != paramDest)
4939 FreeType(paramDestType);
4940 }
4941 paramSource = paramSource->next;
4942 }
4943 if(paramSource)
4944 {
4945 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many parameters\n", (((void *)0))));
4946 return 0x0;
4947 }
4948 return 0x1;
4949 }
4950 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
4951 {
4952 return 0x1;
4953 }
4954 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
4955 {
4956 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4957 return 0x1;
4958 }
4959 }
4960 return 0x0;
4961 }
4962
4963 static void FreeConvert(struct Conversion * convert)
4964 {
4965 if(convert->resultType)
4966 FreeType(convert->resultType);
4967 }
4968
4969 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
4970
4971 struct __ecereNameSpace__ecere__com__BTNamedLink
4972 {
4973 char *  name;
4974 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
4975 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
4976 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
4977 int depth;
4978 void *  data;
4979 } __attribute__ ((gcc_struct));
4980
4981 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
4982
4983 struct __ecereNameSpace__ecere__com__EnumClassData
4984 {
4985 struct __ecereNameSpace__ecere__sys__OldList values;
4986 int largest;
4987 } __attribute__ ((gcc_struct));
4988
4989 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
4990
4991 struct __ecereNameSpace__ecere__sys__NamedLink
4992 {
4993 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
4994 struct __ecereNameSpace__ecere__sys__NamedLink * next;
4995 char *  name;
4996 void *  data;
4997 } __attribute__ ((gcc_struct));
4998
4999 extern void FreeExpContents(struct Expression * exp);
5000
5001 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
5002
5003 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
5004
5005 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
5006
5007 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
5008
5009 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
5010
5011 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5012 {
5013 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
5014
5015 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)))
5016 {
5017 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
5018
5019 if(_class->type == 4)
5020 {
5021 struct __ecereNameSpace__ecere__sys__OldList converts = 
5022 {
5023 0, 0, 0, 0, 0
5024 };
5025 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5026
5027 type->kind = 8;
5028 if(!_class->symbol)
5029 _class->symbol = FindClass(_class->fullName);
5030 type->_class = _class->symbol;
5031 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
5032 {
5033 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5034 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5035
5036 if(enumClass)
5037 {
5038 struct __ecereNameSpace__ecere__com__Class * baseClass;
5039
5040 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
5041 {
5042 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
5043
5044 for(value = e->values.first; value; value = value->next)
5045 {
5046 if(!strcmp(value->name, string))
5047 break;
5048 }
5049 if(value)
5050 {
5051 FreeExpContents(sourceExp);
5052 FreeType(sourceExp->expType);
5053 sourceExp->isConstant = 0x1;
5054 sourceExp->expType = MkClassType(baseClass->fullName);
5055 {
5056 char constant[256];
5057
5058 sourceExp->type = 2;
5059 if(!strcmp(baseClass->dataTypeString, "int"))
5060 sprintf(constant, "%d", value->data);
5061 else
5062 sprintf(constant, "0x%X", value->data);
5063 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5064 }
5065 while(converts.first)
5066 {
5067 struct Conversion * convert = converts.first;
5068
5069 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
5070 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
5071 }
5072 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5073 return 0x1;
5074 }
5075 }
5076 }
5077 }
5078 if(converts.first)
5079 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
5080 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5081 }
5082 }
5083 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)))
5084 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
5085 return 0x1;
5086 return 0x0;
5087 }
5088
5089 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
5090
5091 struct __ecereNameSpace__ecere__com__SubModule
5092 {
5093 struct __ecereNameSpace__ecere__com__SubModule * prev;
5094 struct __ecereNameSpace__ecere__com__SubModule * next;
5095 struct __ecereNameSpace__ecere__com__Instance * module;
5096 int importMode;
5097 } __attribute__ ((gcc_struct));
5098
5099 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
5100 {
5101 struct __ecereNameSpace__ecere__com__SubModule * subModule;
5102
5103 if(searchFor == searchIn)
5104 return 0x1;
5105 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
5106 {
5107 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->application)
5108 {
5109 if(ModuleVisibility(subModule->module, searchFor))
5110 return 0x1;
5111 }
5112 }
5113 return 0x0;
5114 }
5115
5116 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
5117
5118 struct __ecereNameSpace__ecere__com__Application
5119 {
5120 int argc;
5121 char * *  argv;
5122 int exitCode;
5123 unsigned int isGUIApp;
5124 struct __ecereNameSpace__ecere__sys__OldList allModules;
5125 char *  parsedCommand;
5126 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
5127 } __attribute__ ((gcc_struct));
5128
5129 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5130 {
5131 struct __ecereNameSpace__ecere__com__Instance * module;
5132
5133 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))
5134 return 0x1;
5135 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))
5136 return 0x1;
5137 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))
5138 return 0x1;
5139 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)
5140 {
5141 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5142 return 0x1;
5143 }
5144 return 0x0;
5145 }
5146
5147 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
5148
5149 void ReadString(char *  output, char *  string);
5150
5151 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
5152
5153 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
5154
5155 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
5156
5157 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
5158 {
5159 void * __ecereTemp1;
5160 struct Type * source = sourceExp->expType;
5161 struct Type * realDest = dest;
5162 struct Type * backupSourceExpType = (((void *)0));
5163
5164 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5165 return 0x1;
5166 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5167 {
5168 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5169 {
5170 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5171
5172 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5173 ;
5174 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5175 ;
5176 if(sourceBase == destBase)
5177 return 0x1;
5178 }
5179 }
5180 if(source)
5181 {
5182 struct __ecereNameSpace__ecere__sys__OldList * specs;
5183 unsigned int flag = 0x0;
5184 long long value = (((int)0x7fffffff));
5185
5186 source->refCount++;
5187 dest->refCount++;
5188 if(sourceExp->type == 2)
5189 {
5190 if(source->isSigned)
5191 value = strtoll(sourceExp->constant, (((void *)0)), 0);
5192 else
5193 value = strtoull(sourceExp->constant, (((void *)0)), 0);
5194 }
5195 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
5196 {
5197 if(source->isSigned)
5198 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
5199 else
5200 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
5201 }
5202 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5203 {
5204 FreeType(source);
5205 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));
5206 }
5207 if(dest->kind == 8)
5208 {
5209 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5210
5211 if(_class && _class->type == 3)
5212 {
5213 if(source->kind != 8)
5214 {
5215 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5216 struct Type * tempDest, * tempSource;
5217
5218 for(; _class->base->type != 1000; _class = _class->base)
5219 ;
5220 tempSource = dest;
5221 tempDest = tempType;
5222 tempType->kind = 8;
5223 if(!_class->symbol)
5224 _class->symbol = FindClass(_class->fullName);
5225 tempType->_class = _class->symbol;
5226 tempType->truth = dest->truth;
5227 if(tempType->_class)
5228 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5229 backupSourceExpType = sourceExp->expType;
5230 sourceExp->expType = dest;
5231 dest->refCount++;
5232 flag = 0x1;
5233 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5234 }
5235 }
5236 if(_class && _class->type == 2 && source->kind != 8)
5237 {
5238 if(!dest->_class->registered->dataType)
5239 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5240 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5241 {
5242 FreeType(source);
5243 FreeType(sourceExp->expType);
5244 source = sourceExp->expType = MkClassType(dest->_class->string);
5245 source->refCount++;
5246 }
5247 }
5248 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5249 {
5250 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5251 struct Declarator * decl;
5252 char string[1024];
5253
5254 ReadString(string, sourceExp->string);
5255 decl = SpecDeclFromString(string, specs, (((void *)0)));
5256 FreeExpContents(sourceExp);
5257 FreeType(sourceExp->expType);
5258 sourceExp->type = 26;
5259 sourceExp->_classExp.specifiers = specs;
5260 sourceExp->_classExp.decl = decl;
5261 sourceExp->expType = dest;
5262 dest->refCount++;
5263 FreeType(source);
5264 FreeType(dest);
5265 if(backupSourceExpType)
5266 FreeType(backupSourceExpType);
5267 return 0x1;
5268 }
5269 }
5270 else if(source->kind == 8)
5271 {
5272 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5273
5274 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5275 {
5276 if(dest->kind != 8)
5277 {
5278 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5279 struct Type * tempDest, * tempSource;
5280
5281 if(!source->_class->registered->dataType)
5282 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5283 for(; _class->base->type != 1000; _class = _class->base)
5284 ;
5285 tempDest = source;
5286 tempSource = tempType;
5287 tempType->kind = 8;
5288 tempType->_class = FindClass(_class->fullName);
5289 tempType->truth = source->truth;
5290 tempType->classObjectType = source->classObjectType;
5291 if(tempType->_class)
5292 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5293 if(conversions->last)
5294 {
5295 ((struct Conversion *)conversions->last)->resultType = dest;
5296 dest->refCount++;
5297 }
5298 FreeType(sourceExp->expType);
5299 sourceExp->expType = MkClassType(_class->fullName);
5300 sourceExp->expType->truth = source->truth;
5301 sourceExp->expType->classObjectType = source->classObjectType;
5302 if(!sourceExp->destType)
5303 {
5304 FreeType(sourceExp->destType);
5305 sourceExp->destType = sourceExp->expType;
5306 if(sourceExp->expType)
5307 sourceExp->expType->refCount++;
5308 }
5309 if(!_class->dataType)
5310 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5311 FreeType(dest);
5312 dest = MkClassType(source->_class->string);
5313 dest->truth = source->truth;
5314 dest->classObjectType = source->classObjectType;
5315 FreeType(source);
5316 source = _class->dataType;
5317 source->refCount++;
5318 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5319 }
5320 }
5321 }
5322 if(!flag)
5323 {
5324 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5325 {
5326 FreeType(source);
5327 FreeType(dest);
5328 return 0x1;
5329 }
5330 }
5331 if(dest->kind == 8)
5332 {
5333 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5334
5335 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5336 {
5337 if(_class->type == 0 || _class->type == 5)
5338 {
5339 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5340
5341 *newExp = *sourceExp;
5342 if(sourceExp->destType)
5343 sourceExp->destType->refCount++;
5344 if(sourceExp->expType)
5345 sourceExp->expType->refCount++;
5346 sourceExp->type = 11;
5347 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5348 sourceExp->cast.exp = newExp;
5349 FreeType(sourceExp->expType);
5350 sourceExp->expType = (((void *)0));
5351 ProcessExpressionType(sourceExp);
5352 if(!inCompiler)
5353 {
5354 FreeType(sourceExp->expType);
5355 sourceExp->expType = dest;
5356 }
5357 FreeType(source);
5358 if(inCompiler)
5359 FreeType(dest);
5360 if(backupSourceExpType)
5361 FreeType(backupSourceExpType);
5362 return 0x1;
5363 }
5364 if(!_class->dataType)
5365 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5366 FreeType(dest);
5367 dest = _class->dataType;
5368 dest->refCount++;
5369 }
5370 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5371 {
5372 specs = MkListOne(MkSpecifier(DOUBLE));
5373 }
5374 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 7))
5375 {
5376 specs = MkListOne(MkSpecifier(FLOAT));
5377 }
5378 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5379 {
5380 specs = MkList();
5381 if(!dest->isSigned)
5382 ListAdd(specs, MkSpecifier(UNSIGNED));
5383 ListAdd(specs, MkSpecifier(INT64));
5384 }
5385 else if(dest->kind == 3 && (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(INT));
5391 }
5392 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5393 {
5394 specs = MkList();
5395 if(!dest->isSigned)
5396 ListAdd(specs, MkSpecifier(UNSIGNED));
5397 ListAdd(specs, MkSpecifier(SHORT));
5398 }
5399 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 2 || 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(CHAR));
5405 }
5406 else
5407 {
5408 FreeType(source);
5409 FreeType(dest);
5410 if(backupSourceExpType)
5411 {
5412 if(sourceExp->expType)
5413 FreeType(sourceExp->expType);
5414 sourceExp->expType = backupSourceExpType;
5415 }
5416 return 0x0;
5417 }
5418 }
5419 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))
5420 {
5421 specs = MkListOne(MkSpecifier(DOUBLE));
5422 }
5423 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5424 {
5425 specs = MkListOne(MkSpecifier(FLOAT));
5426 }
5427 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)))
5428 {
5429 specs = MkList();
5430 if(!dest->isSigned)
5431 ListAdd(specs, MkSpecifier(UNSIGNED));
5432 ListAdd(specs, MkSpecifier(CHAR));
5433 }
5434 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)))))
5435 {
5436 specs = MkList();
5437 if(!dest->isSigned)
5438 ListAdd(specs, MkSpecifier(UNSIGNED));
5439 ListAdd(specs, MkSpecifier(SHORT));
5440 }
5441 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3))
5442 {
5443 specs = MkList();
5444 if(!dest->isSigned)
5445 ListAdd(specs, MkSpecifier(UNSIGNED));
5446 ListAdd(specs, MkSpecifier(INT));
5447 }
5448 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5449 {
5450 specs = MkList();
5451 if(!dest->isSigned)
5452 ListAdd(specs, MkSpecifier(UNSIGNED));
5453 ListAdd(specs, MkSpecifier(INT64));
5454 }
5455 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5456 {
5457 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5458 }
5459 else
5460 {
5461 FreeType(source);
5462 FreeType(dest);
5463 if(backupSourceExpType)
5464 {
5465 if(sourceExp->expType)
5466 FreeType(sourceExp->expType);
5467 sourceExp->expType = backupSourceExpType;
5468 }
5469 return 0x0;
5470 }
5471 if(!flag)
5472 {
5473 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5474
5475 *newExp = *sourceExp;
5476 newExp->prev = (((void *)0));
5477 newExp->next = (((void *)0));
5478 if(sourceExp->destType)
5479 sourceExp->destType->refCount++;
5480 if(sourceExp->expType)
5481 sourceExp->expType->refCount++;
5482 sourceExp->type = 11;
5483 if(realDest->kind == 8)
5484 {
5485 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5486 FreeList(specs, FreeSpecifier);
5487 }
5488 else
5489 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5490 if(newExp->type == 4)
5491 {
5492 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5493 }
5494 else
5495 sourceExp->cast.exp = newExp;
5496 FreeType(sourceExp->expType);
5497 sourceExp->expType = (((void *)0));
5498 ProcessExpressionType(sourceExp);
5499 }
5500 else
5501 FreeList(specs, FreeSpecifier);
5502 FreeType(dest);
5503 FreeType(source);
5504 if(backupSourceExpType)
5505 FreeType(backupSourceExpType);
5506 return 0x1;
5507 }
5508 else
5509 {
5510 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5511 sourceExp = (*sourceExp->list).last;
5512 if(sourceExp->type == 0)
5513 {
5514 struct Identifier * id = sourceExp->identifier;
5515
5516 if(dest->kind == 8)
5517 {
5518 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5519 {
5520 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5521 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5522
5523 if(enumClass)
5524 {
5525 for(; _class && _class->type == 4; _class = _class->base)
5526 {
5527 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5528 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5529
5530 for(value = e->values.first; value; value = value->next)
5531 {
5532 if(!strcmp(value->name, id->string))
5533 break;
5534 }
5535 if(value)
5536 {
5537 FreeExpContents(sourceExp);
5538 FreeType(sourceExp->expType);
5539 sourceExp->isConstant = 0x1;
5540 sourceExp->expType = MkClassType(_class->fullName);
5541 {
5542 char constant[256];
5543
5544 sourceExp->type = 2;
5545 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5546 sprintf(constant, "%d", value->data);
5547 else
5548 sprintf(constant, "0x%X", value->data);
5549 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5550 }
5551 return 0x1;
5552 }
5553 }
5554 }
5555 }
5556 }
5557 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5558 return 0x1;
5559 }
5560 }
5561 return 0x0;
5562 }
5563
5564 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5565 {
5566 int value2 = op2->i;
5567
5568 exp->type = 2;
5569 exp->string = PrintInt(op1->i + value2);
5570 if(!exp->expType)
5571 {
5572 exp->expType = op1->type;
5573 if(op1->type)
5574 op1->type->refCount++;
5575 }
5576 return 0x1;
5577 }
5578
5579 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5580 {
5581 unsigned int value2 = op2->ui;
5582
5583 exp->type = 2;
5584 exp->string = PrintUInt(op1->ui + value2);
5585 if(!exp->expType)
5586 {
5587 exp->expType = op1->type;
5588 if(op1->type)
5589 op1->type->refCount++;
5590 }
5591 return 0x1;
5592 }
5593
5594 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5595 {
5596 short value2 = op2->s;
5597
5598 exp->type = 2;
5599 exp->string = PrintShort(op1->s + value2);
5600 if(!exp->expType)
5601 {
5602 exp->expType = op1->type;
5603 if(op1->type)
5604 op1->type->refCount++;
5605 }
5606 return 0x1;
5607 }
5608
5609 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5610 {
5611 unsigned short value2 = op2->us;
5612
5613 exp->type = 2;
5614 exp->string = PrintUShort(op1->us + value2);
5615 if(!exp->expType)
5616 {
5617 exp->expType = op1->type;
5618 if(op1->type)
5619 op1->type->refCount++;
5620 }
5621 return 0x1;
5622 }
5623
5624 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5625 {
5626 char value2 = op2->c;
5627
5628 exp->type = 2;
5629 exp->string = PrintChar(op1->c + value2);
5630 if(!exp->expType)
5631 {
5632 exp->expType = op1->type;
5633 if(op1->type)
5634 op1->type->refCount++;
5635 }
5636 return 0x1;
5637 }
5638
5639 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5640 {
5641 unsigned char value2 = op2->uc;
5642
5643 exp->type = 2;
5644 exp->string = PrintUChar(op1->uc + value2);
5645 if(!exp->expType)
5646 {
5647 exp->expType = op1->type;
5648 if(op1->type)
5649 op1->type->refCount++;
5650 }
5651 return 0x1;
5652 }
5653
5654 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5655 {
5656 float value2 = op2->f;
5657
5658 exp->type = 2;
5659 exp->string = PrintFloat(op1->f + value2);
5660 if(!exp->expType)
5661 {
5662 exp->expType = op1->type;
5663 if(op1->type)
5664 op1->type->refCount++;
5665 }
5666 return 0x1;
5667 }
5668
5669 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5670 {
5671 double value2 = op2->d;
5672
5673 exp->type = 2;
5674 exp->string = PrintDouble(op1->d + value2);
5675 if(!exp->expType)
5676 {
5677 exp->expType = op1->type;
5678 if(op1->type)
5679 op1->type->refCount++;
5680 }
5681 return 0x1;
5682 }
5683
5684 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5685 {
5686 int value2 = op2->i;
5687
5688 exp->type = 2;
5689 exp->string = PrintInt(op1->i - value2);
5690 if(!exp->expType)
5691 {
5692 exp->expType = op1->type;
5693 if(op1->type)
5694 op1->type->refCount++;
5695 }
5696 return 0x1;
5697 }
5698
5699 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5700 {
5701 unsigned int value2 = op2->ui;
5702
5703 exp->type = 2;
5704 exp->string = PrintUInt(op1->ui - value2);
5705 if(!exp->expType)
5706 {
5707 exp->expType = op1->type;
5708 if(op1->type)
5709 op1->type->refCount++;
5710 }
5711 return 0x1;
5712 }
5713
5714 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5715 {
5716 short value2 = op2->s;
5717
5718 exp->type = 2;
5719 exp->string = PrintShort(op1->s - value2);
5720 if(!exp->expType)
5721 {
5722 exp->expType = op1->type;
5723 if(op1->type)
5724 op1->type->refCount++;
5725 }
5726 return 0x1;
5727 }
5728
5729 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5730 {
5731 unsigned short value2 = op2->us;
5732
5733 exp->type = 2;
5734 exp->string = PrintUShort(op1->us - value2);
5735 if(!exp->expType)
5736 {
5737 exp->expType = op1->type;
5738 if(op1->type)
5739 op1->type->refCount++;
5740 }
5741 return 0x1;
5742 }
5743
5744 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5745 {
5746 char value2 = op2->c;
5747
5748 exp->type = 2;
5749 exp->string = PrintChar(op1->c - value2);
5750 if(!exp->expType)
5751 {
5752 exp->expType = op1->type;
5753 if(op1->type)
5754 op1->type->refCount++;
5755 }
5756 return 0x1;
5757 }
5758
5759 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5760 {
5761 unsigned char value2 = op2->uc;
5762
5763 exp->type = 2;
5764 exp->string = PrintUChar(op1->uc - value2);
5765 if(!exp->expType)
5766 {
5767 exp->expType = op1->type;
5768 if(op1->type)
5769 op1->type->refCount++;
5770 }
5771 return 0x1;
5772 }
5773
5774 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5775 {
5776 float value2 = op2->f;
5777
5778 exp->type = 2;
5779 exp->string = PrintFloat(op1->f - value2);
5780 if(!exp->expType)
5781 {
5782 exp->expType = op1->type;
5783 if(op1->type)
5784 op1->type->refCount++;
5785 }
5786 return 0x1;
5787 }
5788
5789 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5790 {
5791 double value2 = op2->d;
5792
5793 exp->type = 2;
5794 exp->string = PrintDouble(op1->d - value2);
5795 if(!exp->expType)
5796 {
5797 exp->expType = op1->type;
5798 if(op1->type)
5799 op1->type->refCount++;
5800 }
5801 return 0x1;
5802 }
5803
5804 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5805 {
5806 int value2 = op2->i;
5807
5808 exp->type = 2;
5809 exp->string = PrintInt(op1->i * value2);
5810 if(!exp->expType)
5811 {
5812 exp->expType = op1->type;
5813 if(op1->type)
5814 op1->type->refCount++;
5815 }
5816 return 0x1;
5817 }
5818
5819 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5820 {
5821 unsigned int value2 = op2->ui;
5822
5823 exp->type = 2;
5824 exp->string = PrintUInt(op1->ui * value2);
5825 if(!exp->expType)
5826 {
5827 exp->expType = op1->type;
5828 if(op1->type)
5829 op1->type->refCount++;
5830 }
5831 return 0x1;
5832 }
5833
5834 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5835 {
5836 short value2 = op2->s;
5837
5838 exp->type = 2;
5839 exp->string = PrintShort(op1->s * value2);
5840 if(!exp->expType)
5841 {
5842 exp->expType = op1->type;
5843 if(op1->type)
5844 op1->type->refCount++;
5845 }
5846 return 0x1;
5847 }
5848
5849 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5850 {
5851 unsigned short value2 = op2->us;
5852
5853 exp->type = 2;
5854 exp->string = PrintUShort(op1->us * value2);
5855 if(!exp->expType)
5856 {
5857 exp->expType = op1->type;
5858 if(op1->type)
5859 op1->type->refCount++;
5860 }
5861 return 0x1;
5862 }
5863
5864 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5865 {
5866 char value2 = op2->c;
5867
5868 exp->type = 2;
5869 exp->string = PrintChar(op1->c * value2);
5870 if(!exp->expType)
5871 {
5872 exp->expType = op1->type;
5873 if(op1->type)
5874 op1->type->refCount++;
5875 }
5876 return 0x1;
5877 }
5878
5879 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5880 {
5881 unsigned char value2 = op2->uc;
5882
5883 exp->type = 2;
5884 exp->string = PrintUChar(op1->uc * value2);
5885 if(!exp->expType)
5886 {
5887 exp->expType = op1->type;
5888 if(op1->type)
5889 op1->type->refCount++;
5890 }
5891 return 0x1;
5892 }
5893
5894 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5895 {
5896 float value2 = op2->f;
5897
5898 exp->type = 2;
5899 exp->string = PrintFloat(op1->f * value2);
5900 if(!exp->expType)
5901 {
5902 exp->expType = op1->type;
5903 if(op1->type)
5904 op1->type->refCount++;
5905 }
5906 return 0x1;
5907 }
5908
5909 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5910 {
5911 double value2 = op2->d;
5912
5913 exp->type = 2;
5914 exp->string = PrintDouble(op1->d * value2);
5915 if(!exp->expType)
5916 {
5917 exp->expType = op1->type;
5918 if(op1->type)
5919 op1->type->refCount++;
5920 }
5921 return 0x1;
5922 }
5923
5924 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5925 {
5926 int value2 = op2->i;
5927
5928 exp->type = 2;
5929 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
5930 if(!exp->expType)
5931 {
5932 exp->expType = op1->type;
5933 if(op1->type)
5934 op1->type->refCount++;
5935 }
5936 return 0x1;
5937 }
5938
5939 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5940 {
5941 unsigned int value2 = op2->ui;
5942
5943 exp->type = 2;
5944 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
5945 if(!exp->expType)
5946 {
5947 exp->expType = op1->type;
5948 if(op1->type)
5949 op1->type->refCount++;
5950 }
5951 return 0x1;
5952 }
5953
5954 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5955 {
5956 short value2 = op2->s;
5957
5958 exp->type = 2;
5959 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
5960 if(!exp->expType)
5961 {
5962 exp->expType = op1->type;
5963 if(op1->type)
5964 op1->type->refCount++;
5965 }
5966 return 0x1;
5967 }
5968
5969 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5970 {
5971 unsigned short value2 = op2->us;
5972
5973 exp->type = 2;
5974 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
5975 if(!exp->expType)
5976 {
5977 exp->expType = op1->type;
5978 if(op1->type)
5979 op1->type->refCount++;
5980 }
5981 return 0x1;
5982 }
5983
5984 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5985 {
5986 char value2 = op2->c;
5987
5988 exp->type = 2;
5989 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
5990 if(!exp->expType)
5991 {
5992 exp->expType = op1->type;
5993 if(op1->type)
5994 op1->type->refCount++;
5995 }
5996 return 0x1;
5997 }
5998
5999 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6000 {
6001 unsigned char value2 = op2->uc;
6002
6003 exp->type = 2;
6004 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
6005 if(!exp->expType)
6006 {
6007 exp->expType = op1->type;
6008 if(op1->type)
6009 op1->type->refCount++;
6010 }
6011 return 0x1;
6012 }
6013
6014 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6015 {
6016 float value2 = op2->f;
6017
6018 exp->type = 2;
6019 exp->string = PrintFloat(value2 ? (op1->f / value2) : (float)0);
6020 if(!exp->expType)
6021 {
6022 exp->expType = op1->type;
6023 if(op1->type)
6024 op1->type->refCount++;
6025 }
6026 return 0x1;
6027 }
6028
6029 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6030 {
6031 double value2 = op2->d;
6032
6033 exp->type = 2;
6034 exp->string = PrintDouble(value2 ? (op1->d / value2) : (double)0);
6035 if(!exp->expType)
6036 {
6037 exp->expType = op1->type;
6038 if(op1->type)
6039 op1->type->refCount++;
6040 }
6041 return 0x1;
6042 }
6043
6044 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6045 {
6046 int value2 = op2->i;
6047
6048 exp->type = 2;
6049 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
6050 if(!exp->expType)
6051 {
6052 exp->expType = op1->type;
6053 if(op1->type)
6054 op1->type->refCount++;
6055 }
6056 return 0x1;
6057 }
6058
6059 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6060 {
6061 unsigned int value2 = op2->ui;
6062
6063 exp->type = 2;
6064 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
6065 if(!exp->expType)
6066 {
6067 exp->expType = op1->type;
6068 if(op1->type)
6069 op1->type->refCount++;
6070 }
6071 return 0x1;
6072 }
6073
6074 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6075 {
6076 short value2 = op2->s;
6077
6078 exp->type = 2;
6079 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
6080 if(!exp->expType)
6081 {
6082 exp->expType = op1->type;
6083 if(op1->type)
6084 op1->type->refCount++;
6085 }
6086 return 0x1;
6087 }
6088
6089 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6090 {
6091 unsigned short value2 = op2->us;
6092
6093 exp->type = 2;
6094 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
6095 if(!exp->expType)
6096 {
6097 exp->expType = op1->type;
6098 if(op1->type)
6099 op1->type->refCount++;
6100 }
6101 return 0x1;
6102 }
6103
6104 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6105 {
6106 char value2 = op2->c;
6107
6108 exp->type = 2;
6109 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
6110 if(!exp->expType)
6111 {
6112 exp->expType = op1->type;
6113 if(op1->type)
6114 op1->type->refCount++;
6115 }
6116 return 0x1;
6117 }
6118
6119 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6120 {
6121 unsigned char value2 = op2->uc;
6122
6123 exp->type = 2;
6124 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
6125 if(!exp->expType)
6126 {
6127 exp->expType = op1->type;
6128 if(op1->type)
6129 op1->type->refCount++;
6130 }
6131 return 0x1;
6132 }
6133
6134 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
6135 {
6136 exp->type = 2;
6137 exp->string = PrintInt(-op1->i);
6138 if(!exp->expType)
6139 {
6140 exp->expType = op1->type;
6141 if(op1->type)
6142 op1->type->refCount++;
6143 }
6144 return 0x1;
6145 }
6146
6147 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
6148 {
6149 exp->type = 2;
6150 exp->string = PrintUInt(-op1->ui);
6151 if(!exp->expType)
6152 {
6153 exp->expType = op1->type;
6154 if(op1->type)
6155 op1->type->refCount++;
6156 }
6157 return 0x1;
6158 }
6159
6160 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
6161 {
6162 exp->type = 2;
6163 exp->string = PrintShort(-op1->s);
6164 if(!exp->expType)
6165 {
6166 exp->expType = op1->type;
6167 if(op1->type)
6168 op1->type->refCount++;
6169 }
6170 return 0x1;
6171 }
6172
6173 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
6174 {
6175 exp->type = 2;
6176 exp->string = PrintUShort(-op1->us);
6177 if(!exp->expType)
6178 {
6179 exp->expType = op1->type;
6180 if(op1->type)
6181 op1->type->refCount++;
6182 }
6183 return 0x1;
6184 }
6185
6186 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
6187 {
6188 exp->type = 2;
6189 exp->string = PrintChar(-op1->c);
6190 if(!exp->expType)
6191 {
6192 exp->expType = op1->type;
6193 if(op1->type)
6194 op1->type->refCount++;
6195 }
6196 return 0x1;
6197 }
6198
6199 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
6200 {
6201 exp->type = 2;
6202 exp->string = PrintUChar(-op1->uc);
6203 if(!exp->expType)
6204 {
6205 exp->expType = op1->type;
6206 if(op1->type)
6207 op1->type->refCount++;
6208 }
6209 return 0x1;
6210 }
6211
6212 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
6213 {
6214 exp->type = 2;
6215 exp->string = PrintFloat(-op1->f);
6216 if(!exp->expType)
6217 {
6218 exp->expType = op1->type;
6219 if(op1->type)
6220 op1->type->refCount++;
6221 }
6222 return 0x1;
6223 }
6224
6225 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6226 {
6227 exp->type = 2;
6228 exp->string = PrintDouble(-op1->d);
6229 if(!exp->expType)
6230 {
6231 exp->expType = op1->type;
6232 if(op1->type)
6233 op1->type->refCount++;
6234 }
6235 return 0x1;
6236 }
6237
6238 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6239 {
6240 exp->type = 2;
6241 exp->string = PrintInt(++op1->i);
6242 if(!exp->expType)
6243 {
6244 exp->expType = op1->type;
6245 if(op1->type)
6246 op1->type->refCount++;
6247 }
6248 return 0x1;
6249 }
6250
6251 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6252 {
6253 exp->type = 2;
6254 exp->string = PrintUInt(++op1->ui);
6255 if(!exp->expType)
6256 {
6257 exp->expType = op1->type;
6258 if(op1->type)
6259 op1->type->refCount++;
6260 }
6261 return 0x1;
6262 }
6263
6264 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6265 {
6266 exp->type = 2;
6267 exp->string = PrintShort(++op1->s);
6268 if(!exp->expType)
6269 {
6270 exp->expType = op1->type;
6271 if(op1->type)
6272 op1->type->refCount++;
6273 }
6274 return 0x1;
6275 }
6276
6277 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6278 {
6279 exp->type = 2;
6280 exp->string = PrintUShort(++op1->us);
6281 if(!exp->expType)
6282 {
6283 exp->expType = op1->type;
6284 if(op1->type)
6285 op1->type->refCount++;
6286 }
6287 return 0x1;
6288 }
6289
6290 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6291 {
6292 exp->type = 2;
6293 exp->string = PrintChar(++op1->c);
6294 if(!exp->expType)
6295 {
6296 exp->expType = op1->type;
6297 if(op1->type)
6298 op1->type->refCount++;
6299 }
6300 return 0x1;
6301 }
6302
6303 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6304 {
6305 exp->type = 2;
6306 exp->string = PrintUChar(++op1->uc);
6307 if(!exp->expType)
6308 {
6309 exp->expType = op1->type;
6310 if(op1->type)
6311 op1->type->refCount++;
6312 }
6313 return 0x1;
6314 }
6315
6316 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6317 {
6318 exp->type = 2;
6319 exp->string = PrintFloat(++op1->f);
6320 if(!exp->expType)
6321 {
6322 exp->expType = op1->type;
6323 if(op1->type)
6324 op1->type->refCount++;
6325 }
6326 return 0x1;
6327 }
6328
6329 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6330 {
6331 exp->type = 2;
6332 exp->string = PrintDouble(++op1->d);
6333 if(!exp->expType)
6334 {
6335 exp->expType = op1->type;
6336 if(op1->type)
6337 op1->type->refCount++;
6338 }
6339 return 0x1;
6340 }
6341
6342 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6343 {
6344 exp->type = 2;
6345 exp->string = PrintInt(--op1->i);
6346 if(!exp->expType)
6347 {
6348 exp->expType = op1->type;
6349 if(op1->type)
6350 op1->type->refCount++;
6351 }
6352 return 0x1;
6353 }
6354
6355 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6356 {
6357 exp->type = 2;
6358 exp->string = PrintUInt(--op1->ui);
6359 if(!exp->expType)
6360 {
6361 exp->expType = op1->type;
6362 if(op1->type)
6363 op1->type->refCount++;
6364 }
6365 return 0x1;
6366 }
6367
6368 static unsigned int ShortDec(struct Expression * exp, struct Operand * op1)
6369 {
6370 exp->type = 2;
6371 exp->string = PrintShort(--op1->s);
6372 if(!exp->expType)
6373 {
6374 exp->expType = op1->type;
6375 if(op1->type)
6376 op1->type->refCount++;
6377 }
6378 return 0x1;
6379 }
6380
6381 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6382 {
6383 exp->type = 2;
6384 exp->string = PrintUShort(--op1->us);
6385 if(!exp->expType)
6386 {
6387 exp->expType = op1->type;
6388 if(op1->type)
6389 op1->type->refCount++;
6390 }
6391 return 0x1;
6392 }
6393
6394 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6395 {
6396 exp->type = 2;
6397 exp->string = PrintChar(--op1->c);
6398 if(!exp->expType)
6399 {
6400 exp->expType = op1->type;
6401 if(op1->type)
6402 op1->type->refCount++;
6403 }
6404 return 0x1;
6405 }
6406
6407 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6408 {
6409 exp->type = 2;
6410 exp->string = PrintUChar(--op1->uc);
6411 if(!exp->expType)
6412 {
6413 exp->expType = op1->type;
6414 if(op1->type)
6415 op1->type->refCount++;
6416 }
6417 return 0x1;
6418 }
6419
6420 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6421 {
6422 exp->type = 2;
6423 exp->string = PrintFloat(--op1->f);
6424 if(!exp->expType)
6425 {
6426 exp->expType = op1->type;
6427 if(op1->type)
6428 op1->type->refCount++;
6429 }
6430 return 0x1;
6431 }
6432
6433 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6434 {
6435 exp->type = 2;
6436 exp->string = PrintDouble(--op1->d);
6437 if(!exp->expType)
6438 {
6439 exp->expType = op1->type;
6440 if(op1->type)
6441 op1->type->refCount++;
6442 }
6443 return 0x1;
6444 }
6445
6446 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6447 {
6448 int value2 = op2->i;
6449
6450 exp->type = 2;
6451 exp->string = PrintInt(op1->i = value2);
6452 if(!exp->expType)
6453 {
6454 exp->expType = op1->type;
6455 if(op1->type)
6456 op1->type->refCount++;
6457 }
6458 return 0x1;
6459 }
6460
6461 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6462 {
6463 unsigned int value2 = op2->ui;
6464
6465 exp->type = 2;
6466 exp->string = PrintUInt(op1->ui = value2);
6467 if(!exp->expType)
6468 {
6469 exp->expType = op1->type;
6470 if(op1->type)
6471 op1->type->refCount++;
6472 }
6473 return 0x1;
6474 }
6475
6476 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6477 {
6478 short value2 = op2->s;
6479
6480 exp->type = 2;
6481 exp->string = PrintShort(op1->s = value2);
6482 if(!exp->expType)
6483 {
6484 exp->expType = op1->type;
6485 if(op1->type)
6486 op1->type->refCount++;
6487 }
6488 return 0x1;
6489 }
6490
6491 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6492 {
6493 unsigned short value2 = op2->us;
6494
6495 exp->type = 2;
6496 exp->string = PrintUShort(op1->us = value2);
6497 if(!exp->expType)
6498 {
6499 exp->expType = op1->type;
6500 if(op1->type)
6501 op1->type->refCount++;
6502 }
6503 return 0x1;
6504 }
6505
6506 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6507 {
6508 char value2 = op2->c;
6509
6510 exp->type = 2;
6511 exp->string = PrintChar(op1->c = value2);
6512 if(!exp->expType)
6513 {
6514 exp->expType = op1->type;
6515 if(op1->type)
6516 op1->type->refCount++;
6517 }
6518 return 0x1;
6519 }
6520
6521 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6522 {
6523 unsigned char value2 = op2->uc;
6524
6525 exp->type = 2;
6526 exp->string = PrintUChar(op1->uc = value2);
6527 if(!exp->expType)
6528 {
6529 exp->expType = op1->type;
6530 if(op1->type)
6531 op1->type->refCount++;
6532 }
6533 return 0x1;
6534 }
6535
6536 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6537 {
6538 float value2 = op2->f;
6539
6540 exp->type = 2;
6541 exp->string = PrintFloat(op1->f = value2);
6542 if(!exp->expType)
6543 {
6544 exp->expType = op1->type;
6545 if(op1->type)
6546 op1->type->refCount++;
6547 }
6548 return 0x1;
6549 }
6550
6551 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6552 {
6553 double value2 = op2->d;
6554
6555 exp->type = 2;
6556 exp->string = PrintDouble(op1->d = value2);
6557 if(!exp->expType)
6558 {
6559 exp->expType = op1->type;
6560 if(op1->type)
6561 op1->type->refCount++;
6562 }
6563 return 0x1;
6564 }
6565
6566 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6567 {
6568 int value2 = op2->i;
6569
6570 exp->type = 2;
6571 exp->string = PrintInt(op1->i += value2);
6572 if(!exp->expType)
6573 {
6574 exp->expType = op1->type;
6575 if(op1->type)
6576 op1->type->refCount++;
6577 }
6578 return 0x1;
6579 }
6580
6581 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6582 {
6583 unsigned int value2 = op2->ui;
6584
6585 exp->type = 2;
6586 exp->string = PrintUInt(op1->ui += value2);
6587 if(!exp->expType)
6588 {
6589 exp->expType = op1->type;
6590 if(op1->type)
6591 op1->type->refCount++;
6592 }
6593 return 0x1;
6594 }
6595
6596 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6597 {
6598 short value2 = op2->s;
6599
6600 exp->type = 2;
6601 exp->string = PrintShort(op1->s += value2);
6602 if(!exp->expType)
6603 {
6604 exp->expType = op1->type;
6605 if(op1->type)
6606 op1->type->refCount++;
6607 }
6608 return 0x1;
6609 }
6610
6611 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6612 {
6613 unsigned short value2 = op2->us;
6614
6615 exp->type = 2;
6616 exp->string = PrintUShort(op1->us += value2);
6617 if(!exp->expType)
6618 {
6619 exp->expType = op1->type;
6620 if(op1->type)
6621 op1->type->refCount++;
6622 }
6623 return 0x1;
6624 }
6625
6626 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6627 {
6628 char value2 = op2->c;
6629
6630 exp->type = 2;
6631 exp->string = PrintChar(op1->c += value2);
6632 if(!exp->expType)
6633 {
6634 exp->expType = op1->type;
6635 if(op1->type)
6636 op1->type->refCount++;
6637 }
6638 return 0x1;
6639 }
6640
6641 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6642 {
6643 unsigned char value2 = op2->uc;
6644
6645 exp->type = 2;
6646 exp->string = PrintUChar(op1->uc += value2);
6647 if(!exp->expType)
6648 {
6649 exp->expType = op1->type;
6650 if(op1->type)
6651 op1->type->refCount++;
6652 }
6653 return 0x1;
6654 }
6655
6656 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6657 {
6658 float value2 = op2->f;
6659
6660 exp->type = 2;
6661 exp->string = PrintFloat(op1->f += value2);
6662 if(!exp->expType)
6663 {
6664 exp->expType = op1->type;
6665 if(op1->type)
6666 op1->type->refCount++;
6667 }
6668 return 0x1;
6669 }
6670
6671 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6672 {
6673 double value2 = op2->d;
6674
6675 exp->type = 2;
6676 exp->string = PrintDouble(op1->d += value2);
6677 if(!exp->expType)
6678 {
6679 exp->expType = op1->type;
6680 if(op1->type)
6681 op1->type->refCount++;
6682 }
6683 return 0x1;
6684 }
6685
6686 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6687 {
6688 int value2 = op2->i;
6689
6690 exp->type = 2;
6691 exp->string = PrintInt(op1->i -= value2);
6692 if(!exp->expType)
6693 {
6694 exp->expType = op1->type;
6695 if(op1->type)
6696 op1->type->refCount++;
6697 }
6698 return 0x1;
6699 }
6700
6701 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6702 {
6703 unsigned int value2 = op2->ui;
6704
6705 exp->type = 2;
6706 exp->string = PrintUInt(op1->ui -= value2);
6707 if(!exp->expType)
6708 {
6709 exp->expType = op1->type;
6710 if(op1->type)
6711 op1->type->refCount++;
6712 }
6713 return 0x1;
6714 }
6715
6716 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6717 {
6718 short value2 = op2->s;
6719
6720 exp->type = 2;
6721 exp->string = PrintShort(op1->s -= value2);
6722 if(!exp->expType)
6723 {
6724 exp->expType = op1->type;
6725 if(op1->type)
6726 op1->type->refCount++;
6727 }
6728 return 0x1;
6729 }
6730
6731 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6732 {
6733 unsigned short value2 = op2->us;
6734
6735 exp->type = 2;
6736 exp->string = PrintUShort(op1->us -= value2);
6737 if(!exp->expType)
6738 {
6739 exp->expType = op1->type;
6740 if(op1->type)
6741 op1->type->refCount++;
6742 }
6743 return 0x1;
6744 }
6745
6746 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6747 {
6748 char value2 = op2->c;
6749
6750 exp->type = 2;
6751 exp->string = PrintChar(op1->c -= value2);
6752 if(!exp->expType)
6753 {
6754 exp->expType = op1->type;
6755 if(op1->type)
6756 op1->type->refCount++;
6757 }
6758 return 0x1;
6759 }
6760
6761 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6762 {
6763 unsigned char value2 = op2->uc;
6764
6765 exp->type = 2;
6766 exp->string = PrintUChar(op1->uc -= value2);
6767 if(!exp->expType)
6768 {
6769 exp->expType = op1->type;
6770 if(op1->type)
6771 op1->type->refCount++;
6772 }
6773 return 0x1;
6774 }
6775
6776 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6777 {
6778 float value2 = op2->f;
6779
6780 exp->type = 2;
6781 exp->string = PrintFloat(op1->f -= value2);
6782 if(!exp->expType)
6783 {
6784 exp->expType = op1->type;
6785 if(op1->type)
6786 op1->type->refCount++;
6787 }
6788 return 0x1;
6789 }
6790
6791 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6792 {
6793 double value2 = op2->d;
6794
6795 exp->type = 2;
6796 exp->string = PrintDouble(op1->d -= value2);
6797 if(!exp->expType)
6798 {
6799 exp->expType = op1->type;
6800 if(op1->type)
6801 op1->type->refCount++;
6802 }
6803 return 0x1;
6804 }
6805
6806 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6807 {
6808 int value2 = op2->i;
6809
6810 exp->type = 2;
6811 exp->string = PrintInt(op1->i *= value2);
6812 if(!exp->expType)
6813 {
6814 exp->expType = op1->type;
6815 if(op1->type)
6816 op1->type->refCount++;
6817 }
6818 return 0x1;
6819 }
6820
6821 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6822 {
6823 unsigned int value2 = op2->ui;
6824
6825 exp->type = 2;
6826 exp->string = PrintUInt(op1->ui *= value2);
6827 if(!exp->expType)
6828 {
6829 exp->expType = op1->type;
6830 if(op1->type)
6831 op1->type->refCount++;
6832 }
6833 return 0x1;
6834 }
6835
6836 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6837 {
6838 short value2 = op2->s;
6839
6840 exp->type = 2;
6841 exp->string = PrintShort(op1->s *= value2);
6842 if(!exp->expType)
6843 {
6844 exp->expType = op1->type;
6845 if(op1->type)
6846 op1->type->refCount++;
6847 }
6848 return 0x1;
6849 }
6850
6851 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6852 {
6853 unsigned short value2 = op2->us;
6854
6855 exp->type = 2;
6856 exp->string = PrintUShort(op1->us *= value2);
6857 if(!exp->expType)
6858 {
6859 exp->expType = op1->type;
6860 if(op1->type)
6861 op1->type->refCount++;
6862 }
6863 return 0x1;
6864 }
6865
6866 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6867 {
6868 char value2 = op2->c;
6869
6870 exp->type = 2;
6871 exp->string = PrintChar(op1->c *= value2);
6872 if(!exp->expType)
6873 {
6874 exp->expType = op1->type;
6875 if(op1->type)
6876 op1->type->refCount++;
6877 }
6878 return 0x1;
6879 }
6880
6881 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6882 {
6883 unsigned char value2 = op2->uc;
6884
6885 exp->type = 2;
6886 exp->string = PrintUChar(op1->uc *= value2);
6887 if(!exp->expType)
6888 {
6889 exp->expType = op1->type;
6890 if(op1->type)
6891 op1->type->refCount++;
6892 }
6893 return 0x1;
6894 }
6895
6896 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6897 {
6898 float value2 = op2->f;
6899
6900 exp->type = 2;
6901 exp->string = PrintFloat(op1->f *= value2);
6902 if(!exp->expType)
6903 {
6904 exp->expType = op1->type;
6905 if(op1->type)
6906 op1->type->refCount++;
6907 }
6908 return 0x1;
6909 }
6910
6911 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6912 {
6913 double value2 = op2->d;
6914
6915 exp->type = 2;
6916 exp->string = PrintDouble(op1->d *= value2);
6917 if(!exp->expType)
6918 {
6919 exp->expType = op1->type;
6920 if(op1->type)
6921 op1->type->refCount++;
6922 }
6923 return 0x1;
6924 }
6925
6926 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6927 {
6928 int value2 = op2->i;
6929
6930 exp->type = 2;
6931 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
6932 if(!exp->expType)
6933 {
6934 exp->expType = op1->type;
6935 if(op1->type)
6936 op1->type->refCount++;
6937 }
6938 return 0x1;
6939 }
6940
6941 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6942 {
6943 unsigned int value2 = op2->ui;
6944
6945 exp->type = 2;
6946 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
6947 if(!exp->expType)
6948 {
6949 exp->expType = op1->type;
6950 if(op1->type)
6951 op1->type->refCount++;
6952 }
6953 return 0x1;
6954 }
6955
6956 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6957 {
6958 short value2 = op2->s;
6959
6960 exp->type = 2;
6961 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
6962 if(!exp->expType)
6963 {
6964 exp->expType = op1->type;
6965 if(op1->type)
6966 op1->type->refCount++;
6967 }
6968 return 0x1;
6969 }
6970
6971 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6972 {
6973 unsigned short value2 = op2->us;
6974
6975 exp->type = 2;
6976 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
6977 if(!exp->expType)
6978 {
6979 exp->expType = op1->type;
6980 if(op1->type)
6981 op1->type->refCount++;
6982 }
6983 return 0x1;
6984 }
6985
6986 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6987 {
6988 char value2 = op2->c;
6989
6990 exp->type = 2;
6991 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
6992 if(!exp->expType)
6993 {
6994 exp->expType = op1->type;
6995 if(op1->type)
6996 op1->type->refCount++;
6997 }
6998 return 0x1;
6999 }
7000
7001 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7002 {
7003 unsigned char value2 = op2->uc;
7004
7005 exp->type = 2;
7006 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
7007 if(!exp->expType)
7008 {
7009 exp->expType = op1->type;
7010 if(op1->type)
7011 op1->type->refCount++;
7012 }
7013 return 0x1;
7014 }
7015
7016 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7017 {
7018 float value2 = op2->f;
7019
7020 exp->type = 2;
7021 exp->string = PrintFloat(value2 ? (op1->f /= value2) : (float)0);
7022 if(!exp->expType)
7023 {
7024 exp->expType = op1->type;
7025 if(op1->type)
7026 op1->type->refCount++;
7027 }
7028 return 0x1;
7029 }
7030
7031 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7032 {
7033 double value2 = op2->d;
7034
7035 exp->type = 2;
7036 exp->string = PrintDouble(value2 ? (op1->d /= value2) : (double)0);
7037 if(!exp->expType)
7038 {
7039 exp->expType = op1->type;
7040 if(op1->type)
7041 op1->type->refCount++;
7042 }
7043 return 0x1;
7044 }
7045
7046 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7047 {
7048 int value2 = op2->i;
7049
7050 exp->type = 2;
7051 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
7052 if(!exp->expType)
7053 {
7054 exp->expType = op1->type;
7055 if(op1->type)
7056 op1->type->refCount++;
7057 }
7058 return 0x1;
7059 }
7060
7061 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7062 {
7063 unsigned int value2 = op2->ui;
7064
7065 exp->type = 2;
7066 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
7067 if(!exp->expType)
7068 {
7069 exp->expType = op1->type;
7070 if(op1->type)
7071 op1->type->refCount++;
7072 }
7073 return 0x1;
7074 }
7075
7076 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7077 {
7078 short value2 = op2->s;
7079
7080 exp->type = 2;
7081 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
7082 if(!exp->expType)
7083 {
7084 exp->expType = op1->type;
7085 if(op1->type)
7086 op1->type->refCount++;
7087 }
7088 return 0x1;
7089 }
7090
7091 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7092 {
7093 unsigned short value2 = op2->us;
7094
7095 exp->type = 2;
7096 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
7097 if(!exp->expType)
7098 {
7099 exp->expType = op1->type;
7100 if(op1->type)
7101 op1->type->refCount++;
7102 }
7103 return 0x1;
7104 }
7105
7106 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7107 {
7108 char value2 = op2->c;
7109
7110 exp->type = 2;
7111 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
7112 if(!exp->expType)
7113 {
7114 exp->expType = op1->type;
7115 if(op1->type)
7116 op1->type->refCount++;
7117 }
7118 return 0x1;
7119 }
7120
7121 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7122 {
7123 unsigned char value2 = op2->uc;
7124
7125 exp->type = 2;
7126 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
7127 if(!exp->expType)
7128 {
7129 exp->expType = op1->type;
7130 if(op1->type)
7131 op1->type->refCount++;
7132 }
7133 return 0x1;
7134 }
7135
7136 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7137 {
7138 int value2 = op2->i;
7139
7140 exp->type = 2;
7141 exp->string = PrintInt(op1->i & value2);
7142 if(!exp->expType)
7143 {
7144 exp->expType = op1->type;
7145 if(op1->type)
7146 op1->type->refCount++;
7147 }
7148 return 0x1;
7149 }
7150
7151 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7152 {
7153 unsigned int value2 = op2->ui;
7154
7155 exp->type = 2;
7156 exp->string = PrintUInt(op1->ui & value2);
7157 if(!exp->expType)
7158 {
7159 exp->expType = op1->type;
7160 if(op1->type)
7161 op1->type->refCount++;
7162 }
7163 return 0x1;
7164 }
7165
7166 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7167 {
7168 short value2 = op2->s;
7169
7170 exp->type = 2;
7171 exp->string = PrintShort(op1->s & value2);
7172 if(!exp->expType)
7173 {
7174 exp->expType = op1->type;
7175 if(op1->type)
7176 op1->type->refCount++;
7177 }
7178 return 0x1;
7179 }
7180
7181 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7182 {
7183 unsigned short value2 = op2->us;
7184
7185 exp->type = 2;
7186 exp->string = PrintUShort(op1->us & value2);
7187 if(!exp->expType)
7188 {
7189 exp->expType = op1->type;
7190 if(op1->type)
7191 op1->type->refCount++;
7192 }
7193 return 0x1;
7194 }
7195
7196 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7197 {
7198 char value2 = op2->c;
7199
7200 exp->type = 2;
7201 exp->string = PrintChar(op1->c & value2);
7202 if(!exp->expType)
7203 {
7204 exp->expType = op1->type;
7205 if(op1->type)
7206 op1->type->refCount++;
7207 }
7208 return 0x1;
7209 }
7210
7211 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7212 {
7213 unsigned char value2 = op2->uc;
7214
7215 exp->type = 2;
7216 exp->string = PrintUChar(op1->uc & value2);
7217 if(!exp->expType)
7218 {
7219 exp->expType = op1->type;
7220 if(op1->type)
7221 op1->type->refCount++;
7222 }
7223 return 0x1;
7224 }
7225
7226 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7227 {
7228 int value2 = op2->i;
7229
7230 exp->type = 2;
7231 exp->string = PrintInt(op1->i | value2);
7232 if(!exp->expType)
7233 {
7234 exp->expType = op1->type;
7235 if(op1->type)
7236 op1->type->refCount++;
7237 }
7238 return 0x1;
7239 }
7240
7241 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7242 {
7243 unsigned int value2 = op2->ui;
7244
7245 exp->type = 2;
7246 exp->string = PrintUInt(op1->ui | value2);
7247 if(!exp->expType)
7248 {
7249 exp->expType = op1->type;
7250 if(op1->type)
7251 op1->type->refCount++;
7252 }
7253 return 0x1;
7254 }
7255
7256 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7257 {
7258 short value2 = op2->s;
7259
7260 exp->type = 2;
7261 exp->string = PrintShort(op1->s | value2);
7262 if(!exp->expType)
7263 {
7264 exp->expType = op1->type;
7265 if(op1->type)
7266 op1->type->refCount++;
7267 }
7268 return 0x1;
7269 }
7270
7271 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7272 {
7273 unsigned short value2 = op2->us;
7274
7275 exp->type = 2;
7276 exp->string = PrintUShort(op1->us | value2);
7277 if(!exp->expType)
7278 {
7279 exp->expType = op1->type;
7280 if(op1->type)
7281 op1->type->refCount++;
7282 }
7283 return 0x1;
7284 }
7285
7286 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7287 {
7288 char value2 = op2->c;
7289
7290 exp->type = 2;
7291 exp->string = PrintChar(op1->c | value2);
7292 if(!exp->expType)
7293 {
7294 exp->expType = op1->type;
7295 if(op1->type)
7296 op1->type->refCount++;
7297 }
7298 return 0x1;
7299 }
7300
7301 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7302 {
7303 unsigned char value2 = op2->uc;
7304
7305 exp->type = 2;
7306 exp->string = PrintUChar(op1->uc | value2);
7307 if(!exp->expType)
7308 {
7309 exp->expType = op1->type;
7310 if(op1->type)
7311 op1->type->refCount++;
7312 }
7313 return 0x1;
7314 }
7315
7316 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7317 {
7318 int value2 = op2->i;
7319
7320 exp->type = 2;
7321 exp->string = PrintInt(op1->i ^ value2);
7322 if(!exp->expType)
7323 {
7324 exp->expType = op1->type;
7325 if(op1->type)
7326 op1->type->refCount++;
7327 }
7328 return 0x1;
7329 }
7330
7331 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7332 {
7333 unsigned int value2 = op2->ui;
7334
7335 exp->type = 2;
7336 exp->string = PrintUInt(op1->ui ^ value2);
7337 if(!exp->expType)
7338 {
7339 exp->expType = op1->type;
7340 if(op1->type)
7341 op1->type->refCount++;
7342 }
7343 return 0x1;
7344 }
7345
7346 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7347 {
7348 short value2 = op2->s;
7349
7350 exp->type = 2;
7351 exp->string = PrintShort(op1->s ^ value2);
7352 if(!exp->expType)
7353 {
7354 exp->expType = op1->type;
7355 if(op1->type)
7356 op1->type->refCount++;
7357 }
7358 return 0x1;
7359 }
7360
7361 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7362 {
7363 unsigned short value2 = op2->us;
7364
7365 exp->type = 2;
7366 exp->string = PrintUShort(op1->us ^ value2);
7367 if(!exp->expType)
7368 {
7369 exp->expType = op1->type;
7370 if(op1->type)
7371 op1->type->refCount++;
7372 }
7373 return 0x1;
7374 }
7375
7376 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7377 {
7378 char value2 = op2->c;
7379
7380 exp->type = 2;
7381 exp->string = PrintChar(op1->c ^ value2);
7382 if(!exp->expType)
7383 {
7384 exp->expType = op1->type;
7385 if(op1->type)
7386 op1->type->refCount++;
7387 }
7388 return 0x1;
7389 }
7390
7391 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7392 {
7393 unsigned char value2 = op2->uc;
7394
7395 exp->type = 2;
7396 exp->string = PrintUChar(op1->uc ^ value2);
7397 if(!exp->expType)
7398 {
7399 exp->expType = op1->type;
7400 if(op1->type)
7401 op1->type->refCount++;
7402 }
7403 return 0x1;
7404 }
7405
7406 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7407 {
7408 int value2 = op2->i;
7409
7410 exp->type = 2;
7411 exp->string = PrintInt(op1->i << value2);
7412 if(!exp->expType)
7413 {
7414 exp->expType = op1->type;
7415 if(op1->type)
7416 op1->type->refCount++;
7417 }
7418 return 0x1;
7419 }
7420
7421 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7422 {
7423 unsigned int value2 = op2->ui;
7424
7425 exp->type = 2;
7426 exp->string = PrintUInt(op1->ui << value2);
7427 if(!exp->expType)
7428 {
7429 exp->expType = op1->type;
7430 if(op1->type)
7431 op1->type->refCount++;
7432 }
7433 return 0x1;
7434 }
7435
7436 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7437 {
7438 short value2 = op2->s;
7439
7440 exp->type = 2;
7441 exp->string = PrintShort(op1->s << value2);
7442 if(!exp->expType)
7443 {
7444 exp->expType = op1->type;
7445 if(op1->type)
7446 op1->type->refCount++;
7447 }
7448 return 0x1;
7449 }
7450
7451 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7452 {
7453 unsigned short value2 = op2->us;
7454
7455 exp->type = 2;
7456 exp->string = PrintUShort(op1->us << value2);
7457 if(!exp->expType)
7458 {
7459 exp->expType = op1->type;
7460 if(op1->type)
7461 op1->type->refCount++;
7462 }
7463 return 0x1;
7464 }
7465
7466 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7467 {
7468 char value2 = op2->c;
7469
7470 exp->type = 2;
7471 exp->string = PrintChar(op1->c << value2);
7472 if(!exp->expType)
7473 {
7474 exp->expType = op1->type;
7475 if(op1->type)
7476 op1->type->refCount++;
7477 }
7478 return 0x1;
7479 }
7480
7481 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7482 {
7483 unsigned char value2 = op2->uc;
7484
7485 exp->type = 2;
7486 exp->string = PrintUChar(op1->uc << value2);
7487 if(!exp->expType)
7488 {
7489 exp->expType = op1->type;
7490 if(op1->type)
7491 op1->type->refCount++;
7492 }
7493 return 0x1;
7494 }
7495
7496 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7497 {
7498 int value2 = op2->i;
7499
7500 exp->type = 2;
7501 exp->string = PrintInt(op1->i >> value2);
7502 if(!exp->expType)
7503 {
7504 exp->expType = op1->type;
7505 if(op1->type)
7506 op1->type->refCount++;
7507 }
7508 return 0x1;
7509 }
7510
7511 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7512 {
7513 unsigned int value2 = op2->ui;
7514
7515 exp->type = 2;
7516 exp->string = PrintUInt(op1->ui >> value2);
7517 if(!exp->expType)
7518 {
7519 exp->expType = op1->type;
7520 if(op1->type)
7521 op1->type->refCount++;
7522 }
7523 return 0x1;
7524 }
7525
7526 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7527 {
7528 short value2 = op2->s;
7529
7530 exp->type = 2;
7531 exp->string = PrintShort(op1->s >> value2);
7532 if(!exp->expType)
7533 {
7534 exp->expType = op1->type;
7535 if(op1->type)
7536 op1->type->refCount++;
7537 }
7538 return 0x1;
7539 }
7540
7541 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7542 {
7543 unsigned short value2 = op2->us;
7544
7545 exp->type = 2;
7546 exp->string = PrintUShort(op1->us >> value2);
7547 if(!exp->expType)
7548 {
7549 exp->expType = op1->type;
7550 if(op1->type)
7551 op1->type->refCount++;
7552 }
7553 return 0x1;
7554 }
7555
7556 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7557 {
7558 char value2 = op2->c;
7559
7560 exp->type = 2;
7561 exp->string = PrintChar(op1->c >> value2);
7562 if(!exp->expType)
7563 {
7564 exp->expType = op1->type;
7565 if(op1->type)
7566 op1->type->refCount++;
7567 }
7568 return 0x1;
7569 }
7570
7571 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7572 {
7573 unsigned char value2 = op2->uc;
7574
7575 exp->type = 2;
7576 exp->string = PrintUChar(op1->uc >> value2);
7577 if(!exp->expType)
7578 {
7579 exp->expType = op1->type;
7580 if(op1->type)
7581 op1->type->refCount++;
7582 }
7583 return 0x1;
7584 }
7585
7586 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
7587 {
7588 exp->type = 2;
7589 exp->string = PrintInt(~op1->i);
7590 if(!exp->expType)
7591 {
7592 exp->expType = op1->type;
7593 if(op1->type)
7594 op1->type->refCount++;
7595 }
7596 return 0x1;
7597 }
7598
7599 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
7600 {
7601 exp->type = 2;
7602 exp->string = PrintUInt(~op1->ui);
7603 if(!exp->expType)
7604 {
7605 exp->expType = op1->type;
7606 if(op1->type)
7607 op1->type->refCount++;
7608 }
7609 return 0x1;
7610 }
7611
7612 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
7613 {
7614 exp->type = 2;
7615 exp->string = PrintShort(~op1->s);
7616 if(!exp->expType)
7617 {
7618 exp->expType = op1->type;
7619 if(op1->type)
7620 op1->type->refCount++;
7621 }
7622 return 0x1;
7623 }
7624
7625 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
7626 {
7627 exp->type = 2;
7628 exp->string = PrintUShort(~op1->us);
7629 if(!exp->expType)
7630 {
7631 exp->expType = op1->type;
7632 if(op1->type)
7633 op1->type->refCount++;
7634 }
7635 return 0x1;
7636 }
7637
7638 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
7639 {
7640 exp->type = 2;
7641 exp->string = PrintChar(~op1->c);
7642 if(!exp->expType)
7643 {
7644 exp->expType = op1->type;
7645 if(op1->type)
7646 op1->type->refCount++;
7647 }
7648 return 0x1;
7649 }
7650
7651 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
7652 {
7653 exp->type = 2;
7654 exp->string = PrintUChar(~op1->uc);
7655 if(!exp->expType)
7656 {
7657 exp->expType = op1->type;
7658 if(op1->type)
7659 op1->type->refCount++;
7660 }
7661 return 0x1;
7662 }
7663
7664 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7665 {
7666 int value2 = op2->i;
7667
7668 exp->type = 2;
7669 exp->string = PrintInt(op1->i &= value2);
7670 if(!exp->expType)
7671 {
7672 exp->expType = op1->type;
7673 if(op1->type)
7674 op1->type->refCount++;
7675 }
7676 return 0x1;
7677 }
7678
7679 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7680 {
7681 unsigned int value2 = op2->ui;
7682
7683 exp->type = 2;
7684 exp->string = PrintUInt(op1->ui &= value2);
7685 if(!exp->expType)
7686 {
7687 exp->expType = op1->type;
7688 if(op1->type)
7689 op1->type->refCount++;
7690 }
7691 return 0x1;
7692 }
7693
7694 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7695 {
7696 short value2 = op2->s;
7697
7698 exp->type = 2;
7699 exp->string = PrintShort(op1->s &= value2);
7700 if(!exp->expType)
7701 {
7702 exp->expType = op1->type;
7703 if(op1->type)
7704 op1->type->refCount++;
7705 }
7706 return 0x1;
7707 }
7708
7709 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7710 {
7711 unsigned short value2 = op2->us;
7712
7713 exp->type = 2;
7714 exp->string = PrintUShort(op1->us &= value2);
7715 if(!exp->expType)
7716 {
7717 exp->expType = op1->type;
7718 if(op1->type)
7719 op1->type->refCount++;
7720 }
7721 return 0x1;
7722 }
7723
7724 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7725 {
7726 char value2 = op2->c;
7727
7728 exp->type = 2;
7729 exp->string = PrintChar(op1->c &= value2);
7730 if(!exp->expType)
7731 {
7732 exp->expType = op1->type;
7733 if(op1->type)
7734 op1->type->refCount++;
7735 }
7736 return 0x1;
7737 }
7738
7739 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7740 {
7741 unsigned char value2 = op2->uc;
7742
7743 exp->type = 2;
7744 exp->string = PrintUChar(op1->uc &= value2);
7745 if(!exp->expType)
7746 {
7747 exp->expType = op1->type;
7748 if(op1->type)
7749 op1->type->refCount++;
7750 }
7751 return 0x1;
7752 }
7753
7754 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7755 {
7756 int value2 = op2->i;
7757
7758 exp->type = 2;
7759 exp->string = PrintInt(op1->i |= value2);
7760 if(!exp->expType)
7761 {
7762 exp->expType = op1->type;
7763 if(op1->type)
7764 op1->type->refCount++;
7765 }
7766 return 0x1;
7767 }
7768
7769 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7770 {
7771 unsigned int value2 = op2->ui;
7772
7773 exp->type = 2;
7774 exp->string = PrintUInt(op1->ui |= value2);
7775 if(!exp->expType)
7776 {
7777 exp->expType = op1->type;
7778 if(op1->type)
7779 op1->type->refCount++;
7780 }
7781 return 0x1;
7782 }
7783
7784 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7785 {
7786 short value2 = op2->s;
7787
7788 exp->type = 2;
7789 exp->string = PrintShort(op1->s |= value2);
7790 if(!exp->expType)
7791 {
7792 exp->expType = op1->type;
7793 if(op1->type)
7794 op1->type->refCount++;
7795 }
7796 return 0x1;
7797 }
7798
7799 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7800 {
7801 unsigned short value2 = op2->us;
7802
7803 exp->type = 2;
7804 exp->string = PrintUShort(op1->us |= value2);
7805 if(!exp->expType)
7806 {
7807 exp->expType = op1->type;
7808 if(op1->type)
7809 op1->type->refCount++;
7810 }
7811 return 0x1;
7812 }
7813
7814 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7815 {
7816 char value2 = op2->c;
7817
7818 exp->type = 2;
7819 exp->string = PrintChar(op1->c |= value2);
7820 if(!exp->expType)
7821 {
7822 exp->expType = op1->type;
7823 if(op1->type)
7824 op1->type->refCount++;
7825 }
7826 return 0x1;
7827 }
7828
7829 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7830 {
7831 unsigned char value2 = op2->uc;
7832
7833 exp->type = 2;
7834 exp->string = PrintUChar(op1->uc |= value2);
7835 if(!exp->expType)
7836 {
7837 exp->expType = op1->type;
7838 if(op1->type)
7839 op1->type->refCount++;
7840 }
7841 return 0x1;
7842 }
7843
7844 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7845 {
7846 int value2 = op2->i;
7847
7848 exp->type = 2;
7849 exp->string = PrintInt(op1->i ^= value2);
7850 if(!exp->expType)
7851 {
7852 exp->expType = op1->type;
7853 if(op1->type)
7854 op1->type->refCount++;
7855 }
7856 return 0x1;
7857 }
7858
7859 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7860 {
7861 unsigned int value2 = op2->ui;
7862
7863 exp->type = 2;
7864 exp->string = PrintUInt(op1->ui ^= value2);
7865 if(!exp->expType)
7866 {
7867 exp->expType = op1->type;
7868 if(op1->type)
7869 op1->type->refCount++;
7870 }
7871 return 0x1;
7872 }
7873
7874 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7875 {
7876 short value2 = op2->s;
7877
7878 exp->type = 2;
7879 exp->string = PrintShort(op1->s ^= value2);
7880 if(!exp->expType)
7881 {
7882 exp->expType = op1->type;
7883 if(op1->type)
7884 op1->type->refCount++;
7885 }
7886 return 0x1;
7887 }
7888
7889 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7890 {
7891 unsigned short value2 = op2->us;
7892
7893 exp->type = 2;
7894 exp->string = PrintUShort(op1->us ^= value2);
7895 if(!exp->expType)
7896 {
7897 exp->expType = op1->type;
7898 if(op1->type)
7899 op1->type->refCount++;
7900 }
7901 return 0x1;
7902 }
7903
7904 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7905 {
7906 char value2 = op2->c;
7907
7908 exp->type = 2;
7909 exp->string = PrintChar(op1->c ^= value2);
7910 if(!exp->expType)
7911 {
7912 exp->expType = op1->type;
7913 if(op1->type)
7914 op1->type->refCount++;
7915 }
7916 return 0x1;
7917 }
7918
7919 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7920 {
7921 unsigned char value2 = op2->uc;
7922
7923 exp->type = 2;
7924 exp->string = PrintUChar(op1->uc ^= value2);
7925 if(!exp->expType)
7926 {
7927 exp->expType = op1->type;
7928 if(op1->type)
7929 op1->type->refCount++;
7930 }
7931 return 0x1;
7932 }
7933
7934 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7935 {
7936 int value2 = op2->i;
7937
7938 exp->type = 2;
7939 exp->string = PrintInt(op1->i <<= value2);
7940 if(!exp->expType)
7941 {
7942 exp->expType = op1->type;
7943 if(op1->type)
7944 op1->type->refCount++;
7945 }
7946 return 0x1;
7947 }
7948
7949 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7950 {
7951 unsigned int value2 = op2->ui;
7952
7953 exp->type = 2;
7954 exp->string = PrintUInt(op1->ui <<= value2);
7955 if(!exp->expType)
7956 {
7957 exp->expType = op1->type;
7958 if(op1->type)
7959 op1->type->refCount++;
7960 }
7961 return 0x1;
7962 }
7963
7964 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7965 {
7966 short value2 = op2->s;
7967
7968 exp->type = 2;
7969 exp->string = PrintShort(op1->s <<= value2);
7970 if(!exp->expType)
7971 {
7972 exp->expType = op1->type;
7973 if(op1->type)
7974 op1->type->refCount++;
7975 }
7976 return 0x1;
7977 }
7978
7979 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7980 {
7981 unsigned short value2 = op2->us;
7982
7983 exp->type = 2;
7984 exp->string = PrintUShort(op1->us <<= value2);
7985 if(!exp->expType)
7986 {
7987 exp->expType = op1->type;
7988 if(op1->type)
7989 op1->type->refCount++;
7990 }
7991 return 0x1;
7992 }
7993
7994 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7995 {
7996 char value2 = op2->c;
7997
7998 exp->type = 2;
7999 exp->string = PrintChar(op1->c <<= value2);
8000 if(!exp->expType)
8001 {
8002 exp->expType = op1->type;
8003 if(op1->type)
8004 op1->type->refCount++;
8005 }
8006 return 0x1;
8007 }
8008
8009 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8010 {
8011 unsigned char value2 = op2->uc;
8012
8013 exp->type = 2;
8014 exp->string = PrintUChar(op1->uc <<= value2);
8015 if(!exp->expType)
8016 {
8017 exp->expType = op1->type;
8018 if(op1->type)
8019 op1->type->refCount++;
8020 }
8021 return 0x1;
8022 }
8023
8024 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8025 {
8026 int value2 = op2->i;
8027
8028 exp->type = 2;
8029 exp->string = PrintInt(op1->i >>= value2);
8030 if(!exp->expType)
8031 {
8032 exp->expType = op1->type;
8033 if(op1->type)
8034 op1->type->refCount++;
8035 }
8036 return 0x1;
8037 }
8038
8039 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8040 {
8041 unsigned int value2 = op2->ui;
8042
8043 exp->type = 2;
8044 exp->string = PrintUInt(op1->ui >>= value2);
8045 if(!exp->expType)
8046 {
8047 exp->expType = op1->type;
8048 if(op1->type)
8049 op1->type->refCount++;
8050 }
8051 return 0x1;
8052 }
8053
8054 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8055 {
8056 short value2 = op2->s;
8057
8058 exp->type = 2;
8059 exp->string = PrintShort(op1->s >>= value2);
8060 if(!exp->expType)
8061 {
8062 exp->expType = op1->type;
8063 if(op1->type)
8064 op1->type->refCount++;
8065 }
8066 return 0x1;
8067 }
8068
8069 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8070 {
8071 unsigned short value2 = op2->us;
8072
8073 exp->type = 2;
8074 exp->string = PrintUShort(op1->us >>= value2);
8075 if(!exp->expType)
8076 {
8077 exp->expType = op1->type;
8078 if(op1->type)
8079 op1->type->refCount++;
8080 }
8081 return 0x1;
8082 }
8083
8084 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8085 {
8086 char value2 = op2->c;
8087
8088 exp->type = 2;
8089 exp->string = PrintChar(op1->c >>= value2);
8090 if(!exp->expType)
8091 {
8092 exp->expType = op1->type;
8093 if(op1->type)
8094 op1->type->refCount++;
8095 }
8096 return 0x1;
8097 }
8098
8099 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8100 {
8101 unsigned char value2 = op2->uc;
8102
8103 exp->type = 2;
8104 exp->string = PrintUChar(op1->uc >>= value2);
8105 if(!exp->expType)
8106 {
8107 exp->expType = op1->type;
8108 if(op1->type)
8109 op1->type->refCount++;
8110 }
8111 return 0x1;
8112 }
8113
8114 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
8115 {
8116 exp->type = 2;
8117 exp->string = PrintInt(!op1->i);
8118 if(!exp->expType)
8119 {
8120 exp->expType = op1->type;
8121 if(op1->type)
8122 op1->type->refCount++;
8123 }
8124 return 0x1;
8125 }
8126
8127 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
8128 {
8129 exp->type = 2;
8130 exp->string = PrintUInt(!op1->ui);
8131 if(!exp->expType)
8132 {
8133 exp->expType = op1->type;
8134 if(op1->type)
8135 op1->type->refCount++;
8136 }
8137 return 0x1;
8138 }
8139
8140 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
8141 {
8142 exp->type = 2;
8143 exp->string = PrintShort(!op1->s);
8144 if(!exp->expType)
8145 {
8146 exp->expType = op1->type;
8147 if(op1->type)
8148 op1->type->refCount++;
8149 }
8150 return 0x1;
8151 }
8152
8153 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
8154 {
8155 exp->type = 2;
8156 exp->string = PrintUShort(!op1->us);
8157 if(!exp->expType)
8158 {
8159 exp->expType = op1->type;
8160 if(op1->type)
8161 op1->type->refCount++;
8162 }
8163 return 0x1;
8164 }
8165
8166 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
8167 {
8168 exp->type = 2;
8169 exp->string = PrintChar(!op1->c);
8170 if(!exp->expType)
8171 {
8172 exp->expType = op1->type;
8173 if(op1->type)
8174 op1->type->refCount++;
8175 }
8176 return 0x1;
8177 }
8178
8179 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
8180 {
8181 exp->type = 2;
8182 exp->string = PrintUChar(!op1->uc);
8183 if(!exp->expType)
8184 {
8185 exp->expType = op1->type;
8186 if(op1->type)
8187 op1->type->refCount++;
8188 }
8189 return 0x1;
8190 }
8191
8192 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8193 {
8194 int value2 = op2->i;
8195
8196 exp->type = 2;
8197 exp->string = PrintInt(op1->i == value2);
8198 if(!exp->expType)
8199 {
8200 exp->expType = op1->type;
8201 if(op1->type)
8202 op1->type->refCount++;
8203 }
8204 return 0x1;
8205 }
8206
8207 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8208 {
8209 unsigned int value2 = op2->ui;
8210
8211 exp->type = 2;
8212 exp->string = PrintUInt(op1->ui == value2);
8213 if(!exp->expType)
8214 {
8215 exp->expType = op1->type;
8216 if(op1->type)
8217 op1->type->refCount++;
8218 }
8219 return 0x1;
8220 }
8221
8222 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8223 {
8224 short value2 = op2->s;
8225
8226 exp->type = 2;
8227 exp->string = PrintShort(op1->s == value2);
8228 if(!exp->expType)
8229 {
8230 exp->expType = op1->type;
8231 if(op1->type)
8232 op1->type->refCount++;
8233 }
8234 return 0x1;
8235 }
8236
8237 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8238 {
8239 unsigned short value2 = op2->us;
8240
8241 exp->type = 2;
8242 exp->string = PrintUShort(op1->us == value2);
8243 if(!exp->expType)
8244 {
8245 exp->expType = op1->type;
8246 if(op1->type)
8247 op1->type->refCount++;
8248 }
8249 return 0x1;
8250 }
8251
8252 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8253 {
8254 char value2 = op2->c;
8255
8256 exp->type = 2;
8257 exp->string = PrintChar(op1->c == value2);
8258 if(!exp->expType)
8259 {
8260 exp->expType = op1->type;
8261 if(op1->type)
8262 op1->type->refCount++;
8263 }
8264 return 0x1;
8265 }
8266
8267 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8268 {
8269 unsigned char value2 = op2->uc;
8270
8271 exp->type = 2;
8272 exp->string = PrintUChar(op1->uc == value2);
8273 if(!exp->expType)
8274 {
8275 exp->expType = op1->type;
8276 if(op1->type)
8277 op1->type->refCount++;
8278 }
8279 return 0x1;
8280 }
8281
8282 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8283 {
8284 float value2 = op2->f;
8285
8286 exp->type = 2;
8287 exp->string = PrintFloat(op1->f == value2);
8288 if(!exp->expType)
8289 {
8290 exp->expType = op1->type;
8291 if(op1->type)
8292 op1->type->refCount++;
8293 }
8294 return 0x1;
8295 }
8296
8297 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8298 {
8299 double value2 = op2->d;
8300
8301 exp->type = 2;
8302 exp->string = PrintDouble(op1->d == value2);
8303 if(!exp->expType)
8304 {
8305 exp->expType = op1->type;
8306 if(op1->type)
8307 op1->type->refCount++;
8308 }
8309 return 0x1;
8310 }
8311
8312 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8313 {
8314 int value2 = op2->i;
8315
8316 exp->type = 2;
8317 exp->string = PrintInt(op1->i != value2);
8318 if(!exp->expType)
8319 {
8320 exp->expType = op1->type;
8321 if(op1->type)
8322 op1->type->refCount++;
8323 }
8324 return 0x1;
8325 }
8326
8327 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8328 {
8329 unsigned int value2 = op2->ui;
8330
8331 exp->type = 2;
8332 exp->string = PrintUInt(op1->ui != value2);
8333 if(!exp->expType)
8334 {
8335 exp->expType = op1->type;
8336 if(op1->type)
8337 op1->type->refCount++;
8338 }
8339 return 0x1;
8340 }
8341
8342 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8343 {
8344 short value2 = op2->s;
8345
8346 exp->type = 2;
8347 exp->string = PrintShort(op1->s != value2);
8348 if(!exp->expType)
8349 {
8350 exp->expType = op1->type;
8351 if(op1->type)
8352 op1->type->refCount++;
8353 }
8354 return 0x1;
8355 }
8356
8357 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8358 {
8359 unsigned short value2 = op2->us;
8360
8361 exp->type = 2;
8362 exp->string = PrintUShort(op1->us != value2);
8363 if(!exp->expType)
8364 {
8365 exp->expType = op1->type;
8366 if(op1->type)
8367 op1->type->refCount++;
8368 }
8369 return 0x1;
8370 }
8371
8372 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8373 {
8374 char value2 = op2->c;
8375
8376 exp->type = 2;
8377 exp->string = PrintChar(op1->c != value2);
8378 if(!exp->expType)
8379 {
8380 exp->expType = op1->type;
8381 if(op1->type)
8382 op1->type->refCount++;
8383 }
8384 return 0x1;
8385 }
8386
8387 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8388 {
8389 unsigned char value2 = op2->uc;
8390
8391 exp->type = 2;
8392 exp->string = PrintUChar(op1->uc != value2);
8393 if(!exp->expType)
8394 {
8395 exp->expType = op1->type;
8396 if(op1->type)
8397 op1->type->refCount++;
8398 }
8399 return 0x1;
8400 }
8401
8402 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8403 {
8404 float value2 = op2->f;
8405
8406 exp->type = 2;
8407 exp->string = PrintFloat(op1->f != value2);
8408 if(!exp->expType)
8409 {
8410 exp->expType = op1->type;
8411 if(op1->type)
8412 op1->type->refCount++;
8413 }
8414 return 0x1;
8415 }
8416
8417 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8418 {
8419 double value2 = op2->d;
8420
8421 exp->type = 2;
8422 exp->string = PrintDouble(op1->d != value2);
8423 if(!exp->expType)
8424 {
8425 exp->expType = op1->type;
8426 if(op1->type)
8427 op1->type->refCount++;
8428 }
8429 return 0x1;
8430 }
8431
8432 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8433 {
8434 int value2 = op2->i;
8435
8436 exp->type = 2;
8437 exp->string = PrintInt(op1->i && value2);
8438 if(!exp->expType)
8439 {
8440 exp->expType = op1->type;
8441 if(op1->type)
8442 op1->type->refCount++;
8443 }
8444 return 0x1;
8445 }
8446
8447 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8448 {
8449 unsigned int value2 = op2->ui;
8450
8451 exp->type = 2;
8452 exp->string = PrintUInt(op1->ui && value2);
8453 if(!exp->expType)
8454 {
8455 exp->expType = op1->type;
8456 if(op1->type)
8457 op1->type->refCount++;
8458 }
8459 return 0x1;
8460 }
8461
8462 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8463 {
8464 short value2 = op2->s;
8465
8466 exp->type = 2;
8467 exp->string = PrintShort(op1->s && value2);
8468 if(!exp->expType)
8469 {
8470 exp->expType = op1->type;
8471 if(op1->type)
8472 op1->type->refCount++;
8473 }
8474 return 0x1;
8475 }
8476
8477 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8478 {
8479 unsigned short value2 = op2->us;
8480
8481 exp->type = 2;
8482 exp->string = PrintUShort(op1->us && value2);
8483 if(!exp->expType)
8484 {
8485 exp->expType = op1->type;
8486 if(op1->type)
8487 op1->type->refCount++;
8488 }
8489 return 0x1;
8490 }
8491
8492 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8493 {
8494 char value2 = op2->c;
8495
8496 exp->type = 2;
8497 exp->string = PrintChar(op1->c && value2);
8498 if(!exp->expType)
8499 {
8500 exp->expType = op1->type;
8501 if(op1->type)
8502 op1->type->refCount++;
8503 }
8504 return 0x1;
8505 }
8506
8507 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8508 {
8509 unsigned char value2 = op2->uc;
8510
8511 exp->type = 2;
8512 exp->string = PrintUChar(op1->uc && value2);
8513 if(!exp->expType)
8514 {
8515 exp->expType = op1->type;
8516 if(op1->type)
8517 op1->type->refCount++;
8518 }
8519 return 0x1;
8520 }
8521
8522 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8523 {
8524 float value2 = op2->f;
8525
8526 exp->type = 2;
8527 exp->string = PrintFloat(op1->f && value2);
8528 if(!exp->expType)
8529 {
8530 exp->expType = op1->type;
8531 if(op1->type)
8532 op1->type->refCount++;
8533 }
8534 return 0x1;
8535 }
8536
8537 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8538 {
8539 double value2 = op2->d;
8540
8541 exp->type = 2;
8542 exp->string = PrintDouble(op1->d && value2);
8543 if(!exp->expType)
8544 {
8545 exp->expType = op1->type;
8546 if(op1->type)
8547 op1->type->refCount++;
8548 }
8549 return 0x1;
8550 }
8551
8552 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8553 {
8554 int value2 = op2->i;
8555
8556 exp->type = 2;
8557 exp->string = PrintInt(op1->i || value2);
8558 if(!exp->expType)
8559 {
8560 exp->expType = op1->type;
8561 if(op1->type)
8562 op1->type->refCount++;
8563 }
8564 return 0x1;
8565 }
8566
8567 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8568 {
8569 unsigned int value2 = op2->ui;
8570
8571 exp->type = 2;
8572 exp->string = PrintUInt(op1->ui || value2);
8573 if(!exp->expType)
8574 {
8575 exp->expType = op1->type;
8576 if(op1->type)
8577 op1->type->refCount++;
8578 }
8579 return 0x1;
8580 }
8581
8582 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8583 {
8584 short value2 = op2->s;
8585
8586 exp->type = 2;
8587 exp->string = PrintShort(op1->s || value2);
8588 if(!exp->expType)
8589 {
8590 exp->expType = op1->type;
8591 if(op1->type)
8592 op1->type->refCount++;
8593 }
8594 return 0x1;
8595 }
8596
8597 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8598 {
8599 unsigned short value2 = op2->us;
8600
8601 exp->type = 2;
8602 exp->string = PrintUShort(op1->us || value2);
8603 if(!exp->expType)
8604 {
8605 exp->expType = op1->type;
8606 if(op1->type)
8607 op1->type->refCount++;
8608 }
8609 return 0x1;
8610 }
8611
8612 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8613 {
8614 char value2 = op2->c;
8615
8616 exp->type = 2;
8617 exp->string = PrintChar(op1->c || value2);
8618 if(!exp->expType)
8619 {
8620 exp->expType = op1->type;
8621 if(op1->type)
8622 op1->type->refCount++;
8623 }
8624 return 0x1;
8625 }
8626
8627 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8628 {
8629 unsigned char value2 = op2->uc;
8630
8631 exp->type = 2;
8632 exp->string = PrintUChar(op1->uc || value2);
8633 if(!exp->expType)
8634 {
8635 exp->expType = op1->type;
8636 if(op1->type)
8637 op1->type->refCount++;
8638 }
8639 return 0x1;
8640 }
8641
8642 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8643 {
8644 float value2 = op2->f;
8645
8646 exp->type = 2;
8647 exp->string = PrintFloat(op1->f || value2);
8648 if(!exp->expType)
8649 {
8650 exp->expType = op1->type;
8651 if(op1->type)
8652 op1->type->refCount++;
8653 }
8654 return 0x1;
8655 }
8656
8657 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8658 {
8659 double value2 = op2->d;
8660
8661 exp->type = 2;
8662 exp->string = PrintDouble(op1->d || value2);
8663 if(!exp->expType)
8664 {
8665 exp->expType = op1->type;
8666 if(op1->type)
8667 op1->type->refCount++;
8668 }
8669 return 0x1;
8670 }
8671
8672 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8673 {
8674 int value2 = op2->i;
8675
8676 exp->type = 2;
8677 exp->string = PrintInt(op1->i > value2);
8678 if(!exp->expType)
8679 {
8680 exp->expType = op1->type;
8681 if(op1->type)
8682 op1->type->refCount++;
8683 }
8684 return 0x1;
8685 }
8686
8687 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8688 {
8689 unsigned int value2 = op2->ui;
8690
8691 exp->type = 2;
8692 exp->string = PrintUInt(op1->ui > value2);
8693 if(!exp->expType)
8694 {
8695 exp->expType = op1->type;
8696 if(op1->type)
8697 op1->type->refCount++;
8698 }
8699 return 0x1;
8700 }
8701
8702 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8703 {
8704 short value2 = op2->s;
8705
8706 exp->type = 2;
8707 exp->string = PrintShort(op1->s > value2);
8708 if(!exp->expType)
8709 {
8710 exp->expType = op1->type;
8711 if(op1->type)
8712 op1->type->refCount++;
8713 }
8714 return 0x1;
8715 }
8716
8717 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8718 {
8719 unsigned short value2 = op2->us;
8720
8721 exp->type = 2;
8722 exp->string = PrintUShort(op1->us > value2);
8723 if(!exp->expType)
8724 {
8725 exp->expType = op1->type;
8726 if(op1->type)
8727 op1->type->refCount++;
8728 }
8729 return 0x1;
8730 }
8731
8732 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8733 {
8734 char value2 = op2->c;
8735
8736 exp->type = 2;
8737 exp->string = PrintChar(op1->c > value2);
8738 if(!exp->expType)
8739 {
8740 exp->expType = op1->type;
8741 if(op1->type)
8742 op1->type->refCount++;
8743 }
8744 return 0x1;
8745 }
8746
8747 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8748 {
8749 unsigned char value2 = op2->uc;
8750
8751 exp->type = 2;
8752 exp->string = PrintUChar(op1->uc > value2);
8753 if(!exp->expType)
8754 {
8755 exp->expType = op1->type;
8756 if(op1->type)
8757 op1->type->refCount++;
8758 }
8759 return 0x1;
8760 }
8761
8762 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8763 {
8764 float value2 = op2->f;
8765
8766 exp->type = 2;
8767 exp->string = PrintFloat(op1->f > value2);
8768 if(!exp->expType)
8769 {
8770 exp->expType = op1->type;
8771 if(op1->type)
8772 op1->type->refCount++;
8773 }
8774 return 0x1;
8775 }
8776
8777 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8778 {
8779 double value2 = op2->d;
8780
8781 exp->type = 2;
8782 exp->string = PrintDouble(op1->d > value2);
8783 if(!exp->expType)
8784 {
8785 exp->expType = op1->type;
8786 if(op1->type)
8787 op1->type->refCount++;
8788 }
8789 return 0x1;
8790 }
8791
8792 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8793 {
8794 int value2 = op2->i;
8795
8796 exp->type = 2;
8797 exp->string = PrintInt(op1->i < value2);
8798 if(!exp->expType)
8799 {
8800 exp->expType = op1->type;
8801 if(op1->type)
8802 op1->type->refCount++;
8803 }
8804 return 0x1;
8805 }
8806
8807 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8808 {
8809 unsigned int value2 = op2->ui;
8810
8811 exp->type = 2;
8812 exp->string = PrintUInt(op1->ui < value2);
8813 if(!exp->expType)
8814 {
8815 exp->expType = op1->type;
8816 if(op1->type)
8817 op1->type->refCount++;
8818 }
8819 return 0x1;
8820 }
8821
8822 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8823 {
8824 short value2 = op2->s;
8825
8826 exp->type = 2;
8827 exp->string = PrintShort(op1->s < value2);
8828 if(!exp->expType)
8829 {
8830 exp->expType = op1->type;
8831 if(op1->type)
8832 op1->type->refCount++;
8833 }
8834 return 0x1;
8835 }
8836
8837 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8838 {
8839 unsigned short value2 = op2->us;
8840
8841 exp->type = 2;
8842 exp->string = PrintUShort(op1->us < value2);
8843 if(!exp->expType)
8844 {
8845 exp->expType = op1->type;
8846 if(op1->type)
8847 op1->type->refCount++;
8848 }
8849 return 0x1;
8850 }
8851
8852 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8853 {
8854 char value2 = op2->c;
8855
8856 exp->type = 2;
8857 exp->string = PrintChar(op1->c < value2);
8858 if(!exp->expType)
8859 {
8860 exp->expType = op1->type;
8861 if(op1->type)
8862 op1->type->refCount++;
8863 }
8864 return 0x1;
8865 }
8866
8867 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8868 {
8869 unsigned char value2 = op2->uc;
8870
8871 exp->type = 2;
8872 exp->string = PrintUChar(op1->uc < value2);
8873 if(!exp->expType)
8874 {
8875 exp->expType = op1->type;
8876 if(op1->type)
8877 op1->type->refCount++;
8878 }
8879 return 0x1;
8880 }
8881
8882 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8883 {
8884 float value2 = op2->f;
8885
8886 exp->type = 2;
8887 exp->string = PrintFloat(op1->f < value2);
8888 if(!exp->expType)
8889 {
8890 exp->expType = op1->type;
8891 if(op1->type)
8892 op1->type->refCount++;
8893 }
8894 return 0x1;
8895 }
8896
8897 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8898 {
8899 double value2 = op2->d;
8900
8901 exp->type = 2;
8902 exp->string = PrintDouble(op1->d < value2);
8903 if(!exp->expType)
8904 {
8905 exp->expType = op1->type;
8906 if(op1->type)
8907 op1->type->refCount++;
8908 }
8909 return 0x1;
8910 }
8911
8912 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8913 {
8914 int value2 = op2->i;
8915
8916 exp->type = 2;
8917 exp->string = PrintInt(op1->i >= value2);
8918 if(!exp->expType)
8919 {
8920 exp->expType = op1->type;
8921 if(op1->type)
8922 op1->type->refCount++;
8923 }
8924 return 0x1;
8925 }
8926
8927 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8928 {
8929 unsigned int value2 = op2->ui;
8930
8931 exp->type = 2;
8932 exp->string = PrintUInt(op1->ui >= value2);
8933 if(!exp->expType)
8934 {
8935 exp->expType = op1->type;
8936 if(op1->type)
8937 op1->type->refCount++;
8938 }
8939 return 0x1;
8940 }
8941
8942 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8943 {
8944 short value2 = op2->s;
8945
8946 exp->type = 2;
8947 exp->string = PrintShort(op1->s >= value2);
8948 if(!exp->expType)
8949 {
8950 exp->expType = op1->type;
8951 if(op1->type)
8952 op1->type->refCount++;
8953 }
8954 return 0x1;
8955 }
8956
8957 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8958 {
8959 unsigned short value2 = op2->us;
8960
8961 exp->type = 2;
8962 exp->string = PrintUShort(op1->us >= value2);
8963 if(!exp->expType)
8964 {
8965 exp->expType = op1->type;
8966 if(op1->type)
8967 op1->type->refCount++;
8968 }
8969 return 0x1;
8970 }
8971
8972 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8973 {
8974 char value2 = op2->c;
8975
8976 exp->type = 2;
8977 exp->string = PrintChar(op1->c >= value2);
8978 if(!exp->expType)
8979 {
8980 exp->expType = op1->type;
8981 if(op1->type)
8982 op1->type->refCount++;
8983 }
8984 return 0x1;
8985 }
8986
8987 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8988 {
8989 unsigned char value2 = op2->uc;
8990
8991 exp->type = 2;
8992 exp->string = PrintUChar(op1->uc >= value2);
8993 if(!exp->expType)
8994 {
8995 exp->expType = op1->type;
8996 if(op1->type)
8997 op1->type->refCount++;
8998 }
8999 return 0x1;
9000 }
9001
9002 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9003 {
9004 float value2 = op2->f;
9005
9006 exp->type = 2;
9007 exp->string = PrintFloat(op1->f >= value2);
9008 if(!exp->expType)
9009 {
9010 exp->expType = op1->type;
9011 if(op1->type)
9012 op1->type->refCount++;
9013 }
9014 return 0x1;
9015 }
9016
9017 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9018 {
9019 double value2 = op2->d;
9020
9021 exp->type = 2;
9022 exp->string = PrintDouble(op1->d >= value2);
9023 if(!exp->expType)
9024 {
9025 exp->expType = op1->type;
9026 if(op1->type)
9027 op1->type->refCount++;
9028 }
9029 return 0x1;
9030 }
9031
9032 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9033 {
9034 int value2 = op2->i;
9035
9036 exp->type = 2;
9037 exp->string = PrintInt(op1->i <= value2);
9038 if(!exp->expType)
9039 {
9040 exp->expType = op1->type;
9041 if(op1->type)
9042 op1->type->refCount++;
9043 }
9044 return 0x1;
9045 }
9046
9047 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9048 {
9049 unsigned int value2 = op2->ui;
9050
9051 exp->type = 2;
9052 exp->string = PrintUInt(op1->ui <= value2);
9053 if(!exp->expType)
9054 {
9055 exp->expType = op1->type;
9056 if(op1->type)
9057 op1->type->refCount++;
9058 }
9059 return 0x1;
9060 }
9061
9062 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9063 {
9064 short value2 = op2->s;
9065
9066 exp->type = 2;
9067 exp->string = PrintShort(op1->s <= value2);
9068 if(!exp->expType)
9069 {
9070 exp->expType = op1->type;
9071 if(op1->type)
9072 op1->type->refCount++;
9073 }
9074 return 0x1;
9075 }
9076
9077 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9078 {
9079 unsigned short value2 = op2->us;
9080
9081 exp->type = 2;
9082 exp->string = PrintUShort(op1->us <= value2);
9083 if(!exp->expType)
9084 {
9085 exp->expType = op1->type;
9086 if(op1->type)
9087 op1->type->refCount++;
9088 }
9089 return 0x1;
9090 }
9091
9092 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9093 {
9094 char value2 = op2->c;
9095
9096 exp->type = 2;
9097 exp->string = PrintChar(op1->c <= value2);
9098 if(!exp->expType)
9099 {
9100 exp->expType = op1->type;
9101 if(op1->type)
9102 op1->type->refCount++;
9103 }
9104 return 0x1;
9105 }
9106
9107 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9108 {
9109 unsigned char value2 = op2->uc;
9110
9111 exp->type = 2;
9112 exp->string = PrintUChar(op1->uc <= value2);
9113 if(!exp->expType)
9114 {
9115 exp->expType = op1->type;
9116 if(op1->type)
9117 op1->type->refCount++;
9118 }
9119 return 0x1;
9120 }
9121
9122 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9123 {
9124 float value2 = op2->f;
9125
9126 exp->type = 2;
9127 exp->string = PrintFloat(op1->f <= value2);
9128 if(!exp->expType)
9129 {
9130 exp->expType = op1->type;
9131 if(op1->type)
9132 op1->type->refCount++;
9133 }
9134 return 0x1;
9135 }
9136
9137 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9138 {
9139 double value2 = op2->d;
9140
9141 exp->type = 2;
9142 exp->string = PrintDouble(op1->d <= value2);
9143 if(!exp->expType)
9144 {
9145 exp->expType = op1->type;
9146 if(op1->type)
9147 op1->type->refCount++;
9148 }
9149 return 0x1;
9150 }
9151
9152 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9153 {
9154 exp->type = 2;
9155 exp->string = PrintInt(op1->i ? op2->i : op3->i);
9156 if(!exp->expType)
9157 {
9158 exp->expType = op1->type;
9159 if(op1->type)
9160 op1->type->refCount++;
9161 }
9162 return 0x1;
9163 }
9164
9165 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9166 {
9167 exp->type = 2;
9168 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
9169 if(!exp->expType)
9170 {
9171 exp->expType = op1->type;
9172 if(op1->type)
9173 op1->type->refCount++;
9174 }
9175 return 0x1;
9176 }
9177
9178 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9179 {
9180 exp->type = 2;
9181 exp->string = PrintShort(op1->s ? op2->s : op3->s);
9182 if(!exp->expType)
9183 {
9184 exp->expType = op1->type;
9185 if(op1->type)
9186 op1->type->refCount++;
9187 }
9188 return 0x1;
9189 }
9190
9191 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9192 {
9193 exp->type = 2;
9194 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
9195 if(!exp->expType)
9196 {
9197 exp->expType = op1->type;
9198 if(op1->type)
9199 op1->type->refCount++;
9200 }
9201 return 0x1;
9202 }
9203
9204 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9205 {
9206 exp->type = 2;
9207 exp->string = PrintChar(op1->c ? op2->c : op3->c);
9208 if(!exp->expType)
9209 {
9210 exp->expType = op1->type;
9211 if(op1->type)
9212 op1->type->refCount++;
9213 }
9214 return 0x1;
9215 }
9216
9217 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9218 {
9219 exp->type = 2;
9220 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
9221 if(!exp->expType)
9222 {
9223 exp->expType = op1->type;
9224 if(op1->type)
9225 op1->type->refCount++;
9226 }
9227 return 0x1;
9228 }
9229
9230 static unsigned int FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9231 {
9232 exp->type = 2;
9233 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
9234 if(!exp->expType)
9235 {
9236 exp->expType = op1->type;
9237 if(op1->type)
9238 op1->type->refCount++;
9239 }
9240 return 0x1;
9241 }
9242
9243 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9244 {
9245 exp->type = 2;
9246 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
9247 if(!exp->expType)
9248 {
9249 exp->expType = op1->type;
9250 if(op1->type)
9251 op1->type->refCount++;
9252 }
9253 return 0x1;
9254 }
9255
9256 struct OpTable intOps = 
9257 {
9258 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
9259 };
9260
9261 struct OpTable uintOps = 
9262 {
9263 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
9264 };
9265
9266 struct OpTable shortOps = 
9267 {
9268 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
9269 };
9270
9271 struct OpTable ushortOps = 
9272 {
9273 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
9274 };
9275
9276 struct OpTable floatOps = 
9277 {
9278 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
9279 };
9280
9281 struct OpTable doubleOps = 
9282 {
9283 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
9284 };
9285
9286 struct OpTable charOps = 
9287 {
9288 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
9289 };
9290
9291 struct OpTable ucharOps = 
9292 {
9293 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
9294 };
9295
9296 void ReadString(char * output, char * string)
9297 {
9298 int len = strlen(string);
9299 int c, d = 0;
9300 unsigned int quoted = 0x0, escaped = 0x0;
9301
9302 for(c = 0; c < len; c++)
9303 {
9304 char ch = string[c];
9305
9306 if(escaped)
9307 {
9308 switch(ch)
9309 {
9310 case 'n':
9311 output[d] = '\n';
9312 break;
9313 case 't':
9314 output[d] = '\t';
9315 break;
9316 case 'a':
9317 output[d] = '\a';
9318 break;
9319 case 'b':
9320 output[d] = '\b';
9321 break;
9322 case 'f':
9323 output[d] = '\f';
9324 break;
9325 case 'r':
9326 output[d] = '\r';
9327 break;
9328 case 'v':
9329 output[d] = '\v';
9330 break;
9331 case '\\':
9332 output[d] = '\\';
9333 break;
9334 case '\"':
9335 output[d] = '\"';
9336 break;
9337 default:
9338 output[d++] = '\\';
9339 output[d] = ch;
9340 }
9341 d++;
9342 escaped = 0x0;
9343 }
9344 else
9345 {
9346 if(ch == '\"')
9347 quoted ^= 0x1;
9348 else if(quoted)
9349 {
9350 if(ch == '\\')
9351 escaped = 0x1;
9352 else
9353 output[d++] = ch;
9354 }
9355 }
9356 }
9357 output[d] = '\0';
9358 }
9359
9360 extern long long __ecereNameSpace__ecere__com___strtoi64(char *  string, char * *  endString, int base);
9361
9362 extern uint64 __ecereNameSpace__ecere__com___strtoui64(char *  string, char * *  endString, int base);
9363
9364 extern double strtod(char * , char * * );
9365
9366 struct Operand GetOperand(struct Expression * exp)
9367 {
9368 struct Operand op = 
9369 {
9370 0, 0, 0, 0, 
9371 {
9372 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
9373 }
9374 };
9375 struct Type * type = exp->expType;
9376
9377 if(type)
9378 {
9379 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9380 {
9381 if(!type->_class->registered->dataType)
9382 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9383 type = type->_class->registered->dataType;
9384 }
9385 op.kind = type->kind;
9386 op.type = exp->expType;
9387 if(exp->isConstant && exp->type == 2)
9388 {
9389 switch(op.kind)
9390 {
9391 case 1:
9392 {
9393 if(exp->constant[0] == '\'')
9394 op.c = exp->constant[1];
9395 else if(type->isSigned)
9396 {
9397 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9398 op.ops = charOps;
9399 }
9400 else
9401 {
9402 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9403 op.ops = ucharOps;
9404 }
9405 break;
9406 }
9407 case 2:
9408 if(type->isSigned)
9409 {
9410 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9411 op.ops = shortOps;
9412 }
9413 else
9414 {
9415 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9416 op.ops = ushortOps;
9417 }
9418 break;
9419 case 3:
9420 case 5:
9421 if(type->isSigned)
9422 {
9423 op.i = strtol(exp->constant, (((void *)0)), 0);
9424 op.ops = intOps;
9425 }
9426 else
9427 {
9428 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9429 op.ops = uintOps;
9430 }
9431 op.kind = 3;
9432 break;
9433 case 4:
9434 if(type->isSigned)
9435 {
9436 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9437 op.ops = intOps;
9438 }
9439 else
9440 {
9441 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9442 op.ops = uintOps;
9443 }
9444 op.kind = 3;
9445 break;
9446 case 22:
9447 if(type->isSigned)
9448 {
9449 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9450 op.ops = intOps;
9451 }
9452 else
9453 {
9454 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9455 op.ops = uintOps;
9456 }
9457 op.kind = 3;
9458 break;
9459 case 23:
9460 if(type->isSigned)
9461 {
9462 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9463 op.ops = intOps;
9464 }
9465 else
9466 {
9467 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9468 op.ops = uintOps;
9469 }
9470 op.kind = 3;
9471 break;
9472 case 6:
9473 op.f = (float)strtod(exp->constant, (((void *)0)));
9474 op.ops = floatOps;
9475 break;
9476 case 7:
9477 op.d = (double)strtod(exp->constant, (((void *)0)));
9478 op.ops = doubleOps;
9479 break;
9480 case 12:
9481 case 13:
9482 case 8:
9483 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9484 op.kind = 13;
9485 op.ops = uintOps;
9486 break;
9487 }
9488 }
9489 }
9490 return op;
9491 }
9492
9493 int __ecereVMethodID_class_OnGetString;
9494
9495 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9496
9497 static void UnusedFunction()
9498 {
9499 int a;
9500
9501 ((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);
9502 }
9503
9504 extern int __ecereVMethodID_class_OnGetString;
9505
9506 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9507 {
9508 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9509
9510 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9511 {
9512 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9513 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9514 else
9515 {
9516 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9517 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9518 struct Type * type;
9519 void * ptr = inst->data + dataMember->offset + offset;
9520 char * result = (((void *)0));
9521
9522 exp->loc = member->loc = inst->loc;
9523 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9524 if(!dataMember->dataType)
9525 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9526 type = dataMember->dataType;
9527 if(type->kind == 8)
9528 {
9529 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9530
9531 if(_class->type == 4)
9532 {
9533 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9534
9535 if(enumClass)
9536 {
9537 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9538 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9539
9540 for(item = e->values.first; item; item = item->next)
9541 {
9542 if((int)item->data == *(int *)ptr)
9543 {
9544 result = item->name;
9545 break;
9546 }
9547 }
9548 if(result)
9549 {
9550 exp->identifier = MkIdentifier(result);
9551 exp->type = 0;
9552 exp->destType = MkClassType(_class->fullName);
9553 ProcessExpressionType(exp);
9554 }
9555 }
9556 }
9557 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9558 {
9559 if(!_class->dataType)
9560 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9561 type = _class->dataType;
9562 }
9563 }
9564 if(!result)
9565 {
9566 switch(type->kind)
9567 {
9568 case 6:
9569 {
9570 FreeExpContents(exp);
9571 exp->constant = PrintFloat(*(float *)ptr);
9572 exp->type = 2;
9573 break;
9574 }
9575 case 7:
9576 {
9577 FreeExpContents(exp);
9578 exp->constant = PrintDouble(*(double *)ptr);
9579 exp->type = 2;
9580 break;
9581 }
9582 case 3:
9583 {
9584 FreeExpContents(exp);
9585 exp->constant = PrintInt(*(int *)ptr);
9586 exp->type = 2;
9587 break;
9588 }
9589 case 4:
9590 {
9591 FreeExpContents(exp);
9592 exp->constant = PrintInt64(*(long long *)ptr);
9593 exp->type = 2;
9594 break;
9595 }
9596 case 22:
9597 {
9598 FreeExpContents(exp);
9599 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9600 exp->type = 2;
9601 break;
9602 }
9603 case 23:
9604 {
9605 FreeExpContents(exp);
9606 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9607 exp->type = 2;
9608 break;
9609 }
9610 default:
9611 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9612 }
9613 }
9614 ListAdd(memberList, member);
9615 }
9616 if(parentDataMember->type == 1)
9617 break;
9618 }
9619 }
9620
9621 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9622
9623 void PopulateInstance(struct Instantiation * inst)
9624 {
9625 struct Symbol * classSym = inst->_class->symbol;
9626 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9627 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9628 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9629
9630 inst->members = MkListOne(MkMembersInitList(memberList));
9631 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9632 {
9633 if(!dataMember->isProperty)
9634 {
9635 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9636 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9637 else
9638 {
9639 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9640 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9641 struct Type * type;
9642 void * ptr = inst->data + dataMember->offset;
9643 char * result = (((void *)0));
9644
9645 exp->loc = member->loc = inst->loc;
9646 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9647 if(!dataMember->dataType)
9648 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9649 type = dataMember->dataType;
9650 if(type->kind == 8)
9651 {
9652 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9653
9654 if(_class->type == 4)
9655 {
9656 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9657
9658 if(enumClass)
9659 {
9660 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9661 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9662
9663 for(item = e->values.first; item; item = item->next)
9664 {
9665 if((int)item->data == *(int *)ptr)
9666 {
9667 result = item->name;
9668 break;
9669 }
9670 }
9671 }
9672 if(result)
9673 {
9674 exp->identifier = MkIdentifier(result);
9675 exp->type = 0;
9676 exp->destType = MkClassType(_class->fullName);
9677 ProcessExpressionType(exp);
9678 }
9679 }
9680 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9681 {
9682 if(!_class->dataType)
9683 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9684 type = _class->dataType;
9685 }
9686 }
9687 if(!result)
9688 {
9689 switch(type->kind)
9690 {
9691 case 6:
9692 {
9693 exp->constant = PrintFloat(*(float *)ptr);
9694 exp->type = 2;
9695 break;
9696 }
9697 case 7:
9698 {
9699 exp->constant = PrintDouble(*(double *)ptr);
9700 exp->type = 2;
9701 break;
9702 }
9703 case 3:
9704 {
9705 exp->constant = PrintInt(*(int *)ptr);
9706 exp->type = 2;
9707 break;
9708 }
9709 case 4:
9710 {
9711 exp->constant = PrintInt64(*(long long *)ptr);
9712 exp->type = 2;
9713 break;
9714 }
9715 case 22:
9716 {
9717 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9718 exp->type = 2;
9719 break;
9720 }
9721 default:
9722 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9723 }
9724 }
9725 ListAdd(memberList, member);
9726 }
9727 }
9728 }
9729 }
9730
9731 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);
9732
9733 extern void FreeInstance(struct Instantiation * inst);
9734
9735 void ComputeInstantiation(struct Expression * exp)
9736 {
9737 struct Instantiation * inst = exp->instance;
9738 struct MembersInit * members;
9739 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9740 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9741 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9742 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9743 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9744 int subMemberStackPos = 0;
9745 uint64 bits = 0;
9746
9747 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9748 {
9749 if(inst->data)
9750 return ;
9751 if(_class->type == 0 || _class->type == 5)
9752 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9753 else
9754 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9755 }
9756 if(inst->members)
9757 {
9758 for(members = (*inst->members).first; members; members = members->next)
9759 {
9760 switch(members->type)
9761 {
9762 case 0:
9763 {
9764 if(members->dataMembers)
9765 {
9766 struct MemberInit * member;
9767
9768 for(member = (*members->dataMembers).first; member; member = member->next)
9769 {
9770 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9771 unsigned int found = 0x0;
9772 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9773 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9774 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9775 unsigned int dataMemberOffset;
9776
9777 if(!ident)
9778 {
9779 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9780 if(curMember)
9781 {
9782 if(curMember->isProperty)
9783 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9784 else
9785 {
9786 dataMember = curMember;
9787 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9788 }
9789 found = 0x1;
9790 }
9791 }
9792 else
9793 {
9794 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9795 if(prop)
9796 {
9797 found = 0x1;
9798 if(prop->memberAccess == 1)
9799 {
9800 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9801 curClass = prop->_class;
9802 }
9803 }
9804 else
9805 {
9806 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9807 int _subMemberStackPos = 0;
9808
9809 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9810 if(dataMember)
9811 {
9812 found = 0x1;
9813 if(dataMember->memberAccess == 1)
9814 {
9815 curMember = dataMember;
9816 curClass = dataMember->_class;
9817 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
9818 subMemberStackPos = _subMemberStackPos;
9819 }
9820 }
9821 }
9822 }
9823 if(found && member->initializer && member->initializer->type == 0)
9824 {
9825 struct Expression * value = member->initializer->exp;
9826 struct Type * type = (((void *)0));
9827
9828 if(prop)
9829 {
9830 type = prop->dataType;
9831 }
9832 else if(dataMember)
9833 {
9834 if(!dataMember->dataType)
9835 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9836 type = dataMember->dataType;
9837 }
9838 if(ident && ident->next)
9839 {
9840 for(ident = ident->next; ident && type; ident = ident->next)
9841 {
9842 if(type->kind == 8)
9843 {
9844 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9845 if(prop)
9846 type = prop->dataType;
9847 else
9848 {
9849 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9850 if(dataMember)
9851 type = dataMember->dataType;
9852 }
9853 }
9854 else if(type->kind == 9 || type->kind == 10)
9855 {
9856 struct Type * memberType;
9857
9858 for(memberType = type->members.first; memberType; memberType = memberType->next)
9859 {
9860 if(!strcmp(memberType->name, ident->string))
9861 {
9862 type = memberType;
9863 break;
9864 }
9865 }
9866 }
9867 }
9868 }
9869 if(value)
9870 {
9871 FreeType(value->destType);
9872 value->destType = type;
9873 if(type)
9874 type->refCount++;
9875 ComputeExpression(value);
9876 }
9877 if(value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9878 {
9879 if(type->kind == 8)
9880 {
9881 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9882
9883 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9884 {
9885 if(!_class->dataType)
9886 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9887 type = _class->dataType;
9888 }
9889 }
9890 if(dataMember)
9891 {
9892 void * ptr = inst->data + dataMemberOffset;
9893
9894 if(value->type == 2)
9895 {
9896 switch(type->kind)
9897 {
9898 case 3:
9899 {
9900 GetInt(value, (int *)ptr);
9901 break;
9902 }
9903 case 4:
9904 {
9905 GetInt64(value, (long long *)ptr);
9906 break;
9907 }
9908 case 22:
9909 {
9910 GetIntPtr(value, (intptr_t *)ptr);
9911 break;
9912 }
9913 case 23:
9914 {
9915 GetIntSize(value, (ssize_t *)ptr);
9916 break;
9917 }
9918 case 6:
9919 {
9920 GetFloat(value, (float *)ptr);
9921 break;
9922 }
9923 case 7:
9924 {
9925 GetDouble(value, (double *)ptr);
9926 break;
9927 }
9928 }
9929 }
9930 else if(value->type == 1)
9931 {
9932 if(type->kind == 8)
9933 {
9934 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9935
9936 if(_class->type == 1)
9937 {
9938 ComputeTypeSize(type);
9939 if(value->instance->data)
9940 memcpy(ptr, value->instance->data, type->size);
9941 }
9942 }
9943 }
9944 }
9945 else if(prop)
9946 {
9947 if(value->type == 1 && value->instance->data)
9948 {
9949 void (* Set)(void *, void *) = (void *)prop->Set;
9950
9951 Set(inst->data, value->instance->data);
9952 PopulateInstance(inst);
9953 }
9954 else if(value->type == 2)
9955 {
9956 switch(type->kind)
9957 {
9958 case 7:
9959 {
9960 void (* Set)(void *, double) = (void *)prop->Set;
9961
9962 Set(inst->data, strtod(value->constant, (((void *)0))));
9963 break;
9964 }
9965 case 6:
9966 {
9967 void (* Set)(void *, float) = (void *)prop->Set;
9968
9969 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
9970 break;
9971 }
9972 case 3:
9973 {
9974 void (* Set)(void *, int) = (void *)prop->Set;
9975
9976 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
9977 break;
9978 }
9979 case 4:
9980 {
9981 void (* Set)(void *, long long) = (void *)prop->Set;
9982
9983 Set(inst->data, __ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
9984 break;
9985 }
9986 case 22:
9987 {
9988 void (* Set)(void *, intptr_t) = (void *)prop->Set;
9989
9990 Set(inst->data, (intptr_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
9991 break;
9992 }
9993 case 23:
9994 {
9995 void (* Set)(void *, ssize_t) = (void *)prop->Set;
9996
9997 Set(inst->data, (ssize_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
9998 break;
9999 }
10000 }
10001 }
10002 else if(value->type == 3)
10003 {
10004 char temp[1024];
10005
10006 ReadString(temp, value->string);
10007 ((void (*)(void *, void *))(void *)prop->Set)(inst->data, temp);
10008 }
10009 }
10010 }
10011 else if(_class->type == 3)
10012 {
10013 if(prop)
10014 {
10015 if(value->type == 2)
10016 {
10017 if(type->kind == 8)
10018 {
10019 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10020
10021 if(_class->type == 3)
10022 {
10023 if(!_class->dataType)
10024 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10025 type = _class->dataType;
10026 }
10027 }
10028 switch(type->kind)
10029 {
10030 case 6:
10031 {
10032 float fValue;
10033 float (* Set)(float) = (void *)prop->Set;
10034
10035 GetFloat(member->initializer->exp, &fValue);
10036 exp->constant = PrintFloat(Set(fValue));
10037 exp->type = 2;
10038 break;
10039 }
10040 case 7:
10041 {
10042 double dValue;
10043 double (* Set)(double) = (void *)prop->Set;
10044
10045 GetDouble(member->initializer->exp, &dValue);
10046 exp->constant = PrintDouble(Set(dValue));
10047 exp->type = 2;
10048 break;
10049 }
10050 }
10051 }
10052 }
10053 }
10054 else if(_class->type == 2)
10055 {
10056 if(prop)
10057 {
10058 if(value->type == 1 && value->instance->data)
10059 {
10060 unsigned int (* Set)(void *) = (void *)prop->Set;
10061
10062 bits = Set(value->instance->data);
10063 }
10064 else if(value->type == 2)
10065 {
10066 }
10067 }
10068 else if(dataMember)
10069 {
10070 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
10071 struct Type * type;
10072 int part = 0;
10073
10074 GetInt(value, &part);
10075 bits = (bits & ~bitMember->mask);
10076 if(!bitMember->dataType)
10077 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
10078 type = bitMember->dataType;
10079 if(type->kind == 8 && type->_class && type->_class->registered)
10080 {
10081 if(!type->_class->registered->dataType)
10082 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
10083 type = type->_class->registered->dataType;
10084 }
10085 switch(type->kind)
10086 {
10087 case 1:
10088 if(type->isSigned)
10089 bits |= ((char)part << bitMember->pos);
10090 else
10091 bits |= ((unsigned char)part << bitMember->pos);
10092 break;
10093 case 2:
10094 if(type->isSigned)
10095 bits |= ((short)part << bitMember->pos);
10096 else
10097 bits |= ((unsigned short)part << bitMember->pos);
10098 break;
10099 case 3:
10100 case 5:
10101 if(type->isSigned)
10102 bits |= (part << bitMember->pos);
10103 else
10104 bits |= ((unsigned int)part << bitMember->pos);
10105 break;
10106 case 4:
10107 if(type->isSigned)
10108 bits |= ((long long)part << bitMember->pos);
10109 else
10110 bits |= ((uint64)part << bitMember->pos);
10111 break;
10112 case 22:
10113 if(type->isSigned)
10114 {
10115 bits |= ((intptr_t)part << bitMember->pos);
10116 }
10117 else
10118 {
10119 bits |= ((uintptr_t)part << bitMember->pos);
10120 }
10121 break;
10122 case 23:
10123 if(type->isSigned)
10124 {
10125 bits |= ((ssize_t)part << bitMember->pos);
10126 }
10127 else
10128 {
10129 bits |= ((size_t)part << bitMember->pos);
10130 }
10131 break;
10132 }
10133 }
10134 }
10135 }
10136 else
10137 {
10138 if(_class && _class->type == 3)
10139 {
10140 ComputeExpression(member->initializer->exp);
10141 exp->constant = member->initializer->exp->constant;
10142 exp->type = 2;
10143 member->initializer->exp->constant = (((void *)0));
10144 }
10145 }
10146 }
10147 }
10148 break;
10149 }
10150 }
10151 }
10152 }
10153 if(_class && _class->type == 2)
10154 {
10155 exp->constant = PrintHexUInt(bits);
10156 exp->type = 2;
10157 }
10158 if(exp->type != 1)
10159 {
10160 FreeInstance(inst);
10161 }
10162 }
10163
10164 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
10165 {
10166 if(exp->op.op == SIZEOF)
10167 {
10168 FreeExpContents(exp);
10169 exp->type = 2;
10170 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
10171 }
10172 else
10173 {
10174 if(!exp->op.exp1)
10175 {
10176 switch(exp->op.op)
10177 {
10178 case '+':
10179 {
10180 struct Expression * exp2 = exp->op.exp2;
10181
10182 exp->op.exp2 = (((void *)0));
10183 FreeExpContents(exp);
10184 FreeType(exp->expType);
10185 FreeType(exp->destType);
10186 *exp = *exp2;
10187 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
10188 break;
10189 }
10190 case '-':
10191 if(op1->ops.Neg)
10192 {
10193 FreeExpContents(exp);
10194 op1->ops.Neg(exp, op1);
10195 }
10196 break;
10197 case '~':
10198 if(op1->ops.BitNot)
10199 {
10200 FreeExpContents(exp);
10201 op1->ops.BitNot(exp, op1);
10202 }
10203 break;
10204 case '!':
10205 if(op1->ops.Not)
10206 {
10207 FreeExpContents(exp);
10208 op1->ops.Not(exp, op1);
10209 }
10210 break;
10211 }
10212 }
10213 else
10214 {
10215 switch(exp->op.op)
10216 {
10217 case '+':
10218 if(op1->ops.Add)
10219 {
10220 FreeExpContents(exp);
10221 op1->ops.Add(exp, op1, op2);
10222 }
10223 break;
10224 case '-':
10225 if(op1->ops.Sub)
10226 {
10227 FreeExpContents(exp);
10228 op1->ops.Sub(exp, op1, op2);
10229 }
10230 break;
10231 case '*':
10232 if(op1->ops.Mul)
10233 {
10234 FreeExpContents(exp);
10235 op1->ops.Mul(exp, op1, op2);
10236 }
10237 break;
10238 case '/':
10239 if(op1->ops.Div)
10240 {
10241 FreeExpContents(exp);
10242 op1->ops.Div(exp, op1, op2);
10243 }
10244 break;
10245 case '%':
10246 if(op1->ops.Mod)
10247 {
10248 FreeExpContents(exp);
10249 op1->ops.Mod(exp, op1, op2);
10250 }
10251 break;
10252 case '&':
10253 if(exp->op.exp2)
10254 {
10255 if(op1->ops.BitAnd)
10256 {
10257 FreeExpContents(exp);
10258 op1->ops.BitAnd(exp, op1, op2);
10259 }
10260 }
10261 break;
10262 case '|':
10263 if(op1->ops.BitOr)
10264 {
10265 FreeExpContents(exp);
10266 op1->ops.BitOr(exp, op1, op2);
10267 }
10268 break;
10269 case '^':
10270 if(op1->ops.BitXor)
10271 {
10272 FreeExpContents(exp);
10273 op1->ops.BitXor(exp, op1, op2);
10274 }
10275 break;
10276 case LEFT_OP:
10277 if(op1->ops.LShift)
10278 {
10279 FreeExpContents(exp);
10280 op1->ops.LShift(exp, op1, op2);
10281 }
10282 break;
10283 case RIGHT_OP:
10284 if(op1->ops.RShift)
10285 {
10286 FreeExpContents(exp);
10287 op1->ops.RShift(exp, op1, op2);
10288 }
10289 break;
10290 case EQ_OP:
10291 if(op1->ops.Equ)
10292 {
10293 FreeExpContents(exp);
10294 op1->ops.Equ(exp, op1, op2);
10295 }
10296 break;
10297 case NE_OP:
10298 if(op1->ops.Nqu)
10299 {
10300 FreeExpContents(exp);
10301 op1->ops.Nqu(exp, op1, op2);
10302 }
10303 break;
10304 case AND_OP:
10305 if(op1->ops.And)
10306 {
10307 FreeExpContents(exp);
10308 op1->ops.And(exp, op1, op2);
10309 }
10310 break;
10311 case OR_OP:
10312 if(op1->ops.Or)
10313 {
10314 FreeExpContents(exp);
10315 op1->ops.Or(exp, op1, op2);
10316 }
10317 break;
10318 case '>':
10319 if(op1->ops.Grt)
10320 {
10321 FreeExpContents(exp);
10322 op1->ops.Grt(exp, op1, op2);
10323 }
10324 break;
10325 case '<':
10326 if(op1->ops.Sma)
10327 {
10328 FreeExpContents(exp);
10329 op1->ops.Sma(exp, op1, op2);
10330 }
10331 break;
10332 case GE_OP:
10333 if(op1->ops.GrtEqu)
10334 {
10335 FreeExpContents(exp);
10336 op1->ops.GrtEqu(exp, op1, op2);
10337 }
10338 break;
10339 case LE_OP:
10340 if(op1->ops.SmaEqu)
10341 {
10342 FreeExpContents(exp);
10343 op1->ops.SmaEqu(exp, op1, op2);
10344 }
10345 break;
10346 }
10347 }
10348 }
10349 }
10350
10351 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10352
10353 void ComputeExpression(struct Expression * exp)
10354 {
10355 char expString[10240];
10356
10357 expString[0] = '\0';
10358 switch(exp->type)
10359 {
10360 case 1:
10361 {
10362 ComputeInstantiation(exp);
10363 break;
10364 }
10365 case 4:
10366 {
10367 struct Expression * exp1, * exp2 = (((void *)0));
10368 struct Operand op1 = 
10369 {
10370 0, 0, 0, 0, 
10371 {
10372 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10373 }
10374 };
10375 struct Operand op2 = 
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
10383 if(exp->op.exp2)
10384 ComputeExpression(exp->op.exp2);
10385 if(exp->op.exp1)
10386 {
10387 ComputeExpression(exp->op.exp1);
10388 exp1 = exp->op.exp1;
10389 exp2 = exp->op.exp2;
10390 op1 = GetOperand(exp1);
10391 if(op1.type)
10392 op1.type->refCount++;
10393 if(exp2)
10394 {
10395 op2 = GetOperand(exp2);
10396 if(op2.type)
10397 op2.type->refCount++;
10398 }
10399 }
10400 else
10401 {
10402 exp1 = exp->op.exp2;
10403 op1 = GetOperand(exp1);
10404 if(op1.type)
10405 op1.type->refCount++;
10406 }
10407 CallOperator(exp, exp1, exp2, &op1, &op2);
10408 if(op1.type)
10409 FreeType(op1.type);
10410 if(op2.type)
10411 FreeType(op2.type);
10412 break;
10413 }
10414 case 5:
10415 case 34:
10416 {
10417 struct Expression * e, * n;
10418
10419 for(e = (*exp->list).first; e; e = n)
10420 {
10421 n = e->next;
10422 if(!n)
10423 {
10424 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10425
10426 ComputeExpression(e);
10427 FreeType(exp->expType);
10428 FreeType(exp->destType);
10429 *exp = *e;
10430 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10431 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10432 }
10433 else
10434 {
10435 FreeExpression(e);
10436 }
10437 }
10438 break;
10439 }
10440 case 8:
10441 {
10442 struct Expression * memberExp = exp->member.exp;
10443 struct Identifier * memberID = exp->member.member;
10444 struct Type * type;
10445
10446 ComputeExpression(exp->member.exp);
10447 type = exp->member.exp->expType;
10448 if(type)
10449 {
10450 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)));
10451 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10452 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10453 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10454
10455 if(type->kind == 19 && exp->member.exp->type == 26)
10456 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10457 if(!_class)
10458 {
10459 char string[256];
10460 struct Symbol * classSym;
10461
10462 string[0] = '\0';
10463 PrintType(type, string, 0x0, 0x1);
10464 classSym = FindClass(string);
10465 _class = classSym ? classSym->registered : (((void *)0));
10466 }
10467 if(exp->member.member)
10468 {
10469 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10470 if(!prop)
10471 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10472 }
10473 if(!prop && !member && _class && exp->member.member)
10474 {
10475 struct Symbol * classSym = FindClass(exp->member.member->string);
10476
10477 convertTo = _class;
10478 _class = classSym ? classSym->registered : (((void *)0));
10479 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10480 }
10481 if(prop)
10482 {
10483 if(prop->compiled)
10484 {
10485 struct Type * type = prop->dataType;
10486
10487 if(_class->type == 3)
10488 {
10489 if(type->kind == 8)
10490 {
10491 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10492
10493 if(_class->type == 3)
10494 {
10495 if(!_class->dataType)
10496 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10497 type = _class->dataType;
10498 }
10499 }
10500 switch(type->kind)
10501 {
10502 case 6:
10503 {
10504 float value;
10505 float (* Get)(float) = (void *)prop->Get;
10506
10507 GetFloat(exp->member.exp, &value);
10508 exp->constant = PrintFloat(Get ? Get(value) : value);
10509 exp->type = 2;
10510 break;
10511 }
10512 case 7:
10513 {
10514 double value;
10515 double (* Get)(double);
10516
10517 GetDouble(exp->member.exp, &value);
10518 if(convertTo)
10519 Get = (void *)prop->Set;
10520 else
10521 Get = (void *)prop->Get;
10522 exp->constant = PrintDouble(Get ? Get(value) : value);
10523 exp->type = 2;
10524 break;
10525 }
10526 }
10527 }
10528 else
10529 {
10530 if(convertTo)
10531 {
10532 struct Expression * value = exp->member.exp;
10533 struct Type * type;
10534
10535 if(!prop->dataType)
10536 ProcessPropertyType(prop);
10537 type = prop->dataType;
10538 if(!type)
10539 {
10540 }
10541 else if(_class->type == 1)
10542 {
10543 switch(type->kind)
10544 {
10545 case 8:
10546 {
10547 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10548
10549 if(propertyClass->type == 1 && value->type == 1)
10550 {
10551 void (* Set)(void *, void *) = (void *)prop->Set;
10552
10553 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10554 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10555 exp->instance->_class = MkSpecifierName(_class->fullName);
10556 exp->instance->loc = exp->loc;
10557 exp->type = 1;
10558 Set(exp->instance->data, value->instance->data);
10559 PopulateInstance(exp->instance);
10560 }
10561 break;
10562 }
10563 case 3:
10564 {
10565 int intValue;
10566 void (* Set)(void *, int) = (void *)prop->Set;
10567
10568 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10569 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10570 exp->instance->_class = MkSpecifierName(_class->fullName);
10571 exp->instance->loc = exp->loc;
10572 exp->type = 1;
10573 GetInt(value, &intValue);
10574 Set(exp->instance->data, intValue);
10575 PopulateInstance(exp->instance);
10576 break;
10577 }
10578 case 4:
10579 {
10580 long long intValue;
10581 void (* Set)(void *, long long) = (void *)prop->Set;
10582
10583 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10584 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10585 exp->instance->_class = MkSpecifierName(_class->fullName);
10586 exp->instance->loc = exp->loc;
10587 exp->type = 1;
10588 GetInt64(value, &intValue);
10589 Set(exp->instance->data, intValue);
10590 PopulateInstance(exp->instance);
10591 break;
10592 }
10593 case 22:
10594 {
10595 intptr_t intValue;
10596 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10597
10598 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10599 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10600 exp->instance->_class = MkSpecifierName(_class->fullName);
10601 exp->instance->loc = exp->loc;
10602 exp->type = 1;
10603 GetIntPtr(value, &intValue);
10604 Set(exp->instance->data, intValue);
10605 PopulateInstance(exp->instance);
10606 break;
10607 }
10608 case 23:
10609 {
10610 ssize_t intValue;
10611 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10612
10613 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10614 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10615 exp->instance->_class = MkSpecifierName(_class->fullName);
10616 exp->instance->loc = exp->loc;
10617 exp->type = 1;
10618 GetIntSize(value, &intValue);
10619 Set(exp->instance->data, intValue);
10620 PopulateInstance(exp->instance);
10621 break;
10622 }
10623 case 7:
10624 {
10625 double doubleValue;
10626 void (* Set)(void *, double) = (void *)prop->Set;
10627
10628 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10629 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10630 exp->instance->_class = MkSpecifierName(_class->fullName);
10631 exp->instance->loc = exp->loc;
10632 exp->type = 1;
10633 GetDouble(value, &doubleValue);
10634 Set(exp->instance->data, doubleValue);
10635 PopulateInstance(exp->instance);
10636 break;
10637 }
10638 }
10639 }
10640 else if(_class->type == 2)
10641 {
10642 switch(type->kind)
10643 {
10644 case 8:
10645 {
10646 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10647
10648 if(propertyClass->type == 1 && value->instance->data)
10649 {
10650 unsigned int (* Set)(void *) = (void *)prop->Set;
10651 unsigned int bits = Set(value->instance->data);
10652
10653 exp->constant = PrintHexUInt(bits);
10654 exp->type = 2;
10655 break;
10656 }
10657 else if(_class->type == 2)
10658 {
10659 unsigned int value;
10660 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10661 unsigned int bits;
10662
10663 GetUInt(exp->member.exp, &value);
10664 bits = Set(value);
10665 exp->constant = PrintHexUInt(bits);
10666 exp->type = 2;
10667 }
10668 }
10669 }
10670 }
10671 }
10672 else
10673 {
10674 if(_class->type == 2)
10675 {
10676 unsigned int value;
10677
10678 GetUInt(exp->member.exp, &value);
10679 switch(type->kind)
10680 {
10681 case 8:
10682 {
10683 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10684
10685 if(_class->type == 1)
10686 {
10687 void (* Get)(unsigned int, void *) = (void *)prop->Get;
10688
10689 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10690 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10691 exp->instance->_class = MkSpecifierName(_class->fullName);
10692 exp->instance->loc = exp->loc;
10693 exp->type = 1;
10694 Get(value, exp->instance->data);
10695 PopulateInstance(exp->instance);
10696 }
10697 else if(_class->type == 2)
10698 {
10699 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10700 uint64 bits = Get(value);
10701
10702 exp->constant = PrintHexUInt64(bits);
10703 exp->type = 2;
10704 }
10705 break;
10706 }
10707 }
10708 }
10709 else if(_class->type == 1)
10710 {
10711 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10712
10713 switch(type->kind)
10714 {
10715 case 8:
10716 {
10717 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10718
10719 if(_class->type == 1 && value)
10720 {
10721 void (* Get)(void *, void *) = (void *)prop->Get;
10722
10723 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10724 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10725 exp->instance->_class = MkSpecifierName(_class->fullName);
10726 exp->instance->loc = exp->loc;
10727 exp->type = 1;
10728 Get(value, exp->instance->data);
10729 PopulateInstance(exp->instance);
10730 }
10731 break;
10732 }
10733 }
10734 }
10735 }
10736 }
10737 }
10738 else
10739 {
10740 exp->isConstant = 0x0;
10741 }
10742 }
10743 else if(member)
10744 {
10745 }
10746 }
10747 if(exp->type != 8)
10748 {
10749 FreeExpression(memberExp);
10750 FreeIdentifier(memberID);
10751 }
10752 break;
10753 }
10754 case 10:
10755 {
10756 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10757
10758 FreeExpContents(exp);
10759 exp->constant = PrintUInt(ComputeTypeSize(type));
10760 exp->type = 2;
10761 FreeType(type);
10762 break;
10763 }
10764 case 15:
10765 {
10766 struct Symbol * classSym = exp->_class->symbol;
10767
10768 if(classSym && classSym->registered)
10769 {
10770 if(classSym->registered->fixed)
10771 {
10772 FreeSpecifier(exp->_class);
10773 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10774 exp->type = 2;
10775 }
10776 else
10777 {
10778 char className[1024];
10779
10780 strcpy(className, "__ecereClass_");
10781 FullClassNameCat(className, classSym->string, 0x1);
10782 MangleClassName(className);
10783 FreeExpContents(exp);
10784 exp->type = 9;
10785 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10786 exp->member.member = MkIdentifier("structSize");
10787 }
10788 }
10789 break;
10790 }
10791 case 11:
10792 {
10793 struct Type * type;
10794 struct Expression * e = exp;
10795
10796 if(exp->type == 11)
10797 {
10798 if(exp->cast.exp)
10799 ComputeExpression(exp->cast.exp);
10800 e = exp->cast.exp;
10801 }
10802 if(e && exp->expType)
10803 {
10804 type = exp->expType;
10805 if(type->kind == 8)
10806 {
10807 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10808
10809 if(_class && (_class->type == 3 || _class->type == 2))
10810 {
10811 if(!_class->dataType)
10812 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10813 type = _class->dataType;
10814 }
10815 }
10816 switch(type->kind)
10817 {
10818 case 1:
10819 if(type->isSigned)
10820 {
10821 char value;
10822
10823 GetChar(e, &value);
10824 FreeExpContents(exp);
10825 exp->constant = PrintChar(value);
10826 exp->type = 2;
10827 }
10828 else
10829 {
10830 unsigned char value;
10831
10832 GetUChar(e, &value);
10833 FreeExpContents(exp);
10834 exp->constant = PrintUChar(value);
10835 exp->type = 2;
10836 }
10837 break;
10838 case 2:
10839 if(type->isSigned)
10840 {
10841 short value;
10842
10843 GetShort(e, &value);
10844 FreeExpContents(exp);
10845 exp->constant = PrintShort(value);
10846 exp->type = 2;
10847 }
10848 else
10849 {
10850 unsigned short value;
10851
10852 GetUShort(e, &value);
10853 FreeExpContents(exp);
10854 exp->constant = PrintUShort(value);
10855 exp->type = 2;
10856 }
10857 break;
10858 case 3:
10859 if(type->isSigned)
10860 {
10861 int value;
10862
10863 GetInt(e, &value);
10864 FreeExpContents(exp);
10865 exp->constant = PrintInt(value);
10866 exp->type = 2;
10867 }
10868 else
10869 {
10870 unsigned int value;
10871
10872 GetUInt(e, &value);
10873 FreeExpContents(exp);
10874 exp->constant = PrintUInt(value);
10875 exp->type = 2;
10876 }
10877 break;
10878 case 4:
10879 if(type->isSigned)
10880 {
10881 long long value;
10882
10883 GetInt64(e, &value);
10884 FreeExpContents(exp);
10885 exp->constant = PrintInt64(value);
10886 exp->type = 2;
10887 }
10888 else
10889 {
10890 uint64 value;
10891
10892 GetUInt64(e, &value);
10893 FreeExpContents(exp);
10894 exp->constant = PrintUInt64(value);
10895 exp->type = 2;
10896 }
10897 break;
10898 case 22:
10899 if(type->isSigned)
10900 {
10901 intptr_t value;
10902
10903 GetIntPtr(e, &value);
10904 FreeExpContents(exp);
10905 exp->constant = PrintInt64((long long)value);
10906 exp->type = 2;
10907 }
10908 else
10909 {
10910 uintptr_t value;
10911
10912 GetUIntPtr(e, &value);
10913 FreeExpContents(exp);
10914 exp->constant = PrintUInt64((uint64)value);
10915 exp->type = 2;
10916 }
10917 break;
10918 case 23:
10919 if(type->isSigned)
10920 {
10921 ssize_t value;
10922
10923 GetIntSize(e, &value);
10924 FreeExpContents(exp);
10925 exp->constant = PrintInt64((long long)value);
10926 exp->type = 2;
10927 }
10928 else
10929 {
10930 size_t value;
10931
10932 GetUIntSize(e, &value);
10933 FreeExpContents(exp);
10934 exp->constant = PrintUInt64((uint64)value);
10935 exp->type = 2;
10936 }
10937 break;
10938 case 6:
10939 {
10940 float value;
10941
10942 GetFloat(e, &value);
10943 FreeExpContents(exp);
10944 exp->constant = PrintFloat(value);
10945 exp->type = 2;
10946 break;
10947 }
10948 case 7:
10949 {
10950 double value;
10951
10952 GetDouble(e, &value);
10953 FreeExpContents(exp);
10954 exp->constant = PrintDouble(value);
10955 exp->type = 2;
10956 break;
10957 }
10958 }
10959 }
10960 break;
10961 }
10962 case 12:
10963 {
10964 struct Operand op1 = 
10965 {
10966 0, 0, 0, 0, 
10967 {
10968 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10969 }
10970 };
10971 struct Operand op2 = 
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 op3 = 
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
10986 if(exp->cond.exp)
10987 ComputeExpression((*exp->cond.exp).last);
10988 if(exp->cond.elseExp)
10989 ComputeExpression(exp->cond.elseExp);
10990 if(exp->cond.cond)
10991 ComputeExpression(exp->cond.cond);
10992 op1 = GetOperand(exp->cond.cond);
10993 if(op1.type)
10994 op1.type->refCount++;
10995 op2 = GetOperand((*exp->cond.exp).last);
10996 if(op2.type)
10997 op2.type->refCount++;
10998 op3 = GetOperand(exp->cond.elseExp);
10999 if(op3.type)
11000 op3.type->refCount++;
11001 if(op1.ops.Cond)
11002 {
11003 FreeExpContents(exp);
11004 op1.ops.Cond(exp, &op1, &op2, &op3);
11005 }
11006 if(op1.type)
11007 FreeType(op1.type);
11008 if(op2.type)
11009 FreeType(op2.type);
11010 if(op3.type)
11011 FreeType(op3.type);
11012 break;
11013 }
11014 }
11015 }
11016
11017 void ApplyAnyObjectLogic(struct Expression * e);
11018
11019 extern void CopyTypeInto(struct Type * type, struct Type * src);
11020
11021 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
11022 {
11023 unsigned int result = 0x1;
11024
11025 if(destType)
11026 {
11027 struct __ecereNameSpace__ecere__sys__OldList converts = 
11028 {
11029 0, 0, 0, 0, 0
11030 };
11031 struct Conversion * convert;
11032
11033 if(destType->kind == 0)
11034 return 0x0;
11035 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
11036 result = 0x0;
11037 if(converts.count)
11038 {
11039 for(convert = converts.first; convert; convert = convert->next)
11040 {
11041 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
11042
11043 if(!empty)
11044 {
11045 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11046 int objectType = exp->expType ? exp->expType->classObjectType : 0;
11047
11048 *newExp = *exp;
11049 newExp->destType = (((void *)0));
11050 if(convert->isGet)
11051 {
11052 exp->type = 8;
11053 exp->addedThis = 0x1;
11054 exp->member.exp = newExp;
11055 FreeType(exp->member.exp->expType);
11056 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
11057 exp->member.exp->expType->classObjectType = objectType;
11058 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
11059 exp->member.memberType = 1;
11060 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11061 exp->needCast = 0x1;
11062 if(exp->expType)
11063 exp->expType->refCount++;
11064 ApplyAnyObjectLogic(exp->member.exp);
11065 }
11066 else
11067 {
11068 {
11069 exp->type = 8;
11070 exp->addedThis = 0x1;
11071 exp->member.exp = newExp;
11072 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
11073 {
11074 newExp->byReference = 0x1;
11075 }
11076 FreeType(exp->member.exp->expType);
11077 exp->member.exp->expType = (((void *)0));
11078 if(convert->convert->dataType)
11079 {
11080 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11081 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
11082 exp->member.exp->expType->refCount = 1;
11083 exp->member.exp->expType->classObjectType = objectType;
11084 ApplyAnyObjectLogic(exp->member.exp);
11085 }
11086 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
11087 exp->member.memberType = 4;
11088 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11089 exp->needCast = 0x1;
11090 if(convert->resultType)
11091 convert->resultType->refCount++;
11092 }
11093 }
11094 }
11095 else
11096 {
11097 FreeType(exp->expType);
11098 if(convert->isGet)
11099 {
11100 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11101 exp->needCast = 0x1;
11102 if(exp->expType)
11103 exp->expType->refCount++;
11104 }
11105 else
11106 {
11107 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11108 exp->needCast = 0x1;
11109 if(convert->resultType)
11110 convert->resultType->refCount++;
11111 }
11112 }
11113 }
11114 if(exp->isConstant && inCompiler)
11115 ComputeExpression(exp);
11116 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
11117 }
11118 if(!result && exp->expType && converts.count)
11119 {
11120 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
11121 }
11122 if(!result && exp->expType && exp->destType)
11123 {
11124 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))
11125 result = 0x1;
11126 }
11127 }
11128 return result;
11129 }
11130
11131 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
11132
11133 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
11134
11135 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
11136
11137 void CheckTemplateTypes(struct Expression * exp)
11138 {
11139 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
11140 {
11141 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11142 struct Statement * compound;
11143 struct Context * context;
11144
11145 *newExp = *exp;
11146 if(exp->destType)
11147 exp->destType->refCount++;
11148 if(exp->expType)
11149 exp->expType->refCount++;
11150 newExp->prev = (((void *)0));
11151 newExp->next = (((void *)0));
11152 switch(exp->expType->kind)
11153 {
11154 case 7:
11155 if(exp->destType->classObjectType)
11156 {
11157 if(exp->destType)
11158 exp->destType->refCount--;
11159 if(exp->expType)
11160 exp->expType->refCount--;
11161 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11162 }
11163 else
11164 {
11165 struct __ecereNameSpace__ecere__sys__OldList * specs;
11166 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11167 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11168
11169 context = PushContext();
11170 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11171 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11172 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11173 exp->type = 25;
11174 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11175 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
11176 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
11177 exp->compound->compound.context = context;
11178 PopContext(context);
11179 }
11180 break;
11181 default:
11182 exp->type = 11;
11183 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
11184 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11185 break;
11186 }
11187 }
11188 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
11189 {
11190 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11191 struct Statement * compound;
11192 struct Context * context;
11193
11194 *newExp = *exp;
11195 if(exp->destType)
11196 exp->destType->refCount++;
11197 if(exp->expType)
11198 exp->expType->refCount++;
11199 newExp->prev = (((void *)0));
11200 newExp->next = (((void *)0));
11201 switch(exp->expType->kind)
11202 {
11203 case 7:
11204 if(exp->destType->classObjectType)
11205 {
11206 if(exp->destType)
11207 exp->destType->refCount--;
11208 if(exp->expType)
11209 exp->expType->refCount--;
11210 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11211 }
11212 else
11213 {
11214 struct __ecereNameSpace__ecere__sys__OldList * specs;
11215 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11216 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11217
11218 context = PushContext();
11219 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11220 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11221 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11222 exp->type = 25;
11223 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11224 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
11225 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
11226 exp->compound->compound.context = context;
11227 PopContext(context);
11228 }
11229 break;
11230 case 8:
11231 {
11232 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
11233 {
11234 exp->type = 5;
11235 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
11236 ProcessExpressionType((*exp->list).first);
11237 break;
11238 }
11239 else
11240 {
11241 exp->type = 5;
11242 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
11243 newExp->needCast = 0x1;
11244 ProcessExpressionType((*exp->list).first);
11245 break;
11246 }
11247 }
11248 default:
11249 {
11250 if(exp->expType->kind == 20)
11251 {
11252 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
11253
11254 if(type)
11255 {
11256 FreeType(exp->destType);
11257 FreeType(exp->expType);
11258 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11259 break;
11260 }
11261 }
11262 if(newExp->type == 8 && newExp->member.memberType == 3)
11263 {
11264 exp->type = 4;
11265 exp->op.op = '*';
11266 exp->op.exp1 = (((void *)0));
11267 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
11268 }
11269 else
11270 {
11271 char typeString[1024];
11272 struct Declarator * decl;
11273 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11274
11275 typeString[0] = '\0';
11276 PrintType(exp->expType, typeString, 0x0, 0x0);
11277 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11278 exp->type = 11;
11279 exp->cast.typeName = MkTypeName(specs, decl);
11280 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11281 exp->cast.exp->needCast = 0x1;
11282 }
11283 break;
11284 }
11285 }
11286 }
11287 }
11288
11289 extern int strncmp(const char * , const char * , size_t n);
11290
11291 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
11292
11293 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
11294 {
11295 int nsLen = strlen(nameSpace);
11296 struct Symbol * symbol;
11297
11298 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)))
11299 {
11300 char * s = symbol->string;
11301
11302 if(!strncmp(s, nameSpace, nsLen))
11303 {
11304 int c;
11305 char * namePart;
11306
11307 for(c = strlen(s) - 1; c >= 0; c--)
11308 if(s[c] == ':')
11309 break;
11310 namePart = s + c + 1;
11311 if(!strcmp(namePart, name))
11312 {
11313 return symbol;
11314 }
11315 }
11316 else
11317 break;
11318 }
11319 return (((void *)0));
11320 }
11321
11322 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
11323 {
11324 int c;
11325 char nameSpace[1024];
11326 char * namePart;
11327 unsigned int gotColon = 0x0;
11328
11329 nameSpace[0] = '\0';
11330 for(c = strlen(name) - 1; c >= 0; c--)
11331 if(name[c] == ':')
11332 {
11333 gotColon = 0x1;
11334 break;
11335 }
11336 namePart = name + c + 1;
11337 while(c >= 0 && name[c] == ':')
11338 c--;
11339 if(c >= 0)
11340 {
11341 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
11342
11343 if(symbol)
11344 return symbol;
11345 memcpy(nameSpace, name, c + 1);
11346 nameSpace[c + 1] = (char)0;
11347 return ScanWithNameSpace(tree, nameSpace, namePart);
11348 }
11349 else if(gotColon)
11350 {
11351 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11352
11353 return symbol;
11354 }
11355 else
11356 {
11357 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11358
11359 if(symbol)
11360 return symbol;
11361 return ScanWithNameSpace(tree, "", namePart);
11362 }
11363 return (((void *)0));
11364 }
11365
11366 static void ProcessDeclaration(struct Declaration * decl);
11367
11368 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
11369 {
11370 struct Context * ctx;
11371 struct Symbol * symbol = (((void *)0));
11372
11373 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
11374 {
11375 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
11376 {
11377 symbol = (((void *)0));
11378 if(thisNameSpace)
11379 {
11380 char curName[1024];
11381
11382 strcpy(curName, thisNameSpace);
11383 strcat(curName, "::");
11384 strcat(curName, name);
11385 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
11386 }
11387 if(!symbol)
11388 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
11389 }
11390 else
11391 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
11392 if(symbol || ctx == endContext)
11393 break;
11394 }
11395 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
11396 {
11397 if(symbol->pointerExternal->type == 0)
11398 {
11399 struct FunctionDefinition * function = symbol->pointerExternal->function;
11400 struct Context * tmpContext = curContext;
11401
11402 curContext = (((void *)0));
11403 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
11404 curContext = tmpContext;
11405 symbol->pointerExternal->symbol = symbol;
11406 DeclareType(symbol->type, 0x1, 0x1);
11407 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
11408 symbol->id = curExternal->symbol->idCode;
11409 }
11410 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
11411 {
11412 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
11413 symbol->id = curExternal->symbol->idCode;
11414 }
11415 }
11416 return symbol;
11417 }
11418
11419 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
11420 {
11421 if(!type->isSigned && type->kind != 22 && type->kind != 23)
11422 ListAdd(specs, MkSpecifier(UNSIGNED));
11423 switch(type->kind)
11424 {
11425 case 8:
11426 {
11427 if(type->_class->registered)
11428 {
11429 if(!type->_class->registered->dataType)
11430 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11431 GetTypeSpecs(type->_class->registered->dataType, specs);
11432 }
11433 break;
11434 }
11435 case 7:
11436 ListAdd(specs, MkSpecifier(DOUBLE));
11437 break;
11438 case 6:
11439 ListAdd(specs, MkSpecifier(FLOAT));
11440 break;
11441 case 1:
11442 ListAdd(specs, MkSpecifier(CHAR));
11443 break;
11444 case 2:
11445 ListAdd(specs, MkSpecifier(SHORT));
11446 break;
11447 case 4:
11448 ListAdd(specs, MkSpecifier(INT64));
11449 break;
11450 case 22:
11451 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
11452 break;
11453 case 23:
11454 ListAdd(specs, MkSpecifierName(type->isSigned ? "intsize" : "uintsize"));
11455 break;
11456 case 3:
11457 default:
11458 ListAdd(specs, MkSpecifier(INT));
11459 break;
11460 }
11461 }
11462
11463 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
11464
11465 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int printFunction, unsigned int fullName)
11466 {
11467 if(type)
11468 {
11469 switch(type->kind)
11470 {
11471 case 8:
11472 if(type->_class && type->_class->string)
11473 {
11474 if(type->classObjectType == 2)
11475 strcat(string, "typed_object");
11476 else if(fullName)
11477 strcat(string, type->_class->string);
11478 else
11479 {
11480 if(type->_class->registered)
11481 strcat(string, type->_class->registered->name);
11482 else
11483 strcat(string, type->_class->string);
11484 }
11485 }
11486 break;
11487 case 13:
11488 {
11489 {
11490 _PrintType(type->type, string, 0x0, printFunction, fullName);
11491 strcat(string, " *");
11492 }
11493 break;
11494 }
11495 case 0:
11496 strcat(string, "void");
11497 break;
11498 case 3:
11499 strcat(string, type->isSigned ? "int" : "uint");
11500 break;
11501 case 4:
11502 strcat(string, type->isSigned ? "int64" : "uint64");
11503 break;
11504 case 22:
11505 strcat(string, type->isSigned ? "intptr" : "uintptr");
11506 break;
11507 case 23:
11508 strcat(string, type->isSigned ? "intsize" : "uintsize");
11509 break;
11510 case 1:
11511 strcat(string, type->isSigned ? "char" : "byte");
11512 break;
11513 case 2:
11514 strcat(string, type->isSigned ? "short" : "uint16");
11515 break;
11516 case 6:
11517 strcat(string, "float");
11518 break;
11519 case 7:
11520 strcat(string, "double");
11521 break;
11522 case 9:
11523 if(type->enumName)
11524 {
11525 strcat(string, "struct ");
11526 strcat(string, type->enumName);
11527 }
11528 else if(type->typeName)
11529 {
11530 strcat(string, type->typeName);
11531 }
11532 else
11533 {
11534 struct Type * member;
11535
11536 strcat(string, "struct {");
11537 for(member = type->members.first; member; member = member->next)
11538 {
11539 PrintType(member, string, 0x1, fullName);
11540 strcat(string, "; ");
11541 }
11542 strcat(string, "}");
11543 }
11544 break;
11545 case 10:
11546 if(type->enumName)
11547 {
11548 strcat(string, "union ");
11549 strcat(string, type->enumName);
11550 }
11551 else if(type->typeName)
11552 {
11553 strcat(string, type->typeName);
11554 }
11555 else
11556 {
11557 strcat(string, "union ");
11558 strcat(string, "(unnamed)");
11559 }
11560 break;
11561 case 15:
11562 if(type->enumName)
11563 {
11564 strcat(string, "enum ");
11565 strcat(string, type->enumName);
11566 }
11567 else if(type->typeName)
11568 {
11569 strcat(string, type->typeName);
11570 }
11571 else
11572 strcat(string, "enum");
11573 break;
11574 case 11:
11575 {
11576 if(printFunction)
11577 {
11578 if(type->dllExport)
11579 strcat(string, "dllexport ");
11580 PrintType(type->returnType, string, 0x0, fullName);
11581 strcat(string, " ");
11582 }
11583 if(printName)
11584 {
11585 if(type->name)
11586 {
11587 if(fullName)
11588 strcat(string, type->name);
11589 else
11590 {
11591 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11592
11593 if(name)
11594 name += 2;
11595 else
11596 name = type->name;
11597 strcat(string, name);
11598 }
11599 }
11600 }
11601 if(printFunction)
11602 {
11603 struct Type * param;
11604
11605 strcat(string, "(");
11606 for(param = type->params.first; param; param = param->next)
11607 {
11608 PrintType(param, string, 0x1, fullName);
11609 if(param->next)
11610 strcat(string, ", ");
11611 }
11612 strcat(string, ")");
11613 }
11614 break;
11615 }
11616 case 12:
11617 {
11618 {
11619 char baseType[1024], size[256];
11620 struct Type * arrayType = type;
11621
11622 baseType[0] = '\0';
11623 size[0] = '\0';
11624 while(arrayType->kind == 12)
11625 {
11626 strcat(size, "[");
11627 if(arrayType->enumClass)
11628 strcat(size, arrayType->enumClass->string);
11629 else if(arrayType->arraySizeExp)
11630 PrintExpression(arrayType->arraySizeExp, size);
11631 strcat(size, "]");
11632 arrayType = arrayType->arrayType;
11633 }
11634 _PrintType(arrayType, baseType, printName, printFunction, fullName);
11635 strcat(string, baseType);
11636 strcat(string, size);
11637 }
11638 printName = 0x0;
11639 break;
11640 }
11641 case 14:
11642 strcat(string, "...");
11643 break;
11644 case 16:
11645 _PrintType(type->method->dataType, string, 0x0, printFunction, fullName);
11646 break;
11647 case 19:
11648 strcat(string, "subclass(");
11649 strcat(string, type->_class ? type->_class->string : "int");
11650 strcat(string, ")");
11651 break;
11652 case 20:
11653 strcat(string, type->templateParameter->identifier->string);
11654 break;
11655 case 21:
11656 strcat(string, "thisclass");
11657 break;
11658 case 17:
11659 strcat(string, "__builtin_va_list");
11660 break;
11661 }
11662 if(type->name && printName && type->kind != 11 && (type->kind != 13 || type->type->kind != 11))
11663 {
11664 strcat(string, " ");
11665 strcat(string, type->name);
11666 }
11667 }
11668 }
11669
11670 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11671 {
11672 struct Type * funcType;
11673
11674 for(funcType = type; funcType && (funcType->kind == 13 || funcType->kind == 12); funcType = funcType->type)
11675 ;
11676 if(funcType && funcType->kind == 11 && type != funcType)
11677 {
11678 char typeString[1024];
11679 struct Type * param;
11680
11681 PrintType(funcType->returnType, string, 0x0, fullName);
11682 strcat(string, "(");
11683 _PrintType(type, string, printName, 0x0, fullName);
11684 strcat(string, ")");
11685 strcat(string, "(");
11686 for(param = funcType->params.first; param; param = param->next)
11687 {
11688 PrintType(param, string, 0x1, fullName);
11689 if(param->next)
11690 strcat(string, ", ");
11691 }
11692 strcat(string, ")");
11693 }
11694 else
11695 _PrintType(type, string, printName, 0x1, fullName);
11696 if(type->bitFieldCount)
11697 {
11698 char count[100];
11699
11700 sprintf(count, ":%d", type->bitFieldCount);
11701 strcat(string, count);
11702 }
11703 }
11704
11705 static struct Type * FindMember(struct Type * type, char * string)
11706 {
11707 struct Type * memberType;
11708
11709 for(memberType = type->members.first; memberType; memberType = memberType->next)
11710 {
11711 if(!memberType->name)
11712 {
11713 struct Type * subType = FindMember(memberType, string);
11714
11715 if(subType)
11716 return subType;
11717 }
11718 else if(!strcmp(memberType->name, string))
11719 return memberType;
11720 }
11721 return (((void *)0));
11722 }
11723
11724 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11725 {
11726 struct Type * memberType;
11727
11728 for(memberType = type->members.first; memberType; memberType = memberType->next)
11729 {
11730 if(!memberType->name)
11731 {
11732 struct Type * subType = FindMember(memberType, string);
11733
11734 if(subType)
11735 {
11736 *offset += memberType->offset;
11737 return subType;
11738 }
11739 }
11740 else if(!strcmp(memberType->name, string))
11741 {
11742 *offset += memberType->offset;
11743 return memberType;
11744 }
11745 }
11746 return (((void *)0));
11747 }
11748
11749 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11750
11751 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11752
11753 struct Expression * ParseExpressionString(char * expression)
11754 {
11755 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11756 ((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));
11757 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11758 echoOn = 0x0;
11759 parsedExpression = (((void *)0));
11760 resetScanner();
11761 expression_yyparse();
11762 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11763 return parsedExpression;
11764 }
11765
11766 extern char *  QMkString(char *  source);
11767
11768 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11769 {
11770 void * __ecereTemp1;
11771 struct Identifier * id = exp->identifier;
11772 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11773 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11774 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11775 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11776
11777 if(_class && _class->type == 4)
11778 {
11779 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11780 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11781
11782 if(enumClass)
11783 {
11784 struct __ecereNameSpace__ecere__com__Class * baseClass;
11785
11786 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11787 {
11788 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11789
11790 for(value = e->values.first; value; value = value->next)
11791 {
11792 if(!strcmp(value->name, id->string))
11793 break;
11794 }
11795 if(value)
11796 {
11797 char constant[256];
11798
11799 FreeExpContents(exp);
11800 exp->type = 2;
11801 exp->isConstant = 0x1;
11802 if(!strcmp(baseClass->dataTypeString, "int"))
11803 sprintf(constant, "%d", value->data);
11804 else
11805 sprintf(constant, "0x%X", value->data);
11806 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11807 exp->expType = MkClassType(baseClass->fullName);
11808 break;
11809 }
11810 }
11811 }
11812 if(value)
11813 return 0x1;
11814 }
11815 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11816 {
11817 ProcessMethodType(method);
11818 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));
11819 return 0x1;
11820 }
11821 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11822 {
11823 if(!prop->dataType)
11824 ProcessPropertyType(prop);
11825 exp->expType = prop->dataType;
11826 if(prop->dataType)
11827 prop->dataType->refCount++;
11828 return 0x1;
11829 }
11830 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11831 {
11832 if(!member->dataType)
11833 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11834 exp->expType = member->dataType;
11835 if(member->dataType)
11836 member->dataType->refCount++;
11837 return 0x1;
11838 }
11839 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11840 {
11841 if(!classProp->dataType)
11842 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11843 if(classProp->constant)
11844 {
11845 FreeExpContents(exp);
11846 exp->isConstant = 0x1;
11847 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
11848 {
11849 exp->type = 3;
11850 exp->constant = QMkString((char *)classProp->Get(_class));
11851 }
11852 else
11853 {
11854 char constant[256];
11855
11856 exp->type = 2;
11857 sprintf(constant, "%d", (int)classProp->Get(_class));
11858 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11859 }
11860 }
11861 else
11862 {
11863 }
11864 exp->expType = classProp->dataType;
11865 if(classProp->dataType)
11866 classProp->dataType->refCount++;
11867 return 0x1;
11868 }
11869 return 0x0;
11870 }
11871
11872 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
11873 {
11874 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
11875 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
11876 struct __ecereNameSpace__ecere__com__NameSpace * child;
11877
11878 if(!data)
11879 {
11880 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)))
11881 {
11882 data = ScanGlobalData(child, name);
11883 if(data)
11884 break;
11885 }
11886 }
11887 return data;
11888 }
11889
11890 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
11891
11892 extern char *  strncpy(char * , const char * , size_t n);
11893
11894 static struct GlobalData * FindGlobalData(char * name)
11895 {
11896 int start = 0, c;
11897 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
11898
11899 nameSpace = globalData;
11900 for(c = 0; name[c]; c++)
11901 {
11902 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
11903 {
11904 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
11905 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
11906
11907 strncpy(spaceName, name + start, c - start);
11908 spaceName[c - start] = '\0';
11909 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
11910 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
11911 if(!newSpace)
11912 return (((void *)0));
11913 nameSpace = newSpace;
11914 if(name[c] == ':')
11915 c++;
11916 start = c + 1;
11917 }
11918 }
11919 if(c - start)
11920 {
11921 return ScanGlobalData(nameSpace, name + start);
11922 }
11923 return (((void *)0));
11924 }
11925
11926 static int definedExpStackPos;
11927
11928 static void * definedExpStack[512];
11929
11930 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
11931 {
11932 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
11933
11934 FreeExpContents(checkedExp);
11935 FreeType(checkedExp->expType);
11936 FreeType(checkedExp->destType);
11937 *checkedExp = *newExp;
11938 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11939 checkedExp->prev = prev;
11940 checkedExp->next = next;
11941 }
11942
11943 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
11944
11945 extern int printf(char * , ...);
11946
11947 void __ecereMethod_Expression_Clear();
11948
11949 void ApplyAnyObjectLogic(struct Expression * e)
11950 {
11951 struct Type * destType = e->destType;
11952
11953 if(destType && (destType->classObjectType == 3))
11954 {
11955 if(e && e->expType)
11956 {
11957 struct Type * type = e->expType;
11958 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
11959
11960 if(type->kind == 8 && type->_class && type->_class->registered)
11961 {
11962 _class = type->_class->registered;
11963 }
11964 else if(type->kind == 19)
11965 {
11966 _class = FindClass("ecere::com::Class")->registered;
11967 }
11968 else
11969 {
11970 char string[1024] = "";
11971 struct Symbol * classSym;
11972
11973 PrintType(type, string, 0x0, 0x1);
11974 classSym = FindClass(string);
11975 if(classSym)
11976 _class = classSym->registered;
11977 }
11978 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)))
11979 {
11980 if(!_class || strcmp(_class->fullName, "char *"))
11981 {
11982 struct Expression * checkedExp = e, * newExp;
11983
11984 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
11985 {
11986 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
11987 {
11988 if(checkedExp->type == 25)
11989 {
11990 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
11991 }
11992 else
11993 checkedExp = (*checkedExp->list).last;
11994 }
11995 else if(checkedExp->type == 11)
11996 checkedExp = checkedExp->cast.exp;
11997 }
11998 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
11999 {
12000 newExp = checkedExp->op.exp2;
12001 checkedExp->op.exp2 = (((void *)0));
12002 FreeExpContents(checkedExp);
12003 if(e->expType && e->expType->passAsTemplate)
12004 {
12005 char size[100];
12006
12007 ComputeTypeSize(e->expType);
12008 sprintf(size, "%d", e->expType->size);
12009 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))))));
12010 }
12011 ReplaceExpContents(checkedExp, newExp);
12012 e->byReference = 0x1;
12013 }
12014 else if(!e->byReference || (_class && _class->type == 5))
12015 {
12016 struct Expression * checkedExp, * newExp;
12017
12018 {
12019 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;
12020
12021 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
12022 {
12023 struct Context * context = PushContext();
12024 struct Declarator * decl;
12025 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12026 char typeString[1024];
12027 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12028
12029 typeString[0] = '\0';
12030 *newExp = *e;
12031 newExp->prev = (((void *)0));
12032 newExp->next = (((void *)0));
12033 newExp->expType = (((void *)0));
12034 PrintType(e->expType, typeString, 0x0, 0x1);
12035 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12036 newExp->destType = ProcessType(specs, decl);
12037 curContext = context;
12038 e->type = 25;
12039 if(curCompound)
12040 {
12041 char name[100];
12042 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
12043
12044 sprintf(name, "__internalValue%03X", internalValueCounter++);
12045 if(!curCompound->compound.declarations)
12046 curCompound->compound.declarations = MkList();
12047 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
12048 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
12049 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
12050 e->compound = MkCompoundStmt((((void *)0)), stmts);
12051 }
12052 else
12053 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
12054 {
12055 struct Type * type = e->destType;
12056
12057 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12058 CopyTypeInto(e->destType, type);
12059 e->destType->refCount = 1;
12060 e->destType->classObjectType = 0;
12061 FreeType(type);
12062 }
12063 e->compound->compound.context = context;
12064 PopContext(context);
12065 curContext = context->parent;
12066 }
12067 }
12068 checkedExp = e;
12069 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12070 {
12071 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12072 {
12073 if(checkedExp->type == 25)
12074 {
12075 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12076 }
12077 else
12078 checkedExp = (*checkedExp->list).last;
12079 }
12080 else if(checkedExp->type == 11)
12081 checkedExp = checkedExp->cast.exp;
12082 }
12083 {
12084 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12085
12086 *operand = *checkedExp;
12087 checkedExp->destType = (((void *)0));
12088 checkedExp->expType = (((void *)0));
12089 __ecereMethod_Expression_Clear(checkedExp);
12090 checkedExp->type = 4;
12091 checkedExp->op.op = '&';
12092 checkedExp->op.exp1 = (((void *)0));
12093 checkedExp->op.exp2 = operand;
12094 }
12095 }
12096 }
12097 }
12098 }
12099 }
12100 {
12101 }
12102 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))))
12103 {
12104 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && !strcmp(e->expType->_class->registered->name, "class"))
12105 {
12106 return ;
12107 }
12108 else
12109 {
12110 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12111
12112 *thisExp = *e;
12113 thisExp->prev = (((void *)0));
12114 thisExp->next = (((void *)0));
12115 __ecereMethod_Expression_Clear(e);
12116 e->type = 5;
12117 e->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpBrackets(MkListOne(thisExp))));
12118 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
12119 ((struct Expression *)(*e->list).first)->byReference = 0x1;
12120 {
12121 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12122 CopyTypeInto(e->expType, thisExp->expType);
12123 e->expType->byReference = 0x0;
12124 e->expType->refCount = 1;
12125 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))
12126 {
12127 e->expType->classObjectType = 0;
12128 }
12129 }
12130 }
12131 }
12132 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
12133 {
12134 if(destType->kind == 14)
12135 {
12136 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unspecified type\n", (((void *)0))));
12137 }
12138 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
12139 {
12140 unsigned int byReference = e->expType->byReference;
12141 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12142 struct Declarator * decl;
12143 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12144 char typeString[1024];
12145 struct Type * type;
12146 int backupClassObjectType;
12147
12148 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
12149 type = e->expType;
12150 else
12151 type = destType;
12152 backupClassObjectType = type->classObjectType;
12153 type->classObjectType = 0;
12154 typeString[0] = '\0';
12155 PrintType(type, typeString, 0x0, 0x1);
12156 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12157 type->classObjectType = backupClassObjectType;
12158 *thisExp = *e;
12159 thisExp->prev = (((void *)0));
12160 thisExp->next = (((void *)0));
12161 __ecereMethod_Expression_Clear(e);
12162 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)))
12163 {
12164 e->type = 4;
12165 e->op.op = '*';
12166 e->op.exp1 = (((void *)0));
12167 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
12168 }
12169 else
12170 {
12171 e->type = 11;
12172 e->cast.typeName = MkTypeName(specs, decl);
12173 e->cast.exp = thisExp;
12174 e->byReference = 0x1;
12175 }
12176 e->expType = type;
12177 e->destType = destType;
12178 type->refCount++;
12179 destType->refCount++;
12180 }
12181 }
12182 }
12183
12184 extern char *  strstr(const char * , const char * );
12185
12186 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
12187
12188 struct __ecereNameSpace__ecere__com__DefinedExpression
12189 {
12190 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
12191 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
12192 char *  name;
12193 char *  value;
12194 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
12195 } __attribute__ ((gcc_struct));
12196
12197 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12198
12199 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12200
12201 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
12202
12203 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
12204
12205 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
12206
12207 extern struct Expression * CopyExpression(struct Expression * exp);
12208
12209 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
12210
12211 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
12212
12213 static void ProcessStatement(struct Statement * stmt);
12214
12215 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
12216
12217 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
12218
12219 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
12220
12221 extern char *  sourceFile;
12222
12223 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
12224
12225 void ProcessExpressionType(struct Expression * exp)
12226 {
12227 void * __ecereTemp2;
12228 void * __ecereTemp1;
12229 unsigned int unresolved = 0x0;
12230 struct Location oldyylloc = yylloc;
12231 unsigned int notByReference = 0x0;
12232
12233 if(!exp || exp->expType)
12234 return ;
12235 yylloc = exp->loc;
12236 switch(exp->type)
12237 {
12238 case 0:
12239 {
12240 struct Identifier * id = exp->identifier;
12241
12242 if(!id)
12243 return ;
12244 if(id->_class && id->_class->name)
12245 {
12246 id->classSym = id->_class->symbol;
12247 }
12248 if(strstr(id->string, "__ecereClass") == id->string)
12249 {
12250 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
12251 break;
12252 }
12253 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
12254 {
12255 ReplaceClassMembers(exp, thisClass);
12256 if(exp->type != 0)
12257 {
12258 ProcessExpressionType(exp);
12259 break;
12260 }
12261 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
12262 break;
12263 }
12264 else
12265 {
12266 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12267
12268 if(!symbol)
12269 {
12270 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
12271 break;
12272 else
12273 {
12274 if(thisClass)
12275 {
12276 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
12277 if(exp->type != 0)
12278 {
12279 ProcessExpressionType(exp);
12280 break;
12281 }
12282 }
12283 else if(currentClass && !id->_class)
12284 {
12285 if(ResolveIdWithClass(exp, currentClass, 0x1))
12286 break;
12287 }
12288 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12289 }
12290 }
12291 if(symbol)
12292 {
12293 struct Type * type = symbol->type;
12294 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
12295
12296 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
12297 {
12298 struct Context * context = SetupTemplatesContext(_class);
12299
12300 type = ReplaceThisClassType(_class);
12301 FinishTemplatesContext(context);
12302 if(type)
12303 type->refCount = 0;
12304 }
12305 FreeSpecifier(id->_class);
12306 id->_class = (((void *)0));
12307 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12308 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
12309 id->classSym = (((void *)0));
12310 exp->expType = type;
12311 if(type)
12312 type->refCount++;
12313 if(type && (type->kind == 15 || (_class && _class->type == 4)))
12314 exp->isConstant = 0x1;
12315 if(symbol->isParam || !strcmp(id->string, "this"))
12316 {
12317 if(_class && _class->type == 1)
12318 exp->byReference = 0x1;
12319 }
12320 if(symbol->isIterator)
12321 {
12322 if(symbol->isIterator == 3)
12323 {
12324 exp->type = 5;
12325 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
12326 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
12327 exp->expType = (((void *)0));
12328 ProcessExpressionType(exp);
12329 }
12330 else if(symbol->isIterator != 4)
12331 {
12332 exp->type = 8;
12333 exp->member.exp = MkExpIdentifier(exp->identifier);
12334 exp->member.exp->expType = exp->expType;
12335 exp->member.member = MkIdentifier("data");
12336 exp->expType = (((void *)0));
12337 ProcessExpressionType(exp);
12338 }
12339 }
12340 break;
12341 }
12342 else
12343 {
12344 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
12345
12346 if(thisNameSpace && !(id->_class && !id->_class->name))
12347 {
12348 char name[1024];
12349
12350 strcpy(name, thisNameSpace);
12351 strcat(name, "::");
12352 strcat(name, id->string);
12353 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
12354 }
12355 if(!definedExp)
12356 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
12357 if(definedExp)
12358 {
12359 int c;
12360
12361 for(c = 0; c < definedExpStackPos; c++)
12362 if(definedExpStack[c] == definedExp)
12363 break;
12364 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
12365 {
12366 struct Location backupYylloc = yylloc;
12367
12368 definedExpStack[definedExpStackPos++] = definedExp;
12369 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
12370 ((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));
12371 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
12372 echoOn = 0x0;
12373 parsedExpression = (((void *)0));
12374 resetScanner();
12375 expression_yyparse();
12376 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
12377 yylloc = backupYylloc;
12378 if(parsedExpression)
12379 {
12380 FreeIdentifier(id);
12381 exp->type = 5;
12382 exp->list = MkListOne(parsedExpression);
12383 parsedExpression->loc = yylloc;
12384 ProcessExpressionType(exp);
12385 definedExpStackPos--;
12386 return ;
12387 }
12388 definedExpStackPos--;
12389 }
12390 else
12391 {
12392 if(inCompiler)
12393 {
12394 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
12395 }
12396 }
12397 }
12398 else
12399 {
12400 struct GlobalData * data = (((void *)0));
12401
12402 if(thisNameSpace && !(id->_class && !id->_class->name))
12403 {
12404 char name[1024];
12405
12406 strcpy(name, thisNameSpace);
12407 strcat(name, "::");
12408 strcat(name, id->string);
12409 data = FindGlobalData(name);
12410 }
12411 if(!data)
12412 data = FindGlobalData(id->string);
12413 if(data)
12414 {
12415 DeclareGlobalData(data);
12416 exp->expType = data->dataType;
12417 if(data->dataType)
12418 data->dataType->refCount++;
12419 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12420 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12421 FreeSpecifier(id->_class);
12422 id->_class = (((void *)0));
12423 break;
12424 }
12425 else
12426 {
12427 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
12428
12429 if(thisNameSpace && !(id->_class && !id->_class->name))
12430 {
12431 char name[1024];
12432
12433 strcpy(name, thisNameSpace);
12434 strcat(name, "::");
12435 strcat(name, id->string);
12436 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12437 }
12438 if(!function)
12439 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12440 if(function)
12441 {
12442 char name[1024];
12443
12444 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12445 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12446 name[0] = (char)0;
12447 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12448 strcpy(name, "__ecereFunction_");
12449 FullClassNameCat(name, id->string, 0x0);
12450 if(DeclareFunction(function, name))
12451 {
12452 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12453 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12454 }
12455 exp->expType = function->dataType;
12456 if(function->dataType)
12457 function->dataType->refCount++;
12458 FreeSpecifier(id->_class);
12459 id->_class = (((void *)0));
12460 break;
12461 }
12462 }
12463 }
12464 }
12465 }
12466 unresolved = 0x1;
12467 break;
12468 }
12469 case 1:
12470 {
12471 struct __ecereNameSpace__ecere__com__Class * _class;
12472
12473 if(!exp->instance->_class)
12474 {
12475 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12476 {
12477 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12478 }
12479 }
12480 ProcessInstantiationType(exp->instance);
12481 exp->isConstant = exp->instance->isConstant;
12482 if(exp->instance->_class)
12483 {
12484 exp->expType = MkClassType(exp->instance->_class->name);
12485 }
12486 break;
12487 }
12488 case 2:
12489 {
12490 if(!exp->expType)
12491 {
12492 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12493
12494 exp->expType = type;
12495 if(exp->constant[0] == '\'')
12496 {
12497 if((int)((unsigned char *)exp->constant)[1] > 127)
12498 {
12499 int nb;
12500 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12501
12502 if(nb < 2)
12503 ch = exp->constant[1];
12504 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12505 exp->constant = PrintUInt(ch);
12506 type->kind = 8;
12507 type->_class = FindClass("unichar");
12508 type->isSigned = 0x0;
12509 }
12510 else
12511 {
12512 type->kind = 1;
12513 type->isSigned = 0x1;
12514 }
12515 }
12516 else if(strchr(exp->constant, '.'))
12517 {
12518 char ch = exp->constant[strlen(exp->constant) - 1];
12519
12520 if(ch == 'f')
12521 type->kind = 6;
12522 else
12523 type->kind = 7;
12524 type->isSigned = 0x1;
12525 }
12526 else
12527 {
12528 if(exp->constant[0] == '0' && exp->constant[1])
12529 type->isSigned = 0x0;
12530 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12531 type->isSigned = 0x0;
12532 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12533 type->isSigned = 0x0;
12534 else
12535 type->isSigned = 0x1;
12536 type->kind = 3;
12537 }
12538 exp->isConstant = 0x1;
12539 }
12540 break;
12541 }
12542 case 3:
12543 {
12544 exp->isConstant = 0x1;
12545 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));
12546 break;
12547 }
12548 case 13:
12549 case 28:
12550 ProcessExpressionType(exp->_new.size);
12551 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));
12552 DeclareType(exp->expType->type, 0x0, 0x0);
12553 break;
12554 case 14:
12555 case 29:
12556 ProcessExpressionType(exp->_renew.size);
12557 ProcessExpressionType(exp->_renew.exp);
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->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), ((struct Type *)__ecereTemp1));
12559 DeclareType(exp->expType->type, 0x0, 0x0);
12560 break;
12561 case 4:
12562 {
12563 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12564 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12565 unsigned int useDestType = 0x0, useSideType = 0x0;
12566 struct Location oldyylloc = yylloc;
12567 unsigned int useSideUnit = 0x0;
12568 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
12569
12570 switch(exp->op.op)
12571 {
12572 case '=':
12573 case MUL_ASSIGN:
12574 case DIV_ASSIGN:
12575 case MOD_ASSIGN:
12576 case ADD_ASSIGN:
12577 case SUB_ASSIGN:
12578 case LEFT_ASSIGN:
12579 case RIGHT_ASSIGN:
12580 case AND_ASSIGN:
12581 case XOR_ASSIGN:
12582 case OR_ASSIGN:
12583 assign = 0x1;
12584 break;
12585 case '!':
12586 break;
12587 case AND_OP:
12588 case OR_OP:
12589 boolOps = 0x1;
12590 boolResult = 0x1;
12591 break;
12592 case EQ_OP:
12593 case '<':
12594 case '>':
12595 case LE_OP:
12596 case GE_OP:
12597 case NE_OP:
12598 boolResult = 0x1;
12599 useSideType = 0x1;
12600 break;
12601 case '+':
12602 case '-':
12603 useSideUnit = 0x1;
12604 case '|':
12605 case '&':
12606 case '^':
12607 case '/':
12608 case '%':
12609 case '*':
12610 if(exp->op.op != '*' || exp->op.exp1)
12611 {
12612 useSideType = 0x1;
12613 useDestType = 0x1;
12614 }
12615 break;
12616 }
12617 if(exp->op.op == '&')
12618 {
12619 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12620 {
12621 struct Identifier * id = exp->op.exp2->identifier;
12622 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12623
12624 if(symbol && symbol->isIterator == 2)
12625 {
12626 exp->type = 8;
12627 exp->member.exp = exp->op.exp2;
12628 exp->member.member = MkIdentifier("key");
12629 exp->expType = (((void *)0));
12630 exp->op.exp2->expType = symbol->type;
12631 symbol->type->refCount++;
12632 ProcessExpressionType(exp);
12633 FreeType(dummy);
12634 break;
12635 }
12636 }
12637 }
12638 if(exp->op.exp1)
12639 {
12640 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))
12641 {
12642 if(exp->op.exp1->destType)
12643 FreeType(exp->op.exp1->destType);
12644 exp->op.exp1->destType = exp->destType;
12645 if(exp->destType)
12646 exp->destType->refCount++;
12647 }
12648 else if(!assign)
12649 {
12650 if(exp->op.exp1->destType)
12651 FreeType(exp->op.exp1->destType);
12652 exp->op.exp1->destType = dummy;
12653 dummy->refCount++;
12654 }
12655 if(exp->op.exp1->destType && exp->op.op != '=')
12656 exp->op.exp1->destType->count++;
12657 ProcessExpressionType(exp->op.exp1);
12658 if(exp->op.exp1->destType && exp->op.op != '=')
12659 exp->op.exp1->destType->count--;
12660 if(exp->op.exp1->destType == dummy)
12661 {
12662 FreeType(dummy);
12663 exp->op.exp1->destType = (((void *)0));
12664 }
12665 type1 = exp->op.exp1->expType;
12666 }
12667 if(exp->op.exp2)
12668 {
12669 char expString[10240];
12670
12671 expString[0] = '\0';
12672 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12673 {
12674 if(exp->op.exp1)
12675 {
12676 exp->op.exp2->destType = exp->op.exp1->expType;
12677 if(exp->op.exp1->expType)
12678 exp->op.exp1->expType->refCount++;
12679 }
12680 else
12681 {
12682 exp->op.exp2->destType = exp->destType;
12683 if(exp->destType)
12684 exp->destType->refCount++;
12685 }
12686 if(type1)
12687 type1->refCount++;
12688 exp->expType = type1;
12689 }
12690 else if(assign)
12691 {
12692 if(inCompiler)
12693 PrintExpression(exp->op.exp2, expString);
12694 if(type1 && type1->kind == 13)
12695 {
12696 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)
12697 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12698 else if(exp->op.op == '=')
12699 {
12700 if(exp->op.exp2->destType)
12701 FreeType(exp->op.exp2->destType);
12702 exp->op.exp2->destType = type1;
12703 if(type1)
12704 type1->refCount++;
12705 }
12706 }
12707 else
12708 {
12709 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)
12710 ;
12711 else
12712 {
12713 if(exp->op.exp2->destType)
12714 FreeType(exp->op.exp2->destType);
12715 exp->op.exp2->destType = type1;
12716 if(type1)
12717 type1->refCount++;
12718 }
12719 }
12720 if(type1)
12721 type1->refCount++;
12722 exp->expType = type1;
12723 }
12724 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)))
12725 {
12726 if(exp->op.exp2->destType)
12727 FreeType(exp->op.exp2->destType);
12728 exp->op.exp2->destType = exp->destType;
12729 if(exp->destType)
12730 exp->destType->refCount++;
12731 }
12732 else
12733 {
12734 if(exp->op.exp2->destType)
12735 FreeType(exp->op.exp2->destType);
12736 exp->op.exp2->destType = dummy;
12737 dummy->refCount++;
12738 }
12739 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12740 {
12741 FreeType(exp->op.exp2->destType);
12742 exp->op.exp2->destType = type1;
12743 type1->refCount++;
12744 }
12745 if(exp->op.exp2->destType && exp->op.op != '=')
12746 exp->op.exp2->destType->count++;
12747 ProcessExpressionType(exp->op.exp2);
12748 if(exp->op.exp2->destType && exp->op.op != '=')
12749 exp->op.exp2->destType->count--;
12750 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12751 {
12752 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)
12753 {
12754 if(exp->op.op != '=' && type1->type->kind == 0)
12755 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12756 }
12757 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)))
12758 {
12759 if(exp->op.op == ADD_ASSIGN)
12760 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12761 }
12762 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))
12763 {
12764 if(exp->op.op == ADD_ASSIGN)
12765 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12766 }
12767 else if(inCompiler)
12768 {
12769 char type1String[1024];
12770 char type2String[1024];
12771
12772 type1String[0] = '\0';
12773 type2String[0] = '\0';
12774 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12775 PrintType(type1, type2String, 0x0, 0x1);
12776 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12777 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12778 }
12779 }
12780 if(exp->op.exp2->destType == dummy)
12781 {
12782 FreeType(dummy);
12783 exp->op.exp2->destType = (((void *)0));
12784 }
12785 type2 = exp->op.exp2->expType;
12786 }
12787 dummy->kind = 0;
12788 if(exp->op.op == SIZEOF)
12789 {
12790 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
12791 exp->isConstant = 0x1;
12792 }
12793 else if(exp->op.op == '*' && !exp->op.exp1)
12794 {
12795 exp->expType = Dereference(type2);
12796 if(type2 && type2->kind == 8)
12797 notByReference = 0x1;
12798 }
12799 else if(exp->op.op == '&' && !exp->op.exp1)
12800 exp->expType = Reference(type2);
12801 else if(!assign)
12802 {
12803 if(boolOps)
12804 {
12805 if(exp->op.exp1)
12806 {
12807 if(exp->op.exp1->destType)
12808 FreeType(exp->op.exp1->destType);
12809 exp->op.exp1->destType = MkClassType("bool");
12810 exp->op.exp1->destType->truth = 0x1;
12811 if(!exp->op.exp1->expType)
12812 ProcessExpressionType(exp->op.exp1);
12813 else
12814 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12815 FreeType(exp->op.exp1->expType);
12816 exp->op.exp1->expType = MkClassType("bool");
12817 exp->op.exp1->expType->truth = 0x1;
12818 }
12819 if(exp->op.exp2)
12820 {
12821 if(exp->op.exp2->destType)
12822 FreeType(exp->op.exp2->destType);
12823 exp->op.exp2->destType = MkClassType("bool");
12824 exp->op.exp2->destType->truth = 0x1;
12825 if(!exp->op.exp2->expType)
12826 ProcessExpressionType(exp->op.exp2);
12827 else
12828 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12829 FreeType(exp->op.exp2->expType);
12830 exp->op.exp2->expType = MkClassType("bool");
12831 exp->op.exp2->expType->truth = 0x1;
12832 }
12833 }
12834 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")))))
12835 {
12836 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
12837 {
12838 if(exp->op.exp2->destType)
12839 FreeType(exp->op.exp2->destType);
12840 exp->op.exp2->destType = type1;
12841 type1->refCount++;
12842 if(exp->op.exp1->destType)
12843 FreeType(exp->op.exp1->destType);
12844 exp->op.exp1->destType = type2;
12845 type2->refCount++;
12846 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)
12847 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);
12848 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
12849 {
12850 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12851
12852 if(argExp)
12853 {
12854 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12855
12856 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
12857 ProcessExpressionType(exp->op.exp1);
12858 if(type2->kind != 13)
12859 {
12860 ProcessExpressionType(classExp);
12861 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"))))))));
12862 if(!exp->op.exp2->expType)
12863 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
12864 ProcessExpressionType(exp->op.exp2);
12865 }
12866 }
12867 }
12868 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)))
12869 {
12870 if(type1->kind != 8 && type1->type->kind == 0)
12871 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12872 exp->expType = type1;
12873 if(type1)
12874 type1->refCount++;
12875 }
12876 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)))
12877 {
12878 if(type2->kind != 8 && type2->type->kind == 0)
12879 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12880 exp->expType = type2;
12881 if(type2)
12882 type2->refCount++;
12883 }
12884 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))
12885 {
12886 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
12887 }
12888 else
12889 {
12890 unsigned int success = 0x0;
12891
12892 if(type1->kind == 13 && type2->kind == 13)
12893 {
12894 if(exp->op.op == '+')
12895 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12896 else if(exp->op.op == '-')
12897 {
12898 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
12899 {
12900 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
12901 success = 0x1;
12902 if(type1->type->kind == 20)
12903 {
12904 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12905
12906 if(argExp)
12907 {
12908 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12909
12910 ProcessExpressionType(classExp);
12911 exp->type = 5;
12912 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")))))));
12913 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
12914 FreeType(dummy);
12915 return ;
12916 }
12917 }
12918 }
12919 }
12920 }
12921 if(!success && exp->op.exp1->type == 2)
12922 {
12923 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12924 {
12925 if(exp->expType)
12926 FreeType(exp->expType);
12927 exp->expType = exp->op.exp1->destType;
12928 if(exp->op.exp1->destType)
12929 exp->op.exp1->destType->refCount++;
12930 success = 0x1;
12931 }
12932 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12933 {
12934 if(exp->expType)
12935 FreeType(exp->expType);
12936 exp->expType = exp->op.exp2->destType;
12937 if(exp->op.exp2->destType)
12938 exp->op.exp2->destType->refCount++;
12939 success = 0x1;
12940 }
12941 }
12942 else if(!success)
12943 {
12944 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12945 {
12946 if(exp->expType)
12947 FreeType(exp->expType);
12948 exp->expType = exp->op.exp2->destType;
12949 if(exp->op.exp2->destType)
12950 exp->op.exp2->destType->refCount++;
12951 success = 0x1;
12952 }
12953 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12954 {
12955 if(exp->expType)
12956 FreeType(exp->expType);
12957 exp->expType = exp->op.exp1->destType;
12958 if(exp->op.exp1->destType)
12959 exp->op.exp1->destType->refCount++;
12960 success = 0x1;
12961 }
12962 }
12963 if(!success)
12964 {
12965 char expString1[10240];
12966 char expString2[10240];
12967 char type1[1024];
12968 char type2[1024];
12969
12970 expString1[0] = '\0';
12971 expString2[0] = '\0';
12972 type1[0] = '\0';
12973 type2[0] = '\0';
12974 if(inCompiler)
12975 {
12976 PrintExpression(exp->op.exp1, expString1);
12977 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12978 PrintExpression(exp->op.exp2, expString2);
12979 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12980 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
12981 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
12982 }
12983 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
12984 }
12985 }
12986 }
12987 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12988 {
12989 if(exp->op.exp1->destType)
12990 FreeType(exp->op.exp1->destType);
12991 exp->op.exp1->destType = type2->_class->registered->dataType;
12992 if(type2->_class->registered->dataType)
12993 type2->_class->registered->dataType->refCount++;
12994 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12995 exp->expType = type2;
12996 if(type2)
12997 type2->refCount++;
12998 }
12999 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13000 {
13001 if(exp->op.exp2->destType)
13002 FreeType(exp->op.exp2->destType);
13003 exp->op.exp2->destType = type1->_class->registered->dataType;
13004 if(type1->_class->registered->dataType)
13005 type1->_class->registered->dataType->refCount++;
13006 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13007 exp->expType = type1;
13008 if(type1)
13009 type1->refCount++;
13010 }
13011 else if(type1)
13012 {
13013 unsigned int valid = 0x0;
13014
13015 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
13016 {
13017 if(exp->op.exp2->destType)
13018 FreeType(exp->op.exp2->destType);
13019 if(!type1->_class->registered->dataType)
13020 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
13021 exp->op.exp2->destType = type1->_class->registered->dataType;
13022 exp->op.exp2->destType->refCount++;
13023 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13024 type2 = exp->op.exp2->destType;
13025 exp->expType = type2;
13026 type2->refCount++;
13027 }
13028 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
13029 {
13030 if(exp->op.exp1->destType)
13031 FreeType(exp->op.exp1->destType);
13032 if(!type2->_class->registered->dataType)
13033 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
13034 exp->op.exp1->destType = type2->_class->registered->dataType;
13035 exp->op.exp1->destType->refCount++;
13036 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13037 type1 = exp->op.exp1->destType;
13038 exp->expType = type1;
13039 type1->refCount++;
13040 }
13041 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
13042 {
13043 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
13044 {
13045 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
13046 {
13047 if(exp->expType)
13048 FreeType(exp->expType);
13049 exp->expType = exp->op.exp1->expType;
13050 if(exp->op.exp2->expType)
13051 exp->op.exp1->expType->refCount++;
13052 valid = 0x1;
13053 }
13054 }
13055 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
13056 {
13057 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
13058 {
13059 if(exp->expType)
13060 FreeType(exp->expType);
13061 exp->expType = exp->op.exp2->expType;
13062 if(exp->op.exp2->expType)
13063 exp->op.exp2->expType->refCount++;
13064 valid = 0x1;
13065 }
13066 }
13067 }
13068 if(!valid)
13069 {
13070 if(exp->op.exp2->destType)
13071 FreeType(exp->op.exp2->destType);
13072 exp->op.exp2->destType = type1;
13073 type1->refCount++;
13074 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13075 {
13076 if(exp->expType)
13077 FreeType(exp->expType);
13078 exp->expType = exp->op.exp2->destType;
13079 if(exp->op.exp2->destType)
13080 exp->op.exp2->destType->refCount++;
13081 }
13082 else if(type1 && type2)
13083 {
13084 char expString1[10240];
13085 char expString2[10240];
13086 char type1String[1024];
13087 char type2String[1024];
13088
13089 expString1[0] = '\0';
13090 expString2[0] = '\0';
13091 type1String[0] = '\0';
13092 type2String[0] = '\0';
13093 if(inCompiler)
13094 {
13095 PrintExpression(exp->op.exp1, expString1);
13096 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13097 PrintExpression(exp->op.exp2, expString2);
13098 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13099 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
13100 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
13101 }
13102 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
13103 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
13104 {
13105 exp->expType = exp->op.exp1->expType;
13106 if(exp->op.exp1->expType)
13107 exp->op.exp1->expType->refCount++;
13108 }
13109 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13110 {
13111 exp->expType = exp->op.exp2->expType;
13112 if(exp->op.exp2->expType)
13113 exp->op.exp2->expType->refCount++;
13114 }
13115 }
13116 }
13117 }
13118 else if(type2)
13119 {
13120 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13121 {
13122 struct Type * oldType = exp->op.exp1->expType;
13123
13124 exp->op.exp1->expType = (((void *)0));
13125 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13126 FreeType(oldType);
13127 else
13128 exp->op.exp1->expType = oldType;
13129 }
13130 if(exp->op.exp1->destType)
13131 FreeType(exp->op.exp1->destType);
13132 exp->op.exp1->destType = type2;
13133 type2->refCount++;
13134 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13135 {
13136 if(exp->expType)
13137 FreeType(exp->expType);
13138 exp->expType = exp->op.exp1->destType;
13139 if(exp->op.exp1->destType)
13140 exp->op.exp1->destType->refCount++;
13141 }
13142 }
13143 }
13144 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
13145 {
13146 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13147 {
13148 if(exp->op.exp1->destType)
13149 FreeType(exp->op.exp1->destType);
13150 exp->op.exp1->destType = type2->_class->registered->dataType;
13151 if(type2->_class->registered->dataType)
13152 type2->_class->registered->dataType->refCount++;
13153 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13154 }
13155 if(exp->op.op == '!')
13156 {
13157 exp->expType = MkClassType("bool");
13158 exp->expType->truth = 0x1;
13159 }
13160 else
13161 {
13162 exp->expType = type2;
13163 if(type2)
13164 type2->refCount++;
13165 }
13166 }
13167 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
13168 {
13169 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13170 {
13171 if(exp->op.exp2->destType)
13172 FreeType(exp->op.exp2->destType);
13173 exp->op.exp2->destType = type1->_class->registered->dataType;
13174 if(type1->_class->registered->dataType)
13175 type1->_class->registered->dataType->refCount++;
13176 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13177 }
13178 exp->expType = type1;
13179 if(type1)
13180 type1->refCount++;
13181 }
13182 }
13183 yylloc = exp->loc;
13184 if(exp->op.exp1 && !exp->op.exp1->expType)
13185 {
13186 char expString[10000];
13187
13188 expString[0] = '\0';
13189 if(inCompiler)
13190 {
13191 PrintExpression(exp->op.exp1, expString);
13192 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13193 }
13194 if(expString[0])
13195 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13196 }
13197 if(exp->op.exp2 && !exp->op.exp2->expType)
13198 {
13199 char expString[10240];
13200
13201 expString[0] = '\0';
13202 if(inCompiler)
13203 {
13204 PrintExpression(exp->op.exp2, expString);
13205 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13206 }
13207 if(expString[0])
13208 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13209 }
13210 if(boolResult)
13211 {
13212 FreeType(exp->expType);
13213 exp->expType = MkClassType("bool");
13214 exp->expType->truth = 0x1;
13215 }
13216 if(exp->op.op != SIZEOF)
13217 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
13218 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
13219 {
13220 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
13221 }
13222 yylloc = oldyylloc;
13223 FreeType(dummy);
13224 break;
13225 }
13226 case 5:
13227 case 34:
13228 {
13229 struct Expression * e;
13230
13231 exp->isConstant = 0x1;
13232 for(e = (*exp->list).first; e; e = e->next)
13233 {
13234 unsigned int inced = 0x0;
13235
13236 if(!e->next)
13237 {
13238 FreeType(e->destType);
13239 e->destType = exp->destType;
13240 if(e->destType)
13241 {
13242 exp->destType->refCount++;
13243 e->destType->count++;
13244 inced = 0x1;
13245 }
13246 }
13247 ProcessExpressionType(e);
13248 if(inced)
13249 exp->destType->count--;
13250 if(!exp->expType && !e->next)
13251 {
13252 exp->expType = e->expType;
13253 if(e->expType)
13254 e->expType->refCount++;
13255 }
13256 if(!e->isConstant)
13257 exp->isConstant = 0x0;
13258 }
13259 e = (*exp->list).first;
13260 if(!e->next && e->type == 8)
13261 {
13262 struct Expression * next = exp->next, * prev = exp->prev;
13263
13264 FreeType(exp->expType);
13265 FreeType(exp->destType);
13266 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
13267 *exp = *e;
13268 exp->prev = prev;
13269 exp->next = next;
13270 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
13271 ProcessExpressionType(exp);
13272 }
13273 break;
13274 }
13275 case 6:
13276 {
13277 struct Expression * e;
13278
13279 exp->isConstant = 0x1;
13280 ProcessExpressionType(exp->index.exp);
13281 if(!exp->index.exp->isConstant)
13282 exp->isConstant = 0x0;
13283 if(exp->index.exp->expType)
13284 {
13285 struct Type * source = exp->index.exp->expType;
13286
13287 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)
13288 {
13289 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
13290
13291 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
13292 if(exp->index.index && (*exp->index.index).last)
13293 {
13294 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
13295 }
13296 }
13297 }
13298 for(e = (*exp->index.index).first; e; e = e->next)
13299 {
13300 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
13301 {
13302 if(e->destType)
13303 FreeType(e->destType);
13304 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
13305 }
13306 ProcessExpressionType(e);
13307 if(!e->next)
13308 {
13309 }
13310 if(!e->isConstant)
13311 exp->isConstant = 0x0;
13312 }
13313 if(!exp->expType)
13314 exp->expType = Dereference(exp->index.exp->expType);
13315 if(exp->expType)
13316 DeclareType(exp->expType, 0x0, 0x0);
13317 break;
13318 }
13319 case 7:
13320 {
13321 struct Expression * e;
13322 struct Type * functionType;
13323 struct Type * methodType = (((void *)0));
13324 char name[1024];
13325
13326 name[0] = '\0';
13327 if(inCompiler)
13328 {
13329 PrintExpression(exp->call.exp, name);
13330 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
13331 {
13332 PrintExpression(exp->call.exp, name);
13333 }
13334 }
13335 if(exp->call.exp->type == 0)
13336 {
13337 struct Expression * idExp = exp->call.exp;
13338 struct Identifier * id = idExp->identifier;
13339
13340 if(!strcmp(id->string, "__builtin_frame_address"))
13341 {
13342 exp->expType = ProcessTypeString("void *", 0x1);
13343 if(exp->call.arguments && (*exp->call.arguments).first)
13344 ProcessExpressionType((*exp->call.arguments).first);
13345 break;
13346 }
13347 else if(!strcmp(id->string, "__ENDIAN_PAD"))
13348 {
13349 exp->expType = ProcessTypeString("int", 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, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
13355 {
13356 struct Expression * a = (((void *)0));
13357 struct Expression * b = (((void *)0));
13358 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
13359
13360 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
13361 {
13362 a = (*exp->call.arguments).first;
13363 b = (*exp->call.arguments).last;
13364 tempExp1 = a;
13365 tempExp2 = b;
13366 }
13367 else if((*exp->call.arguments).count == 1)
13368 {
13369 a = (*exp->call.arguments).first;
13370 tempExp1 = a;
13371 }
13372 if(a)
13373 {
13374 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
13375 idExp->identifier = (((void *)0));
13376 FreeExpContents(exp);
13377 ProcessExpressionType(a);
13378 if(b)
13379 ProcessExpressionType(b);
13380 exp->type = 5;
13381 exp->list = MkList();
13382 if(a->expType && (!b || b->expType))
13383 {
13384 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
13385 {
13386 if(inCompiler)
13387 {
13388 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13389 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
13390 struct Declaration * decl;
13391 char temp1[1024], temp2[1024];
13392
13393 GetTypeSpecs(a->expType, specs);
13394 if(a && !a->isConstant && a->type != 0)
13395 {
13396 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
13397 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
13398 tempExp1 = QMkExpId(temp1);
13399 tempExp1->expType = a->expType;
13400 if(a->expType)
13401 a->expType->refCount++;
13402 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
13403 }
13404 if(b && !b->isConstant && b->type != 0)
13405 {
13406 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
13407 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
13408 tempExp2 = QMkExpId(temp2);
13409 tempExp2->expType = b->expType;
13410 if(b->expType)
13411 b->expType->refCount++;
13412 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
13413 }
13414 decl = MkDeclaration(specs, decls);
13415 if(!curCompound->compound.declarations)
13416 curCompound->compound.declarations = MkList();
13417 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
13418 }
13419 }
13420 }
13421 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13422 {
13423 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13424
13425 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13426 exp->expType = a->expType;
13427 if(a->expType)
13428 a->expType->refCount++;
13429 }
13430 else if(!strcmp(id->string, "Abs"))
13431 {
13432 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13433 exp->expType = a->expType;
13434 if(a->expType)
13435 a->expType->refCount++;
13436 }
13437 else if(!strcmp(id->string, "Sgn"))
13438 {
13439 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"))))));
13440 exp->expType = ProcessTypeString("int", 0x0);
13441 }
13442 FreeExpression(tempExp1);
13443 if(tempExp2)
13444 FreeExpression(tempExp2);
13445 FreeIdentifier(id);
13446 break;
13447 }
13448 }
13449 }
13450 {
13451 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
13452
13453 if(!exp->call.exp->destType)
13454 {
13455 exp->call.exp->destType = dummy;
13456 dummy->refCount++;
13457 }
13458 ProcessExpressionType(exp->call.exp);
13459 if(exp->call.exp->destType == dummy)
13460 {
13461 FreeType(dummy);
13462 exp->call.exp->destType = (((void *)0));
13463 }
13464 FreeType(dummy);
13465 }
13466 functionType = exp->call.exp->expType;
13467 if(functionType && functionType->kind == 16)
13468 {
13469 methodType = functionType;
13470 functionType = methodType->method->dataType;
13471 if(exp->call.exp->expType->usedClass)
13472 {
13473 char typeString[1024];
13474
13475 typeString[0] = '\0';
13476 PrintType(functionType, typeString, 0x1, 0x1);
13477 if(strstr(typeString, "thisclass"))
13478 {
13479 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13480 struct Declarator * decl;
13481
13482 {
13483 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13484
13485 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13486 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13487 thisClassParams = 0x0;
13488 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13489 {
13490 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13491
13492 thisClass = exp->call.exp->expType->usedClass;
13493 ProcessDeclarator(decl);
13494 thisClass = backupThisClass;
13495 }
13496 thisClassParams = 0x1;
13497 functionType = ProcessType(specs, decl);
13498 functionType->refCount = 0;
13499 FinishTemplatesContext(context);
13500 }
13501 FreeList(specs, FreeSpecifier);
13502 FreeDeclarator(decl);
13503 }
13504 }
13505 }
13506 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13507 {
13508 struct Type * type = functionType->type;
13509
13510 if(!functionType->refCount)
13511 {
13512 functionType->type = (((void *)0));
13513 FreeType(functionType);
13514 }
13515 functionType = type;
13516 }
13517 if(functionType && functionType->kind != 11)
13518 {
13519 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13520 }
13521 else if(functionType)
13522 {
13523 unsigned int emptyParams = 0x0, noParams = 0x0;
13524 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13525 struct Type * type = functionType->params.first;
13526 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13527 int extra = 0;
13528 struct Location oldyylloc = yylloc;
13529
13530 if(!type)
13531 emptyParams = 0x1;
13532 if(functionType->extraParam && e && functionType->thisClass)
13533 {
13534 e->destType = MkClassType(functionType->thisClass->string);
13535 e = e->next;
13536 }
13537 if(!functionType->staticMethod)
13538 {
13539 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13540 {
13541 type = MkClassType(memberExp->member.exp->expType->_class->string);
13542 if(e)
13543 {
13544 e->destType = type;
13545 e = e->next;
13546 type = functionType->params.first;
13547 }
13548 else
13549 type->refCount = 0;
13550 }
13551 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13552 {
13553 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13554 if(e)
13555 {
13556 e->destType = type;
13557 e = e->next;
13558 type = functionType->params.first;
13559 }
13560 else
13561 type->refCount = 0;
13562 }
13563 }
13564 if(type && type->kind == 0)
13565 {
13566 noParams = 0x1;
13567 if(!type->refCount)
13568 FreeType(type);
13569 type = (((void *)0));
13570 }
13571 for(; e; e = e->next)
13572 {
13573 if(!type && !emptyParams)
13574 {
13575 yylloc = e->loc;
13576 if(methodType && methodType->methodClass)
13577 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);
13578 else
13579 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);
13580 break;
13581 }
13582 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13583 {
13584 struct Type * templatedType = (((void *)0));
13585 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13586 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13587 int id = 0;
13588
13589 if(_class && _class->templateArgs)
13590 {
13591 struct __ecereNameSpace__ecere__com__Class * sClass;
13592
13593 for(sClass = _class; sClass; sClass = sClass->base)
13594 {
13595 if(sClass->templateClass)
13596 sClass = sClass->templateClass;
13597 id = 0;
13598 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13599 {
13600 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13601 {
13602 struct __ecereNameSpace__ecere__com__Class * nextClass;
13603
13604 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13605 {
13606 if(nextClass->templateClass)
13607 nextClass = nextClass->templateClass;
13608 id += nextClass->templateParams.count;
13609 }
13610 break;
13611 }
13612 id++;
13613 }
13614 if(curParam)
13615 break;
13616 }
13617 }
13618 if(curParam && _class->templateArgs[id].dataTypeString)
13619 {
13620 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13621
13622 {
13623 struct Context * context = SetupTemplatesContext(_class);
13624
13625 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13626 FinishTemplatesContext(context);
13627 }
13628 e->destType = templatedType;
13629 if(templatedType)
13630 {
13631 templatedType->passAsTemplate = 0x1;
13632 }
13633 }
13634 else
13635 {
13636 e->destType = type;
13637 if(type)
13638 type->refCount++;
13639 }
13640 }
13641 else
13642 {
13643 if(type && type->kind == 14 && type->prev && type->prev->kind == 8 && type->prev->classObjectType)
13644 {
13645 e->destType = type->prev;
13646 e->destType->refCount++;
13647 }
13648 else
13649 {
13650 e->destType = type;
13651 if(type)
13652 type->refCount++;
13653 }
13654 }
13655 if(type && type->kind != 14)
13656 {
13657 struct Type * next = type->next;
13658
13659 if(!type->refCount)
13660 FreeType(type);
13661 type = next;
13662 }
13663 }
13664 if(type && type->kind != 14)
13665 {
13666 if(methodType && methodType->methodClass)
13667 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);
13668 else
13669 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);
13670 }
13671 yylloc = oldyylloc;
13672 if(type && !type->refCount)
13673 FreeType(type);
13674 }
13675 else
13676 {
13677 functionType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 0, ((struct Type *)__ecereTemp1)->kind = 11, ((struct Type *)__ecereTemp1));
13678 if(exp->call.exp->type == 0)
13679 {
13680 char * string = exp->call.exp->identifier->string;
13681
13682 if(inCompiler)
13683 {
13684 struct Symbol * symbol;
13685 struct Location oldyylloc = yylloc;
13686
13687 yylloc = exp->call.exp->identifier->loc;
13688 if(strstr(string, "__builtin_") == string)
13689 ;
13690 else
13691 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13692 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));
13693 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13694 if(strstr(symbol->string, "::"))
13695 globalContext->hasNameSpace = 0x1;
13696 yylloc = oldyylloc;
13697 }
13698 }
13699 else if(exp->call.exp->type == 8)
13700 {
13701 }
13702 else
13703 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13704 if(!functionType->returnType)
13705 {
13706 functionType->returnType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
13707 }
13708 }
13709 if(functionType && functionType->kind == 11)
13710 {
13711 exp->expType = functionType->returnType;
13712 if(functionType->returnType)
13713 functionType->returnType->refCount++;
13714 if(!functionType->refCount)
13715 FreeType(functionType);
13716 }
13717 if(exp->call.arguments)
13718 {
13719 for(e = (*exp->call.arguments).first; e; e = e->next)
13720 {
13721 struct Type * destType = e->destType;
13722
13723 ProcessExpressionType(e);
13724 }
13725 }
13726 break;
13727 }
13728 case 8:
13729 {
13730 struct Type * type;
13731 struct Location oldyylloc = yylloc;
13732 unsigned int thisPtr = (exp->member.exp && exp->member.exp->type == 0 && !strcmp(exp->member.exp->identifier->string, "this"));
13733
13734 exp->thisPtr = thisPtr;
13735 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13736 {
13737 exp->member.member->classSym = exp->member.member->_class->symbol;
13738 }
13739 ProcessExpressionType(exp->member.exp);
13740 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)
13741 {
13742 exp->isConstant = 0x0;
13743 }
13744 else
13745 exp->isConstant = exp->member.exp->isConstant;
13746 type = exp->member.exp->expType;
13747 yylloc = exp->loc;
13748 if(type && (type->kind == 20))
13749 {
13750 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13751 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13752
13753 if(_class)
13754 {
13755 for(param = _class->templateParams.first; param; param = param->next)
13756 {
13757 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
13758 break;
13759 }
13760 }
13761 if(param && param->defaultArg.member)
13762 {
13763 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
13764
13765 if(argExp)
13766 {
13767 struct Expression * expMember = exp->member.exp;
13768 struct Declarator * decl;
13769 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13770 char thisClassTypeString[1024];
13771
13772 FreeIdentifier(exp->member.member);
13773 ProcessExpressionType(argExp);
13774 {
13775 char * colon = strstr(param->defaultArg.memberString, "::");
13776
13777 if(colon)
13778 {
13779 char className[1024];
13780 struct __ecereNameSpace__ecere__com__Class * sClass;
13781
13782 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
13783 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
13784 }
13785 else
13786 strcpy(thisClassTypeString, _class->fullName);
13787 }
13788 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
13789 exp->expType = ProcessType(specs, decl);
13790 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
13791 {
13792 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13793 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13794 int c;
13795 int paramCount = 0;
13796 int lastParam = -1;
13797 char templateString[1024];
13798 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13799
13800 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13801 for(cClass = expClass; cClass; cClass = cClass->base)
13802 {
13803 int p = 0;
13804
13805 for(param = cClass->templateParams.first; param; param = param->next)
13806 {
13807 int id = p;
13808 struct __ecereNameSpace__ecere__com__Class * sClass;
13809 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13810
13811 for(sClass = cClass->base; sClass; sClass = sClass->base)
13812 id += sClass->templateParams.count;
13813 arg = expClass->templateArgs[id];
13814 for(sClass = _class; sClass; sClass = sClass->base)
13815 {
13816 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
13817 int p = 0;
13818 struct __ecereNameSpace__ecere__com__Class * nextClass;
13819
13820 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13821 p += nextClass->templateParams.count;
13822 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
13823 {
13824 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
13825 {
13826 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13827 {
13828 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
13829 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
13830 break;
13831 }
13832 }
13833 }
13834 }
13835 {
13836 char argument[256];
13837
13838 argument[0] = '\0';
13839 switch(param->type)
13840 {
13841 case 2:
13842 {
13843 char expString[1024];
13844 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13845 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13846 struct Expression * exp;
13847 char * string = PrintHexUInt64(arg.expression.ui64);
13848
13849 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13850 ProcessExpressionType(exp);
13851 ComputeExpression(exp);
13852 expString[0] = '\0';
13853 PrintExpression(exp, expString);
13854 strcat(argument, expString);
13855 FreeExpression(exp);
13856 break;
13857 }
13858 case 1:
13859 {
13860 strcat(argument, arg.member->name);
13861 break;
13862 }
13863 case 0:
13864 {
13865 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13866 {
13867 if(!strcmp(arg.dataTypeString, "thisclass"))
13868 strcat(argument, thisClassTypeString);
13869 else
13870 strcat(argument, arg.dataTypeString);
13871 }
13872 break;
13873 }
13874 }
13875 if(argument[0])
13876 {
13877 if(paramCount)
13878 strcat(templateString, ", ");
13879 if(lastParam != p - 1)
13880 {
13881 strcat(templateString, param->name);
13882 strcat(templateString, " = ");
13883 }
13884 strcat(templateString, argument);
13885 paramCount++;
13886 lastParam = p;
13887 }
13888 p++;
13889 }
13890 }
13891 }
13892 {
13893 int len = strlen(templateString);
13894
13895 if(templateString[len - 1] == '>')
13896 templateString[len++] = ' ';
13897 templateString[len++] = '>';
13898 templateString[len++] = '\0';
13899 }
13900 {
13901 struct Context * context = SetupTemplatesContext(_class);
13902
13903 FreeType(exp->expType);
13904 exp->expType = ProcessTypeString(templateString, 0x0);
13905 FinishTemplatesContext(context);
13906 }
13907 }
13908 exp->type = 5;
13909 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")))))))));
13910 }
13911 }
13912 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
13913 {
13914 type = ProcessTemplateParameterType(type->templateParameter);
13915 }
13916 }
13917 if(type && (type->kind == 20))
13918 ;
13919 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13920 {
13921 struct Identifier * id = exp->member.member;
13922 int typeKind = type->kind;
13923 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));
13924
13925 if(typeKind == 19 && exp->member.exp->type == 26)
13926 {
13927 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
13928 typeKind = 8;
13929 }
13930 if(id && (typeKind == 3 || typeKind == 15))
13931 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
13932 if(_class && id)
13933 {
13934 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
13935 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
13936 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
13937 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
13938 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
13939
13940 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
13941 exp->member.memberType = 1;
13942 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
13943 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
13944 if(typeKind != 19)
13945 {
13946 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
13947 {
13948 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13949 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
13950 {
13951 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13952 if(prop)
13953 member = (((void *)0));
13954 }
13955 if(!member && !prop)
13956 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13957 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
13958 exp->member.thisPtr = 0x1;
13959 }
13960 else
13961 {
13962 if(!id->classSym)
13963 {
13964 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
13965 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13966 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
13967 }
13968 if(!prop && !member)
13969 {
13970 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
13971 if(!method)
13972 {
13973 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13974 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13975 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13976 }
13977 }
13978 if(member && prop)
13979 {
13980 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
13981 prop = (((void *)0));
13982 else
13983 member = (((void *)0));
13984 }
13985 }
13986 }
13987 if(!prop && !member)
13988 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
13989 if(!prop && !member && !method)
13990 {
13991 if(typeKind == 19)
13992 {
13993 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
13994 if(classProp)
13995 {
13996 exp->member.memberType = 5;
13997 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
13998 }
13999 else
14000 {
14001 char structName[1024];
14002 struct Identifier * id = exp->member.member;
14003 struct Expression * classExp = exp->member.exp;
14004
14005 type->refCount++;
14006 FreeType(classExp->expType);
14007 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
14008 strcpy(structName, "__ecereClassData_");
14009 FullClassNameCat(structName, type->_class->string, 0x0);
14010 exp->type = 9;
14011 exp->member.member = id;
14012 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"))))))));
14013 FreeType(type);
14014 ProcessExpressionType(exp);
14015 return ;
14016 }
14017 }
14018 else
14019 {
14020 struct Symbol * classSym = FindClass(id->string);
14021
14022 if(classSym)
14023 {
14024 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
14025
14026 if(convertClass)
14027 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
14028 }
14029 }
14030 }
14031 if(prop)
14032 {
14033 exp->member.memberType = 1;
14034 if(!prop->dataType)
14035 ProcessPropertyType(prop);
14036 exp->expType = prop->dataType;
14037 if(prop->dataType)
14038 prop->dataType->refCount++;
14039 }
14040 else if(member)
14041 {
14042 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14043 {
14044 FreeExpContents(exp);
14045 exp->type = 0;
14046 exp->identifier = MkIdentifier("class");
14047 ProcessExpressionType(exp);
14048 return ;
14049 }
14050 exp->member.memberType = 3;
14051 DeclareStruct(_class->fullName, 0x0);
14052 if(!member->dataType)
14053 {
14054 struct Context * context = SetupTemplatesContext(_class);
14055
14056 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
14057 FinishTemplatesContext(context);
14058 }
14059 exp->expType = member->dataType;
14060 if(member->dataType)
14061 member->dataType->refCount++;
14062 }
14063 else if(revConvert)
14064 {
14065 exp->member.memberType = 4;
14066 exp->expType = MkClassType(revConvert->_class->fullName);
14067 }
14068 else if(method)
14069 {
14070 if(inCompiler)
14071 {
14072 exp->member.memberType = 2;
14073 }
14074 if(!method->dataType)
14075 ProcessMethodType(method);
14076 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));
14077 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
14078 exp->expType->usedClass = _class;
14079 }
14080 else if(!classProp)
14081 {
14082 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14083 {
14084 FreeExpContents(exp);
14085 exp->type = 0;
14086 exp->identifier = MkIdentifier("class");
14087 ProcessExpressionType(exp);
14088 return ;
14089 }
14090 yylloc = exp->member.member->loc;
14091 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
14092 if(inCompiler)
14093 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
14094 }
14095 if(_class && exp->expType)
14096 {
14097 struct __ecereNameSpace__ecere__com__Class * tClass;
14098
14099 tClass = _class;
14100 while(tClass && !tClass->templateClass)
14101 tClass = tClass->base;
14102 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
14103 {
14104 int id = 0;
14105 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14106 struct __ecereNameSpace__ecere__com__Class * sClass;
14107
14108 for(sClass = tClass; sClass; sClass = sClass->base)
14109 {
14110 id = 0;
14111 if(sClass->templateClass)
14112 sClass = sClass->templateClass;
14113 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14114 {
14115 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
14116 {
14117 for(sClass = sClass->base; sClass; sClass = sClass->base)
14118 id += sClass->templateParams.count;
14119 break;
14120 }
14121 id++;
14122 }
14123 if(curParam)
14124 break;
14125 }
14126 if(curParam && tClass->templateArgs[id].dataTypeString)
14127 {
14128 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14129 struct Context * context = SetupTemplatesContext(tClass);
14130
14131 FreeType(exp->expType);
14132 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
14133 if(exp->expType)
14134 {
14135 if(exp->expType->kind == 21)
14136 {
14137 FreeType(exp->expType);
14138 exp->expType = ReplaceThisClassType(_class);
14139 }
14140 if(tClass->templateClass)
14141 exp->expType->passAsTemplate = 0x1;
14142 if(!exp->destType)
14143 {
14144 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
14145 if(exp->destType->kind == 21)
14146 {
14147 FreeType(exp->destType);
14148 exp->destType = ReplaceThisClassType(_class);
14149 }
14150 }
14151 }
14152 FinishTemplatesContext(context);
14153 }
14154 }
14155 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
14156 {
14157 int id = 0;
14158 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14159 struct __ecereNameSpace__ecere__com__Class * sClass;
14160
14161 for(sClass = tClass; sClass; sClass = sClass->base)
14162 {
14163 id = 0;
14164 if(sClass->templateClass)
14165 sClass = sClass->templateClass;
14166 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14167 {
14168 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
14169 {
14170 for(sClass = sClass->base; sClass; sClass = sClass->base)
14171 id += sClass->templateParams.count;
14172 break;
14173 }
14174 id++;
14175 }
14176 if(curParam)
14177 break;
14178 }
14179 if(curParam)
14180 {
14181 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14182 struct Context * context = SetupTemplatesContext(tClass);
14183 struct Type * basicType;
14184
14185 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
14186 if(basicType)
14187 {
14188 if(basicType->kind == 21)
14189 {
14190 FreeType(basicType);
14191 basicType = ReplaceThisClassType(_class);
14192 }
14193 FreeType(exp->expType);
14194 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));
14195 if(!exp->destType)
14196 {
14197 exp->destType = exp->expType;
14198 exp->destType->refCount++;
14199 }
14200 {
14201 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14202 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14203 struct Declarator * decl;
14204
14205 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
14206 *newExp = *exp;
14207 if(exp->destType)
14208 exp->destType->refCount++;
14209 if(exp->expType)
14210 exp->expType->refCount++;
14211 exp->type = 11;
14212 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
14213 exp->cast.exp = newExp;
14214 }
14215 }
14216 FinishTemplatesContext(context);
14217 }
14218 }
14219 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
14220 {
14221 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
14222
14223 if(expClass)
14224 {
14225 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
14226 int c;
14227 int p = 0;
14228 int paramCount = 0;
14229 int lastParam = -1;
14230 char templateString[1024];
14231 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
14232
14233 sprintf(templateString, "%s<", expClass->templateClass->fullName);
14234 while(cClass != expClass)
14235 {
14236 struct __ecereNameSpace__ecere__com__Class * sClass;
14237
14238 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
14239 ;
14240 cClass = sClass;
14241 for(param = cClass->templateParams.first; param; param = param->next)
14242 {
14243 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
14244 int c;
14245 int cp = 0;
14246 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
14247 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
14248
14249 while(cClassCur != tClass && !paramCur)
14250 {
14251 struct __ecereNameSpace__ecere__com__Class * sClassCur;
14252
14253 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
14254 ;
14255 cClassCur = sClassCur;
14256 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
14257 {
14258 if(!strcmp(paramCur->name, param->name))
14259 {
14260 break;
14261 }
14262 cp++;
14263 }
14264 }
14265 if(paramCur && paramCur->type == 0)
14266 arg = tClass->templateArgs[cp];
14267 else
14268 arg = expClass->templateArgs[p];
14269 {
14270 char argument[256];
14271
14272 argument[0] = '\0';
14273 switch(param->type)
14274 {
14275 case 2:
14276 {
14277 char expString[1024];
14278 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14279 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14280 struct Expression * exp;
14281 char * string = PrintHexUInt64(arg.expression.ui64);
14282
14283 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14284 ProcessExpressionType(exp);
14285 ComputeExpression(exp);
14286 expString[0] = '\0';
14287 PrintExpression(exp, expString);
14288 strcat(argument, expString);
14289 FreeExpression(exp);
14290 break;
14291 }
14292 case 1:
14293 {
14294 strcat(argument, arg.member->name);
14295 break;
14296 }
14297 case 0:
14298 {
14299 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14300 strcat(argument, arg.dataTypeString);
14301 break;
14302 }
14303 }
14304 if(argument[0])
14305 {
14306 if(paramCount)
14307 strcat(templateString, ", ");
14308 if(lastParam != p - 1)
14309 {
14310 strcat(templateString, param->name);
14311 strcat(templateString, " = ");
14312 }
14313 strcat(templateString, argument);
14314 paramCount++;
14315 lastParam = p;
14316 }
14317 }
14318 p++;
14319 }
14320 }
14321 {
14322 int len = strlen(templateString);
14323
14324 if(templateString[len - 1] == '>')
14325 templateString[len++] = ' ';
14326 templateString[len++] = '>';
14327 templateString[len++] = '\0';
14328 }
14329 FreeType(exp->expType);
14330 {
14331 struct Context * context = SetupTemplatesContext(tClass);
14332
14333 exp->expType = ProcessTypeString(templateString, 0x0);
14334 FinishTemplatesContext(context);
14335 }
14336 }
14337 }
14338 }
14339 }
14340 else
14341 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)");
14342 }
14343 else if(type && (type->kind == 9 || type->kind == 10))
14344 {
14345 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
14346
14347 if(memberType)
14348 {
14349 exp->expType = memberType;
14350 if(memberType)
14351 memberType->refCount++;
14352 }
14353 }
14354 else
14355 {
14356 char expString[10240];
14357
14358 expString[0] = '\0';
14359 if(inCompiler)
14360 {
14361 PrintExpression(exp, expString);
14362 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14363 }
14364 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
14365 }
14366 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
14367 {
14368 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
14369 {
14370 struct Identifier * id = exp->member.member;
14371 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));
14372
14373 if(_class)
14374 {
14375 FreeType(exp->expType);
14376 exp->expType = ReplaceThisClassType(_class);
14377 }
14378 }
14379 }
14380 yylloc = oldyylloc;
14381 break;
14382 }
14383 case 9:
14384 {
14385 struct Type * destType = exp->destType;
14386
14387 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
14388 {
14389 exp->member.member->classSym = exp->member.member->_class->symbol;
14390 }
14391 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
14392 exp->type = 8;
14393 if(destType)
14394 destType->count++;
14395 ProcessExpressionType(exp);
14396 if(destType)
14397 destType->count--;
14398 break;
14399 }
14400 case 15:
14401 {
14402 struct Symbol * classSym = exp->_class->symbol;
14403
14404 if(classSym && classSym->registered)
14405 {
14406 if(classSym->registered->type == 5)
14407 {
14408 char name[1024];
14409
14410 name[0] = '\0';
14411 DeclareStruct(classSym->string, 0x0);
14412 FreeSpecifier(exp->_class);
14413 exp->type = 10;
14414 FullClassNameCat(name, classSym->string, 0x0);
14415 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
14416 }
14417 else
14418 {
14419 if(classSym->registered->fixed)
14420 {
14421 FreeSpecifier(exp->_class);
14422 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
14423 exp->type = 2;
14424 }
14425 else
14426 {
14427 char className[1024];
14428
14429 strcpy(className, "__ecereClass_");
14430 FullClassNameCat(className, classSym->string, 0x1);
14431 MangleClassName(className);
14432 DeclareClass(classSym, className);
14433 FreeExpContents(exp);
14434 exp->type = 9;
14435 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14436 exp->member.member = MkIdentifier("structSize");
14437 }
14438 }
14439 }
14440 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14441 break;
14442 }
14443 case 10:
14444 {
14445 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
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 exp->isConstant = 0x1;
14449 DeclareType(type, 0x0, 0x0);
14450 FreeType(type);
14451 break;
14452 }
14453 case 11:
14454 {
14455 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14456
14457 type->count = (unsigned int)1;
14458 FreeType(exp->cast.exp->destType);
14459 exp->cast.exp->destType = type;
14460 type->refCount++;
14461 ProcessExpressionType(exp->cast.exp);
14462 type->count = (unsigned int)0;
14463 exp->expType = type;
14464 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14465 {
14466 void * prev = exp->prev, * next = exp->next;
14467 struct Type * expType = exp->cast.exp->destType;
14468 struct Expression * castExp = exp->cast.exp;
14469 struct Type * destType = exp->destType;
14470
14471 if(expType)
14472 expType->refCount++;
14473 FreeType(exp->expType);
14474 FreeTypeName(exp->cast.typeName);
14475 *exp = *castExp;
14476 FreeType(exp->expType);
14477 FreeType(exp->destType);
14478 exp->expType = expType;
14479 exp->destType = destType;
14480 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14481 exp->prev = prev;
14482 exp->next = next;
14483 }
14484 else
14485 {
14486 exp->isConstant = exp->cast.exp->isConstant;
14487 }
14488 break;
14489 }
14490 case 35:
14491 {
14492 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14493
14494 type->refCount++;
14495 exp->expType = type;
14496 break;
14497 }
14498 case 36:
14499 {
14500 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14501
14502 ProcessExpressionType(exp->vaArg.exp);
14503 type->refCount++;
14504 exp->expType = type;
14505 break;
14506 }
14507 case 12:
14508 {
14509 struct Expression * e;
14510
14511 exp->isConstant = 0x1;
14512 FreeType(exp->cond.cond->destType);
14513 exp->cond.cond->destType = MkClassType("bool");
14514 exp->cond.cond->destType->truth = 0x1;
14515 ProcessExpressionType(exp->cond.cond);
14516 if(!exp->cond.cond->isConstant)
14517 exp->isConstant = 0x0;
14518 for(e = (*exp->cond.exp).first; e; e = e->next)
14519 {
14520 if(!e->next)
14521 {
14522 FreeType(e->destType);
14523 e->destType = exp->destType;
14524 if(e->destType)
14525 e->destType->refCount++;
14526 }
14527 ProcessExpressionType(e);
14528 if(!e->next)
14529 {
14530 exp->expType = e->expType;
14531 if(e->expType)
14532 e->expType->refCount++;
14533 }
14534 if(!e->isConstant)
14535 exp->isConstant = 0x0;
14536 }
14537 FreeType(exp->cond.elseExp->destType);
14538 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14539 if(exp->cond.elseExp->destType)
14540 exp->cond.elseExp->destType->refCount++;
14541 ProcessExpressionType(exp->cond.elseExp);
14542 if(!exp->cond.elseExp->isConstant)
14543 exp->isConstant = 0x0;
14544 break;
14545 }
14546 case 25:
14547 {
14548 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14549 {
14550 struct Statement * last = (*exp->compound->compound.statements).last;
14551
14552 if(last->type == 3 && last->expressions && (*last->expressions).last)
14553 {
14554 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14555 if(exp->destType)
14556 exp->destType->refCount++;
14557 }
14558 ProcessStatement(exp->compound);
14559 exp->expType = ((struct Expression *)(*last->expressions).last)->expType;
14560 if(((struct Expression *)(*last->expressions).last)->expType)
14561 exp->expType->refCount++;
14562 }
14563 break;
14564 }
14565 case 26:
14566 {
14567 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14568
14569 if(spec && spec->type == 1)
14570 {
14571 exp->expType = MkClassType(spec->name);
14572 exp->expType->kind = 19;
14573 exp->byReference = 0x1;
14574 }
14575 else
14576 {
14577 exp->expType = MkClassType("ecere::com::Class");
14578 exp->byReference = 0x1;
14579 }
14580 break;
14581 }
14582 case 27:
14583 {
14584 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14585
14586 if(_class)
14587 {
14588 struct Identifier * id = exp->classData.id;
14589 char structName[1024];
14590 struct Expression * classExp;
14591
14592 strcpy(structName, "__ecereClassData_");
14593 FullClassNameCat(structName, _class->fullName, 0x0);
14594 exp->type = 9;
14595 exp->member.member = id;
14596 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14597 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14598 else
14599 classExp = MkExpIdentifier(MkIdentifier("class"));
14600 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"))))))));
14601 ProcessExpressionType(exp);
14602 return ;
14603 }
14604 break;
14605 }
14606 case 37:
14607 {
14608 struct Type * type = (((void *)0));
14609 char * typeString = (((void *)0));
14610 char typeStringBuf[1024];
14611
14612 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))
14613 {
14614 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14615
14616 typeString = templateClass->templateArgs[2].dataTypeString;
14617 }
14618 else if(exp->list)
14619 {
14620 struct Expression * e;
14621
14622 for(e = (*exp->list).first; e; e = e->next)
14623 {
14624 ProcessExpressionType(e);
14625 if(e->expType)
14626 {
14627 if(!type)
14628 {
14629 type = e->expType;
14630 type->refCount++;
14631 }
14632 else
14633 {
14634 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14635 {
14636 FreeType(type);
14637 type = e->expType;
14638 e->expType = (((void *)0));
14639 e = (*exp->list).first;
14640 ProcessExpressionType(e);
14641 if(e->expType)
14642 {
14643 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14644 {
14645 FreeType(e->expType);
14646 e->expType = (((void *)0));
14647 FreeType(type);
14648 type = (((void *)0));
14649 break;
14650 }
14651 }
14652 }
14653 }
14654 if(e->expType)
14655 {
14656 FreeType(e->expType);
14657 e->expType = (((void *)0));
14658 }
14659 }
14660 }
14661 if(type)
14662 {
14663 typeStringBuf[0] = '\0';
14664 PrintType(type, typeStringBuf, 0x0, 0x1);
14665 typeString = typeStringBuf;
14666 FreeType(type);
14667 type = (((void *)0));
14668 }
14669 }
14670 if(typeString)
14671 {
14672 char templateString[1024];
14673 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14674 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14675 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14676 struct Expression * expExt;
14677 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14678
14679 sprintf(templateString, "Container<%s>", typeString);
14680 if(exp->list)
14681 {
14682 struct Expression * e;
14683
14684 type = ProcessTypeString(typeString, 0x0);
14685 while(e = (*exp->list).first)
14686 {
14687 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14688 e->destType = type;
14689 type->refCount++;
14690 ProcessExpressionType(e);
14691 ListAdd(initializers, MkInitializerAssignment(e));
14692 }
14693 FreeType(type);
14694 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14695 }
14696 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
14697 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
14698 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14699 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
14700 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14701 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
14702 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14703 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
14704 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14705 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))));
14706 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14707 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
14708 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14709 exp->expType = ProcessTypeString(templateString, 0x0);
14710 exp->type = 5;
14711 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
14712 ProcessExpressionType(expExt);
14713 }
14714 else
14715 {
14716 exp->expType = ProcessTypeString("Container", 0x0);
14717 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
14718 }
14719 break;
14720 }
14721 }
14722 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
14723 {
14724 FreeType(exp->expType);
14725 exp->expType = ReplaceThisClassType(thisClass);
14726 }
14727 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
14728 {
14729 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
14730
14731 if(symbol)
14732 {
14733 if(exp->expType->kind != 15)
14734 {
14735 struct Type * member;
14736 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
14737
14738 FreeType(exp->expType);
14739 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14740 exp->expType->kind = symbol->type->kind;
14741 exp->expType->refCount++;
14742 exp->expType->enumName = enumName;
14743 exp->expType->members = symbol->type->members;
14744 for(member = symbol->type->members.first; member; member = member->next)
14745 member->refCount++;
14746 }
14747 else
14748 {
14749 struct __ecereNameSpace__ecere__sys__NamedLink * member;
14750
14751 for(member = symbol->type->members.first; member; member = member->next)
14752 {
14753 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(structSize_NamedLink), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
14754
14755 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
14756 }
14757 }
14758 }
14759 }
14760 yylloc = exp->loc;
14761 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
14762 ;
14763 else if(exp->destType && !exp->destType->keepCast)
14764 {
14765 if(!CheckExpressionType(exp, exp->destType, 0x0))
14766 {
14767 if(!exp->destType->count || unresolved)
14768 {
14769 if(!exp->expType)
14770 {
14771 yylloc = exp->loc;
14772 if(exp->destType->kind != 14)
14773 {
14774 char type2[1024];
14775
14776 type2[0] = '\0';
14777 if(inCompiler)
14778 {
14779 char expString[10240];
14780
14781 expString[0] = '\0';
14782 PrintType(exp->destType, type2, 0x0, 0x1);
14783 if(inCompiler)
14784 {
14785 PrintExpression(exp, expString);
14786 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14787 }
14788 if(unresolved)
14789 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
14790 else if(exp->type != 16)
14791 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
14792 }
14793 }
14794 else
14795 {
14796 char expString[10240];
14797
14798 expString[0] = '\0';
14799 if(inCompiler)
14800 {
14801 PrintExpression(exp, expString);
14802 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14803 }
14804 if(unresolved)
14805 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
14806 else if(exp->type != 16)
14807 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14808 }
14809 }
14810 else
14811 {
14812 char type1[1024];
14813 char type2[1024];
14814
14815 type1[0] = '\0';
14816 type2[0] = '\0';
14817 if(inCompiler)
14818 {
14819 PrintType(exp->expType, type1, 0x0, 0x1);
14820 PrintType(exp->destType, type2, 0x0, 0x1);
14821 }
14822 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)))
14823 ;
14824 else
14825 {
14826 char expString[10240];
14827
14828 expString[0] = '\0';
14829 if(inCompiler)
14830 {
14831 PrintExpression(exp, expString);
14832 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14833 }
14834 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
14835 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
14836 FreeType(exp->expType);
14837 exp->destType->refCount++;
14838 exp->expType = exp->destType;
14839 }
14840 }
14841 }
14842 }
14843 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
14844 {
14845 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14846 char typeString[1024];
14847 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14848 struct Declarator * decl;
14849
14850 typeString[0] = '\0';
14851 *newExp = *exp;
14852 if(exp->expType)
14853 exp->expType->refCount++;
14854 if(exp->expType)
14855 exp->expType->refCount++;
14856 exp->type = 11;
14857 newExp->destType = exp->expType;
14858 PrintType(exp->expType, typeString, 0x0, 0x0);
14859 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14860 exp->cast.typeName = MkTypeName(specs, decl);
14861 exp->cast.exp = newExp;
14862 }
14863 }
14864 else if(unresolved)
14865 {
14866 if(exp->identifier->_class && exp->identifier->_class->name)
14867 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
14868 else if(exp->identifier->string && exp->identifier->string[0])
14869 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
14870 }
14871 else if(!exp->expType && exp->type != 16)
14872 {
14873 char expString[10240];
14874
14875 expString[0] = '\0';
14876 if(inCompiler)
14877 {
14878 PrintExpression(exp, expString);
14879 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14880 }
14881 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14882 }
14883 ApplyAnyObjectLogic(exp);
14884 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5)
14885 {
14886 exp->byReference = 0x1;
14887 }
14888 yylloc = oldyylloc;
14889 }
14890
14891 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)
14892 {
14893 if(*curMember)
14894 {
14895 *curMember = (*curMember)->next;
14896 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
14897 {
14898 *curMember = subMemberStack[--(*subMemberStackPos)];
14899 *curMember = (*curMember)->next;
14900 }
14901 while((*curMember) && (*curMember)->isProperty)
14902 *curMember = (*curMember)->next;
14903 if(subMemberStackPos)
14904 {
14905 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14906 {
14907 subMemberStack[(*subMemberStackPos)++] = *curMember;
14908 *curMember = (*curMember)->members.first;
14909 while(*curMember && (*curMember)->isProperty)
14910 *curMember = (*curMember)->next;
14911 }
14912 }
14913 }
14914 while(!*curMember)
14915 {
14916 if(!*curMember)
14917 {
14918 if(subMemberStackPos && *subMemberStackPos)
14919 {
14920 *curMember = subMemberStack[--(*subMemberStackPos)];
14921 *curMember = (*curMember)->next;
14922 }
14923 else
14924 {
14925 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
14926
14927 if(*curClass == _class)
14928 break;
14929 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
14930 ;
14931 *curMember = (*curClass)->membersAndProperties.first;
14932 }
14933 while((*curMember) && (*curMember)->isProperty)
14934 *curMember = (*curMember)->next;
14935 if(subMemberStackPos)
14936 {
14937 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14938 {
14939 subMemberStack[(*subMemberStackPos)++] = *curMember;
14940 *curMember = (*curMember)->members.first;
14941 while(*curMember && (*curMember)->isProperty)
14942 *curMember = (*curMember)->next;
14943 }
14944 }
14945 }
14946 }
14947 }
14948
14949 static void ProcessInitializer(struct Initializer * init, struct Type * type)
14950 {
14951 switch(init->type)
14952 {
14953 case 0:
14954 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
14955 {
14956 if(init->exp && !init->exp->destType)
14957 {
14958 FreeType(init->exp->destType);
14959 init->exp->destType = type;
14960 if(type)
14961 type->refCount++;
14962 }
14963 if(init->exp)
14964 {
14965 ProcessExpressionType(init->exp);
14966 init->isConstant = init->exp->isConstant;
14967 }
14968 break;
14969 }
14970 else
14971 {
14972 struct Expression * exp = init->exp;
14973 struct Instantiation * inst = exp->instance;
14974 struct MembersInit * members;
14975
14976 init->type = 1;
14977 init->list = MkList();
14978 if(inst->members)
14979 {
14980 for(members = (*inst->members).first; members; members = members->next)
14981 {
14982 if(members->type == 0)
14983 {
14984 struct MemberInit * member;
14985
14986 for(member = (*members->dataMembers).first; member; member = member->next)
14987 {
14988 ListAdd(init->list, member->initializer);
14989 member->initializer = (((void *)0));
14990 }
14991 }
14992 }
14993 }
14994 FreeExpression(exp);
14995 }
14996 case 1:
14997 {
14998 struct Initializer * i;
14999 struct Type * initializerType = (((void *)0));
15000 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
15001 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
15002 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
15003 int subMemberStackPos = 0;
15004
15005 if(type && type->kind == 12)
15006 initializerType = Dereference(type);
15007 else if(type && (type->kind == 9 || type->kind == 10))
15008 initializerType = type->members.first;
15009 for(i = (*init->list).first; i; i = i->next)
15010 {
15011 if(type && type->kind == 8 && type->_class && type->_class->registered)
15012 {
15013 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
15014 if(curMember)
15015 {
15016 if(!curMember->dataType)
15017 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
15018 initializerType = curMember->dataType;
15019 }
15020 }
15021 ProcessInitializer(i, initializerType);
15022 if(initializerType && type && (type->kind == 9 || type->kind == 10))
15023 initializerType = initializerType->next;
15024 if(!i->isConstant)
15025 init->isConstant = 0x0;
15026 }
15027 if(type && type->kind == 12)
15028 FreeType(initializerType);
15029 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
15030 {
15031 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
15032 }
15033 break;
15034 }
15035 }
15036 }
15037
15038 extern struct Symbol * FindType(struct Context * ctx, char *  name);
15039
15040 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
15041
15042 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
15043 {
15044 switch(spec->type)
15045 {
15046 case 0:
15047 {
15048 if(spec->specifier == THISCLASS)
15049 {
15050 if(thisClass)
15051 {
15052 spec->type = 1;
15053 spec->name = ReplaceThisClass(thisClass);
15054 spec->symbol = FindClass(spec->name);
15055 ProcessSpecifier(spec, declareStruct);
15056 }
15057 }
15058 break;
15059 }
15060 case 1:
15061 {
15062 struct Symbol * symbol = FindType(curContext, spec->name);
15063
15064 if(symbol)
15065 DeclareType(symbol->type, 0x1, 0x1);
15066 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
15067 DeclareStruct(spec->name, 0x0);
15068 break;
15069 }
15070 case 2:
15071 {
15072 struct Enumerator * e;
15073
15074 if(spec->list)
15075 {
15076 for(e = (*spec->list).first; e; e = e->next)
15077 {
15078 if(e->exp)
15079 ProcessExpressionType(e->exp);
15080 }
15081 }
15082 break;
15083 }
15084 case 3:
15085 case 4:
15086 {
15087 if(spec->definitions)
15088 {
15089 struct ClassDef * def;
15090 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
15091
15092 ProcessClass(spec->definitions, symbol);
15093 }
15094 break;
15095 }
15096 }
15097 }
15098
15099 static void ProcessDeclarator(struct Declarator * decl)
15100 {
15101 switch(decl->type)
15102 {
15103 case 1:
15104 if(decl->identifier->classSym)
15105 {
15106 FreeSpecifier(decl->identifier->_class);
15107 decl->identifier->_class = (((void *)0));
15108 }
15109 break;
15110 case 3:
15111 if(decl->array.exp)
15112 ProcessExpressionType(decl->array.exp);
15113 case 0:
15114 case 2:
15115 case 4:
15116 case 5:
15117 case 6:
15118 case 7:
15119 if(decl->declarator)
15120 ProcessDeclarator(decl->declarator);
15121 if(decl->type == 4)
15122 {
15123 struct Identifier * id = GetDeclId(decl);
15124
15125 if(id && id->_class)
15126 {
15127 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
15128
15129 if(!decl->function.parameters)
15130 decl->function.parameters = MkList();
15131 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
15132 id->_class = (((void *)0));
15133 }
15134 if(decl->function.parameters)
15135 {
15136 struct TypeName * param;
15137
15138 for(param = (*decl->function.parameters).first; param; param = param->next)
15139 {
15140 if(param->qualifiers && (*param->qualifiers).first)
15141 {
15142 struct Specifier * spec = (*param->qualifiers).first;
15143
15144 if(spec && spec->specifier == TYPED_OBJECT)
15145 {
15146 struct Declarator * d = param->declarator;
15147 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);
15148
15149 FreeList(param->qualifiers, FreeSpecifier);
15150 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
15151 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
15152 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
15153 param = newParam;
15154 }
15155 else if(spec && spec->specifier == ANY_OBJECT)
15156 {
15157 struct Declarator * d = param->declarator;
15158
15159 FreeList(param->qualifiers, FreeSpecifier);
15160 param->qualifiers = MkListOne(MkSpecifier(VOID));
15161 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
15162 }
15163 else if(spec->specifier == THISCLASS)
15164 {
15165 if(thisClass)
15166 {
15167 spec->type = 1;
15168 spec->name = ReplaceThisClass(thisClass);
15169 spec->symbol = FindClass(spec->name);
15170 ProcessSpecifier(spec, 0x0);
15171 }
15172 }
15173 }
15174 if(param->declarator)
15175 ProcessDeclarator(param->declarator);
15176 }
15177 }
15178 }
15179 break;
15180 }
15181 }
15182
15183 extern struct Identifier * CopyIdentifier(struct Identifier * id);
15184
15185 extern void FreeInitDeclarator(struct InitDeclarator * decl);
15186
15187 static void ProcessDeclaration(struct Declaration * decl)
15188 {
15189 yylloc = decl->loc;
15190 switch(decl->type)
15191 {
15192 case 1:
15193 {
15194 unsigned int declareStruct = 0x0;
15195
15196 if(decl->declarators)
15197 {
15198 struct InitDeclarator * d;
15199
15200 for(d = (*decl->declarators).first; d; d = d->next)
15201 {
15202 struct Type * type, * subType;
15203
15204 ProcessDeclarator(d->declarator);
15205 type = ProcessType(decl->specifiers, d->declarator);
15206 if(d->initializer)
15207 {
15208 ProcessInitializer(d->initializer, type);
15209 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
15210 {
15211 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
15212 {
15213 struct Instantiation * inst = d->initializer->exp->instance;
15214
15215 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
15216 d->initializer->exp->instance = (((void *)0));
15217 if(decl->specifiers)
15218 FreeList(decl->specifiers, FreeSpecifier);
15219 FreeList(decl->declarators, FreeInitDeclarator);
15220 d = (((void *)0));
15221 decl->type = 2;
15222 decl->inst = inst;
15223 }
15224 }
15225 }
15226 for(subType = type; subType; )
15227 {
15228 if(subType->kind == 8)
15229 {
15230 declareStruct = 0x1;
15231 break;
15232 }
15233 else if(subType->kind == 13)
15234 break;
15235 else if(subType->kind == 12)
15236 subType = subType->arrayType;
15237 else
15238 break;
15239 }
15240 FreeType(type);
15241 if(!d)
15242 break;
15243 }
15244 }
15245 if(decl->specifiers)
15246 {
15247 struct Specifier * s;
15248
15249 for(s = (*decl->specifiers).first; s; s = s->next)
15250 {
15251 ProcessSpecifier(s, declareStruct);
15252 }
15253 }
15254 break;
15255 }
15256 case 2:
15257 {
15258 ProcessInstantiationType(decl->inst);
15259 break;
15260 }
15261 case 0:
15262 {
15263 struct Specifier * spec;
15264 struct Declarator * d;
15265 unsigned int declareStruct = 0x0;
15266
15267 if(decl->declarators)
15268 {
15269 for(d = (*decl->declarators).first; d; d = d->next)
15270 {
15271 struct Type * type = ProcessType(decl->specifiers, d->declarator);
15272 struct Type * subType;
15273
15274 ProcessDeclarator(d);
15275 for(subType = type; subType; )
15276 {
15277 if(subType->kind == 8)
15278 {
15279 declareStruct = 0x1;
15280 break;
15281 }
15282 else if(subType->kind == 13)
15283 break;
15284 else if(subType->kind == 12)
15285 subType = subType->arrayType;
15286 else
15287 break;
15288 }
15289 FreeType(type);
15290 }
15291 }
15292 if(decl->specifiers)
15293 {
15294 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
15295 ProcessSpecifier(spec, declareStruct);
15296 }
15297 break;
15298 }
15299 }
15300 }
15301
15302 static struct FunctionDefinition * curFunction;
15303
15304 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
15305 {
15306 char propName[1024], propNameM[1024];
15307 char getName[1024], setName[1024];
15308 struct __ecereNameSpace__ecere__sys__OldList * args;
15309
15310 DeclareProperty(prop, setName, getName);
15311 strcpy(propName, "__ecereProp_");
15312 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15313 strcat(propName, "_");
15314 FullClassNameCat(propName, prop->name, 0x1);
15315 MangleClassName(propName);
15316 strcpy(propNameM, "__ecerePropM_");
15317 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
15318 strcat(propNameM, "_");
15319 FullClassNameCat(propNameM, prop->name, 0x1);
15320 MangleClassName(propNameM);
15321 if(prop->isWatchable)
15322 {
15323 args = MkList();
15324 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15325 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15326 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15327 args = MkList();
15328 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15329 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15330 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15331 }
15332 {
15333 args = MkList();
15334 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15335 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15336 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15337 args = MkList();
15338 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15339 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15340 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15341 }
15342 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15343 curFunction->propSet->fireWatchersDone = 0x1;
15344 }
15345
15346 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
15347
15348 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
15349
15350 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
15351
15352 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
15353
15354 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
15355
15356 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
15357
15358 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
15359
15360 extern void FreePropertyWatch(struct PropertyWatch * watcher);
15361
15362 static void ProcessStatement(struct Statement * stmt)
15363 {
15364 yylloc = stmt->loc;
15365 switch(stmt->type)
15366 {
15367 case 0:
15368 ProcessStatement(stmt->labeled.stmt);
15369 break;
15370 case 1:
15371 if(stmt->caseStmt.exp)
15372 {
15373 FreeType(stmt->caseStmt.exp->destType);
15374 stmt->caseStmt.exp->destType = curSwitchType;
15375 if(curSwitchType)
15376 curSwitchType->refCount++;
15377 ProcessExpressionType(stmt->caseStmt.exp);
15378 ComputeExpression(stmt->caseStmt.exp);
15379 }
15380 if(stmt->caseStmt.stmt)
15381 ProcessStatement(stmt->caseStmt.stmt);
15382 break;
15383 case 2:
15384 {
15385 if(stmt->compound.context)
15386 {
15387 struct Declaration * decl;
15388 struct Statement * s;
15389 struct Statement * prevCompound = curCompound;
15390 struct Context * prevContext = curContext;
15391
15392 if(!stmt->compound.isSwitch)
15393 {
15394 curCompound = stmt;
15395 curContext = stmt->compound.context;
15396 }
15397 if(stmt->compound.declarations)
15398 {
15399 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
15400 ProcessDeclaration(decl);
15401 }
15402 if(stmt->compound.statements)
15403 {
15404 for(s = (*stmt->compound.statements).first; s; s = s->next)
15405 ProcessStatement(s);
15406 }
15407 curContext = prevContext;
15408 curCompound = prevCompound;
15409 }
15410 break;
15411 }
15412 case 3:
15413 {
15414 struct Expression * exp;
15415
15416 if(stmt->expressions)
15417 {
15418 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15419 ProcessExpressionType(exp);
15420 }
15421 break;
15422 }
15423 case 4:
15424 {
15425 struct Expression * exp;
15426
15427 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15428 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15429 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15430 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15431 {
15432 ProcessExpressionType(exp);
15433 }
15434 if(stmt->ifStmt.stmt)
15435 ProcessStatement(stmt->ifStmt.stmt);
15436 if(stmt->ifStmt.elseStmt)
15437 ProcessStatement(stmt->ifStmt.elseStmt);
15438 break;
15439 }
15440 case 5:
15441 {
15442 struct Type * oldSwitchType = curSwitchType;
15443
15444 if(stmt->switchStmt.exp)
15445 {
15446 struct Expression * exp;
15447
15448 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15449 {
15450 if(!exp->next)
15451 {
15452 ProcessExpressionType(exp);
15453 }
15454 if(!exp->next)
15455 curSwitchType = exp->expType;
15456 }
15457 }
15458 ProcessStatement(stmt->switchStmt.stmt);
15459 curSwitchType = oldSwitchType;
15460 break;
15461 }
15462 case 6:
15463 {
15464 if(stmt->whileStmt.exp)
15465 {
15466 struct Expression * exp;
15467
15468 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15469 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15470 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15471 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15472 {
15473 ProcessExpressionType(exp);
15474 }
15475 }
15476 if(stmt->whileStmt.stmt)
15477 ProcessStatement(stmt->whileStmt.stmt);
15478 break;
15479 }
15480 case 7:
15481 {
15482 if(stmt->doWhile.exp)
15483 {
15484 struct Expression * exp;
15485
15486 if((*stmt->doWhile.exp).last)
15487 {
15488 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15489 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15490 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15491 }
15492 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15493 {
15494 ProcessExpressionType(exp);
15495 }
15496 }
15497 if(stmt->doWhile.stmt)
15498 ProcessStatement(stmt->doWhile.stmt);
15499 break;
15500 }
15501 case 8:
15502 {
15503 struct Expression * exp;
15504
15505 if(stmt->forStmt.init)
15506 ProcessStatement(stmt->forStmt.init);
15507 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15508 {
15509 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15510 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15511 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15512 }
15513 if(stmt->forStmt.check)
15514 ProcessStatement(stmt->forStmt.check);
15515 if(stmt->forStmt.increment)
15516 {
15517 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15518 ProcessExpressionType(exp);
15519 }
15520 if(stmt->forStmt.stmt)
15521 ProcessStatement(stmt->forStmt.stmt);
15522 break;
15523 }
15524 case 18:
15525 {
15526 struct Identifier * id = stmt->forEachStmt.id;
15527 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15528 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15529 struct Statement * block = stmt->forEachStmt.stmt;
15530 char iteratorType[1024];
15531 struct Type * source;
15532 struct Expression * e;
15533 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));
15534 struct Expression * arrayExp;
15535 char * typeString = (((void *)0));
15536 int builtinCount = 0;
15537
15538 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15539 {
15540 if(!e->next)
15541 {
15542 FreeType(e->destType);
15543 e->destType = ProcessTypeString("Container", 0x0);
15544 }
15545 if(!isBuiltin || e->next)
15546 ProcessExpressionType(e);
15547 }
15548 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15549 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15550 {
15551 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15552 struct Symbol * symbol;
15553 struct Expression * expIt = (((void *)0));
15554 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15555 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15556 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15557 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15558
15559 stmt->type = 2;
15560 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15561 stmt->compound.context->parent = curContext;
15562 curContext = stmt->compound.context;
15563 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15564 {
15565 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15566 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15567
15568 isCustomAVLTree = 0x1;
15569 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15570 isAVLTree = 0x1;
15571 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15572 isMap = 0x1;
15573 }
15574 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15575 isArray = 0x1;
15576 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15577 {
15578 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15579
15580 isLinkList = 0x1;
15581 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15582 }
15583 if(isArray)
15584 {
15585 struct Declarator * decl;
15586 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15587
15588 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15589 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15590 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15591 }
15592 else if(isBuiltin)
15593 {
15594 struct Type * type = (((void *)0));
15595 char typeStringBuf[1024];
15596
15597 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15598 if(((struct Expression *)(*exp).last)->type == 11)
15599 {
15600 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15601
15602 if(typeName)
15603 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15604 }
15605 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)
15606 {
15607 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15608
15609 typeString = templateClass->templateArgs[2].dataTypeString;
15610 }
15611 else if(arrayExp->list)
15612 {
15613 struct Expression * e;
15614
15615 for(e = (*arrayExp->list).first; e; e = e->next)
15616 {
15617 ProcessExpressionType(e);
15618 if(e->expType)
15619 {
15620 if(!type)
15621 {
15622 type = e->expType;
15623 type->refCount++;
15624 }
15625 else
15626 {
15627 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15628 {
15629 FreeType(type);
15630 type = e->expType;
15631 e->expType = (((void *)0));
15632 e = (*arrayExp->list).first;
15633 ProcessExpressionType(e);
15634 if(e->expType)
15635 {
15636 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15637 {
15638 FreeType(e->expType);
15639 e->expType = (((void *)0));
15640 FreeType(type);
15641 type = (((void *)0));
15642 break;
15643 }
15644 }
15645 }
15646 }
15647 if(e->expType)
15648 {
15649 FreeType(e->expType);
15650 e->expType = (((void *)0));
15651 }
15652 }
15653 }
15654 if(type)
15655 {
15656 typeStringBuf[0] = '\0';
15657 PrintType(type, typeStringBuf, 0x0, 0x1);
15658 typeString = typeStringBuf;
15659 FreeType(type);
15660 }
15661 }
15662 if(typeString)
15663 {
15664 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15665 struct Declarator * decl;
15666 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15667
15668 if(arrayExp->list)
15669 {
15670 struct Expression * e;
15671
15672 builtinCount = (*arrayExp->list).count;
15673 type = ProcessTypeString(typeString, 0x0);
15674 while(e = (*arrayExp->list).first)
15675 {
15676 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15677 e->destType = type;
15678 type->refCount++;
15679 ProcessExpressionType(e);
15680 ListAdd(initializers, MkInitializerAssignment(e));
15681 }
15682 FreeType(type);
15683 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15684 }
15685 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15686 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15687 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorArray(PlugDeclarator(decl, MkDeclaratorIdentifier(MkIdentifier("__internalArray"))), (((void *)0))), MkInitializerList(initializers)))));
15688 FreeList(exp, FreeExpression);
15689 }
15690 else
15691 {
15692 arrayExp->expType = ProcessTypeString("Container", 0x0);
15693 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15694 }
15695 }
15696 else if(isLinkList && !isList)
15697 {
15698 struct Declarator * decl;
15699 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15700
15701 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15702 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15703 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15704 }
15705 else if(_class->templateArgs)
15706 {
15707 if(isMap)
15708 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15709 else
15710 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
15711 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
15712 }
15713 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
15714 if(block && block->type == 2 && block->compound.context)
15715 {
15716 block->compound.context->parent = stmt->compound.context;
15717 }
15718 if(filter)
15719 {
15720 block = MkIfStmt(filter, block, (((void *)0)));
15721 }
15722 if(isArray)
15723 {
15724 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));
15725 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15726 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15727 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15728 }
15729 else if(isBuiltin)
15730 {
15731 char count[128];
15732
15733 sprintf(count, "%d", builtinCount);
15734 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));
15735 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15736 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15737 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15738 }
15739 else if(isLinkList && !isList)
15740 {
15741 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
15742 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
15743
15744 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
15745 {
15746 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));
15747 }
15748 else
15749 {
15750 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15751 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
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)), '=', MkExpCast(MkTypeName(specs, decl), MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("__internalLinkList")), MkIdentifier("GetNext")), MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("IteratorPointer")), (((void *)0))), MkExpIdentifier(CopyIdentifier(id)))))))), block));
15754 }
15755 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15756 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15757 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15758 }
15759 else
15760 {
15761 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
15762 }
15763 ProcessExpressionType(expIt);
15764 if((*stmt->compound.declarations).first)
15765 ProcessDeclaration((*stmt->compound.declarations).first);
15766 if(symbol)
15767 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
15768 ProcessStatement(stmt);
15769 curContext = stmt->compound.context->parent;
15770 break;
15771 }
15772 else
15773 {
15774 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
15775 }
15776 break;
15777 }
15778 case 9:
15779 break;
15780 case 10:
15781 break;
15782 case 11:
15783 break;
15784 case 12:
15785 {
15786 struct Expression * exp;
15787
15788 if(stmt->expressions)
15789 {
15790 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15791 {
15792 if(!exp->next)
15793 {
15794 if(curFunction && !curFunction->type)
15795 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
15796 FreeType(exp->destType);
15797 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
15798 if(exp->destType)
15799 exp->destType->refCount++;
15800 }
15801 ProcessExpressionType(exp);
15802 }
15803 }
15804 break;
15805 }
15806 case 14:
15807 {
15808 ProcessDeclaration(stmt->decl);
15809 break;
15810 }
15811 case 13:
15812 {
15813 struct AsmField * field;
15814
15815 if(stmt->asmStmt.inputFields)
15816 {
15817 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
15818 if(field->expression)
15819 ProcessExpressionType(field->expression);
15820 }
15821 if(stmt->asmStmt.outputFields)
15822 {
15823 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
15824 if(field->expression)
15825 ProcessExpressionType(field->expression);
15826 }
15827 if(stmt->asmStmt.clobberedFields)
15828 {
15829 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
15830 {
15831 if(field->expression)
15832 ProcessExpressionType(field->expression);
15833 }
15834 }
15835 break;
15836 }
15837 case 17:
15838 {
15839 struct PropertyWatch * propWatch;
15840 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15841 struct Expression * object = stmt->_watch.object;
15842 struct Expression * watcher = stmt->_watch.watcher;
15843
15844 if(watcher)
15845 ProcessExpressionType(watcher);
15846 if(object)
15847 ProcessExpressionType(object);
15848 if(inCompiler)
15849 {
15850 if(watcher || thisClass)
15851 {
15852 struct External * external = curExternal;
15853 struct Context * context = curContext;
15854
15855 stmt->type = 3;
15856 stmt->expressions = MkList();
15857 curExternal = external->prev;
15858 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15859 {
15860 struct ClassFunction * func;
15861 char watcherName[1024];
15862 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
15863 struct External * createdExternal;
15864 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
15865
15866 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
15867 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
15868 if(propWatch->deleteWatch)
15869 strcat(watcherName, "_delete");
15870 else
15871 {
15872 struct Identifier * propID;
15873
15874 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15875 {
15876 strcat(watcherName, "_");
15877 strcat(watcherName, propID->string);
15878 }
15879 }
15880 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
15881 {
15882 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
15883 ProcessClassFunctionBody(func, propWatch->compound);
15884 propWatch->compound = (((void *)0));
15885 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
15886 createdExternal->symbol->idCode = external->symbol->idCode;
15887 curExternal = createdExternal;
15888 ProcessFunction(createdExternal->function);
15889 {
15890 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
15891
15892 externalDecl->declaration = decl;
15893 if(decl->symbol && !decl->symbol->pointerExternal)
15894 decl->symbol->pointerExternal = externalDecl;
15895 }
15896 if(propWatch->deleteWatch)
15897 {
15898 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15899
15900 ListAdd(args, CopyExpression(object));
15901 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15902 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15903 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
15904 }
15905 else
15906 {
15907 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
15908 struct Identifier * propID;
15909
15910 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15911 {
15912 char propName[1024];
15913 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15914
15915 if(prop)
15916 {
15917 char getName[1024], setName[1024];
15918 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15919
15920 DeclareProperty(prop, setName, getName);
15921 strcpy(propName, "__ecereProp_");
15922 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15923 strcat(propName, "_");
15924 FullClassNameCat(propName, prop->name, 0x1);
15925 ListAdd(args, CopyExpression(object));
15926 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15927 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15928 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15929 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
15930 }
15931 else
15932 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
15933 }
15934 }
15935 }
15936 else
15937 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
15938 }
15939 curExternal = external;
15940 curContext = context;
15941 if(watcher)
15942 FreeExpression(watcher);
15943 if(object)
15944 FreeExpression(object);
15945 FreeList(watches, FreePropertyWatch);
15946 }
15947 else
15948 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
15949 }
15950 else
15951 {
15952 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15953 {
15954 ProcessStatement(propWatch->compound);
15955 }
15956 }
15957 break;
15958 }
15959 case 15:
15960 {
15961 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15962 struct Expression * object = stmt->_watch.object;
15963 struct __ecereNameSpace__ecere__com__Class * _class;
15964
15965 if(object)
15966 ProcessExpressionType(object);
15967 if(inCompiler)
15968 {
15969 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
15970 if(_class)
15971 {
15972 struct Identifier * propID;
15973
15974 stmt->type = 3;
15975 stmt->expressions = MkList();
15976 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15977 {
15978 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
15979 }
15980 else if(!watches)
15981 {
15982 }
15983 if(watches)
15984 {
15985 for(propID = (*watches).first; propID; propID = propID->next)
15986 {
15987 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15988
15989 if(prop)
15990 {
15991 CreateFireWatcher(prop, object, stmt);
15992 }
15993 else
15994 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
15995 }
15996 }
15997 else
15998 {
15999 struct __ecereNameSpace__ecere__com__Property * prop;
16000 struct __ecereNameSpace__ecere__com__Class * base;
16001
16002 for(base = _class; base; base = base->base)
16003 {
16004 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
16005 {
16006 if(prop->isProperty && prop->isWatchable)
16007 {
16008 CreateFireWatcher(prop, object, stmt);
16009 }
16010 }
16011 }
16012 }
16013 if(object)
16014 FreeExpression(object);
16015 FreeList(watches, FreeIdentifier);
16016 }
16017 else
16018 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16019 }
16020 break;
16021 }
16022 case 16:
16023 {
16024 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16025 struct Expression * object = stmt->_watch.object;
16026 struct Expression * watcher = stmt->_watch.watcher;
16027 struct __ecereNameSpace__ecere__com__Class * _class;
16028
16029 if(object)
16030 ProcessExpressionType(object);
16031 if(watcher)
16032 ProcessExpressionType(watcher);
16033 if(inCompiler)
16034 {
16035 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
16036 if(watcher || thisClass)
16037 {
16038 if(_class)
16039 {
16040 struct Identifier * propID;
16041
16042 stmt->type = 3;
16043 stmt->expressions = MkList();
16044 if(!watches)
16045 {
16046 struct __ecereNameSpace__ecere__sys__OldList * args;
16047
16048 args = MkList();
16049 ListAdd(args, CopyExpression(object));
16050 ListAdd(args, MkExpConstant("0"));
16051 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16052 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16053 }
16054 else
16055 {
16056 for(propID = (*watches).first; propID; propID = propID->next)
16057 {
16058 char propName[1024];
16059 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16060
16061 if(prop)
16062 {
16063 char getName[1024], setName[1024];
16064 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16065
16066 DeclareProperty(prop, setName, getName);
16067 strcpy(propName, "__ecereProp_");
16068 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16069 strcat(propName, "_");
16070 FullClassNameCat(propName, prop->name, 0x1);
16071 MangleClassName(propName);
16072 ListAdd(args, CopyExpression(object));
16073 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16074 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16075 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16076 }
16077 else
16078 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16079 }
16080 }
16081 if(object)
16082 FreeExpression(object);
16083 if(watcher)
16084 FreeExpression(watcher);
16085 FreeList(watches, FreeIdentifier);
16086 }
16087 else
16088 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16089 }
16090 else
16091 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
16092 }
16093 break;
16094 }
16095 }
16096 }
16097
16098 extern struct Expression * QBrackets(struct Expression * exp);
16099
16100 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
16101
16102 extern struct Declarator * QMkPtrDecl(char *  id);
16103
16104 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
16105
16106 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
16107
16108 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
16109
16110 static void ProcessFunction(struct FunctionDefinition * function)
16111 {
16112 void * __ecereTemp2;
16113 void * __ecereTemp1;
16114 struct Identifier * id = GetDeclId(function->declarator);
16115 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
16116 struct Type * type = symbol ? symbol->type : (((void *)0));
16117 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
16118 struct Context * oldTopContext = topContext;
16119
16120 yylloc = function->loc;
16121 if(type && type->thisClass)
16122 {
16123 struct Symbol * classSym = type->thisClass;
16124 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
16125 char className[1024];
16126 char structName[1024];
16127 struct Declarator * funcDecl;
16128 struct Symbol * thisSymbol;
16129 unsigned int typedObject = 0x0;
16130
16131 if(_class && !_class->base)
16132 {
16133 _class = currentClass;
16134 if(_class && !_class->symbol)
16135 _class->symbol = FindClass(_class->fullName);
16136 classSym = _class ? _class->symbol : (((void *)0));
16137 typedObject = 0x1;
16138 }
16139 thisClass = _class;
16140 if(inCompiler && _class)
16141 {
16142 if(type->kind == 11)
16143 {
16144 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
16145 {
16146 struct Type * param = symbol->type->params.first;
16147
16148 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
16149 FreeType(param);
16150 }
16151 if(type->classObjectType != 1)
16152 {
16153 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
16154 symbol->type->staticMethod = 0x1;
16155 symbol->type->thisClass = (((void *)0));
16156 symbol->type->extraParam = 0x0;
16157 }
16158 }
16159 strcpy(className, "__ecereClass_");
16160 FullClassNameCat(className, _class->fullName, 0x1);
16161 MangleClassName(className);
16162 structName[0] = (char)0;
16163 FullClassNameCat(structName, _class->fullName, 0x0);
16164 funcDecl = GetFuncDecl(function->declarator);
16165 if(funcDecl)
16166 {
16167 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16168 {
16169 struct TypeName * param = (*funcDecl->function.parameters).first;
16170
16171 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16172 {
16173 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16174 FreeTypeName(param);
16175 }
16176 }
16177 if(!function->propertyNoThis)
16178 {
16179 struct TypeName * thisParam;
16180
16181 if(type->classObjectType != 1)
16182 {
16183 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16184 if(!funcDecl->function.parameters)
16185 funcDecl->function.parameters = MkList();
16186 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16187 }
16188 if(typedObject)
16189 {
16190 if(type->classObjectType != 1)
16191 {
16192 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
16193 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
16194 }
16195 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));
16196 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16197 }
16198 }
16199 }
16200 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16201 {
16202 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16203
16204 funcDecl = GetFuncDecl(initDecl->declarator);
16205 if(funcDecl)
16206 {
16207 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16208 {
16209 struct TypeName * param = (*funcDecl->function.parameters).first;
16210
16211 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16212 {
16213 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16214 FreeTypeName(param);
16215 }
16216 }
16217 if(type->classObjectType != 1)
16218 {
16219 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
16220 {
16221 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16222
16223 if(!funcDecl->function.parameters)
16224 funcDecl->function.parameters = MkList();
16225 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16226 }
16227 }
16228 }
16229 }
16230 }
16231 if(function->body)
16232 {
16233 if(type->classObjectType != 1)
16234 {
16235 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));
16236 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16237 if(typedObject && thisSymbol->type)
16238 {
16239 thisSymbol->type->classObjectType = 2;
16240 thisSymbol->type->byReference = type->byReference;
16241 }
16242 }
16243 }
16244 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
16245 {
16246 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
16247
16248 {
16249 struct __ecereNameSpace__ecere__com__Class * base;
16250
16251 for(base = _class; base && base->type != 1000; base = base->next)
16252 {
16253 for(member = base->membersAndProperties.first; member; member = member->next)
16254 if(!member->isProperty)
16255 break;
16256 if(member)
16257 break;
16258 }
16259 }
16260 for(member = _class->membersAndProperties.first; member; member = member->next)
16261 if(!member->isProperty)
16262 break;
16263 if(member)
16264 {
16265 char pointerName[1024];
16266 struct Declaration * decl;
16267 struct Initializer * initializer;
16268 struct Expression * exp, * bytePtr;
16269
16270 strcpy(pointerName, "__ecerePointer_");
16271 FullClassNameCat(pointerName, _class->fullName, 0x0);
16272 {
16273 char className[1024];
16274
16275 strcpy(className, "__ecereClass_");
16276 FullClassNameCat(className, classSym->string, 0x1);
16277 MangleClassName(className);
16278 DeclareClass(classSym, className);
16279 }
16280 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
16281 if(_class->fixed)
16282 {
16283 char string[256];
16284
16285 sprintf(string, "%d", _class->offset);
16286 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
16287 }
16288 else
16289 {
16290 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
16291 }
16292 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
16293 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));
16294 if(function->body)
16295 {
16296 yylloc = function->body->loc;
16297 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
16298 {
16299 struct Context * prevContext = curContext;
16300
16301 curContext = function->body->compound.context;
16302 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
16303 curContext = prevContext;
16304 }
16305 decl->symbol = (((void *)0));
16306 if(!function->body->compound.declarations)
16307 function->body->compound.declarations = MkList();
16308 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
16309 }
16310 }
16311 }
16312 }
16313 else
16314 thisClass = (((void *)0));
16315 if(id)
16316 {
16317 FreeSpecifier(id->_class);
16318 id->_class = (((void *)0));
16319 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16320 {
16321 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16322
16323 id = GetDeclId(initDecl->declarator);
16324 FreeSpecifier(id->_class);
16325 id->_class = (((void *)0));
16326 }
16327 }
16328 if(function->body)
16329 topContext = function->body->compound.context;
16330 {
16331 struct FunctionDefinition * oldFunction = curFunction;
16332
16333 curFunction = function;
16334 if(function->body)
16335 ProcessStatement(function->body);
16336 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
16337 {
16338 struct Statement * prevCompound = curCompound;
16339 struct Context * prevContext = curContext;
16340 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
16341
16342 if(!function->body->compound.statements)
16343 function->body->compound.statements = MkList();
16344 ListAdd(function->body->compound.statements, fireWatchers);
16345 curCompound = function->body;
16346 curContext = function->body->compound.context;
16347 ProcessStatement(fireWatchers);
16348 curContext = prevContext;
16349 curCompound = prevCompound;
16350 }
16351 curFunction = oldFunction;
16352 }
16353 if(function->declarator)
16354 {
16355 ProcessDeclarator(function->declarator);
16356 }
16357 topContext = oldTopContext;
16358 thisClass = oldThisClass;
16359 }
16360
16361 extern void FreeSymbol(struct Symbol * symbol);
16362
16363 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
16364
16365 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
16366 {
16367 struct ClassDef * def;
16368 struct External * external = curExternal;
16369 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
16370
16371 for(def = definitions->first; def; def = def->next)
16372 {
16373 if(def->type == 0)
16374 {
16375 if(def->function->declarator)
16376 curExternal = def->function->declarator->symbol->pointerExternal;
16377 else
16378 curExternal = external;
16379 ProcessFunction((struct FunctionDefinition *)def->function);
16380 }
16381 else if(def->type == 2)
16382 {
16383 if(def->decl->type == 2)
16384 {
16385 thisClass = regClass;
16386 ProcessInstantiationType(def->decl->inst);
16387 thisClass = (((void *)0));
16388 }
16389 else
16390 {
16391 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
16392
16393 if(regClass)
16394 thisClass = regClass;
16395 ProcessDeclaration(def->decl);
16396 thisClass = backThisClass;
16397 }
16398 }
16399 else if(def->type == 1 && def->defProperties)
16400 {
16401 struct MemberInit * defProperty;
16402 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);
16403
16404 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16405 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
16406 {
16407 thisClass = regClass;
16408 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
16409 thisClass = (((void *)0));
16410 }
16411 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16412 FreeSymbol(thisSymbol);
16413 }
16414 else if(def->type == 3 && def->propertyDef)
16415 {
16416 struct PropertyDef * prop = def->propertyDef;
16417
16418 thisClass = regClass;
16419 if(prop->setStmt)
16420 {
16421 if(regClass)
16422 {
16423 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16424
16425 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16426 }
16427 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16428 ProcessStatement(prop->setStmt);
16429 }
16430 if(prop->getStmt)
16431 {
16432 if(regClass)
16433 {
16434 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16435
16436 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16437 }
16438 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16439 ProcessStatement(prop->getStmt);
16440 }
16441 if(prop->issetStmt)
16442 {
16443 if(regClass)
16444 {
16445 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16446
16447 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16448 }
16449 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16450 ProcessStatement(prop->issetStmt);
16451 }
16452 thisClass = (((void *)0));
16453 }
16454 else if(def->type == 4 && def->propertyWatch)
16455 {
16456 struct PropertyWatch * propertyWatch = def->propertyWatch;
16457
16458 thisClass = regClass;
16459 if(propertyWatch->compound)
16460 {
16461 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);
16462
16463 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16464 curExternal = (((void *)0));
16465 ProcessStatement(propertyWatch->compound);
16466 }
16467 thisClass = (((void *)0));
16468 }
16469 }
16470 }
16471
16472 void DeclareFunctionUtil(char * s)
16473 {
16474 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
16475
16476 if(function)
16477 {
16478 char name[1024];
16479
16480 name[0] = (char)0;
16481 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
16482 strcpy(name, "__ecereFunction_");
16483 FullClassNameCat(name, s, 0x0);
16484 DeclareFunction(function, name);
16485 }
16486 }
16487
16488 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16489
16490 void ComputeDataTypes()
16491 {
16492 void * __ecereTemp1;
16493 struct External * external;
16494 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16495 struct External * after = (((void *)0));
16496
16497 currentClass = (((void *)0));
16498 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16499 for(external = (*ast).first; external; external = external->next)
16500 {
16501 if(external->type == 1)
16502 {
16503 struct Declaration * decl = external->declaration;
16504
16505 if(decl)
16506 {
16507 struct __ecereNameSpace__ecere__sys__OldList * decls = decl->declarators;
16508
16509 if(decls)
16510 {
16511 struct InitDeclarator * initDecl = (*decls).first;
16512
16513 if(initDecl)
16514 {
16515 struct Declarator * declarator = initDecl->declarator;
16516
16517 if(declarator && declarator->type == 1)
16518 {
16519 struct Identifier * id = declarator->identifier;
16520
16521 if(id && id->string)
16522 {
16523 if(!strcmp(id->string, "uintptr_t") || !strcmp(id->string, "intptr_t") || !strcmp(id->string, "size_t") || !strcmp(id->string, "ssize_t"))
16524 {
16525 external->symbol->id = -1001, external->symbol->idCode = -1001;
16526 after = external;
16527 }
16528 }
16529 }
16530 }
16531 }
16532 }
16533 }
16534 }
16535 temp->symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->id = -1000, ((struct Symbol *)__ecereTemp1)->idCode = -1000, ((struct Symbol *)__ecereTemp1));
16536 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), after, temp);
16537 curExternal = temp;
16538 DeclareFunctionUtil("eSystem_New");
16539 DeclareFunctionUtil("eSystem_New0");
16540 DeclareFunctionUtil("eSystem_Renew");
16541 DeclareFunctionUtil("eSystem_Renew0");
16542 DeclareFunctionUtil("eClass_GetProperty");
16543 DeclareStruct("ecere::com::Class", 0x0);
16544 DeclareStruct("ecere::com::Instance", 0x0);
16545 DeclareStruct("ecere::com::Property", 0x0);
16546 DeclareStruct("ecere::com::DataMember", 0x0);
16547 DeclareStruct("ecere::com::Method", 0x0);
16548 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16549 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16550 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16551 for(external = (*ast).first; external; external = external->next)
16552 {
16553 afterExternal = curExternal = external;
16554 if(external->type == 0)
16555 {
16556 currentClass = external->function->_class;
16557 ProcessFunction(external->function);
16558 }
16559 else if(external->type == 1)
16560 {
16561 currentClass = (((void *)0));
16562 ProcessDeclaration(external->declaration);
16563 }
16564 else if(external->type == 2)
16565 {
16566 struct ClassDefinition * _class = external->_class;
16567
16568 currentClass = external->symbol->registered;
16569 if(_class->definitions)
16570 {
16571 ProcessClass(_class->definitions, _class->symbol);
16572 }
16573 if(inCompiler)
16574 {
16575 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16576 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16577 }
16578 }
16579 else if(external->type == 4)
16580 {
16581 thisNameSpace = external->id->string;
16582 }
16583 }
16584 currentClass = (((void *)0));
16585 thisNameSpace = (((void *)0));
16586 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16587 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16588 }
16589
16590 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);
16591
16592 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);
16593
16594 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16595 {
16596 struct __ecereNameSpace__ecere__com__Class * class;
16597
16598 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16599 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16600 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16601 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16602 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16603 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16604 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16605 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16606 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16607 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16608 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16609 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16610 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16611 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16612 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16613 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16614 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16615 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16616 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16617 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16618 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16619 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16620 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
16621 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
16622 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntSize", "bool GetIntSize(Expression exp, intsize * value2)", GetIntSize, module, 1);
16623 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntSize", "bool GetUIntSize(Expression exp, uintsize * value2)", GetUIntSize, module, 1);
16624 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16625 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16626 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16627 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16628 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16629 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16630 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16631 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16632 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16633 __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);
16634 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16635 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16636 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16637 __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);
16638 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16639 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16640 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16641 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16642 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16643 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16644 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16645 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16646 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16647 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16648 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16649 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16650 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16651 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
16652 __ecereClass_Conversion = class;
16653 __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);
16654 __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);
16655 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16656 __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);
16657 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16658 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16659 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16660 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16661 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16662 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16663 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16664 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16665 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16666 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16667 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16668 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16669 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16670 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16671 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16672 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
16673 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16674 }
16675
16676 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16677 {
16678
16679 }
16680