compiler: Added (u)intsize to map to size_t; Updated C prototypes to use it; Fixed...
[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
5163 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5164 return 0x1;
5165 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5166 {
5167 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5168 {
5169 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5170
5171 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5172 ;
5173 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5174 ;
5175 if(sourceBase == destBase)
5176 return 0x1;
5177 }
5178 }
5179 if(source)
5180 {
5181 struct __ecereNameSpace__ecere__sys__OldList * specs;
5182 unsigned int flag = 0x0;
5183 long long value = (((int)0x7fffffff));
5184
5185 source->refCount++;
5186 dest->refCount++;
5187 if(sourceExp->type == 2)
5188 {
5189 if(source->isSigned)
5190 value = strtoll(sourceExp->constant, (((void *)0)), 0);
5191 else
5192 value = strtoull(sourceExp->constant, (((void *)0)), 0);
5193 }
5194 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
5195 {
5196 if(source->isSigned)
5197 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
5198 else
5199 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
5200 }
5201 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5202 {
5203 FreeType(source);
5204 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));
5205 }
5206 if(dest->kind == 8)
5207 {
5208 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5209
5210 if(_class && _class->type == 3)
5211 {
5212 if(source->kind != 8)
5213 {
5214 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5215 struct Type * tempDest, * tempSource;
5216
5217 for(; _class->base->type != 1000; _class = _class->base)
5218 ;
5219 tempSource = dest;
5220 tempDest = tempType;
5221 tempType->kind = 8;
5222 if(!_class->symbol)
5223 _class->symbol = FindClass(_class->fullName);
5224 tempType->_class = _class->symbol;
5225 tempType->truth = dest->truth;
5226 if(tempType->_class)
5227 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5228 FreeType(sourceExp->expType);
5229 sourceExp->expType = dest;
5230 dest->refCount++;
5231 flag = 0x1;
5232 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5233 }
5234 }
5235 if(_class && _class->type == 2 && source->kind != 8)
5236 {
5237 if(!dest->_class->registered->dataType)
5238 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5239 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5240 {
5241 FreeType(source);
5242 FreeType(sourceExp->expType);
5243 source = sourceExp->expType = MkClassType(dest->_class->string);
5244 source->refCount++;
5245 }
5246 }
5247 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5248 {
5249 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5250 struct Declarator * decl;
5251 char string[1024];
5252
5253 ReadString(string, sourceExp->string);
5254 decl = SpecDeclFromString(string, specs, (((void *)0)));
5255 FreeExpContents(sourceExp);
5256 FreeType(sourceExp->expType);
5257 sourceExp->type = 26;
5258 sourceExp->_classExp.specifiers = specs;
5259 sourceExp->_classExp.decl = decl;
5260 sourceExp->expType = dest;
5261 dest->refCount++;
5262 FreeType(source);
5263 FreeType(dest);
5264 return 0x1;
5265 }
5266 }
5267 else if(source->kind == 8)
5268 {
5269 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5270
5271 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5272 {
5273 if(dest->kind != 8)
5274 {
5275 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5276 struct Type * tempDest, * tempSource;
5277
5278 if(!source->_class->registered->dataType)
5279 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5280 for(; _class->base->type != 1000; _class = _class->base)
5281 ;
5282 tempDest = source;
5283 tempSource = tempType;
5284 tempType->kind = 8;
5285 tempType->_class = FindClass(_class->fullName);
5286 tempType->truth = source->truth;
5287 tempType->classObjectType = source->classObjectType;
5288 if(tempType->_class)
5289 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5290 if(conversions->last)
5291 {
5292 ((struct Conversion *)conversions->last)->resultType = dest;
5293 dest->refCount++;
5294 }
5295 FreeType(sourceExp->expType);
5296 sourceExp->expType = MkClassType(_class->fullName);
5297 sourceExp->expType->truth = source->truth;
5298 sourceExp->expType->classObjectType = source->classObjectType;
5299 if(!sourceExp->destType)
5300 {
5301 FreeType(sourceExp->destType);
5302 sourceExp->destType = sourceExp->expType;
5303 if(sourceExp->expType)
5304 sourceExp->expType->refCount++;
5305 }
5306 if(!_class->dataType)
5307 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5308 FreeType(dest);
5309 dest = MkClassType(source->_class->string);
5310 dest->truth = source->truth;
5311 dest->classObjectType = source->classObjectType;
5312 FreeType(source);
5313 source = _class->dataType;
5314 source->refCount++;
5315 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5316 }
5317 }
5318 }
5319 if(!flag)
5320 {
5321 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5322 {
5323 FreeType(source);
5324 FreeType(dest);
5325 return 0x1;
5326 }
5327 }
5328 if(dest->kind == 8)
5329 {
5330 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5331
5332 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5333 {
5334 if(_class->type == 0 || _class->type == 5)
5335 {
5336 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5337
5338 *newExp = *sourceExp;
5339 if(sourceExp->destType)
5340 sourceExp->destType->refCount++;
5341 if(sourceExp->expType)
5342 sourceExp->expType->refCount++;
5343 sourceExp->type = 11;
5344 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5345 sourceExp->cast.exp = newExp;
5346 FreeType(sourceExp->expType);
5347 sourceExp->expType = (((void *)0));
5348 ProcessExpressionType(sourceExp);
5349 if(!inCompiler)
5350 {
5351 FreeType(sourceExp->expType);
5352 sourceExp->expType = dest;
5353 }
5354 FreeType(source);
5355 if(inCompiler)
5356 FreeType(dest);
5357 return 0x1;
5358 }
5359 if(!_class->dataType)
5360 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5361 FreeType(dest);
5362 dest = _class->dataType;
5363 dest->refCount++;
5364 }
5365 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5366 {
5367 specs = MkListOne(MkSpecifier(DOUBLE));
5368 }
5369 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 7))
5370 {
5371 specs = MkListOne(MkSpecifier(FLOAT));
5372 }
5373 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5374 {
5375 specs = MkList();
5376 if(!dest->isSigned)
5377 ListAdd(specs, MkSpecifier(UNSIGNED));
5378 ListAdd(specs, MkSpecifier(INT64));
5379 }
5380 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5381 {
5382 specs = MkList();
5383 if(!dest->isSigned)
5384 ListAdd(specs, MkSpecifier(UNSIGNED));
5385 ListAdd(specs, MkSpecifier(INT));
5386 }
5387 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5388 {
5389 specs = MkList();
5390 if(!dest->isSigned)
5391 ListAdd(specs, MkSpecifier(UNSIGNED));
5392 ListAdd(specs, MkSpecifier(SHORT));
5393 }
5394 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5395 {
5396 specs = MkList();
5397 if(!dest->isSigned)
5398 ListAdd(specs, MkSpecifier(UNSIGNED));
5399 ListAdd(specs, MkSpecifier(CHAR));
5400 }
5401 else
5402 {
5403 FreeType(source);
5404 FreeType(dest);
5405 return 0x0;
5406 }
5407 }
5408 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))
5409 {
5410 specs = MkListOne(MkSpecifier(DOUBLE));
5411 }
5412 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5413 {
5414 specs = MkListOne(MkSpecifier(FLOAT));
5415 }
5416 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)))
5417 {
5418 specs = MkList();
5419 if(!dest->isSigned)
5420 ListAdd(specs, MkSpecifier(UNSIGNED));
5421 ListAdd(specs, MkSpecifier(CHAR));
5422 }
5423 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)))))
5424 {
5425 specs = MkList();
5426 if(!dest->isSigned)
5427 ListAdd(specs, MkSpecifier(UNSIGNED));
5428 ListAdd(specs, MkSpecifier(SHORT));
5429 }
5430 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3))
5431 {
5432 specs = MkList();
5433 if(!dest->isSigned)
5434 ListAdd(specs, MkSpecifier(UNSIGNED));
5435 ListAdd(specs, MkSpecifier(INT));
5436 }
5437 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5438 {
5439 specs = MkList();
5440 if(!dest->isSigned)
5441 ListAdd(specs, MkSpecifier(UNSIGNED));
5442 ListAdd(specs, MkSpecifier(INT64));
5443 }
5444 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5445 {
5446 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5447 }
5448 else
5449 {
5450 FreeType(source);
5451 FreeType(dest);
5452 return 0x0;
5453 }
5454 if(!flag)
5455 {
5456 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5457
5458 *newExp = *sourceExp;
5459 newExp->prev = (((void *)0));
5460 newExp->next = (((void *)0));
5461 if(sourceExp->destType)
5462 sourceExp->destType->refCount++;
5463 if(sourceExp->expType)
5464 sourceExp->expType->refCount++;
5465 sourceExp->type = 11;
5466 if(realDest->kind == 8)
5467 {
5468 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5469 FreeList(specs, FreeSpecifier);
5470 }
5471 else
5472 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5473 if(newExp->type == 4)
5474 {
5475 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5476 }
5477 else
5478 sourceExp->cast.exp = newExp;
5479 FreeType(sourceExp->expType);
5480 sourceExp->expType = (((void *)0));
5481 ProcessExpressionType(sourceExp);
5482 }
5483 else
5484 FreeList(specs, FreeSpecifier);
5485 FreeType(dest);
5486 FreeType(source);
5487 return 0x1;
5488 }
5489 else
5490 {
5491 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5492 sourceExp = (*sourceExp->list).last;
5493 if(sourceExp->type == 0)
5494 {
5495 struct Identifier * id = sourceExp->identifier;
5496
5497 if(dest->kind == 8)
5498 {
5499 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5500 {
5501 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5502 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5503
5504 if(enumClass)
5505 {
5506 for(; _class && _class->type == 4; _class = _class->base)
5507 {
5508 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5509 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5510
5511 for(value = e->values.first; value; value = value->next)
5512 {
5513 if(!strcmp(value->name, id->string))
5514 break;
5515 }
5516 if(value)
5517 {
5518 FreeExpContents(sourceExp);
5519 FreeType(sourceExp->expType);
5520 sourceExp->isConstant = 0x1;
5521 sourceExp->expType = MkClassType(_class->fullName);
5522 {
5523 char constant[256];
5524
5525 sourceExp->type = 2;
5526 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5527 sprintf(constant, "%d", value->data);
5528 else
5529 sprintf(constant, "0x%X", value->data);
5530 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5531 }
5532 return 0x1;
5533 }
5534 }
5535 }
5536 }
5537 }
5538 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5539 return 0x1;
5540 }
5541 }
5542 return 0x0;
5543 }
5544
5545 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5546 {
5547 int value2 = op2->i;
5548
5549 exp->type = 2;
5550 exp->string = PrintInt(op1->i + value2);
5551 if(!exp->expType)
5552 {
5553 exp->expType = op1->type;
5554 if(op1->type)
5555 op1->type->refCount++;
5556 }
5557 return 0x1;
5558 }
5559
5560 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5561 {
5562 unsigned int value2 = op2->ui;
5563
5564 exp->type = 2;
5565 exp->string = PrintUInt(op1->ui + value2);
5566 if(!exp->expType)
5567 {
5568 exp->expType = op1->type;
5569 if(op1->type)
5570 op1->type->refCount++;
5571 }
5572 return 0x1;
5573 }
5574
5575 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5576 {
5577 short value2 = op2->s;
5578
5579 exp->type = 2;
5580 exp->string = PrintShort(op1->s + value2);
5581 if(!exp->expType)
5582 {
5583 exp->expType = op1->type;
5584 if(op1->type)
5585 op1->type->refCount++;
5586 }
5587 return 0x1;
5588 }
5589
5590 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5591 {
5592 unsigned short value2 = op2->us;
5593
5594 exp->type = 2;
5595 exp->string = PrintUShort(op1->us + value2);
5596 if(!exp->expType)
5597 {
5598 exp->expType = op1->type;
5599 if(op1->type)
5600 op1->type->refCount++;
5601 }
5602 return 0x1;
5603 }
5604
5605 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5606 {
5607 char value2 = op2->c;
5608
5609 exp->type = 2;
5610 exp->string = PrintChar(op1->c + value2);
5611 if(!exp->expType)
5612 {
5613 exp->expType = op1->type;
5614 if(op1->type)
5615 op1->type->refCount++;
5616 }
5617 return 0x1;
5618 }
5619
5620 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5621 {
5622 unsigned char value2 = op2->uc;
5623
5624 exp->type = 2;
5625 exp->string = PrintUChar(op1->uc + value2);
5626 if(!exp->expType)
5627 {
5628 exp->expType = op1->type;
5629 if(op1->type)
5630 op1->type->refCount++;
5631 }
5632 return 0x1;
5633 }
5634
5635 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5636 {
5637 float value2 = op2->f;
5638
5639 exp->type = 2;
5640 exp->string = PrintFloat(op1->f + value2);
5641 if(!exp->expType)
5642 {
5643 exp->expType = op1->type;
5644 if(op1->type)
5645 op1->type->refCount++;
5646 }
5647 return 0x1;
5648 }
5649
5650 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5651 {
5652 double value2 = op2->d;
5653
5654 exp->type = 2;
5655 exp->string = PrintDouble(op1->d + value2);
5656 if(!exp->expType)
5657 {
5658 exp->expType = op1->type;
5659 if(op1->type)
5660 op1->type->refCount++;
5661 }
5662 return 0x1;
5663 }
5664
5665 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5666 {
5667 int value2 = op2->i;
5668
5669 exp->type = 2;
5670 exp->string = PrintInt(op1->i - value2);
5671 if(!exp->expType)
5672 {
5673 exp->expType = op1->type;
5674 if(op1->type)
5675 op1->type->refCount++;
5676 }
5677 return 0x1;
5678 }
5679
5680 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5681 {
5682 unsigned int value2 = op2->ui;
5683
5684 exp->type = 2;
5685 exp->string = PrintUInt(op1->ui - value2);
5686 if(!exp->expType)
5687 {
5688 exp->expType = op1->type;
5689 if(op1->type)
5690 op1->type->refCount++;
5691 }
5692 return 0x1;
5693 }
5694
5695 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5696 {
5697 short value2 = op2->s;
5698
5699 exp->type = 2;
5700 exp->string = PrintShort(op1->s - value2);
5701 if(!exp->expType)
5702 {
5703 exp->expType = op1->type;
5704 if(op1->type)
5705 op1->type->refCount++;
5706 }
5707 return 0x1;
5708 }
5709
5710 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5711 {
5712 unsigned short value2 = op2->us;
5713
5714 exp->type = 2;
5715 exp->string = PrintUShort(op1->us - value2);
5716 if(!exp->expType)
5717 {
5718 exp->expType = op1->type;
5719 if(op1->type)
5720 op1->type->refCount++;
5721 }
5722 return 0x1;
5723 }
5724
5725 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5726 {
5727 char value2 = op2->c;
5728
5729 exp->type = 2;
5730 exp->string = PrintChar(op1->c - value2);
5731 if(!exp->expType)
5732 {
5733 exp->expType = op1->type;
5734 if(op1->type)
5735 op1->type->refCount++;
5736 }
5737 return 0x1;
5738 }
5739
5740 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5741 {
5742 unsigned char value2 = op2->uc;
5743
5744 exp->type = 2;
5745 exp->string = PrintUChar(op1->uc - value2);
5746 if(!exp->expType)
5747 {
5748 exp->expType = op1->type;
5749 if(op1->type)
5750 op1->type->refCount++;
5751 }
5752 return 0x1;
5753 }
5754
5755 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5756 {
5757 float value2 = op2->f;
5758
5759 exp->type = 2;
5760 exp->string = PrintFloat(op1->f - value2);
5761 if(!exp->expType)
5762 {
5763 exp->expType = op1->type;
5764 if(op1->type)
5765 op1->type->refCount++;
5766 }
5767 return 0x1;
5768 }
5769
5770 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5771 {
5772 double value2 = op2->d;
5773
5774 exp->type = 2;
5775 exp->string = PrintDouble(op1->d - value2);
5776 if(!exp->expType)
5777 {
5778 exp->expType = op1->type;
5779 if(op1->type)
5780 op1->type->refCount++;
5781 }
5782 return 0x1;
5783 }
5784
5785 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5786 {
5787 int value2 = op2->i;
5788
5789 exp->type = 2;
5790 exp->string = PrintInt(op1->i * value2);
5791 if(!exp->expType)
5792 {
5793 exp->expType = op1->type;
5794 if(op1->type)
5795 op1->type->refCount++;
5796 }
5797 return 0x1;
5798 }
5799
5800 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5801 {
5802 unsigned int value2 = op2->ui;
5803
5804 exp->type = 2;
5805 exp->string = PrintUInt(op1->ui * value2);
5806 if(!exp->expType)
5807 {
5808 exp->expType = op1->type;
5809 if(op1->type)
5810 op1->type->refCount++;
5811 }
5812 return 0x1;
5813 }
5814
5815 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5816 {
5817 short value2 = op2->s;
5818
5819 exp->type = 2;
5820 exp->string = PrintShort(op1->s * value2);
5821 if(!exp->expType)
5822 {
5823 exp->expType = op1->type;
5824 if(op1->type)
5825 op1->type->refCount++;
5826 }
5827 return 0x1;
5828 }
5829
5830 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5831 {
5832 unsigned short value2 = op2->us;
5833
5834 exp->type = 2;
5835 exp->string = PrintUShort(op1->us * value2);
5836 if(!exp->expType)
5837 {
5838 exp->expType = op1->type;
5839 if(op1->type)
5840 op1->type->refCount++;
5841 }
5842 return 0x1;
5843 }
5844
5845 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5846 {
5847 char value2 = op2->c;
5848
5849 exp->type = 2;
5850 exp->string = PrintChar(op1->c * value2);
5851 if(!exp->expType)
5852 {
5853 exp->expType = op1->type;
5854 if(op1->type)
5855 op1->type->refCount++;
5856 }
5857 return 0x1;
5858 }
5859
5860 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5861 {
5862 unsigned char value2 = op2->uc;
5863
5864 exp->type = 2;
5865 exp->string = PrintUChar(op1->uc * value2);
5866 if(!exp->expType)
5867 {
5868 exp->expType = op1->type;
5869 if(op1->type)
5870 op1->type->refCount++;
5871 }
5872 return 0x1;
5873 }
5874
5875 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5876 {
5877 float value2 = op2->f;
5878
5879 exp->type = 2;
5880 exp->string = PrintFloat(op1->f * value2);
5881 if(!exp->expType)
5882 {
5883 exp->expType = op1->type;
5884 if(op1->type)
5885 op1->type->refCount++;
5886 }
5887 return 0x1;
5888 }
5889
5890 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5891 {
5892 double value2 = op2->d;
5893
5894 exp->type = 2;
5895 exp->string = PrintDouble(op1->d * value2);
5896 if(!exp->expType)
5897 {
5898 exp->expType = op1->type;
5899 if(op1->type)
5900 op1->type->refCount++;
5901 }
5902 return 0x1;
5903 }
5904
5905 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5906 {
5907 int value2 = op2->i;
5908
5909 exp->type = 2;
5910 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
5911 if(!exp->expType)
5912 {
5913 exp->expType = op1->type;
5914 if(op1->type)
5915 op1->type->refCount++;
5916 }
5917 return 0x1;
5918 }
5919
5920 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5921 {
5922 unsigned int value2 = op2->ui;
5923
5924 exp->type = 2;
5925 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
5926 if(!exp->expType)
5927 {
5928 exp->expType = op1->type;
5929 if(op1->type)
5930 op1->type->refCount++;
5931 }
5932 return 0x1;
5933 }
5934
5935 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5936 {
5937 short value2 = op2->s;
5938
5939 exp->type = 2;
5940 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
5941 if(!exp->expType)
5942 {
5943 exp->expType = op1->type;
5944 if(op1->type)
5945 op1->type->refCount++;
5946 }
5947 return 0x1;
5948 }
5949
5950 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5951 {
5952 unsigned short value2 = op2->us;
5953
5954 exp->type = 2;
5955 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
5956 if(!exp->expType)
5957 {
5958 exp->expType = op1->type;
5959 if(op1->type)
5960 op1->type->refCount++;
5961 }
5962 return 0x1;
5963 }
5964
5965 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5966 {
5967 char value2 = op2->c;
5968
5969 exp->type = 2;
5970 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
5971 if(!exp->expType)
5972 {
5973 exp->expType = op1->type;
5974 if(op1->type)
5975 op1->type->refCount++;
5976 }
5977 return 0x1;
5978 }
5979
5980 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5981 {
5982 unsigned char value2 = op2->uc;
5983
5984 exp->type = 2;
5985 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
5986 if(!exp->expType)
5987 {
5988 exp->expType = op1->type;
5989 if(op1->type)
5990 op1->type->refCount++;
5991 }
5992 return 0x1;
5993 }
5994
5995 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5996 {
5997 float value2 = op2->f;
5998
5999 exp->type = 2;
6000 exp->string = PrintFloat(value2 ? (op1->f / value2) : (float)0);
6001 if(!exp->expType)
6002 {
6003 exp->expType = op1->type;
6004 if(op1->type)
6005 op1->type->refCount++;
6006 }
6007 return 0x1;
6008 }
6009
6010 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6011 {
6012 double value2 = op2->d;
6013
6014 exp->type = 2;
6015 exp->string = PrintDouble(value2 ? (op1->d / value2) : (double)0);
6016 if(!exp->expType)
6017 {
6018 exp->expType = op1->type;
6019 if(op1->type)
6020 op1->type->refCount++;
6021 }
6022 return 0x1;
6023 }
6024
6025 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6026 {
6027 int value2 = op2->i;
6028
6029 exp->type = 2;
6030 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
6031 if(!exp->expType)
6032 {
6033 exp->expType = op1->type;
6034 if(op1->type)
6035 op1->type->refCount++;
6036 }
6037 return 0x1;
6038 }
6039
6040 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6041 {
6042 unsigned int value2 = op2->ui;
6043
6044 exp->type = 2;
6045 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
6046 if(!exp->expType)
6047 {
6048 exp->expType = op1->type;
6049 if(op1->type)
6050 op1->type->refCount++;
6051 }
6052 return 0x1;
6053 }
6054
6055 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6056 {
6057 short value2 = op2->s;
6058
6059 exp->type = 2;
6060 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
6061 if(!exp->expType)
6062 {
6063 exp->expType = op1->type;
6064 if(op1->type)
6065 op1->type->refCount++;
6066 }
6067 return 0x1;
6068 }
6069
6070 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6071 {
6072 unsigned short value2 = op2->us;
6073
6074 exp->type = 2;
6075 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
6076 if(!exp->expType)
6077 {
6078 exp->expType = op1->type;
6079 if(op1->type)
6080 op1->type->refCount++;
6081 }
6082 return 0x1;
6083 }
6084
6085 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6086 {
6087 char value2 = op2->c;
6088
6089 exp->type = 2;
6090 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
6091 if(!exp->expType)
6092 {
6093 exp->expType = op1->type;
6094 if(op1->type)
6095 op1->type->refCount++;
6096 }
6097 return 0x1;
6098 }
6099
6100 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6101 {
6102 unsigned char value2 = op2->uc;
6103
6104 exp->type = 2;
6105 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
6106 if(!exp->expType)
6107 {
6108 exp->expType = op1->type;
6109 if(op1->type)
6110 op1->type->refCount++;
6111 }
6112 return 0x1;
6113 }
6114
6115 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
6116 {
6117 exp->type = 2;
6118 exp->string = PrintInt(-op1->i);
6119 if(!exp->expType)
6120 {
6121 exp->expType = op1->type;
6122 if(op1->type)
6123 op1->type->refCount++;
6124 }
6125 return 0x1;
6126 }
6127
6128 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
6129 {
6130 exp->type = 2;
6131 exp->string = PrintUInt(-op1->ui);
6132 if(!exp->expType)
6133 {
6134 exp->expType = op1->type;
6135 if(op1->type)
6136 op1->type->refCount++;
6137 }
6138 return 0x1;
6139 }
6140
6141 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
6142 {
6143 exp->type = 2;
6144 exp->string = PrintShort(-op1->s);
6145 if(!exp->expType)
6146 {
6147 exp->expType = op1->type;
6148 if(op1->type)
6149 op1->type->refCount++;
6150 }
6151 return 0x1;
6152 }
6153
6154 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
6155 {
6156 exp->type = 2;
6157 exp->string = PrintUShort(-op1->us);
6158 if(!exp->expType)
6159 {
6160 exp->expType = op1->type;
6161 if(op1->type)
6162 op1->type->refCount++;
6163 }
6164 return 0x1;
6165 }
6166
6167 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
6168 {
6169 exp->type = 2;
6170 exp->string = PrintChar(-op1->c);
6171 if(!exp->expType)
6172 {
6173 exp->expType = op1->type;
6174 if(op1->type)
6175 op1->type->refCount++;
6176 }
6177 return 0x1;
6178 }
6179
6180 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
6181 {
6182 exp->type = 2;
6183 exp->string = PrintUChar(-op1->uc);
6184 if(!exp->expType)
6185 {
6186 exp->expType = op1->type;
6187 if(op1->type)
6188 op1->type->refCount++;
6189 }
6190 return 0x1;
6191 }
6192
6193 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
6194 {
6195 exp->type = 2;
6196 exp->string = PrintFloat(-op1->f);
6197 if(!exp->expType)
6198 {
6199 exp->expType = op1->type;
6200 if(op1->type)
6201 op1->type->refCount++;
6202 }
6203 return 0x1;
6204 }
6205
6206 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6207 {
6208 exp->type = 2;
6209 exp->string = PrintDouble(-op1->d);
6210 if(!exp->expType)
6211 {
6212 exp->expType = op1->type;
6213 if(op1->type)
6214 op1->type->refCount++;
6215 }
6216 return 0x1;
6217 }
6218
6219 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6220 {
6221 exp->type = 2;
6222 exp->string = PrintInt(++op1->i);
6223 if(!exp->expType)
6224 {
6225 exp->expType = op1->type;
6226 if(op1->type)
6227 op1->type->refCount++;
6228 }
6229 return 0x1;
6230 }
6231
6232 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6233 {
6234 exp->type = 2;
6235 exp->string = PrintUInt(++op1->ui);
6236 if(!exp->expType)
6237 {
6238 exp->expType = op1->type;
6239 if(op1->type)
6240 op1->type->refCount++;
6241 }
6242 return 0x1;
6243 }
6244
6245 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6246 {
6247 exp->type = 2;
6248 exp->string = PrintShort(++op1->s);
6249 if(!exp->expType)
6250 {
6251 exp->expType = op1->type;
6252 if(op1->type)
6253 op1->type->refCount++;
6254 }
6255 return 0x1;
6256 }
6257
6258 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6259 {
6260 exp->type = 2;
6261 exp->string = PrintUShort(++op1->us);
6262 if(!exp->expType)
6263 {
6264 exp->expType = op1->type;
6265 if(op1->type)
6266 op1->type->refCount++;
6267 }
6268 return 0x1;
6269 }
6270
6271 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6272 {
6273 exp->type = 2;
6274 exp->string = PrintChar(++op1->c);
6275 if(!exp->expType)
6276 {
6277 exp->expType = op1->type;
6278 if(op1->type)
6279 op1->type->refCount++;
6280 }
6281 return 0x1;
6282 }
6283
6284 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6285 {
6286 exp->type = 2;
6287 exp->string = PrintUChar(++op1->uc);
6288 if(!exp->expType)
6289 {
6290 exp->expType = op1->type;
6291 if(op1->type)
6292 op1->type->refCount++;
6293 }
6294 return 0x1;
6295 }
6296
6297 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6298 {
6299 exp->type = 2;
6300 exp->string = PrintFloat(++op1->f);
6301 if(!exp->expType)
6302 {
6303 exp->expType = op1->type;
6304 if(op1->type)
6305 op1->type->refCount++;
6306 }
6307 return 0x1;
6308 }
6309
6310 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6311 {
6312 exp->type = 2;
6313 exp->string = PrintDouble(++op1->d);
6314 if(!exp->expType)
6315 {
6316 exp->expType = op1->type;
6317 if(op1->type)
6318 op1->type->refCount++;
6319 }
6320 return 0x1;
6321 }
6322
6323 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6324 {
6325 exp->type = 2;
6326 exp->string = PrintInt(--op1->i);
6327 if(!exp->expType)
6328 {
6329 exp->expType = op1->type;
6330 if(op1->type)
6331 op1->type->refCount++;
6332 }
6333 return 0x1;
6334 }
6335
6336 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6337 {
6338 exp->type = 2;
6339 exp->string = PrintUInt(--op1->ui);
6340 if(!exp->expType)
6341 {
6342 exp->expType = op1->type;
6343 if(op1->type)
6344 op1->type->refCount++;
6345 }
6346 return 0x1;
6347 }
6348
6349 static unsigned int ShortDec(struct Expression * exp, struct Operand * op1)
6350 {
6351 exp->type = 2;
6352 exp->string = PrintShort(--op1->s);
6353 if(!exp->expType)
6354 {
6355 exp->expType = op1->type;
6356 if(op1->type)
6357 op1->type->refCount++;
6358 }
6359 return 0x1;
6360 }
6361
6362 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6363 {
6364 exp->type = 2;
6365 exp->string = PrintUShort(--op1->us);
6366 if(!exp->expType)
6367 {
6368 exp->expType = op1->type;
6369 if(op1->type)
6370 op1->type->refCount++;
6371 }
6372 return 0x1;
6373 }
6374
6375 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6376 {
6377 exp->type = 2;
6378 exp->string = PrintChar(--op1->c);
6379 if(!exp->expType)
6380 {
6381 exp->expType = op1->type;
6382 if(op1->type)
6383 op1->type->refCount++;
6384 }
6385 return 0x1;
6386 }
6387
6388 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6389 {
6390 exp->type = 2;
6391 exp->string = PrintUChar(--op1->uc);
6392 if(!exp->expType)
6393 {
6394 exp->expType = op1->type;
6395 if(op1->type)
6396 op1->type->refCount++;
6397 }
6398 return 0x1;
6399 }
6400
6401 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6402 {
6403 exp->type = 2;
6404 exp->string = PrintFloat(--op1->f);
6405 if(!exp->expType)
6406 {
6407 exp->expType = op1->type;
6408 if(op1->type)
6409 op1->type->refCount++;
6410 }
6411 return 0x1;
6412 }
6413
6414 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6415 {
6416 exp->type = 2;
6417 exp->string = PrintDouble(--op1->d);
6418 if(!exp->expType)
6419 {
6420 exp->expType = op1->type;
6421 if(op1->type)
6422 op1->type->refCount++;
6423 }
6424 return 0x1;
6425 }
6426
6427 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6428 {
6429 int value2 = op2->i;
6430
6431 exp->type = 2;
6432 exp->string = PrintInt(op1->i = value2);
6433 if(!exp->expType)
6434 {
6435 exp->expType = op1->type;
6436 if(op1->type)
6437 op1->type->refCount++;
6438 }
6439 return 0x1;
6440 }
6441
6442 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6443 {
6444 unsigned int value2 = op2->ui;
6445
6446 exp->type = 2;
6447 exp->string = PrintUInt(op1->ui = value2);
6448 if(!exp->expType)
6449 {
6450 exp->expType = op1->type;
6451 if(op1->type)
6452 op1->type->refCount++;
6453 }
6454 return 0x1;
6455 }
6456
6457 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6458 {
6459 short value2 = op2->s;
6460
6461 exp->type = 2;
6462 exp->string = PrintShort(op1->s = value2);
6463 if(!exp->expType)
6464 {
6465 exp->expType = op1->type;
6466 if(op1->type)
6467 op1->type->refCount++;
6468 }
6469 return 0x1;
6470 }
6471
6472 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6473 {
6474 unsigned short value2 = op2->us;
6475
6476 exp->type = 2;
6477 exp->string = PrintUShort(op1->us = value2);
6478 if(!exp->expType)
6479 {
6480 exp->expType = op1->type;
6481 if(op1->type)
6482 op1->type->refCount++;
6483 }
6484 return 0x1;
6485 }
6486
6487 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6488 {
6489 char value2 = op2->c;
6490
6491 exp->type = 2;
6492 exp->string = PrintChar(op1->c = value2);
6493 if(!exp->expType)
6494 {
6495 exp->expType = op1->type;
6496 if(op1->type)
6497 op1->type->refCount++;
6498 }
6499 return 0x1;
6500 }
6501
6502 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6503 {
6504 unsigned char value2 = op2->uc;
6505
6506 exp->type = 2;
6507 exp->string = PrintUChar(op1->uc = value2);
6508 if(!exp->expType)
6509 {
6510 exp->expType = op1->type;
6511 if(op1->type)
6512 op1->type->refCount++;
6513 }
6514 return 0x1;
6515 }
6516
6517 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6518 {
6519 float value2 = op2->f;
6520
6521 exp->type = 2;
6522 exp->string = PrintFloat(op1->f = value2);
6523 if(!exp->expType)
6524 {
6525 exp->expType = op1->type;
6526 if(op1->type)
6527 op1->type->refCount++;
6528 }
6529 return 0x1;
6530 }
6531
6532 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6533 {
6534 double value2 = op2->d;
6535
6536 exp->type = 2;
6537 exp->string = PrintDouble(op1->d = value2);
6538 if(!exp->expType)
6539 {
6540 exp->expType = op1->type;
6541 if(op1->type)
6542 op1->type->refCount++;
6543 }
6544 return 0x1;
6545 }
6546
6547 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6548 {
6549 int value2 = op2->i;
6550
6551 exp->type = 2;
6552 exp->string = PrintInt(op1->i += value2);
6553 if(!exp->expType)
6554 {
6555 exp->expType = op1->type;
6556 if(op1->type)
6557 op1->type->refCount++;
6558 }
6559 return 0x1;
6560 }
6561
6562 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6563 {
6564 unsigned int value2 = op2->ui;
6565
6566 exp->type = 2;
6567 exp->string = PrintUInt(op1->ui += value2);
6568 if(!exp->expType)
6569 {
6570 exp->expType = op1->type;
6571 if(op1->type)
6572 op1->type->refCount++;
6573 }
6574 return 0x1;
6575 }
6576
6577 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6578 {
6579 short value2 = op2->s;
6580
6581 exp->type = 2;
6582 exp->string = PrintShort(op1->s += value2);
6583 if(!exp->expType)
6584 {
6585 exp->expType = op1->type;
6586 if(op1->type)
6587 op1->type->refCount++;
6588 }
6589 return 0x1;
6590 }
6591
6592 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6593 {
6594 unsigned short value2 = op2->us;
6595
6596 exp->type = 2;
6597 exp->string = PrintUShort(op1->us += value2);
6598 if(!exp->expType)
6599 {
6600 exp->expType = op1->type;
6601 if(op1->type)
6602 op1->type->refCount++;
6603 }
6604 return 0x1;
6605 }
6606
6607 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6608 {
6609 char value2 = op2->c;
6610
6611 exp->type = 2;
6612 exp->string = PrintChar(op1->c += value2);
6613 if(!exp->expType)
6614 {
6615 exp->expType = op1->type;
6616 if(op1->type)
6617 op1->type->refCount++;
6618 }
6619 return 0x1;
6620 }
6621
6622 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6623 {
6624 unsigned char value2 = op2->uc;
6625
6626 exp->type = 2;
6627 exp->string = PrintUChar(op1->uc += value2);
6628 if(!exp->expType)
6629 {
6630 exp->expType = op1->type;
6631 if(op1->type)
6632 op1->type->refCount++;
6633 }
6634 return 0x1;
6635 }
6636
6637 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6638 {
6639 float value2 = op2->f;
6640
6641 exp->type = 2;
6642 exp->string = PrintFloat(op1->f += value2);
6643 if(!exp->expType)
6644 {
6645 exp->expType = op1->type;
6646 if(op1->type)
6647 op1->type->refCount++;
6648 }
6649 return 0x1;
6650 }
6651
6652 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6653 {
6654 double value2 = op2->d;
6655
6656 exp->type = 2;
6657 exp->string = PrintDouble(op1->d += value2);
6658 if(!exp->expType)
6659 {
6660 exp->expType = op1->type;
6661 if(op1->type)
6662 op1->type->refCount++;
6663 }
6664 return 0x1;
6665 }
6666
6667 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6668 {
6669 int value2 = op2->i;
6670
6671 exp->type = 2;
6672 exp->string = PrintInt(op1->i -= value2);
6673 if(!exp->expType)
6674 {
6675 exp->expType = op1->type;
6676 if(op1->type)
6677 op1->type->refCount++;
6678 }
6679 return 0x1;
6680 }
6681
6682 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6683 {
6684 unsigned int value2 = op2->ui;
6685
6686 exp->type = 2;
6687 exp->string = PrintUInt(op1->ui -= value2);
6688 if(!exp->expType)
6689 {
6690 exp->expType = op1->type;
6691 if(op1->type)
6692 op1->type->refCount++;
6693 }
6694 return 0x1;
6695 }
6696
6697 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6698 {
6699 short value2 = op2->s;
6700
6701 exp->type = 2;
6702 exp->string = PrintShort(op1->s -= value2);
6703 if(!exp->expType)
6704 {
6705 exp->expType = op1->type;
6706 if(op1->type)
6707 op1->type->refCount++;
6708 }
6709 return 0x1;
6710 }
6711
6712 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6713 {
6714 unsigned short value2 = op2->us;
6715
6716 exp->type = 2;
6717 exp->string = PrintUShort(op1->us -= value2);
6718 if(!exp->expType)
6719 {
6720 exp->expType = op1->type;
6721 if(op1->type)
6722 op1->type->refCount++;
6723 }
6724 return 0x1;
6725 }
6726
6727 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6728 {
6729 char value2 = op2->c;
6730
6731 exp->type = 2;
6732 exp->string = PrintChar(op1->c -= value2);
6733 if(!exp->expType)
6734 {
6735 exp->expType = op1->type;
6736 if(op1->type)
6737 op1->type->refCount++;
6738 }
6739 return 0x1;
6740 }
6741
6742 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6743 {
6744 unsigned char value2 = op2->uc;
6745
6746 exp->type = 2;
6747 exp->string = PrintUChar(op1->uc -= value2);
6748 if(!exp->expType)
6749 {
6750 exp->expType = op1->type;
6751 if(op1->type)
6752 op1->type->refCount++;
6753 }
6754 return 0x1;
6755 }
6756
6757 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6758 {
6759 float value2 = op2->f;
6760
6761 exp->type = 2;
6762 exp->string = PrintFloat(op1->f -= value2);
6763 if(!exp->expType)
6764 {
6765 exp->expType = op1->type;
6766 if(op1->type)
6767 op1->type->refCount++;
6768 }
6769 return 0x1;
6770 }
6771
6772 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6773 {
6774 double value2 = op2->d;
6775
6776 exp->type = 2;
6777 exp->string = PrintDouble(op1->d -= value2);
6778 if(!exp->expType)
6779 {
6780 exp->expType = op1->type;
6781 if(op1->type)
6782 op1->type->refCount++;
6783 }
6784 return 0x1;
6785 }
6786
6787 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6788 {
6789 int value2 = op2->i;
6790
6791 exp->type = 2;
6792 exp->string = PrintInt(op1->i *= value2);
6793 if(!exp->expType)
6794 {
6795 exp->expType = op1->type;
6796 if(op1->type)
6797 op1->type->refCount++;
6798 }
6799 return 0x1;
6800 }
6801
6802 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6803 {
6804 unsigned int value2 = op2->ui;
6805
6806 exp->type = 2;
6807 exp->string = PrintUInt(op1->ui *= value2);
6808 if(!exp->expType)
6809 {
6810 exp->expType = op1->type;
6811 if(op1->type)
6812 op1->type->refCount++;
6813 }
6814 return 0x1;
6815 }
6816
6817 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6818 {
6819 short value2 = op2->s;
6820
6821 exp->type = 2;
6822 exp->string = PrintShort(op1->s *= value2);
6823 if(!exp->expType)
6824 {
6825 exp->expType = op1->type;
6826 if(op1->type)
6827 op1->type->refCount++;
6828 }
6829 return 0x1;
6830 }
6831
6832 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6833 {
6834 unsigned short value2 = op2->us;
6835
6836 exp->type = 2;
6837 exp->string = PrintUShort(op1->us *= value2);
6838 if(!exp->expType)
6839 {
6840 exp->expType = op1->type;
6841 if(op1->type)
6842 op1->type->refCount++;
6843 }
6844 return 0x1;
6845 }
6846
6847 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6848 {
6849 char value2 = op2->c;
6850
6851 exp->type = 2;
6852 exp->string = PrintChar(op1->c *= value2);
6853 if(!exp->expType)
6854 {
6855 exp->expType = op1->type;
6856 if(op1->type)
6857 op1->type->refCount++;
6858 }
6859 return 0x1;
6860 }
6861
6862 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6863 {
6864 unsigned char value2 = op2->uc;
6865
6866 exp->type = 2;
6867 exp->string = PrintUChar(op1->uc *= value2);
6868 if(!exp->expType)
6869 {
6870 exp->expType = op1->type;
6871 if(op1->type)
6872 op1->type->refCount++;
6873 }
6874 return 0x1;
6875 }
6876
6877 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6878 {
6879 float value2 = op2->f;
6880
6881 exp->type = 2;
6882 exp->string = PrintFloat(op1->f *= value2);
6883 if(!exp->expType)
6884 {
6885 exp->expType = op1->type;
6886 if(op1->type)
6887 op1->type->refCount++;
6888 }
6889 return 0x1;
6890 }
6891
6892 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6893 {
6894 double value2 = op2->d;
6895
6896 exp->type = 2;
6897 exp->string = PrintDouble(op1->d *= value2);
6898 if(!exp->expType)
6899 {
6900 exp->expType = op1->type;
6901 if(op1->type)
6902 op1->type->refCount++;
6903 }
6904 return 0x1;
6905 }
6906
6907 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6908 {
6909 int value2 = op2->i;
6910
6911 exp->type = 2;
6912 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
6913 if(!exp->expType)
6914 {
6915 exp->expType = op1->type;
6916 if(op1->type)
6917 op1->type->refCount++;
6918 }
6919 return 0x1;
6920 }
6921
6922 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6923 {
6924 unsigned int value2 = op2->ui;
6925
6926 exp->type = 2;
6927 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
6928 if(!exp->expType)
6929 {
6930 exp->expType = op1->type;
6931 if(op1->type)
6932 op1->type->refCount++;
6933 }
6934 return 0x1;
6935 }
6936
6937 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6938 {
6939 short value2 = op2->s;
6940
6941 exp->type = 2;
6942 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
6943 if(!exp->expType)
6944 {
6945 exp->expType = op1->type;
6946 if(op1->type)
6947 op1->type->refCount++;
6948 }
6949 return 0x1;
6950 }
6951
6952 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6953 {
6954 unsigned short value2 = op2->us;
6955
6956 exp->type = 2;
6957 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
6958 if(!exp->expType)
6959 {
6960 exp->expType = op1->type;
6961 if(op1->type)
6962 op1->type->refCount++;
6963 }
6964 return 0x1;
6965 }
6966
6967 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6968 {
6969 char value2 = op2->c;
6970
6971 exp->type = 2;
6972 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
6973 if(!exp->expType)
6974 {
6975 exp->expType = op1->type;
6976 if(op1->type)
6977 op1->type->refCount++;
6978 }
6979 return 0x1;
6980 }
6981
6982 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6983 {
6984 unsigned char value2 = op2->uc;
6985
6986 exp->type = 2;
6987 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
6988 if(!exp->expType)
6989 {
6990 exp->expType = op1->type;
6991 if(op1->type)
6992 op1->type->refCount++;
6993 }
6994 return 0x1;
6995 }
6996
6997 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6998 {
6999 float value2 = op2->f;
7000
7001 exp->type = 2;
7002 exp->string = PrintFloat(value2 ? (op1->f /= value2) : (float)0);
7003 if(!exp->expType)
7004 {
7005 exp->expType = op1->type;
7006 if(op1->type)
7007 op1->type->refCount++;
7008 }
7009 return 0x1;
7010 }
7011
7012 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7013 {
7014 double value2 = op2->d;
7015
7016 exp->type = 2;
7017 exp->string = PrintDouble(value2 ? (op1->d /= value2) : (double)0);
7018 if(!exp->expType)
7019 {
7020 exp->expType = op1->type;
7021 if(op1->type)
7022 op1->type->refCount++;
7023 }
7024 return 0x1;
7025 }
7026
7027 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7028 {
7029 int value2 = op2->i;
7030
7031 exp->type = 2;
7032 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
7033 if(!exp->expType)
7034 {
7035 exp->expType = op1->type;
7036 if(op1->type)
7037 op1->type->refCount++;
7038 }
7039 return 0x1;
7040 }
7041
7042 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7043 {
7044 unsigned int value2 = op2->ui;
7045
7046 exp->type = 2;
7047 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
7048 if(!exp->expType)
7049 {
7050 exp->expType = op1->type;
7051 if(op1->type)
7052 op1->type->refCount++;
7053 }
7054 return 0x1;
7055 }
7056
7057 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7058 {
7059 short value2 = op2->s;
7060
7061 exp->type = 2;
7062 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
7063 if(!exp->expType)
7064 {
7065 exp->expType = op1->type;
7066 if(op1->type)
7067 op1->type->refCount++;
7068 }
7069 return 0x1;
7070 }
7071
7072 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7073 {
7074 unsigned short value2 = op2->us;
7075
7076 exp->type = 2;
7077 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
7078 if(!exp->expType)
7079 {
7080 exp->expType = op1->type;
7081 if(op1->type)
7082 op1->type->refCount++;
7083 }
7084 return 0x1;
7085 }
7086
7087 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7088 {
7089 char value2 = op2->c;
7090
7091 exp->type = 2;
7092 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
7093 if(!exp->expType)
7094 {
7095 exp->expType = op1->type;
7096 if(op1->type)
7097 op1->type->refCount++;
7098 }
7099 return 0x1;
7100 }
7101
7102 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7103 {
7104 unsigned char value2 = op2->uc;
7105
7106 exp->type = 2;
7107 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
7108 if(!exp->expType)
7109 {
7110 exp->expType = op1->type;
7111 if(op1->type)
7112 op1->type->refCount++;
7113 }
7114 return 0x1;
7115 }
7116
7117 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7118 {
7119 int value2 = op2->i;
7120
7121 exp->type = 2;
7122 exp->string = PrintInt(op1->i & value2);
7123 if(!exp->expType)
7124 {
7125 exp->expType = op1->type;
7126 if(op1->type)
7127 op1->type->refCount++;
7128 }
7129 return 0x1;
7130 }
7131
7132 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7133 {
7134 unsigned int value2 = op2->ui;
7135
7136 exp->type = 2;
7137 exp->string = PrintUInt(op1->ui & value2);
7138 if(!exp->expType)
7139 {
7140 exp->expType = op1->type;
7141 if(op1->type)
7142 op1->type->refCount++;
7143 }
7144 return 0x1;
7145 }
7146
7147 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7148 {
7149 short value2 = op2->s;
7150
7151 exp->type = 2;
7152 exp->string = PrintShort(op1->s & value2);
7153 if(!exp->expType)
7154 {
7155 exp->expType = op1->type;
7156 if(op1->type)
7157 op1->type->refCount++;
7158 }
7159 return 0x1;
7160 }
7161
7162 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7163 {
7164 unsigned short value2 = op2->us;
7165
7166 exp->type = 2;
7167 exp->string = PrintUShort(op1->us & value2);
7168 if(!exp->expType)
7169 {
7170 exp->expType = op1->type;
7171 if(op1->type)
7172 op1->type->refCount++;
7173 }
7174 return 0x1;
7175 }
7176
7177 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7178 {
7179 char value2 = op2->c;
7180
7181 exp->type = 2;
7182 exp->string = PrintChar(op1->c & value2);
7183 if(!exp->expType)
7184 {
7185 exp->expType = op1->type;
7186 if(op1->type)
7187 op1->type->refCount++;
7188 }
7189 return 0x1;
7190 }
7191
7192 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7193 {
7194 unsigned char value2 = op2->uc;
7195
7196 exp->type = 2;
7197 exp->string = PrintUChar(op1->uc & value2);
7198 if(!exp->expType)
7199 {
7200 exp->expType = op1->type;
7201 if(op1->type)
7202 op1->type->refCount++;
7203 }
7204 return 0x1;
7205 }
7206
7207 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7208 {
7209 int value2 = op2->i;
7210
7211 exp->type = 2;
7212 exp->string = PrintInt(op1->i | value2);
7213 if(!exp->expType)
7214 {
7215 exp->expType = op1->type;
7216 if(op1->type)
7217 op1->type->refCount++;
7218 }
7219 return 0x1;
7220 }
7221
7222 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7223 {
7224 unsigned int value2 = op2->ui;
7225
7226 exp->type = 2;
7227 exp->string = PrintUInt(op1->ui | value2);
7228 if(!exp->expType)
7229 {
7230 exp->expType = op1->type;
7231 if(op1->type)
7232 op1->type->refCount++;
7233 }
7234 return 0x1;
7235 }
7236
7237 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7238 {
7239 short value2 = op2->s;
7240
7241 exp->type = 2;
7242 exp->string = PrintShort(op1->s | value2);
7243 if(!exp->expType)
7244 {
7245 exp->expType = op1->type;
7246 if(op1->type)
7247 op1->type->refCount++;
7248 }
7249 return 0x1;
7250 }
7251
7252 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7253 {
7254 unsigned short value2 = op2->us;
7255
7256 exp->type = 2;
7257 exp->string = PrintUShort(op1->us | value2);
7258 if(!exp->expType)
7259 {
7260 exp->expType = op1->type;
7261 if(op1->type)
7262 op1->type->refCount++;
7263 }
7264 return 0x1;
7265 }
7266
7267 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7268 {
7269 char value2 = op2->c;
7270
7271 exp->type = 2;
7272 exp->string = PrintChar(op1->c | value2);
7273 if(!exp->expType)
7274 {
7275 exp->expType = op1->type;
7276 if(op1->type)
7277 op1->type->refCount++;
7278 }
7279 return 0x1;
7280 }
7281
7282 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7283 {
7284 unsigned char value2 = op2->uc;
7285
7286 exp->type = 2;
7287 exp->string = PrintUChar(op1->uc | value2);
7288 if(!exp->expType)
7289 {
7290 exp->expType = op1->type;
7291 if(op1->type)
7292 op1->type->refCount++;
7293 }
7294 return 0x1;
7295 }
7296
7297 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7298 {
7299 int value2 = op2->i;
7300
7301 exp->type = 2;
7302 exp->string = PrintInt(op1->i ^ value2);
7303 if(!exp->expType)
7304 {
7305 exp->expType = op1->type;
7306 if(op1->type)
7307 op1->type->refCount++;
7308 }
7309 return 0x1;
7310 }
7311
7312 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7313 {
7314 unsigned int value2 = op2->ui;
7315
7316 exp->type = 2;
7317 exp->string = PrintUInt(op1->ui ^ value2);
7318 if(!exp->expType)
7319 {
7320 exp->expType = op1->type;
7321 if(op1->type)
7322 op1->type->refCount++;
7323 }
7324 return 0x1;
7325 }
7326
7327 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7328 {
7329 short value2 = op2->s;
7330
7331 exp->type = 2;
7332 exp->string = PrintShort(op1->s ^ value2);
7333 if(!exp->expType)
7334 {
7335 exp->expType = op1->type;
7336 if(op1->type)
7337 op1->type->refCount++;
7338 }
7339 return 0x1;
7340 }
7341
7342 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7343 {
7344 unsigned short value2 = op2->us;
7345
7346 exp->type = 2;
7347 exp->string = PrintUShort(op1->us ^ value2);
7348 if(!exp->expType)
7349 {
7350 exp->expType = op1->type;
7351 if(op1->type)
7352 op1->type->refCount++;
7353 }
7354 return 0x1;
7355 }
7356
7357 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7358 {
7359 char value2 = op2->c;
7360
7361 exp->type = 2;
7362 exp->string = PrintChar(op1->c ^ value2);
7363 if(!exp->expType)
7364 {
7365 exp->expType = op1->type;
7366 if(op1->type)
7367 op1->type->refCount++;
7368 }
7369 return 0x1;
7370 }
7371
7372 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7373 {
7374 unsigned char value2 = op2->uc;
7375
7376 exp->type = 2;
7377 exp->string = PrintUChar(op1->uc ^ value2);
7378 if(!exp->expType)
7379 {
7380 exp->expType = op1->type;
7381 if(op1->type)
7382 op1->type->refCount++;
7383 }
7384 return 0x1;
7385 }
7386
7387 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7388 {
7389 int value2 = op2->i;
7390
7391 exp->type = 2;
7392 exp->string = PrintInt(op1->i << value2);
7393 if(!exp->expType)
7394 {
7395 exp->expType = op1->type;
7396 if(op1->type)
7397 op1->type->refCount++;
7398 }
7399 return 0x1;
7400 }
7401
7402 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7403 {
7404 unsigned int value2 = op2->ui;
7405
7406 exp->type = 2;
7407 exp->string = PrintUInt(op1->ui << value2);
7408 if(!exp->expType)
7409 {
7410 exp->expType = op1->type;
7411 if(op1->type)
7412 op1->type->refCount++;
7413 }
7414 return 0x1;
7415 }
7416
7417 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7418 {
7419 short value2 = op2->s;
7420
7421 exp->type = 2;
7422 exp->string = PrintShort(op1->s << value2);
7423 if(!exp->expType)
7424 {
7425 exp->expType = op1->type;
7426 if(op1->type)
7427 op1->type->refCount++;
7428 }
7429 return 0x1;
7430 }
7431
7432 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7433 {
7434 unsigned short value2 = op2->us;
7435
7436 exp->type = 2;
7437 exp->string = PrintUShort(op1->us << value2);
7438 if(!exp->expType)
7439 {
7440 exp->expType = op1->type;
7441 if(op1->type)
7442 op1->type->refCount++;
7443 }
7444 return 0x1;
7445 }
7446
7447 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7448 {
7449 char value2 = op2->c;
7450
7451 exp->type = 2;
7452 exp->string = PrintChar(op1->c << value2);
7453 if(!exp->expType)
7454 {
7455 exp->expType = op1->type;
7456 if(op1->type)
7457 op1->type->refCount++;
7458 }
7459 return 0x1;
7460 }
7461
7462 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7463 {
7464 unsigned char value2 = op2->uc;
7465
7466 exp->type = 2;
7467 exp->string = PrintUChar(op1->uc << value2);
7468 if(!exp->expType)
7469 {
7470 exp->expType = op1->type;
7471 if(op1->type)
7472 op1->type->refCount++;
7473 }
7474 return 0x1;
7475 }
7476
7477 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7478 {
7479 int value2 = op2->i;
7480
7481 exp->type = 2;
7482 exp->string = PrintInt(op1->i >> value2);
7483 if(!exp->expType)
7484 {
7485 exp->expType = op1->type;
7486 if(op1->type)
7487 op1->type->refCount++;
7488 }
7489 return 0x1;
7490 }
7491
7492 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7493 {
7494 unsigned int value2 = op2->ui;
7495
7496 exp->type = 2;
7497 exp->string = PrintUInt(op1->ui >> value2);
7498 if(!exp->expType)
7499 {
7500 exp->expType = op1->type;
7501 if(op1->type)
7502 op1->type->refCount++;
7503 }
7504 return 0x1;
7505 }
7506
7507 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7508 {
7509 short value2 = op2->s;
7510
7511 exp->type = 2;
7512 exp->string = PrintShort(op1->s >> value2);
7513 if(!exp->expType)
7514 {
7515 exp->expType = op1->type;
7516 if(op1->type)
7517 op1->type->refCount++;
7518 }
7519 return 0x1;
7520 }
7521
7522 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7523 {
7524 unsigned short value2 = op2->us;
7525
7526 exp->type = 2;
7527 exp->string = PrintUShort(op1->us >> value2);
7528 if(!exp->expType)
7529 {
7530 exp->expType = op1->type;
7531 if(op1->type)
7532 op1->type->refCount++;
7533 }
7534 return 0x1;
7535 }
7536
7537 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7538 {
7539 char value2 = op2->c;
7540
7541 exp->type = 2;
7542 exp->string = PrintChar(op1->c >> value2);
7543 if(!exp->expType)
7544 {
7545 exp->expType = op1->type;
7546 if(op1->type)
7547 op1->type->refCount++;
7548 }
7549 return 0x1;
7550 }
7551
7552 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7553 {
7554 unsigned char value2 = op2->uc;
7555
7556 exp->type = 2;
7557 exp->string = PrintUChar(op1->uc >> value2);
7558 if(!exp->expType)
7559 {
7560 exp->expType = op1->type;
7561 if(op1->type)
7562 op1->type->refCount++;
7563 }
7564 return 0x1;
7565 }
7566
7567 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
7568 {
7569 exp->type = 2;
7570 exp->string = PrintInt(~op1->i);
7571 if(!exp->expType)
7572 {
7573 exp->expType = op1->type;
7574 if(op1->type)
7575 op1->type->refCount++;
7576 }
7577 return 0x1;
7578 }
7579
7580 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
7581 {
7582 exp->type = 2;
7583 exp->string = PrintUInt(~op1->ui);
7584 if(!exp->expType)
7585 {
7586 exp->expType = op1->type;
7587 if(op1->type)
7588 op1->type->refCount++;
7589 }
7590 return 0x1;
7591 }
7592
7593 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
7594 {
7595 exp->type = 2;
7596 exp->string = PrintShort(~op1->s);
7597 if(!exp->expType)
7598 {
7599 exp->expType = op1->type;
7600 if(op1->type)
7601 op1->type->refCount++;
7602 }
7603 return 0x1;
7604 }
7605
7606 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
7607 {
7608 exp->type = 2;
7609 exp->string = PrintUShort(~op1->us);
7610 if(!exp->expType)
7611 {
7612 exp->expType = op1->type;
7613 if(op1->type)
7614 op1->type->refCount++;
7615 }
7616 return 0x1;
7617 }
7618
7619 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
7620 {
7621 exp->type = 2;
7622 exp->string = PrintChar(~op1->c);
7623 if(!exp->expType)
7624 {
7625 exp->expType = op1->type;
7626 if(op1->type)
7627 op1->type->refCount++;
7628 }
7629 return 0x1;
7630 }
7631
7632 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
7633 {
7634 exp->type = 2;
7635 exp->string = PrintUChar(~op1->uc);
7636 if(!exp->expType)
7637 {
7638 exp->expType = op1->type;
7639 if(op1->type)
7640 op1->type->refCount++;
7641 }
7642 return 0x1;
7643 }
7644
7645 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7646 {
7647 int value2 = op2->i;
7648
7649 exp->type = 2;
7650 exp->string = PrintInt(op1->i &= value2);
7651 if(!exp->expType)
7652 {
7653 exp->expType = op1->type;
7654 if(op1->type)
7655 op1->type->refCount++;
7656 }
7657 return 0x1;
7658 }
7659
7660 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7661 {
7662 unsigned int value2 = op2->ui;
7663
7664 exp->type = 2;
7665 exp->string = PrintUInt(op1->ui &= value2);
7666 if(!exp->expType)
7667 {
7668 exp->expType = op1->type;
7669 if(op1->type)
7670 op1->type->refCount++;
7671 }
7672 return 0x1;
7673 }
7674
7675 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7676 {
7677 short value2 = op2->s;
7678
7679 exp->type = 2;
7680 exp->string = PrintShort(op1->s &= value2);
7681 if(!exp->expType)
7682 {
7683 exp->expType = op1->type;
7684 if(op1->type)
7685 op1->type->refCount++;
7686 }
7687 return 0x1;
7688 }
7689
7690 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7691 {
7692 unsigned short value2 = op2->us;
7693
7694 exp->type = 2;
7695 exp->string = PrintUShort(op1->us &= value2);
7696 if(!exp->expType)
7697 {
7698 exp->expType = op1->type;
7699 if(op1->type)
7700 op1->type->refCount++;
7701 }
7702 return 0x1;
7703 }
7704
7705 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7706 {
7707 char value2 = op2->c;
7708
7709 exp->type = 2;
7710 exp->string = PrintChar(op1->c &= value2);
7711 if(!exp->expType)
7712 {
7713 exp->expType = op1->type;
7714 if(op1->type)
7715 op1->type->refCount++;
7716 }
7717 return 0x1;
7718 }
7719
7720 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7721 {
7722 unsigned char value2 = op2->uc;
7723
7724 exp->type = 2;
7725 exp->string = PrintUChar(op1->uc &= value2);
7726 if(!exp->expType)
7727 {
7728 exp->expType = op1->type;
7729 if(op1->type)
7730 op1->type->refCount++;
7731 }
7732 return 0x1;
7733 }
7734
7735 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7736 {
7737 int value2 = op2->i;
7738
7739 exp->type = 2;
7740 exp->string = PrintInt(op1->i |= value2);
7741 if(!exp->expType)
7742 {
7743 exp->expType = op1->type;
7744 if(op1->type)
7745 op1->type->refCount++;
7746 }
7747 return 0x1;
7748 }
7749
7750 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7751 {
7752 unsigned int value2 = op2->ui;
7753
7754 exp->type = 2;
7755 exp->string = PrintUInt(op1->ui |= value2);
7756 if(!exp->expType)
7757 {
7758 exp->expType = op1->type;
7759 if(op1->type)
7760 op1->type->refCount++;
7761 }
7762 return 0x1;
7763 }
7764
7765 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7766 {
7767 short value2 = op2->s;
7768
7769 exp->type = 2;
7770 exp->string = PrintShort(op1->s |= value2);
7771 if(!exp->expType)
7772 {
7773 exp->expType = op1->type;
7774 if(op1->type)
7775 op1->type->refCount++;
7776 }
7777 return 0x1;
7778 }
7779
7780 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7781 {
7782 unsigned short value2 = op2->us;
7783
7784 exp->type = 2;
7785 exp->string = PrintUShort(op1->us |= value2);
7786 if(!exp->expType)
7787 {
7788 exp->expType = op1->type;
7789 if(op1->type)
7790 op1->type->refCount++;
7791 }
7792 return 0x1;
7793 }
7794
7795 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7796 {
7797 char value2 = op2->c;
7798
7799 exp->type = 2;
7800 exp->string = PrintChar(op1->c |= value2);
7801 if(!exp->expType)
7802 {
7803 exp->expType = op1->type;
7804 if(op1->type)
7805 op1->type->refCount++;
7806 }
7807 return 0x1;
7808 }
7809
7810 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7811 {
7812 unsigned char value2 = op2->uc;
7813
7814 exp->type = 2;
7815 exp->string = PrintUChar(op1->uc |= value2);
7816 if(!exp->expType)
7817 {
7818 exp->expType = op1->type;
7819 if(op1->type)
7820 op1->type->refCount++;
7821 }
7822 return 0x1;
7823 }
7824
7825 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7826 {
7827 int value2 = op2->i;
7828
7829 exp->type = 2;
7830 exp->string = PrintInt(op1->i ^= value2);
7831 if(!exp->expType)
7832 {
7833 exp->expType = op1->type;
7834 if(op1->type)
7835 op1->type->refCount++;
7836 }
7837 return 0x1;
7838 }
7839
7840 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7841 {
7842 unsigned int value2 = op2->ui;
7843
7844 exp->type = 2;
7845 exp->string = PrintUInt(op1->ui ^= value2);
7846 if(!exp->expType)
7847 {
7848 exp->expType = op1->type;
7849 if(op1->type)
7850 op1->type->refCount++;
7851 }
7852 return 0x1;
7853 }
7854
7855 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7856 {
7857 short value2 = op2->s;
7858
7859 exp->type = 2;
7860 exp->string = PrintShort(op1->s ^= value2);
7861 if(!exp->expType)
7862 {
7863 exp->expType = op1->type;
7864 if(op1->type)
7865 op1->type->refCount++;
7866 }
7867 return 0x1;
7868 }
7869
7870 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7871 {
7872 unsigned short value2 = op2->us;
7873
7874 exp->type = 2;
7875 exp->string = PrintUShort(op1->us ^= value2);
7876 if(!exp->expType)
7877 {
7878 exp->expType = op1->type;
7879 if(op1->type)
7880 op1->type->refCount++;
7881 }
7882 return 0x1;
7883 }
7884
7885 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7886 {
7887 char value2 = op2->c;
7888
7889 exp->type = 2;
7890 exp->string = PrintChar(op1->c ^= value2);
7891 if(!exp->expType)
7892 {
7893 exp->expType = op1->type;
7894 if(op1->type)
7895 op1->type->refCount++;
7896 }
7897 return 0x1;
7898 }
7899
7900 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7901 {
7902 unsigned char value2 = op2->uc;
7903
7904 exp->type = 2;
7905 exp->string = PrintUChar(op1->uc ^= value2);
7906 if(!exp->expType)
7907 {
7908 exp->expType = op1->type;
7909 if(op1->type)
7910 op1->type->refCount++;
7911 }
7912 return 0x1;
7913 }
7914
7915 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7916 {
7917 int value2 = op2->i;
7918
7919 exp->type = 2;
7920 exp->string = PrintInt(op1->i <<= value2);
7921 if(!exp->expType)
7922 {
7923 exp->expType = op1->type;
7924 if(op1->type)
7925 op1->type->refCount++;
7926 }
7927 return 0x1;
7928 }
7929
7930 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7931 {
7932 unsigned int value2 = op2->ui;
7933
7934 exp->type = 2;
7935 exp->string = PrintUInt(op1->ui <<= value2);
7936 if(!exp->expType)
7937 {
7938 exp->expType = op1->type;
7939 if(op1->type)
7940 op1->type->refCount++;
7941 }
7942 return 0x1;
7943 }
7944
7945 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7946 {
7947 short value2 = op2->s;
7948
7949 exp->type = 2;
7950 exp->string = PrintShort(op1->s <<= value2);
7951 if(!exp->expType)
7952 {
7953 exp->expType = op1->type;
7954 if(op1->type)
7955 op1->type->refCount++;
7956 }
7957 return 0x1;
7958 }
7959
7960 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7961 {
7962 unsigned short value2 = op2->us;
7963
7964 exp->type = 2;
7965 exp->string = PrintUShort(op1->us <<= value2);
7966 if(!exp->expType)
7967 {
7968 exp->expType = op1->type;
7969 if(op1->type)
7970 op1->type->refCount++;
7971 }
7972 return 0x1;
7973 }
7974
7975 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7976 {
7977 char value2 = op2->c;
7978
7979 exp->type = 2;
7980 exp->string = PrintChar(op1->c <<= value2);
7981 if(!exp->expType)
7982 {
7983 exp->expType = op1->type;
7984 if(op1->type)
7985 op1->type->refCount++;
7986 }
7987 return 0x1;
7988 }
7989
7990 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7991 {
7992 unsigned char value2 = op2->uc;
7993
7994 exp->type = 2;
7995 exp->string = PrintUChar(op1->uc <<= value2);
7996 if(!exp->expType)
7997 {
7998 exp->expType = op1->type;
7999 if(op1->type)
8000 op1->type->refCount++;
8001 }
8002 return 0x1;
8003 }
8004
8005 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8006 {
8007 int value2 = op2->i;
8008
8009 exp->type = 2;
8010 exp->string = PrintInt(op1->i >>= value2);
8011 if(!exp->expType)
8012 {
8013 exp->expType = op1->type;
8014 if(op1->type)
8015 op1->type->refCount++;
8016 }
8017 return 0x1;
8018 }
8019
8020 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8021 {
8022 unsigned int value2 = op2->ui;
8023
8024 exp->type = 2;
8025 exp->string = PrintUInt(op1->ui >>= value2);
8026 if(!exp->expType)
8027 {
8028 exp->expType = op1->type;
8029 if(op1->type)
8030 op1->type->refCount++;
8031 }
8032 return 0x1;
8033 }
8034
8035 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8036 {
8037 short value2 = op2->s;
8038
8039 exp->type = 2;
8040 exp->string = PrintShort(op1->s >>= value2);
8041 if(!exp->expType)
8042 {
8043 exp->expType = op1->type;
8044 if(op1->type)
8045 op1->type->refCount++;
8046 }
8047 return 0x1;
8048 }
8049
8050 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8051 {
8052 unsigned short value2 = op2->us;
8053
8054 exp->type = 2;
8055 exp->string = PrintUShort(op1->us >>= value2);
8056 if(!exp->expType)
8057 {
8058 exp->expType = op1->type;
8059 if(op1->type)
8060 op1->type->refCount++;
8061 }
8062 return 0x1;
8063 }
8064
8065 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8066 {
8067 char value2 = op2->c;
8068
8069 exp->type = 2;
8070 exp->string = PrintChar(op1->c >>= value2);
8071 if(!exp->expType)
8072 {
8073 exp->expType = op1->type;
8074 if(op1->type)
8075 op1->type->refCount++;
8076 }
8077 return 0x1;
8078 }
8079
8080 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8081 {
8082 unsigned char value2 = op2->uc;
8083
8084 exp->type = 2;
8085 exp->string = PrintUChar(op1->uc >>= value2);
8086 if(!exp->expType)
8087 {
8088 exp->expType = op1->type;
8089 if(op1->type)
8090 op1->type->refCount++;
8091 }
8092 return 0x1;
8093 }
8094
8095 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
8096 {
8097 exp->type = 2;
8098 exp->string = PrintInt(!op1->i);
8099 if(!exp->expType)
8100 {
8101 exp->expType = op1->type;
8102 if(op1->type)
8103 op1->type->refCount++;
8104 }
8105 return 0x1;
8106 }
8107
8108 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
8109 {
8110 exp->type = 2;
8111 exp->string = PrintUInt(!op1->ui);
8112 if(!exp->expType)
8113 {
8114 exp->expType = op1->type;
8115 if(op1->type)
8116 op1->type->refCount++;
8117 }
8118 return 0x1;
8119 }
8120
8121 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
8122 {
8123 exp->type = 2;
8124 exp->string = PrintShort(!op1->s);
8125 if(!exp->expType)
8126 {
8127 exp->expType = op1->type;
8128 if(op1->type)
8129 op1->type->refCount++;
8130 }
8131 return 0x1;
8132 }
8133
8134 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
8135 {
8136 exp->type = 2;
8137 exp->string = PrintUShort(!op1->us);
8138 if(!exp->expType)
8139 {
8140 exp->expType = op1->type;
8141 if(op1->type)
8142 op1->type->refCount++;
8143 }
8144 return 0x1;
8145 }
8146
8147 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
8148 {
8149 exp->type = 2;
8150 exp->string = PrintChar(!op1->c);
8151 if(!exp->expType)
8152 {
8153 exp->expType = op1->type;
8154 if(op1->type)
8155 op1->type->refCount++;
8156 }
8157 return 0x1;
8158 }
8159
8160 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
8161 {
8162 exp->type = 2;
8163 exp->string = PrintUChar(!op1->uc);
8164 if(!exp->expType)
8165 {
8166 exp->expType = op1->type;
8167 if(op1->type)
8168 op1->type->refCount++;
8169 }
8170 return 0x1;
8171 }
8172
8173 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8174 {
8175 int value2 = op2->i;
8176
8177 exp->type = 2;
8178 exp->string = PrintInt(op1->i == value2);
8179 if(!exp->expType)
8180 {
8181 exp->expType = op1->type;
8182 if(op1->type)
8183 op1->type->refCount++;
8184 }
8185 return 0x1;
8186 }
8187
8188 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8189 {
8190 unsigned int value2 = op2->ui;
8191
8192 exp->type = 2;
8193 exp->string = PrintUInt(op1->ui == value2);
8194 if(!exp->expType)
8195 {
8196 exp->expType = op1->type;
8197 if(op1->type)
8198 op1->type->refCount++;
8199 }
8200 return 0x1;
8201 }
8202
8203 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8204 {
8205 short value2 = op2->s;
8206
8207 exp->type = 2;
8208 exp->string = PrintShort(op1->s == value2);
8209 if(!exp->expType)
8210 {
8211 exp->expType = op1->type;
8212 if(op1->type)
8213 op1->type->refCount++;
8214 }
8215 return 0x1;
8216 }
8217
8218 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8219 {
8220 unsigned short value2 = op2->us;
8221
8222 exp->type = 2;
8223 exp->string = PrintUShort(op1->us == value2);
8224 if(!exp->expType)
8225 {
8226 exp->expType = op1->type;
8227 if(op1->type)
8228 op1->type->refCount++;
8229 }
8230 return 0x1;
8231 }
8232
8233 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8234 {
8235 char value2 = op2->c;
8236
8237 exp->type = 2;
8238 exp->string = PrintChar(op1->c == value2);
8239 if(!exp->expType)
8240 {
8241 exp->expType = op1->type;
8242 if(op1->type)
8243 op1->type->refCount++;
8244 }
8245 return 0x1;
8246 }
8247
8248 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8249 {
8250 unsigned char value2 = op2->uc;
8251
8252 exp->type = 2;
8253 exp->string = PrintUChar(op1->uc == value2);
8254 if(!exp->expType)
8255 {
8256 exp->expType = op1->type;
8257 if(op1->type)
8258 op1->type->refCount++;
8259 }
8260 return 0x1;
8261 }
8262
8263 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8264 {
8265 float value2 = op2->f;
8266
8267 exp->type = 2;
8268 exp->string = PrintFloat(op1->f == value2);
8269 if(!exp->expType)
8270 {
8271 exp->expType = op1->type;
8272 if(op1->type)
8273 op1->type->refCount++;
8274 }
8275 return 0x1;
8276 }
8277
8278 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8279 {
8280 double value2 = op2->d;
8281
8282 exp->type = 2;
8283 exp->string = PrintDouble(op1->d == value2);
8284 if(!exp->expType)
8285 {
8286 exp->expType = op1->type;
8287 if(op1->type)
8288 op1->type->refCount++;
8289 }
8290 return 0x1;
8291 }
8292
8293 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8294 {
8295 int value2 = op2->i;
8296
8297 exp->type = 2;
8298 exp->string = PrintInt(op1->i != value2);
8299 if(!exp->expType)
8300 {
8301 exp->expType = op1->type;
8302 if(op1->type)
8303 op1->type->refCount++;
8304 }
8305 return 0x1;
8306 }
8307
8308 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8309 {
8310 unsigned int value2 = op2->ui;
8311
8312 exp->type = 2;
8313 exp->string = PrintUInt(op1->ui != value2);
8314 if(!exp->expType)
8315 {
8316 exp->expType = op1->type;
8317 if(op1->type)
8318 op1->type->refCount++;
8319 }
8320 return 0x1;
8321 }
8322
8323 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8324 {
8325 short value2 = op2->s;
8326
8327 exp->type = 2;
8328 exp->string = PrintShort(op1->s != value2);
8329 if(!exp->expType)
8330 {
8331 exp->expType = op1->type;
8332 if(op1->type)
8333 op1->type->refCount++;
8334 }
8335 return 0x1;
8336 }
8337
8338 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8339 {
8340 unsigned short value2 = op2->us;
8341
8342 exp->type = 2;
8343 exp->string = PrintUShort(op1->us != value2);
8344 if(!exp->expType)
8345 {
8346 exp->expType = op1->type;
8347 if(op1->type)
8348 op1->type->refCount++;
8349 }
8350 return 0x1;
8351 }
8352
8353 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8354 {
8355 char value2 = op2->c;
8356
8357 exp->type = 2;
8358 exp->string = PrintChar(op1->c != value2);
8359 if(!exp->expType)
8360 {
8361 exp->expType = op1->type;
8362 if(op1->type)
8363 op1->type->refCount++;
8364 }
8365 return 0x1;
8366 }
8367
8368 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8369 {
8370 unsigned char value2 = op2->uc;
8371
8372 exp->type = 2;
8373 exp->string = PrintUChar(op1->uc != value2);
8374 if(!exp->expType)
8375 {
8376 exp->expType = op1->type;
8377 if(op1->type)
8378 op1->type->refCount++;
8379 }
8380 return 0x1;
8381 }
8382
8383 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8384 {
8385 float value2 = op2->f;
8386
8387 exp->type = 2;
8388 exp->string = PrintFloat(op1->f != value2);
8389 if(!exp->expType)
8390 {
8391 exp->expType = op1->type;
8392 if(op1->type)
8393 op1->type->refCount++;
8394 }
8395 return 0x1;
8396 }
8397
8398 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8399 {
8400 double value2 = op2->d;
8401
8402 exp->type = 2;
8403 exp->string = PrintDouble(op1->d != value2);
8404 if(!exp->expType)
8405 {
8406 exp->expType = op1->type;
8407 if(op1->type)
8408 op1->type->refCount++;
8409 }
8410 return 0x1;
8411 }
8412
8413 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8414 {
8415 int value2 = op2->i;
8416
8417 exp->type = 2;
8418 exp->string = PrintInt(op1->i && value2);
8419 if(!exp->expType)
8420 {
8421 exp->expType = op1->type;
8422 if(op1->type)
8423 op1->type->refCount++;
8424 }
8425 return 0x1;
8426 }
8427
8428 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8429 {
8430 unsigned int value2 = op2->ui;
8431
8432 exp->type = 2;
8433 exp->string = PrintUInt(op1->ui && value2);
8434 if(!exp->expType)
8435 {
8436 exp->expType = op1->type;
8437 if(op1->type)
8438 op1->type->refCount++;
8439 }
8440 return 0x1;
8441 }
8442
8443 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8444 {
8445 short value2 = op2->s;
8446
8447 exp->type = 2;
8448 exp->string = PrintShort(op1->s && value2);
8449 if(!exp->expType)
8450 {
8451 exp->expType = op1->type;
8452 if(op1->type)
8453 op1->type->refCount++;
8454 }
8455 return 0x1;
8456 }
8457
8458 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8459 {
8460 unsigned short value2 = op2->us;
8461
8462 exp->type = 2;
8463 exp->string = PrintUShort(op1->us && value2);
8464 if(!exp->expType)
8465 {
8466 exp->expType = op1->type;
8467 if(op1->type)
8468 op1->type->refCount++;
8469 }
8470 return 0x1;
8471 }
8472
8473 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8474 {
8475 char value2 = op2->c;
8476
8477 exp->type = 2;
8478 exp->string = PrintChar(op1->c && value2);
8479 if(!exp->expType)
8480 {
8481 exp->expType = op1->type;
8482 if(op1->type)
8483 op1->type->refCount++;
8484 }
8485 return 0x1;
8486 }
8487
8488 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8489 {
8490 unsigned char value2 = op2->uc;
8491
8492 exp->type = 2;
8493 exp->string = PrintUChar(op1->uc && value2);
8494 if(!exp->expType)
8495 {
8496 exp->expType = op1->type;
8497 if(op1->type)
8498 op1->type->refCount++;
8499 }
8500 return 0x1;
8501 }
8502
8503 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8504 {
8505 float value2 = op2->f;
8506
8507 exp->type = 2;
8508 exp->string = PrintFloat(op1->f && value2);
8509 if(!exp->expType)
8510 {
8511 exp->expType = op1->type;
8512 if(op1->type)
8513 op1->type->refCount++;
8514 }
8515 return 0x1;
8516 }
8517
8518 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8519 {
8520 double value2 = op2->d;
8521
8522 exp->type = 2;
8523 exp->string = PrintDouble(op1->d && value2);
8524 if(!exp->expType)
8525 {
8526 exp->expType = op1->type;
8527 if(op1->type)
8528 op1->type->refCount++;
8529 }
8530 return 0x1;
8531 }
8532
8533 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8534 {
8535 int value2 = op2->i;
8536
8537 exp->type = 2;
8538 exp->string = PrintInt(op1->i || value2);
8539 if(!exp->expType)
8540 {
8541 exp->expType = op1->type;
8542 if(op1->type)
8543 op1->type->refCount++;
8544 }
8545 return 0x1;
8546 }
8547
8548 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8549 {
8550 unsigned int value2 = op2->ui;
8551
8552 exp->type = 2;
8553 exp->string = PrintUInt(op1->ui || value2);
8554 if(!exp->expType)
8555 {
8556 exp->expType = op1->type;
8557 if(op1->type)
8558 op1->type->refCount++;
8559 }
8560 return 0x1;
8561 }
8562
8563 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8564 {
8565 short value2 = op2->s;
8566
8567 exp->type = 2;
8568 exp->string = PrintShort(op1->s || value2);
8569 if(!exp->expType)
8570 {
8571 exp->expType = op1->type;
8572 if(op1->type)
8573 op1->type->refCount++;
8574 }
8575 return 0x1;
8576 }
8577
8578 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8579 {
8580 unsigned short value2 = op2->us;
8581
8582 exp->type = 2;
8583 exp->string = PrintUShort(op1->us || value2);
8584 if(!exp->expType)
8585 {
8586 exp->expType = op1->type;
8587 if(op1->type)
8588 op1->type->refCount++;
8589 }
8590 return 0x1;
8591 }
8592
8593 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8594 {
8595 char value2 = op2->c;
8596
8597 exp->type = 2;
8598 exp->string = PrintChar(op1->c || value2);
8599 if(!exp->expType)
8600 {
8601 exp->expType = op1->type;
8602 if(op1->type)
8603 op1->type->refCount++;
8604 }
8605 return 0x1;
8606 }
8607
8608 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8609 {
8610 unsigned char value2 = op2->uc;
8611
8612 exp->type = 2;
8613 exp->string = PrintUChar(op1->uc || value2);
8614 if(!exp->expType)
8615 {
8616 exp->expType = op1->type;
8617 if(op1->type)
8618 op1->type->refCount++;
8619 }
8620 return 0x1;
8621 }
8622
8623 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8624 {
8625 float value2 = op2->f;
8626
8627 exp->type = 2;
8628 exp->string = PrintFloat(op1->f || value2);
8629 if(!exp->expType)
8630 {
8631 exp->expType = op1->type;
8632 if(op1->type)
8633 op1->type->refCount++;
8634 }
8635 return 0x1;
8636 }
8637
8638 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8639 {
8640 double value2 = op2->d;
8641
8642 exp->type = 2;
8643 exp->string = PrintDouble(op1->d || value2);
8644 if(!exp->expType)
8645 {
8646 exp->expType = op1->type;
8647 if(op1->type)
8648 op1->type->refCount++;
8649 }
8650 return 0x1;
8651 }
8652
8653 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8654 {
8655 int value2 = op2->i;
8656
8657 exp->type = 2;
8658 exp->string = PrintInt(op1->i > value2);
8659 if(!exp->expType)
8660 {
8661 exp->expType = op1->type;
8662 if(op1->type)
8663 op1->type->refCount++;
8664 }
8665 return 0x1;
8666 }
8667
8668 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8669 {
8670 unsigned int value2 = op2->ui;
8671
8672 exp->type = 2;
8673 exp->string = PrintUInt(op1->ui > value2);
8674 if(!exp->expType)
8675 {
8676 exp->expType = op1->type;
8677 if(op1->type)
8678 op1->type->refCount++;
8679 }
8680 return 0x1;
8681 }
8682
8683 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8684 {
8685 short value2 = op2->s;
8686
8687 exp->type = 2;
8688 exp->string = PrintShort(op1->s > value2);
8689 if(!exp->expType)
8690 {
8691 exp->expType = op1->type;
8692 if(op1->type)
8693 op1->type->refCount++;
8694 }
8695 return 0x1;
8696 }
8697
8698 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8699 {
8700 unsigned short value2 = op2->us;
8701
8702 exp->type = 2;
8703 exp->string = PrintUShort(op1->us > value2);
8704 if(!exp->expType)
8705 {
8706 exp->expType = op1->type;
8707 if(op1->type)
8708 op1->type->refCount++;
8709 }
8710 return 0x1;
8711 }
8712
8713 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8714 {
8715 char value2 = op2->c;
8716
8717 exp->type = 2;
8718 exp->string = PrintChar(op1->c > value2);
8719 if(!exp->expType)
8720 {
8721 exp->expType = op1->type;
8722 if(op1->type)
8723 op1->type->refCount++;
8724 }
8725 return 0x1;
8726 }
8727
8728 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8729 {
8730 unsigned char value2 = op2->uc;
8731
8732 exp->type = 2;
8733 exp->string = PrintUChar(op1->uc > value2);
8734 if(!exp->expType)
8735 {
8736 exp->expType = op1->type;
8737 if(op1->type)
8738 op1->type->refCount++;
8739 }
8740 return 0x1;
8741 }
8742
8743 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8744 {
8745 float value2 = op2->f;
8746
8747 exp->type = 2;
8748 exp->string = PrintFloat(op1->f > value2);
8749 if(!exp->expType)
8750 {
8751 exp->expType = op1->type;
8752 if(op1->type)
8753 op1->type->refCount++;
8754 }
8755 return 0x1;
8756 }
8757
8758 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8759 {
8760 double value2 = op2->d;
8761
8762 exp->type = 2;
8763 exp->string = PrintDouble(op1->d > value2);
8764 if(!exp->expType)
8765 {
8766 exp->expType = op1->type;
8767 if(op1->type)
8768 op1->type->refCount++;
8769 }
8770 return 0x1;
8771 }
8772
8773 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8774 {
8775 int value2 = op2->i;
8776
8777 exp->type = 2;
8778 exp->string = PrintInt(op1->i < value2);
8779 if(!exp->expType)
8780 {
8781 exp->expType = op1->type;
8782 if(op1->type)
8783 op1->type->refCount++;
8784 }
8785 return 0x1;
8786 }
8787
8788 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8789 {
8790 unsigned int value2 = op2->ui;
8791
8792 exp->type = 2;
8793 exp->string = PrintUInt(op1->ui < value2);
8794 if(!exp->expType)
8795 {
8796 exp->expType = op1->type;
8797 if(op1->type)
8798 op1->type->refCount++;
8799 }
8800 return 0x1;
8801 }
8802
8803 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8804 {
8805 short value2 = op2->s;
8806
8807 exp->type = 2;
8808 exp->string = PrintShort(op1->s < value2);
8809 if(!exp->expType)
8810 {
8811 exp->expType = op1->type;
8812 if(op1->type)
8813 op1->type->refCount++;
8814 }
8815 return 0x1;
8816 }
8817
8818 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8819 {
8820 unsigned short value2 = op2->us;
8821
8822 exp->type = 2;
8823 exp->string = PrintUShort(op1->us < value2);
8824 if(!exp->expType)
8825 {
8826 exp->expType = op1->type;
8827 if(op1->type)
8828 op1->type->refCount++;
8829 }
8830 return 0x1;
8831 }
8832
8833 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8834 {
8835 char value2 = op2->c;
8836
8837 exp->type = 2;
8838 exp->string = PrintChar(op1->c < value2);
8839 if(!exp->expType)
8840 {
8841 exp->expType = op1->type;
8842 if(op1->type)
8843 op1->type->refCount++;
8844 }
8845 return 0x1;
8846 }
8847
8848 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8849 {
8850 unsigned char value2 = op2->uc;
8851
8852 exp->type = 2;
8853 exp->string = PrintUChar(op1->uc < value2);
8854 if(!exp->expType)
8855 {
8856 exp->expType = op1->type;
8857 if(op1->type)
8858 op1->type->refCount++;
8859 }
8860 return 0x1;
8861 }
8862
8863 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8864 {
8865 float value2 = op2->f;
8866
8867 exp->type = 2;
8868 exp->string = PrintFloat(op1->f < value2);
8869 if(!exp->expType)
8870 {
8871 exp->expType = op1->type;
8872 if(op1->type)
8873 op1->type->refCount++;
8874 }
8875 return 0x1;
8876 }
8877
8878 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8879 {
8880 double value2 = op2->d;
8881
8882 exp->type = 2;
8883 exp->string = PrintDouble(op1->d < value2);
8884 if(!exp->expType)
8885 {
8886 exp->expType = op1->type;
8887 if(op1->type)
8888 op1->type->refCount++;
8889 }
8890 return 0x1;
8891 }
8892
8893 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8894 {
8895 int value2 = op2->i;
8896
8897 exp->type = 2;
8898 exp->string = PrintInt(op1->i >= value2);
8899 if(!exp->expType)
8900 {
8901 exp->expType = op1->type;
8902 if(op1->type)
8903 op1->type->refCount++;
8904 }
8905 return 0x1;
8906 }
8907
8908 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8909 {
8910 unsigned int value2 = op2->ui;
8911
8912 exp->type = 2;
8913 exp->string = PrintUInt(op1->ui >= value2);
8914 if(!exp->expType)
8915 {
8916 exp->expType = op1->type;
8917 if(op1->type)
8918 op1->type->refCount++;
8919 }
8920 return 0x1;
8921 }
8922
8923 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8924 {
8925 short value2 = op2->s;
8926
8927 exp->type = 2;
8928 exp->string = PrintShort(op1->s >= value2);
8929 if(!exp->expType)
8930 {
8931 exp->expType = op1->type;
8932 if(op1->type)
8933 op1->type->refCount++;
8934 }
8935 return 0x1;
8936 }
8937
8938 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8939 {
8940 unsigned short value2 = op2->us;
8941
8942 exp->type = 2;
8943 exp->string = PrintUShort(op1->us >= value2);
8944 if(!exp->expType)
8945 {
8946 exp->expType = op1->type;
8947 if(op1->type)
8948 op1->type->refCount++;
8949 }
8950 return 0x1;
8951 }
8952
8953 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8954 {
8955 char value2 = op2->c;
8956
8957 exp->type = 2;
8958 exp->string = PrintChar(op1->c >= value2);
8959 if(!exp->expType)
8960 {
8961 exp->expType = op1->type;
8962 if(op1->type)
8963 op1->type->refCount++;
8964 }
8965 return 0x1;
8966 }
8967
8968 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8969 {
8970 unsigned char value2 = op2->uc;
8971
8972 exp->type = 2;
8973 exp->string = PrintUChar(op1->uc >= value2);
8974 if(!exp->expType)
8975 {
8976 exp->expType = op1->type;
8977 if(op1->type)
8978 op1->type->refCount++;
8979 }
8980 return 0x1;
8981 }
8982
8983 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8984 {
8985 float value2 = op2->f;
8986
8987 exp->type = 2;
8988 exp->string = PrintFloat(op1->f >= value2);
8989 if(!exp->expType)
8990 {
8991 exp->expType = op1->type;
8992 if(op1->type)
8993 op1->type->refCount++;
8994 }
8995 return 0x1;
8996 }
8997
8998 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8999 {
9000 double value2 = op2->d;
9001
9002 exp->type = 2;
9003 exp->string = PrintDouble(op1->d >= value2);
9004 if(!exp->expType)
9005 {
9006 exp->expType = op1->type;
9007 if(op1->type)
9008 op1->type->refCount++;
9009 }
9010 return 0x1;
9011 }
9012
9013 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9014 {
9015 int value2 = op2->i;
9016
9017 exp->type = 2;
9018 exp->string = PrintInt(op1->i <= value2);
9019 if(!exp->expType)
9020 {
9021 exp->expType = op1->type;
9022 if(op1->type)
9023 op1->type->refCount++;
9024 }
9025 return 0x1;
9026 }
9027
9028 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9029 {
9030 unsigned int value2 = op2->ui;
9031
9032 exp->type = 2;
9033 exp->string = PrintUInt(op1->ui <= value2);
9034 if(!exp->expType)
9035 {
9036 exp->expType = op1->type;
9037 if(op1->type)
9038 op1->type->refCount++;
9039 }
9040 return 0x1;
9041 }
9042
9043 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9044 {
9045 short value2 = op2->s;
9046
9047 exp->type = 2;
9048 exp->string = PrintShort(op1->s <= value2);
9049 if(!exp->expType)
9050 {
9051 exp->expType = op1->type;
9052 if(op1->type)
9053 op1->type->refCount++;
9054 }
9055 return 0x1;
9056 }
9057
9058 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9059 {
9060 unsigned short value2 = op2->us;
9061
9062 exp->type = 2;
9063 exp->string = PrintUShort(op1->us <= value2);
9064 if(!exp->expType)
9065 {
9066 exp->expType = op1->type;
9067 if(op1->type)
9068 op1->type->refCount++;
9069 }
9070 return 0x1;
9071 }
9072
9073 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9074 {
9075 char value2 = op2->c;
9076
9077 exp->type = 2;
9078 exp->string = PrintChar(op1->c <= value2);
9079 if(!exp->expType)
9080 {
9081 exp->expType = op1->type;
9082 if(op1->type)
9083 op1->type->refCount++;
9084 }
9085 return 0x1;
9086 }
9087
9088 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9089 {
9090 unsigned char value2 = op2->uc;
9091
9092 exp->type = 2;
9093 exp->string = PrintUChar(op1->uc <= value2);
9094 if(!exp->expType)
9095 {
9096 exp->expType = op1->type;
9097 if(op1->type)
9098 op1->type->refCount++;
9099 }
9100 return 0x1;
9101 }
9102
9103 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9104 {
9105 float value2 = op2->f;
9106
9107 exp->type = 2;
9108 exp->string = PrintFloat(op1->f <= value2);
9109 if(!exp->expType)
9110 {
9111 exp->expType = op1->type;
9112 if(op1->type)
9113 op1->type->refCount++;
9114 }
9115 return 0x1;
9116 }
9117
9118 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9119 {
9120 double value2 = op2->d;
9121
9122 exp->type = 2;
9123 exp->string = PrintDouble(op1->d <= value2);
9124 if(!exp->expType)
9125 {
9126 exp->expType = op1->type;
9127 if(op1->type)
9128 op1->type->refCount++;
9129 }
9130 return 0x1;
9131 }
9132
9133 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9134 {
9135 exp->type = 2;
9136 exp->string = PrintInt(op1->i ? op2->i : op3->i);
9137 if(!exp->expType)
9138 {
9139 exp->expType = op1->type;
9140 if(op1->type)
9141 op1->type->refCount++;
9142 }
9143 return 0x1;
9144 }
9145
9146 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9147 {
9148 exp->type = 2;
9149 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
9150 if(!exp->expType)
9151 {
9152 exp->expType = op1->type;
9153 if(op1->type)
9154 op1->type->refCount++;
9155 }
9156 return 0x1;
9157 }
9158
9159 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9160 {
9161 exp->type = 2;
9162 exp->string = PrintShort(op1->s ? op2->s : op3->s);
9163 if(!exp->expType)
9164 {
9165 exp->expType = op1->type;
9166 if(op1->type)
9167 op1->type->refCount++;
9168 }
9169 return 0x1;
9170 }
9171
9172 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9173 {
9174 exp->type = 2;
9175 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
9176 if(!exp->expType)
9177 {
9178 exp->expType = op1->type;
9179 if(op1->type)
9180 op1->type->refCount++;
9181 }
9182 return 0x1;
9183 }
9184
9185 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9186 {
9187 exp->type = 2;
9188 exp->string = PrintChar(op1->c ? op2->c : op3->c);
9189 if(!exp->expType)
9190 {
9191 exp->expType = op1->type;
9192 if(op1->type)
9193 op1->type->refCount++;
9194 }
9195 return 0x1;
9196 }
9197
9198 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9199 {
9200 exp->type = 2;
9201 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
9202 if(!exp->expType)
9203 {
9204 exp->expType = op1->type;
9205 if(op1->type)
9206 op1->type->refCount++;
9207 }
9208 return 0x1;
9209 }
9210
9211 static unsigned int FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9212 {
9213 exp->type = 2;
9214 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
9215 if(!exp->expType)
9216 {
9217 exp->expType = op1->type;
9218 if(op1->type)
9219 op1->type->refCount++;
9220 }
9221 return 0x1;
9222 }
9223
9224 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9225 {
9226 exp->type = 2;
9227 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
9228 if(!exp->expType)
9229 {
9230 exp->expType = op1->type;
9231 if(op1->type)
9232 op1->type->refCount++;
9233 }
9234 return 0x1;
9235 }
9236
9237 struct OpTable intOps = 
9238 {
9239 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
9240 };
9241
9242 struct OpTable uintOps = 
9243 {
9244 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
9245 };
9246
9247 struct OpTable shortOps = 
9248 {
9249 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
9250 };
9251
9252 struct OpTable ushortOps = 
9253 {
9254 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
9255 };
9256
9257 struct OpTable floatOps = 
9258 {
9259 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
9260 };
9261
9262 struct OpTable doubleOps = 
9263 {
9264 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
9265 };
9266
9267 struct OpTable charOps = 
9268 {
9269 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
9270 };
9271
9272 struct OpTable ucharOps = 
9273 {
9274 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
9275 };
9276
9277 void ReadString(char * output, char * string)
9278 {
9279 int len = strlen(string);
9280 int c, d = 0;
9281 unsigned int quoted = 0x0, escaped = 0x0;
9282
9283 for(c = 0; c < len; c++)
9284 {
9285 char ch = string[c];
9286
9287 if(escaped)
9288 {
9289 switch(ch)
9290 {
9291 case 'n':
9292 output[d] = '\n';
9293 break;
9294 case 't':
9295 output[d] = '\t';
9296 break;
9297 case 'a':
9298 output[d] = '\a';
9299 break;
9300 case 'b':
9301 output[d] = '\b';
9302 break;
9303 case 'f':
9304 output[d] = '\f';
9305 break;
9306 case 'r':
9307 output[d] = '\r';
9308 break;
9309 case 'v':
9310 output[d] = '\v';
9311 break;
9312 case '\\':
9313 output[d] = '\\';
9314 break;
9315 case '\"':
9316 output[d] = '\"';
9317 break;
9318 default:
9319 output[d++] = '\\';
9320 output[d] = ch;
9321 }
9322 d++;
9323 escaped = 0x0;
9324 }
9325 else
9326 {
9327 if(ch == '\"')
9328 quoted ^= 0x1;
9329 else if(quoted)
9330 {
9331 if(ch == '\\')
9332 escaped = 0x1;
9333 else
9334 output[d++] = ch;
9335 }
9336 }
9337 }
9338 output[d] = '\0';
9339 }
9340
9341 extern long long __ecereNameSpace__ecere__com___strtoi64(char *  string, char * *  endString, int base);
9342
9343 extern uint64 __ecereNameSpace__ecere__com___strtoui64(char *  string, char * *  endString, int base);
9344
9345 extern double strtod(char * , char * * );
9346
9347 struct Operand GetOperand(struct Expression * exp)
9348 {
9349 struct Operand op = 
9350 {
9351 0, 0, 0, 0, 
9352 {
9353 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
9354 }
9355 };
9356 struct Type * type = exp->expType;
9357
9358 if(type)
9359 {
9360 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9361 {
9362 if(!type->_class->registered->dataType)
9363 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9364 type = type->_class->registered->dataType;
9365 }
9366 op.kind = type->kind;
9367 op.type = exp->expType;
9368 if(exp->isConstant && exp->type == 2)
9369 {
9370 switch(op.kind)
9371 {
9372 case 1:
9373 {
9374 if(exp->constant[0] == '\'')
9375 op.c = exp->constant[1];
9376 else if(type->isSigned)
9377 {
9378 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9379 op.ops = charOps;
9380 }
9381 else
9382 {
9383 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9384 op.ops = ucharOps;
9385 }
9386 break;
9387 }
9388 case 2:
9389 if(type->isSigned)
9390 {
9391 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9392 op.ops = shortOps;
9393 }
9394 else
9395 {
9396 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9397 op.ops = ushortOps;
9398 }
9399 break;
9400 case 3:
9401 case 5:
9402 if(type->isSigned)
9403 {
9404 op.i = strtol(exp->constant, (((void *)0)), 0);
9405 op.ops = intOps;
9406 }
9407 else
9408 {
9409 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9410 op.ops = uintOps;
9411 }
9412 op.kind = 3;
9413 break;
9414 case 4:
9415 if(type->isSigned)
9416 {
9417 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9418 op.ops = intOps;
9419 }
9420 else
9421 {
9422 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9423 op.ops = uintOps;
9424 }
9425 op.kind = 3;
9426 break;
9427 case 22:
9428 if(type->isSigned)
9429 {
9430 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9431 op.ops = intOps;
9432 }
9433 else
9434 {
9435 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9436 op.ops = uintOps;
9437 }
9438 op.kind = 3;
9439 break;
9440 case 23:
9441 if(type->isSigned)
9442 {
9443 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9444 op.ops = intOps;
9445 }
9446 else
9447 {
9448 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9449 op.ops = uintOps;
9450 }
9451 op.kind = 3;
9452 break;
9453 case 6:
9454 op.f = (float)strtod(exp->constant, (((void *)0)));
9455 op.ops = floatOps;
9456 break;
9457 case 7:
9458 op.d = (double)strtod(exp->constant, (((void *)0)));
9459 op.ops = doubleOps;
9460 break;
9461 case 12:
9462 case 13:
9463 case 8:
9464 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9465 op.kind = 13;
9466 op.ops = uintOps;
9467 break;
9468 }
9469 }
9470 }
9471 return op;
9472 }
9473
9474 int __ecereVMethodID_class_OnGetString;
9475
9476 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9477
9478 static void UnusedFunction()
9479 {
9480 int a;
9481
9482 ((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);
9483 }
9484
9485 extern int __ecereVMethodID_class_OnGetString;
9486
9487 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9488 {
9489 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9490
9491 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9492 {
9493 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9494 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9495 else
9496 {
9497 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9498 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9499 struct Type * type;
9500 void * ptr = inst->data + dataMember->offset + offset;
9501 char * result = (((void *)0));
9502
9503 exp->loc = member->loc = inst->loc;
9504 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9505 if(!dataMember->dataType)
9506 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9507 type = dataMember->dataType;
9508 if(type->kind == 8)
9509 {
9510 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9511
9512 if(_class->type == 4)
9513 {
9514 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9515
9516 if(enumClass)
9517 {
9518 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9519 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9520
9521 for(item = e->values.first; item; item = item->next)
9522 {
9523 if((int)item->data == *(int *)ptr)
9524 {
9525 result = item->name;
9526 break;
9527 }
9528 }
9529 if(result)
9530 {
9531 exp->identifier = MkIdentifier(result);
9532 exp->type = 0;
9533 exp->destType = MkClassType(_class->fullName);
9534 ProcessExpressionType(exp);
9535 }
9536 }
9537 }
9538 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9539 {
9540 if(!_class->dataType)
9541 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9542 type = _class->dataType;
9543 }
9544 }
9545 if(!result)
9546 {
9547 switch(type->kind)
9548 {
9549 case 6:
9550 {
9551 FreeExpContents(exp);
9552 exp->constant = PrintFloat(*(float *)ptr);
9553 exp->type = 2;
9554 break;
9555 }
9556 case 7:
9557 {
9558 FreeExpContents(exp);
9559 exp->constant = PrintDouble(*(double *)ptr);
9560 exp->type = 2;
9561 break;
9562 }
9563 case 3:
9564 {
9565 FreeExpContents(exp);
9566 exp->constant = PrintInt(*(int *)ptr);
9567 exp->type = 2;
9568 break;
9569 }
9570 case 4:
9571 {
9572 FreeExpContents(exp);
9573 exp->constant = PrintInt64(*(long long *)ptr);
9574 exp->type = 2;
9575 break;
9576 }
9577 case 22:
9578 {
9579 FreeExpContents(exp);
9580 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9581 exp->type = 2;
9582 break;
9583 }
9584 case 23:
9585 {
9586 FreeExpContents(exp);
9587 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9588 exp->type = 2;
9589 break;
9590 }
9591 default:
9592 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9593 }
9594 }
9595 ListAdd(memberList, member);
9596 }
9597 if(parentDataMember->type == 1)
9598 break;
9599 }
9600 }
9601
9602 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9603
9604 void PopulateInstance(struct Instantiation * inst)
9605 {
9606 struct Symbol * classSym = inst->_class->symbol;
9607 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9608 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9609 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9610
9611 inst->members = MkListOne(MkMembersInitList(memberList));
9612 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9613 {
9614 if(!dataMember->isProperty)
9615 {
9616 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9617 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9618 else
9619 {
9620 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9621 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9622 struct Type * type;
9623 void * ptr = inst->data + dataMember->offset;
9624 char * result = (((void *)0));
9625
9626 exp->loc = member->loc = inst->loc;
9627 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9628 if(!dataMember->dataType)
9629 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9630 type = dataMember->dataType;
9631 if(type->kind == 8)
9632 {
9633 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9634
9635 if(_class->type == 4)
9636 {
9637 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9638
9639 if(enumClass)
9640 {
9641 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9642 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9643
9644 for(item = e->values.first; item; item = item->next)
9645 {
9646 if((int)item->data == *(int *)ptr)
9647 {
9648 result = item->name;
9649 break;
9650 }
9651 }
9652 }
9653 if(result)
9654 {
9655 exp->identifier = MkIdentifier(result);
9656 exp->type = 0;
9657 exp->destType = MkClassType(_class->fullName);
9658 ProcessExpressionType(exp);
9659 }
9660 }
9661 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9662 {
9663 if(!_class->dataType)
9664 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9665 type = _class->dataType;
9666 }
9667 }
9668 if(!result)
9669 {
9670 switch(type->kind)
9671 {
9672 case 6:
9673 {
9674 exp->constant = PrintFloat(*(float *)ptr);
9675 exp->type = 2;
9676 break;
9677 }
9678 case 7:
9679 {
9680 exp->constant = PrintDouble(*(double *)ptr);
9681 exp->type = 2;
9682 break;
9683 }
9684 case 3:
9685 {
9686 exp->constant = PrintInt(*(int *)ptr);
9687 exp->type = 2;
9688 break;
9689 }
9690 case 4:
9691 {
9692 exp->constant = PrintInt64(*(long long *)ptr);
9693 exp->type = 2;
9694 break;
9695 }
9696 case 22:
9697 {
9698 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9699 exp->type = 2;
9700 break;
9701 }
9702 default:
9703 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9704 }
9705 }
9706 ListAdd(memberList, member);
9707 }
9708 }
9709 }
9710 }
9711
9712 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);
9713
9714 extern void FreeInstance(struct Instantiation * inst);
9715
9716 void ComputeInstantiation(struct Expression * exp)
9717 {
9718 struct Instantiation * inst = exp->instance;
9719 struct MembersInit * members;
9720 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9721 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9722 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9723 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9724 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9725 int subMemberStackPos = 0;
9726 uint64 bits = 0;
9727
9728 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9729 {
9730 if(inst->data)
9731 return ;
9732 if(_class->type == 0 || _class->type == 5)
9733 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9734 else
9735 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9736 }
9737 if(inst->members)
9738 {
9739 for(members = (*inst->members).first; members; members = members->next)
9740 {
9741 switch(members->type)
9742 {
9743 case 0:
9744 {
9745 if(members->dataMembers)
9746 {
9747 struct MemberInit * member;
9748
9749 for(member = (*members->dataMembers).first; member; member = member->next)
9750 {
9751 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9752 unsigned int found = 0x0;
9753 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9754 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9755 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9756 unsigned int dataMemberOffset;
9757
9758 if(!ident)
9759 {
9760 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9761 if(curMember)
9762 {
9763 if(curMember->isProperty)
9764 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9765 else
9766 {
9767 dataMember = curMember;
9768 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9769 }
9770 found = 0x1;
9771 }
9772 }
9773 else
9774 {
9775 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9776 if(prop)
9777 {
9778 found = 0x1;
9779 if(prop->memberAccess == 1)
9780 {
9781 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9782 curClass = prop->_class;
9783 }
9784 }
9785 else
9786 {
9787 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9788 int _subMemberStackPos = 0;
9789
9790 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9791 if(dataMember)
9792 {
9793 found = 0x1;
9794 if(dataMember->memberAccess == 1)
9795 {
9796 curMember = dataMember;
9797 curClass = dataMember->_class;
9798 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
9799 subMemberStackPos = _subMemberStackPos;
9800 }
9801 }
9802 }
9803 }
9804 if(found && member->initializer && member->initializer->type == 0)
9805 {
9806 struct Expression * value = member->initializer->exp;
9807 struct Type * type = (((void *)0));
9808
9809 if(prop)
9810 {
9811 type = prop->dataType;
9812 }
9813 else if(dataMember)
9814 {
9815 if(!dataMember->dataType)
9816 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9817 type = dataMember->dataType;
9818 }
9819 if(ident && ident->next)
9820 {
9821 for(ident = ident->next; ident && type; ident = ident->next)
9822 {
9823 if(type->kind == 8)
9824 {
9825 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9826 if(prop)
9827 type = prop->dataType;
9828 else
9829 {
9830 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9831 if(dataMember)
9832 type = dataMember->dataType;
9833 }
9834 }
9835 else if(type->kind == 9 || type->kind == 10)
9836 {
9837 struct Type * memberType;
9838
9839 for(memberType = type->members.first; memberType; memberType = memberType->next)
9840 {
9841 if(!strcmp(memberType->name, ident->string))
9842 {
9843 type = memberType;
9844 break;
9845 }
9846 }
9847 }
9848 }
9849 }
9850 if(value)
9851 {
9852 FreeType(value->destType);
9853 value->destType = type;
9854 if(type)
9855 type->refCount++;
9856 ComputeExpression(value);
9857 }
9858 if(value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9859 {
9860 if(type->kind == 8)
9861 {
9862 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9863
9864 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9865 {
9866 if(!_class->dataType)
9867 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9868 type = _class->dataType;
9869 }
9870 }
9871 if(dataMember)
9872 {
9873 void * ptr = inst->data + dataMemberOffset;
9874
9875 if(value->type == 2)
9876 {
9877 switch(type->kind)
9878 {
9879 case 3:
9880 {
9881 GetInt(value, (int *)ptr);
9882 break;
9883 }
9884 case 4:
9885 {
9886 GetInt64(value, (long long *)ptr);
9887 break;
9888 }
9889 case 22:
9890 {
9891 GetIntPtr(value, (intptr_t *)ptr);
9892 break;
9893 }
9894 case 23:
9895 {
9896 GetIntSize(value, (ssize_t *)ptr);
9897 break;
9898 }
9899 case 6:
9900 {
9901 GetFloat(value, (float *)ptr);
9902 break;
9903 }
9904 case 7:
9905 {
9906 GetDouble(value, (double *)ptr);
9907 break;
9908 }
9909 }
9910 }
9911 else if(value->type == 1)
9912 {
9913 if(type->kind == 8)
9914 {
9915 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9916
9917 if(_class->type == 1)
9918 {
9919 ComputeTypeSize(type);
9920 if(value->instance->data)
9921 memcpy(ptr, value->instance->data, type->size);
9922 }
9923 }
9924 }
9925 }
9926 else if(prop)
9927 {
9928 if(value->type == 1 && value->instance->data)
9929 {
9930 void (* Set)(void *, void *) = (void *)prop->Set;
9931
9932 Set(inst->data, value->instance->data);
9933 PopulateInstance(inst);
9934 }
9935 else if(value->type == 2)
9936 {
9937 switch(type->kind)
9938 {
9939 case 7:
9940 {
9941 void (* Set)(void *, double) = (void *)prop->Set;
9942
9943 Set(inst->data, strtod(value->constant, (((void *)0))));
9944 break;
9945 }
9946 case 6:
9947 {
9948 void (* Set)(void *, float) = (void *)prop->Set;
9949
9950 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
9951 break;
9952 }
9953 case 3:
9954 {
9955 void (* Set)(void *, int) = (void *)prop->Set;
9956
9957 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
9958 break;
9959 }
9960 case 4:
9961 {
9962 void (* Set)(void *, long long) = (void *)prop->Set;
9963
9964 Set(inst->data, __ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
9965 break;
9966 }
9967 case 22:
9968 {
9969 void (* Set)(void *, intptr_t) = (void *)prop->Set;
9970
9971 Set(inst->data, (intptr_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
9972 break;
9973 }
9974 case 23:
9975 {
9976 void (* Set)(void *, ssize_t) = (void *)prop->Set;
9977
9978 Set(inst->data, (ssize_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
9979 break;
9980 }
9981 }
9982 }
9983 else if(value->type == 3)
9984 {
9985 char temp[1024];
9986
9987 ReadString(temp, value->string);
9988 ((void (*)(void *, void *))(void *)prop->Set)(inst->data, temp);
9989 }
9990 }
9991 }
9992 else if(_class->type == 3)
9993 {
9994 if(prop)
9995 {
9996 if(value->type == 2)
9997 {
9998 if(type->kind == 8)
9999 {
10000 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10001
10002 if(_class->type == 3)
10003 {
10004 if(!_class->dataType)
10005 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10006 type = _class->dataType;
10007 }
10008 }
10009 switch(type->kind)
10010 {
10011 case 6:
10012 {
10013 float fValue;
10014 float (* Set)(float) = (void *)prop->Set;
10015
10016 GetFloat(member->initializer->exp, &fValue);
10017 exp->constant = PrintFloat(Set(fValue));
10018 exp->type = 2;
10019 break;
10020 }
10021 case 7:
10022 {
10023 double dValue;
10024 double (* Set)(double) = (void *)prop->Set;
10025
10026 GetDouble(member->initializer->exp, &dValue);
10027 exp->constant = PrintDouble(Set(dValue));
10028 exp->type = 2;
10029 break;
10030 }
10031 }
10032 }
10033 }
10034 }
10035 else if(_class->type == 2)
10036 {
10037 if(prop)
10038 {
10039 if(value->type == 1 && value->instance->data)
10040 {
10041 unsigned int (* Set)(void *) = (void *)prop->Set;
10042
10043 bits = Set(value->instance->data);
10044 }
10045 else if(value->type == 2)
10046 {
10047 }
10048 }
10049 else if(dataMember)
10050 {
10051 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
10052 struct Type * type;
10053 int part = 0;
10054
10055 GetInt(value, &part);
10056 bits = (bits & ~bitMember->mask);
10057 if(!bitMember->dataType)
10058 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
10059 type = bitMember->dataType;
10060 if(type->kind == 8 && type->_class && type->_class->registered)
10061 {
10062 if(!type->_class->registered->dataType)
10063 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
10064 type = type->_class->registered->dataType;
10065 }
10066 switch(type->kind)
10067 {
10068 case 1:
10069 if(type->isSigned)
10070 bits |= ((char)part << bitMember->pos);
10071 else
10072 bits |= ((unsigned char)part << bitMember->pos);
10073 break;
10074 case 2:
10075 if(type->isSigned)
10076 bits |= ((short)part << bitMember->pos);
10077 else
10078 bits |= ((unsigned short)part << bitMember->pos);
10079 break;
10080 case 3:
10081 case 5:
10082 if(type->isSigned)
10083 bits |= (part << bitMember->pos);
10084 else
10085 bits |= ((unsigned int)part << bitMember->pos);
10086 break;
10087 case 4:
10088 if(type->isSigned)
10089 bits |= ((long long)part << bitMember->pos);
10090 else
10091 bits |= ((uint64)part << bitMember->pos);
10092 break;
10093 case 22:
10094 if(type->isSigned)
10095 bits |= ((intptr_t)part << bitMember->pos);
10096 else
10097 bits |= ((uintptr_t)part << bitMember->pos);
10098 break;
10099 case 23:
10100 if(type->isSigned)
10101 bits |= ((ssize_t)part << bitMember->pos);
10102 else
10103 bits |= ((size_t)part << bitMember->pos);
10104 break;
10105 }
10106 }
10107 }
10108 }
10109 else
10110 {
10111 if(_class && _class->type == 3)
10112 {
10113 ComputeExpression(member->initializer->exp);
10114 exp->constant = member->initializer->exp->constant;
10115 exp->type = 2;
10116 member->initializer->exp->constant = (((void *)0));
10117 }
10118 }
10119 }
10120 }
10121 break;
10122 }
10123 }
10124 }
10125 }
10126 if(_class && _class->type == 2)
10127 {
10128 exp->constant = PrintHexUInt(bits);
10129 exp->type = 2;
10130 }
10131 if(exp->type != 1)
10132 {
10133 FreeInstance(inst);
10134 }
10135 }
10136
10137 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
10138 {
10139 if(exp->op.op == SIZEOF)
10140 {
10141 FreeExpContents(exp);
10142 exp->type = 2;
10143 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
10144 }
10145 else
10146 {
10147 if(!exp->op.exp1)
10148 {
10149 switch(exp->op.op)
10150 {
10151 case '+':
10152 {
10153 struct Expression * exp2 = exp->op.exp2;
10154
10155 exp->op.exp2 = (((void *)0));
10156 FreeExpContents(exp);
10157 FreeType(exp->expType);
10158 FreeType(exp->destType);
10159 *exp = *exp2;
10160 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
10161 break;
10162 }
10163 case '-':
10164 if(op1->ops.Neg)
10165 {
10166 FreeExpContents(exp);
10167 op1->ops.Neg(exp, op1);
10168 }
10169 break;
10170 case '~':
10171 if(op1->ops.BitNot)
10172 {
10173 FreeExpContents(exp);
10174 op1->ops.BitNot(exp, op1);
10175 }
10176 break;
10177 case '!':
10178 if(op1->ops.Not)
10179 {
10180 FreeExpContents(exp);
10181 op1->ops.Not(exp, op1);
10182 }
10183 break;
10184 }
10185 }
10186 else
10187 {
10188 switch(exp->op.op)
10189 {
10190 case '+':
10191 if(op1->ops.Add)
10192 {
10193 FreeExpContents(exp);
10194 op1->ops.Add(exp, op1, op2);
10195 }
10196 break;
10197 case '-':
10198 if(op1->ops.Sub)
10199 {
10200 FreeExpContents(exp);
10201 op1->ops.Sub(exp, op1, op2);
10202 }
10203 break;
10204 case '*':
10205 if(op1->ops.Mul)
10206 {
10207 FreeExpContents(exp);
10208 op1->ops.Mul(exp, op1, op2);
10209 }
10210 break;
10211 case '/':
10212 if(op1->ops.Div)
10213 {
10214 FreeExpContents(exp);
10215 op1->ops.Div(exp, op1, op2);
10216 }
10217 break;
10218 case '%':
10219 if(op1->ops.Mod)
10220 {
10221 FreeExpContents(exp);
10222 op1->ops.Mod(exp, op1, op2);
10223 }
10224 break;
10225 case '&':
10226 if(exp->op.exp2)
10227 {
10228 if(op1->ops.BitAnd)
10229 {
10230 FreeExpContents(exp);
10231 op1->ops.BitAnd(exp, op1, op2);
10232 }
10233 }
10234 break;
10235 case '|':
10236 if(op1->ops.BitOr)
10237 {
10238 FreeExpContents(exp);
10239 op1->ops.BitOr(exp, op1, op2);
10240 }
10241 break;
10242 case '^':
10243 if(op1->ops.BitXor)
10244 {
10245 FreeExpContents(exp);
10246 op1->ops.BitXor(exp, op1, op2);
10247 }
10248 break;
10249 case LEFT_OP:
10250 if(op1->ops.LShift)
10251 {
10252 FreeExpContents(exp);
10253 op1->ops.LShift(exp, op1, op2);
10254 }
10255 break;
10256 case RIGHT_OP:
10257 if(op1->ops.RShift)
10258 {
10259 FreeExpContents(exp);
10260 op1->ops.RShift(exp, op1, op2);
10261 }
10262 break;
10263 case EQ_OP:
10264 if(op1->ops.Equ)
10265 {
10266 FreeExpContents(exp);
10267 op1->ops.Equ(exp, op1, op2);
10268 }
10269 break;
10270 case NE_OP:
10271 if(op1->ops.Nqu)
10272 {
10273 FreeExpContents(exp);
10274 op1->ops.Nqu(exp, op1, op2);
10275 }
10276 break;
10277 case AND_OP:
10278 if(op1->ops.And)
10279 {
10280 FreeExpContents(exp);
10281 op1->ops.And(exp, op1, op2);
10282 }
10283 break;
10284 case OR_OP:
10285 if(op1->ops.Or)
10286 {
10287 FreeExpContents(exp);
10288 op1->ops.Or(exp, op1, op2);
10289 }
10290 break;
10291 case '>':
10292 if(op1->ops.Grt)
10293 {
10294 FreeExpContents(exp);
10295 op1->ops.Grt(exp, op1, op2);
10296 }
10297 break;
10298 case '<':
10299 if(op1->ops.Sma)
10300 {
10301 FreeExpContents(exp);
10302 op1->ops.Sma(exp, op1, op2);
10303 }
10304 break;
10305 case GE_OP:
10306 if(op1->ops.GrtEqu)
10307 {
10308 FreeExpContents(exp);
10309 op1->ops.GrtEqu(exp, op1, op2);
10310 }
10311 break;
10312 case LE_OP:
10313 if(op1->ops.SmaEqu)
10314 {
10315 FreeExpContents(exp);
10316 op1->ops.SmaEqu(exp, op1, op2);
10317 }
10318 break;
10319 }
10320 }
10321 }
10322 }
10323
10324 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10325
10326 void ComputeExpression(struct Expression * exp)
10327 {
10328 char expString[10240];
10329
10330 expString[0] = '\0';
10331 switch(exp->type)
10332 {
10333 case 1:
10334 {
10335 ComputeInstantiation(exp);
10336 break;
10337 }
10338 case 4:
10339 {
10340 struct Expression * exp1, * exp2 = (((void *)0));
10341 struct Operand op1 = 
10342 {
10343 0, 0, 0, 0, 
10344 {
10345 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10346 }
10347 };
10348 struct Operand op2 = 
10349 {
10350 0, 0, 0, 0, 
10351 {
10352 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10353 }
10354 };
10355
10356 if(exp->op.exp2)
10357 ComputeExpression(exp->op.exp2);
10358 if(exp->op.exp1)
10359 {
10360 ComputeExpression(exp->op.exp1);
10361 exp1 = exp->op.exp1;
10362 exp2 = exp->op.exp2;
10363 op1 = GetOperand(exp1);
10364 if(op1.type)
10365 op1.type->refCount++;
10366 if(exp2)
10367 {
10368 op2 = GetOperand(exp2);
10369 if(op2.type)
10370 op2.type->refCount++;
10371 }
10372 }
10373 else
10374 {
10375 exp1 = exp->op.exp2;
10376 op1 = GetOperand(exp1);
10377 if(op1.type)
10378 op1.type->refCount++;
10379 }
10380 CallOperator(exp, exp1, exp2, &op1, &op2);
10381 if(op1.type)
10382 FreeType(op1.type);
10383 if(op2.type)
10384 FreeType(op2.type);
10385 break;
10386 }
10387 case 5:
10388 case 34:
10389 {
10390 struct Expression * e, * n;
10391
10392 for(e = (*exp->list).first; e; e = n)
10393 {
10394 n = e->next;
10395 if(!n)
10396 {
10397 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10398
10399 ComputeExpression(e);
10400 FreeType(exp->expType);
10401 FreeType(exp->destType);
10402 *exp = *e;
10403 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10404 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10405 }
10406 else
10407 {
10408 FreeExpression(e);
10409 }
10410 }
10411 break;
10412 }
10413 case 8:
10414 {
10415 struct Expression * memberExp = exp->member.exp;
10416 struct Identifier * memberID = exp->member.member;
10417 struct Type * type;
10418
10419 ComputeExpression(exp->member.exp);
10420 type = exp->member.exp->expType;
10421 if(type)
10422 {
10423 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)));
10424 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10425 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10426 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10427
10428 if(type->kind == 19 && exp->member.exp->type == 26)
10429 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10430 if(!_class)
10431 {
10432 char string[256];
10433 struct Symbol * classSym;
10434
10435 string[0] = '\0';
10436 PrintType(type, string, 0x0, 0x1);
10437 classSym = FindClass(string);
10438 _class = classSym ? classSym->registered : (((void *)0));
10439 }
10440 if(exp->member.member)
10441 {
10442 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10443 if(!prop)
10444 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10445 }
10446 if(!prop && !member && _class && exp->member.member)
10447 {
10448 struct Symbol * classSym = FindClass(exp->member.member->string);
10449
10450 convertTo = _class;
10451 _class = classSym ? classSym->registered : (((void *)0));
10452 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10453 }
10454 if(prop)
10455 {
10456 if(prop->compiled)
10457 {
10458 struct Type * type = prop->dataType;
10459
10460 if(_class->type == 3)
10461 {
10462 if(type->kind == 8)
10463 {
10464 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10465
10466 if(_class->type == 3)
10467 {
10468 if(!_class->dataType)
10469 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10470 type = _class->dataType;
10471 }
10472 }
10473 switch(type->kind)
10474 {
10475 case 6:
10476 {
10477 float value;
10478 float (* Get)(float) = (void *)prop->Get;
10479
10480 GetFloat(exp->member.exp, &value);
10481 exp->constant = PrintFloat(Get ? Get(value) : value);
10482 exp->type = 2;
10483 break;
10484 }
10485 case 7:
10486 {
10487 double value;
10488 double (* Get)(double);
10489
10490 GetDouble(exp->member.exp, &value);
10491 if(convertTo)
10492 Get = (void *)prop->Set;
10493 else
10494 Get = (void *)prop->Get;
10495 exp->constant = PrintDouble(Get ? Get(value) : value);
10496 exp->type = 2;
10497 break;
10498 }
10499 }
10500 }
10501 else
10502 {
10503 if(convertTo)
10504 {
10505 struct Expression * value = exp->member.exp;
10506 struct Type * type;
10507
10508 if(!prop->dataType)
10509 ProcessPropertyType(prop);
10510 type = prop->dataType;
10511 if(!type)
10512 {
10513 }
10514 else if(_class->type == 1)
10515 {
10516 switch(type->kind)
10517 {
10518 case 8:
10519 {
10520 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10521
10522 if(propertyClass->type == 1 && value->type == 1)
10523 {
10524 void (* Set)(void *, void *) = (void *)prop->Set;
10525
10526 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10527 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10528 exp->instance->_class = MkSpecifierName(_class->fullName);
10529 exp->instance->loc = exp->loc;
10530 exp->type = 1;
10531 Set(exp->instance->data, value->instance->data);
10532 PopulateInstance(exp->instance);
10533 }
10534 break;
10535 }
10536 case 3:
10537 {
10538 int intValue;
10539 void (* Set)(void *, int) = (void *)prop->Set;
10540
10541 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10542 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10543 exp->instance->_class = MkSpecifierName(_class->fullName);
10544 exp->instance->loc = exp->loc;
10545 exp->type = 1;
10546 GetInt(value, &intValue);
10547 Set(exp->instance->data, intValue);
10548 PopulateInstance(exp->instance);
10549 break;
10550 }
10551 case 4:
10552 {
10553 long long intValue;
10554 void (* Set)(void *, long long) = (void *)prop->Set;
10555
10556 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10557 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10558 exp->instance->_class = MkSpecifierName(_class->fullName);
10559 exp->instance->loc = exp->loc;
10560 exp->type = 1;
10561 GetInt64(value, &intValue);
10562 Set(exp->instance->data, intValue);
10563 PopulateInstance(exp->instance);
10564 break;
10565 }
10566 case 22:
10567 {
10568 intptr_t intValue;
10569 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10570
10571 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10572 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10573 exp->instance->_class = MkSpecifierName(_class->fullName);
10574 exp->instance->loc = exp->loc;
10575 exp->type = 1;
10576 GetIntPtr(value, &intValue);
10577 Set(exp->instance->data, intValue);
10578 PopulateInstance(exp->instance);
10579 break;
10580 }
10581 case 23:
10582 {
10583 ssize_t intValue;
10584 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10585
10586 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10587 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10588 exp->instance->_class = MkSpecifierName(_class->fullName);
10589 exp->instance->loc = exp->loc;
10590 exp->type = 1;
10591 GetIntSize(value, &intValue);
10592 Set(exp->instance->data, intValue);
10593 PopulateInstance(exp->instance);
10594 break;
10595 }
10596 case 7:
10597 {
10598 double doubleValue;
10599 void (* Set)(void *, double) = (void *)prop->Set;
10600
10601 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10602 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10603 exp->instance->_class = MkSpecifierName(_class->fullName);
10604 exp->instance->loc = exp->loc;
10605 exp->type = 1;
10606 GetDouble(value, &doubleValue);
10607 Set(exp->instance->data, doubleValue);
10608 PopulateInstance(exp->instance);
10609 break;
10610 }
10611 }
10612 }
10613 else if(_class->type == 2)
10614 {
10615 switch(type->kind)
10616 {
10617 case 8:
10618 {
10619 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10620
10621 if(propertyClass->type == 1 && value->instance->data)
10622 {
10623 unsigned int (* Set)(void *) = (void *)prop->Set;
10624 unsigned int bits = Set(value->instance->data);
10625
10626 exp->constant = PrintHexUInt(bits);
10627 exp->type = 2;
10628 break;
10629 }
10630 else if(_class->type == 2)
10631 {
10632 unsigned int value;
10633 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10634 unsigned int bits;
10635
10636 GetUInt(exp->member.exp, &value);
10637 bits = Set(value);
10638 exp->constant = PrintHexUInt(bits);
10639 exp->type = 2;
10640 }
10641 }
10642 }
10643 }
10644 }
10645 else
10646 {
10647 if(_class->type == 2)
10648 {
10649 unsigned int value;
10650
10651 GetUInt(exp->member.exp, &value);
10652 switch(type->kind)
10653 {
10654 case 8:
10655 {
10656 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10657
10658 if(_class->type == 1)
10659 {
10660 void (* Get)(unsigned int, void *) = (void *)prop->Get;
10661
10662 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10663 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10664 exp->instance->_class = MkSpecifierName(_class->fullName);
10665 exp->instance->loc = exp->loc;
10666 exp->type = 1;
10667 Get(value, exp->instance->data);
10668 PopulateInstance(exp->instance);
10669 }
10670 else if(_class->type == 2)
10671 {
10672 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10673 uint64 bits = Get(value);
10674
10675 exp->constant = PrintHexUInt64(bits);
10676 exp->type = 2;
10677 }
10678 break;
10679 }
10680 }
10681 }
10682 else if(_class->type == 1)
10683 {
10684 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10685
10686 switch(type->kind)
10687 {
10688 case 8:
10689 {
10690 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10691
10692 if(_class->type == 1 && value)
10693 {
10694 void (* Get)(void *, void *) = (void *)prop->Get;
10695
10696 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10697 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10698 exp->instance->_class = MkSpecifierName(_class->fullName);
10699 exp->instance->loc = exp->loc;
10700 exp->type = 1;
10701 Get(value, exp->instance->data);
10702 PopulateInstance(exp->instance);
10703 }
10704 break;
10705 }
10706 }
10707 }
10708 }
10709 }
10710 }
10711 else
10712 {
10713 exp->isConstant = 0x0;
10714 }
10715 }
10716 else if(member)
10717 {
10718 }
10719 }
10720 if(exp->type != 8)
10721 {
10722 FreeExpression(memberExp);
10723 FreeIdentifier(memberID);
10724 }
10725 break;
10726 }
10727 case 10:
10728 {
10729 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10730
10731 FreeExpContents(exp);
10732 exp->constant = PrintUInt(ComputeTypeSize(type));
10733 exp->type = 2;
10734 FreeType(type);
10735 break;
10736 }
10737 case 15:
10738 {
10739 struct Symbol * classSym = exp->_class->symbol;
10740
10741 if(classSym && classSym->registered)
10742 {
10743 if(classSym->registered->fixed)
10744 {
10745 FreeSpecifier(exp->_class);
10746 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10747 exp->type = 2;
10748 }
10749 else
10750 {
10751 char className[1024];
10752
10753 strcpy(className, "__ecereClass_");
10754 FullClassNameCat(className, classSym->string, 0x1);
10755 MangleClassName(className);
10756 FreeExpContents(exp);
10757 exp->type = 9;
10758 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10759 exp->member.member = MkIdentifier("structSize");
10760 }
10761 }
10762 break;
10763 }
10764 case 11:
10765 {
10766 struct Type * type;
10767 struct Expression * e = exp;
10768
10769 if(exp->type == 11)
10770 {
10771 if(exp->cast.exp)
10772 ComputeExpression(exp->cast.exp);
10773 e = exp->cast.exp;
10774 }
10775 if(e && exp->expType)
10776 {
10777 type = exp->expType;
10778 if(type->kind == 8)
10779 {
10780 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10781
10782 if(_class && (_class->type == 3 || _class->type == 2))
10783 {
10784 if(!_class->dataType)
10785 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10786 type = _class->dataType;
10787 }
10788 }
10789 switch(type->kind)
10790 {
10791 case 1:
10792 if(type->isSigned)
10793 {
10794 char value;
10795
10796 GetChar(e, &value);
10797 FreeExpContents(exp);
10798 exp->constant = PrintChar(value);
10799 exp->type = 2;
10800 }
10801 else
10802 {
10803 unsigned char value;
10804
10805 GetUChar(e, &value);
10806 FreeExpContents(exp);
10807 exp->constant = PrintUChar(value);
10808 exp->type = 2;
10809 }
10810 break;
10811 case 2:
10812 if(type->isSigned)
10813 {
10814 short value;
10815
10816 GetShort(e, &value);
10817 FreeExpContents(exp);
10818 exp->constant = PrintShort(value);
10819 exp->type = 2;
10820 }
10821 else
10822 {
10823 unsigned short value;
10824
10825 GetUShort(e, &value);
10826 FreeExpContents(exp);
10827 exp->constant = PrintUShort(value);
10828 exp->type = 2;
10829 }
10830 break;
10831 case 3:
10832 if(type->isSigned)
10833 {
10834 int value;
10835
10836 GetInt(e, &value);
10837 FreeExpContents(exp);
10838 exp->constant = PrintInt(value);
10839 exp->type = 2;
10840 }
10841 else
10842 {
10843 unsigned int value;
10844
10845 GetUInt(e, &value);
10846 FreeExpContents(exp);
10847 exp->constant = PrintUInt(value);
10848 exp->type = 2;
10849 }
10850 break;
10851 case 4:
10852 if(type->isSigned)
10853 {
10854 long long value;
10855
10856 GetInt64(e, &value);
10857 FreeExpContents(exp);
10858 exp->constant = PrintInt64(value);
10859 exp->type = 2;
10860 }
10861 else
10862 {
10863 uint64 value;
10864
10865 GetUInt64(e, &value);
10866 FreeExpContents(exp);
10867 exp->constant = PrintUInt64(value);
10868 exp->type = 2;
10869 }
10870 break;
10871 case 22:
10872 if(type->isSigned)
10873 {
10874 intptr_t value;
10875
10876 GetIntPtr(e, &value);
10877 FreeExpContents(exp);
10878 exp->constant = PrintInt64((long long)value);
10879 exp->type = 2;
10880 }
10881 else
10882 {
10883 uintptr_t value;
10884
10885 GetUIntPtr(e, &value);
10886 FreeExpContents(exp);
10887 exp->constant = PrintUInt64((uint64)value);
10888 exp->type = 2;
10889 }
10890 break;
10891 case 23:
10892 if(type->isSigned)
10893 {
10894 ssize_t value;
10895
10896 GetIntSize(e, &value);
10897 FreeExpContents(exp);
10898 exp->constant = PrintInt64((long long)value);
10899 exp->type = 2;
10900 }
10901 else
10902 {
10903 size_t value;
10904
10905 GetUIntSize(e, &value);
10906 FreeExpContents(exp);
10907 exp->constant = PrintUInt64((uint64)value);
10908 exp->type = 2;
10909 }
10910 break;
10911 case 6:
10912 {
10913 float value;
10914
10915 GetFloat(e, &value);
10916 FreeExpContents(exp);
10917 exp->constant = PrintFloat(value);
10918 exp->type = 2;
10919 break;
10920 }
10921 case 7:
10922 {
10923 double value;
10924
10925 GetDouble(e, &value);
10926 FreeExpContents(exp);
10927 exp->constant = PrintDouble(value);
10928 exp->type = 2;
10929 break;
10930 }
10931 }
10932 }
10933 break;
10934 }
10935 case 12:
10936 {
10937 struct Operand op1 = 
10938 {
10939 0, 0, 0, 0, 
10940 {
10941 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10942 }
10943 };
10944 struct Operand op2 = 
10945 {
10946 0, 0, 0, 0, 
10947 {
10948 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10949 }
10950 };
10951 struct Operand op3 = 
10952 {
10953 0, 0, 0, 0, 
10954 {
10955 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10956 }
10957 };
10958
10959 if(exp->cond.exp)
10960 ComputeExpression((*exp->cond.exp).last);
10961 if(exp->cond.elseExp)
10962 ComputeExpression(exp->cond.elseExp);
10963 if(exp->cond.cond)
10964 ComputeExpression(exp->cond.cond);
10965 op1 = GetOperand(exp->cond.cond);
10966 if(op1.type)
10967 op1.type->refCount++;
10968 op2 = GetOperand((*exp->cond.exp).last);
10969 if(op2.type)
10970 op2.type->refCount++;
10971 op3 = GetOperand(exp->cond.elseExp);
10972 if(op3.type)
10973 op3.type->refCount++;
10974 if(op1.ops.Cond)
10975 {
10976 FreeExpContents(exp);
10977 op1.ops.Cond(exp, &op1, &op2, &op3);
10978 }
10979 if(op1.type)
10980 FreeType(op1.type);
10981 if(op2.type)
10982 FreeType(op2.type);
10983 if(op3.type)
10984 FreeType(op3.type);
10985 break;
10986 }
10987 }
10988 }
10989
10990 void ApplyAnyObjectLogic(struct Expression * e);
10991
10992 extern void CopyTypeInto(struct Type * type, struct Type * src);
10993
10994 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
10995 {
10996 unsigned int result = 0x1;
10997
10998 if(destType)
10999 {
11000 struct __ecereNameSpace__ecere__sys__OldList converts = 
11001 {
11002 0, 0, 0, 0, 0
11003 };
11004 struct Conversion * convert;
11005
11006 if(destType->kind == 0)
11007 return 0x0;
11008 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
11009 result = 0x0;
11010 if(converts.count)
11011 {
11012 for(convert = converts.first; convert; convert = convert->next)
11013 {
11014 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
11015
11016 if(!empty)
11017 {
11018 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11019 int objectType = exp->expType ? exp->expType->classObjectType : 0;
11020
11021 *newExp = *exp;
11022 newExp->destType = (((void *)0));
11023 if(convert->isGet)
11024 {
11025 exp->type = 8;
11026 exp->addedThis = 0x1;
11027 exp->member.exp = newExp;
11028 FreeType(exp->member.exp->expType);
11029 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
11030 exp->member.exp->expType->classObjectType = objectType;
11031 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
11032 exp->member.memberType = 1;
11033 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11034 exp->needCast = 0x1;
11035 if(exp->expType)
11036 exp->expType->refCount++;
11037 ApplyAnyObjectLogic(exp->member.exp);
11038 }
11039 else
11040 {
11041 {
11042 exp->type = 8;
11043 exp->addedThis = 0x1;
11044 exp->member.exp = newExp;
11045 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
11046 {
11047 newExp->byReference = 0x1;
11048 }
11049 FreeType(exp->member.exp->expType);
11050 exp->member.exp->expType = (((void *)0));
11051 if(convert->convert->dataType)
11052 {
11053 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11054 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
11055 exp->member.exp->expType->refCount = 1;
11056 exp->member.exp->expType->classObjectType = objectType;
11057 ApplyAnyObjectLogic(exp->member.exp);
11058 }
11059 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
11060 exp->member.memberType = 4;
11061 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11062 exp->needCast = 0x1;
11063 if(convert->resultType)
11064 convert->resultType->refCount++;
11065 }
11066 }
11067 }
11068 else
11069 {
11070 FreeType(exp->expType);
11071 if(convert->isGet)
11072 {
11073 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11074 exp->needCast = 0x1;
11075 if(exp->expType)
11076 exp->expType->refCount++;
11077 }
11078 else
11079 {
11080 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11081 exp->needCast = 0x1;
11082 if(convert->resultType)
11083 convert->resultType->refCount++;
11084 }
11085 }
11086 }
11087 if(exp->isConstant && inCompiler)
11088 ComputeExpression(exp);
11089 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
11090 }
11091 if(!result && exp->expType && converts.count)
11092 {
11093 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
11094 }
11095 if(!result && exp->expType && exp->destType)
11096 {
11097 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))
11098 result = 0x1;
11099 }
11100 }
11101 return result;
11102 }
11103
11104 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
11105
11106 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
11107
11108 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
11109
11110 void CheckTemplateTypes(struct Expression * exp)
11111 {
11112 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
11113 {
11114 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11115 struct Statement * compound;
11116 struct Context * context;
11117
11118 *newExp = *exp;
11119 if(exp->destType)
11120 exp->destType->refCount++;
11121 if(exp->expType)
11122 exp->expType->refCount++;
11123 newExp->prev = (((void *)0));
11124 newExp->next = (((void *)0));
11125 switch(exp->expType->kind)
11126 {
11127 case 7:
11128 if(exp->destType->classObjectType)
11129 {
11130 if(exp->destType)
11131 exp->destType->refCount--;
11132 if(exp->expType)
11133 exp->expType->refCount--;
11134 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11135 }
11136 else
11137 {
11138 struct __ecereNameSpace__ecere__sys__OldList * specs;
11139 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11140 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11141
11142 context = PushContext();
11143 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11144 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11145 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11146 exp->type = 25;
11147 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11148 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
11149 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
11150 exp->compound->compound.context = context;
11151 PopContext(context);
11152 }
11153 break;
11154 default:
11155 exp->type = 11;
11156 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
11157 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11158 break;
11159 }
11160 }
11161 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
11162 {
11163 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11164 struct Statement * compound;
11165 struct Context * context;
11166
11167 *newExp = *exp;
11168 if(exp->destType)
11169 exp->destType->refCount++;
11170 if(exp->expType)
11171 exp->expType->refCount++;
11172 newExp->prev = (((void *)0));
11173 newExp->next = (((void *)0));
11174 switch(exp->expType->kind)
11175 {
11176 case 7:
11177 if(exp->destType->classObjectType)
11178 {
11179 if(exp->destType)
11180 exp->destType->refCount--;
11181 if(exp->expType)
11182 exp->expType->refCount--;
11183 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11184 }
11185 else
11186 {
11187 struct __ecereNameSpace__ecere__sys__OldList * specs;
11188 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11189 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11190
11191 context = PushContext();
11192 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11193 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11194 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11195 exp->type = 25;
11196 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11197 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
11198 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
11199 exp->compound->compound.context = context;
11200 PopContext(context);
11201 }
11202 break;
11203 case 8:
11204 {
11205 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
11206 {
11207 exp->type = 5;
11208 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
11209 ProcessExpressionType((*exp->list).first);
11210 break;
11211 }
11212 else
11213 {
11214 exp->type = 5;
11215 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
11216 newExp->needCast = 0x1;
11217 ProcessExpressionType((*exp->list).first);
11218 break;
11219 }
11220 }
11221 default:
11222 {
11223 if(exp->expType->kind == 20)
11224 {
11225 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
11226
11227 if(type)
11228 {
11229 FreeType(exp->destType);
11230 FreeType(exp->expType);
11231 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11232 break;
11233 }
11234 }
11235 if(newExp->type == 8 && newExp->member.memberType == 3)
11236 {
11237 exp->type = 4;
11238 exp->op.op = '*';
11239 exp->op.exp1 = (((void *)0));
11240 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
11241 }
11242 else
11243 {
11244 char typeString[1024];
11245 struct Declarator * decl;
11246 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11247
11248 typeString[0] = '\0';
11249 PrintType(exp->expType, typeString, 0x0, 0x0);
11250 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11251 exp->type = 11;
11252 exp->cast.typeName = MkTypeName(specs, decl);
11253 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11254 exp->cast.exp->needCast = 0x1;
11255 }
11256 break;
11257 }
11258 }
11259 }
11260 }
11261
11262 extern int strncmp(const char * , const char * , size_t n);
11263
11264 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
11265
11266 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
11267 {
11268 int nsLen = strlen(nameSpace);
11269 struct Symbol * symbol;
11270
11271 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)))
11272 {
11273 char * s = symbol->string;
11274
11275 if(!strncmp(s, nameSpace, nsLen))
11276 {
11277 int c;
11278 char * namePart;
11279
11280 for(c = strlen(s) - 1; c >= 0; c--)
11281 if(s[c] == ':')
11282 break;
11283 namePart = s + c + 1;
11284 if(!strcmp(namePart, name))
11285 {
11286 return symbol;
11287 }
11288 }
11289 else
11290 break;
11291 }
11292 return (((void *)0));
11293 }
11294
11295 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
11296 {
11297 int c;
11298 char nameSpace[1024];
11299 char * namePart;
11300 unsigned int gotColon = 0x0;
11301
11302 nameSpace[0] = '\0';
11303 for(c = strlen(name) - 1; c >= 0; c--)
11304 if(name[c] == ':')
11305 {
11306 gotColon = 0x1;
11307 break;
11308 }
11309 namePart = name + c + 1;
11310 while(c >= 0 && name[c] == ':')
11311 c--;
11312 if(c >= 0)
11313 {
11314 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
11315
11316 if(symbol)
11317 return symbol;
11318 memcpy(nameSpace, name, c + 1);
11319 nameSpace[c + 1] = (char)0;
11320 return ScanWithNameSpace(tree, nameSpace, namePart);
11321 }
11322 else if(gotColon)
11323 {
11324 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11325
11326 return symbol;
11327 }
11328 else
11329 {
11330 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11331
11332 if(symbol)
11333 return symbol;
11334 return ScanWithNameSpace(tree, "", namePart);
11335 }
11336 return (((void *)0));
11337 }
11338
11339 static void ProcessDeclaration(struct Declaration * decl);
11340
11341 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
11342 {
11343 struct Context * ctx;
11344 struct Symbol * symbol = (((void *)0));
11345
11346 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
11347 {
11348 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
11349 {
11350 symbol = (((void *)0));
11351 if(thisNameSpace)
11352 {
11353 char curName[1024];
11354
11355 strcpy(curName, thisNameSpace);
11356 strcat(curName, "::");
11357 strcat(curName, name);
11358 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
11359 }
11360 if(!symbol)
11361 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
11362 }
11363 else
11364 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
11365 if(symbol || ctx == endContext)
11366 break;
11367 }
11368 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
11369 {
11370 if(symbol->pointerExternal->type == 0)
11371 {
11372 struct FunctionDefinition * function = symbol->pointerExternal->function;
11373 struct Context * tmpContext = curContext;
11374
11375 curContext = (((void *)0));
11376 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
11377 curContext = tmpContext;
11378 symbol->pointerExternal->symbol = symbol;
11379 DeclareType(symbol->type, 0x1, 0x1);
11380 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
11381 symbol->id = curExternal->symbol->idCode;
11382 }
11383 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
11384 {
11385 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
11386 symbol->id = curExternal->symbol->idCode;
11387 }
11388 }
11389 return symbol;
11390 }
11391
11392 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
11393 {
11394 if(!type->isSigned && type->kind != 22 && type->kind != 23)
11395 ListAdd(specs, MkSpecifier(UNSIGNED));
11396 switch(type->kind)
11397 {
11398 case 8:
11399 {
11400 if(type->_class->registered)
11401 {
11402 if(!type->_class->registered->dataType)
11403 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11404 GetTypeSpecs(type->_class->registered->dataType, specs);
11405 }
11406 break;
11407 }
11408 case 7:
11409 ListAdd(specs, MkSpecifier(DOUBLE));
11410 break;
11411 case 6:
11412 ListAdd(specs, MkSpecifier(FLOAT));
11413 break;
11414 case 1:
11415 ListAdd(specs, MkSpecifier(CHAR));
11416 break;
11417 case 2:
11418 ListAdd(specs, MkSpecifier(SHORT));
11419 break;
11420 case 4:
11421 ListAdd(specs, MkSpecifier(INT64));
11422 break;
11423 case 22:
11424 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
11425 break;
11426 case 23:
11427 ListAdd(specs, MkSpecifierName(type->isSigned ? "intsize" : "uintsize"));
11428 break;
11429 case 3:
11430 default:
11431 ListAdd(specs, MkSpecifier(INT));
11432 break;
11433 }
11434 }
11435
11436 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
11437
11438 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int printFunction, unsigned int fullName)
11439 {
11440 if(type)
11441 {
11442 switch(type->kind)
11443 {
11444 case 8:
11445 if(type->_class && type->_class->string)
11446 {
11447 if(type->classObjectType == 2)
11448 strcat(string, "typed_object");
11449 else if(fullName)
11450 strcat(string, type->_class->string);
11451 else
11452 {
11453 if(type->_class->registered)
11454 strcat(string, type->_class->registered->name);
11455 else
11456 strcat(string, type->_class->string);
11457 }
11458 }
11459 break;
11460 case 13:
11461 {
11462 {
11463 _PrintType(type->type, string, 0x0, printFunction, fullName);
11464 strcat(string, " *");
11465 }
11466 break;
11467 }
11468 case 0:
11469 strcat(string, "void");
11470 break;
11471 case 3:
11472 strcat(string, type->isSigned ? "int" : "uint");
11473 break;
11474 case 4:
11475 strcat(string, type->isSigned ? "int64" : "uint64");
11476 break;
11477 case 22:
11478 strcat(string, type->isSigned ? "intptr" : "uintptr");
11479 break;
11480 case 23:
11481 strcat(string, type->isSigned ? "intsize" : "uintsize");
11482 break;
11483 case 1:
11484 strcat(string, type->isSigned ? "char" : "byte");
11485 break;
11486 case 2:
11487 strcat(string, type->isSigned ? "short" : "uint16");
11488 break;
11489 case 6:
11490 strcat(string, "float");
11491 break;
11492 case 7:
11493 strcat(string, "double");
11494 break;
11495 case 9:
11496 if(type->enumName)
11497 {
11498 strcat(string, "struct ");
11499 strcat(string, type->enumName);
11500 }
11501 else if(type->typeName)
11502 {
11503 strcat(string, type->typeName);
11504 }
11505 else
11506 {
11507 struct Type * member;
11508
11509 strcat(string, "struct {");
11510 for(member = type->members.first; member; member = member->next)
11511 {
11512 PrintType(member, string, 0x1, fullName);
11513 strcat(string, "; ");
11514 }
11515 strcat(string, "}");
11516 }
11517 break;
11518 case 10:
11519 if(type->enumName)
11520 {
11521 strcat(string, "union ");
11522 strcat(string, type->enumName);
11523 }
11524 else if(type->typeName)
11525 {
11526 strcat(string, type->typeName);
11527 }
11528 else
11529 {
11530 strcat(string, "union ");
11531 strcat(string, "(unnamed)");
11532 }
11533 break;
11534 case 15:
11535 if(type->enumName)
11536 {
11537 strcat(string, "enum ");
11538 strcat(string, type->enumName);
11539 }
11540 else if(type->typeName)
11541 {
11542 strcat(string, type->typeName);
11543 }
11544 else
11545 strcat(string, "enum");
11546 break;
11547 case 11:
11548 {
11549 if(printFunction)
11550 {
11551 if(type->dllExport)
11552 strcat(string, "dllexport ");
11553 PrintType(type->returnType, string, 0x0, fullName);
11554 strcat(string, " ");
11555 }
11556 if(printName)
11557 {
11558 if(type->name)
11559 {
11560 if(fullName)
11561 strcat(string, type->name);
11562 else
11563 {
11564 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11565
11566 if(name)
11567 name += 2;
11568 else
11569 name = type->name;
11570 strcat(string, name);
11571 }
11572 }
11573 }
11574 if(printFunction)
11575 {
11576 struct Type * param;
11577
11578 strcat(string, "(");
11579 for(param = type->params.first; param; param = param->next)
11580 {
11581 PrintType(param, string, 0x1, fullName);
11582 if(param->next)
11583 strcat(string, ", ");
11584 }
11585 strcat(string, ")");
11586 }
11587 break;
11588 }
11589 case 12:
11590 {
11591 {
11592 char baseType[1024], size[256];
11593 struct Type * arrayType = type;
11594
11595 baseType[0] = '\0';
11596 size[0] = '\0';
11597 while(arrayType->kind == 12)
11598 {
11599 strcat(size, "[");
11600 if(arrayType->enumClass)
11601 strcat(size, arrayType->enumClass->string);
11602 else if(arrayType->arraySizeExp)
11603 PrintExpression(arrayType->arraySizeExp, size);
11604 strcat(size, "]");
11605 arrayType = arrayType->arrayType;
11606 }
11607 _PrintType(arrayType, baseType, printName, printFunction, fullName);
11608 strcat(string, baseType);
11609 strcat(string, size);
11610 }
11611 printName = 0x0;
11612 break;
11613 }
11614 case 14:
11615 strcat(string, "...");
11616 break;
11617 case 16:
11618 _PrintType(type->method->dataType, string, 0x0, printFunction, fullName);
11619 break;
11620 case 19:
11621 strcat(string, "subclass(");
11622 strcat(string, type->_class ? type->_class->string : "int");
11623 strcat(string, ")");
11624 break;
11625 case 20:
11626 strcat(string, type->templateParameter->identifier->string);
11627 break;
11628 case 21:
11629 strcat(string, "thisclass");
11630 break;
11631 case 17:
11632 strcat(string, "__builtin_va_list");
11633 break;
11634 }
11635 if(type->name && printName && type->kind != 11 && (type->kind != 13 || type->type->kind != 11))
11636 {
11637 strcat(string, " ");
11638 strcat(string, type->name);
11639 }
11640 }
11641 }
11642
11643 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11644 {
11645 struct Type * funcType;
11646
11647 for(funcType = type; funcType && (funcType->kind == 13 || funcType->kind == 12); funcType = funcType->type)
11648 ;
11649 if(funcType && funcType->kind == 11 && type != funcType)
11650 {
11651 char typeString[1024];
11652 struct Type * param;
11653
11654 PrintType(funcType->returnType, string, 0x0, fullName);
11655 strcat(string, "(");
11656 _PrintType(type, string, printName, 0x0, fullName);
11657 strcat(string, ")");
11658 strcat(string, "(");
11659 for(param = funcType->params.first; param; param = param->next)
11660 {
11661 PrintType(param, string, 0x1, fullName);
11662 if(param->next)
11663 strcat(string, ", ");
11664 }
11665 strcat(string, ")");
11666 }
11667 else
11668 _PrintType(type, string, printName, 0x1, fullName);
11669 if(type->bitFieldCount)
11670 {
11671 char count[100];
11672
11673 sprintf(count, ":%d", type->bitFieldCount);
11674 strcat(string, count);
11675 }
11676 }
11677
11678 static struct Type * FindMember(struct Type * type, char * string)
11679 {
11680 struct Type * memberType;
11681
11682 for(memberType = type->members.first; memberType; memberType = memberType->next)
11683 {
11684 if(!memberType->name)
11685 {
11686 struct Type * subType = FindMember(memberType, string);
11687
11688 if(subType)
11689 return subType;
11690 }
11691 else if(!strcmp(memberType->name, string))
11692 return memberType;
11693 }
11694 return (((void *)0));
11695 }
11696
11697 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11698 {
11699 struct Type * memberType;
11700
11701 for(memberType = type->members.first; memberType; memberType = memberType->next)
11702 {
11703 if(!memberType->name)
11704 {
11705 struct Type * subType = FindMember(memberType, string);
11706
11707 if(subType)
11708 {
11709 *offset += memberType->offset;
11710 return subType;
11711 }
11712 }
11713 else if(!strcmp(memberType->name, string))
11714 {
11715 *offset += memberType->offset;
11716 return memberType;
11717 }
11718 }
11719 return (((void *)0));
11720 }
11721
11722 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11723
11724 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11725
11726 struct Expression * ParseExpressionString(char * expression)
11727 {
11728 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11729 ((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));
11730 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11731 echoOn = 0x0;
11732 parsedExpression = (((void *)0));
11733 resetScanner();
11734 expression_yyparse();
11735 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11736 return parsedExpression;
11737 }
11738
11739 extern char *  QMkString(char *  source);
11740
11741 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11742 {
11743 void * __ecereTemp1;
11744 struct Identifier * id = exp->identifier;
11745 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11746 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11747 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11748 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11749
11750 if(_class && _class->type == 4)
11751 {
11752 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11753 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11754
11755 if(enumClass)
11756 {
11757 struct __ecereNameSpace__ecere__com__Class * baseClass;
11758
11759 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11760 {
11761 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11762
11763 for(value = e->values.first; value; value = value->next)
11764 {
11765 if(!strcmp(value->name, id->string))
11766 break;
11767 }
11768 if(value)
11769 {
11770 char constant[256];
11771
11772 FreeExpContents(exp);
11773 exp->type = 2;
11774 exp->isConstant = 0x1;
11775 if(!strcmp(baseClass->dataTypeString, "int"))
11776 sprintf(constant, "%d", value->data);
11777 else
11778 sprintf(constant, "0x%X", value->data);
11779 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11780 exp->expType = MkClassType(baseClass->fullName);
11781 break;
11782 }
11783 }
11784 }
11785 if(value)
11786 return 0x1;
11787 }
11788 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11789 {
11790 ProcessMethodType(method);
11791 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));
11792 return 0x1;
11793 }
11794 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11795 {
11796 if(!prop->dataType)
11797 ProcessPropertyType(prop);
11798 exp->expType = prop->dataType;
11799 if(prop->dataType)
11800 prop->dataType->refCount++;
11801 return 0x1;
11802 }
11803 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11804 {
11805 if(!member->dataType)
11806 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11807 exp->expType = member->dataType;
11808 if(member->dataType)
11809 member->dataType->refCount++;
11810 return 0x1;
11811 }
11812 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11813 {
11814 if(!classProp->dataType)
11815 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11816 if(classProp->constant)
11817 {
11818 FreeExpContents(exp);
11819 exp->isConstant = 0x1;
11820 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
11821 {
11822 exp->type = 3;
11823 exp->constant = QMkString((char *)classProp->Get(_class));
11824 }
11825 else
11826 {
11827 char constant[256];
11828
11829 exp->type = 2;
11830 sprintf(constant, "%d", (int)classProp->Get(_class));
11831 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11832 }
11833 }
11834 else
11835 {
11836 }
11837 exp->expType = classProp->dataType;
11838 if(classProp->dataType)
11839 classProp->dataType->refCount++;
11840 return 0x1;
11841 }
11842 return 0x0;
11843 }
11844
11845 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
11846 {
11847 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
11848 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
11849 struct __ecereNameSpace__ecere__com__NameSpace * child;
11850
11851 if(!data)
11852 {
11853 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)))
11854 {
11855 data = ScanGlobalData(child, name);
11856 if(data)
11857 break;
11858 }
11859 }
11860 return data;
11861 }
11862
11863 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
11864
11865 extern char *  strncpy(char * , const char * , size_t n);
11866
11867 static struct GlobalData * FindGlobalData(char * name)
11868 {
11869 int start = 0, c;
11870 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
11871
11872 nameSpace = globalData;
11873 for(c = 0; name[c]; c++)
11874 {
11875 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
11876 {
11877 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
11878 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
11879
11880 strncpy(spaceName, name + start, c - start);
11881 spaceName[c - start] = '\0';
11882 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
11883 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
11884 if(!newSpace)
11885 return (((void *)0));
11886 nameSpace = newSpace;
11887 if(name[c] == ':')
11888 c++;
11889 start = c + 1;
11890 }
11891 }
11892 if(c - start)
11893 {
11894 return ScanGlobalData(nameSpace, name + start);
11895 }
11896 return (((void *)0));
11897 }
11898
11899 static int definedExpStackPos;
11900
11901 static void * definedExpStack[512];
11902
11903 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
11904 {
11905 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
11906
11907 FreeExpContents(checkedExp);
11908 FreeType(checkedExp->expType);
11909 FreeType(checkedExp->destType);
11910 *checkedExp = *newExp;
11911 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11912 checkedExp->prev = prev;
11913 checkedExp->next = next;
11914 }
11915
11916 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
11917
11918 extern int printf(char * , ...);
11919
11920 void __ecereMethod_Expression_Clear();
11921
11922 void ApplyAnyObjectLogic(struct Expression * e)
11923 {
11924 struct Type * destType = e->destType;
11925
11926 if(destType && (destType->classObjectType == 3))
11927 {
11928 if(e && e->expType)
11929 {
11930 struct Type * type = e->expType;
11931 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
11932
11933 if(type->kind == 8 && type->_class && type->_class->registered)
11934 {
11935 _class = type->_class->registered;
11936 }
11937 else if(type->kind == 19)
11938 {
11939 _class = FindClass("ecere::com::Class")->registered;
11940 }
11941 else
11942 {
11943 char string[1024] = "";
11944 struct Symbol * classSym;
11945
11946 PrintType(type, string, 0x0, 0x1);
11947 classSym = FindClass(string);
11948 if(classSym)
11949 _class = classSym->registered;
11950 }
11951 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)))
11952 {
11953 if(!_class || strcmp(_class->fullName, "char *"))
11954 {
11955 struct Expression * checkedExp = e, * newExp;
11956
11957 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
11958 {
11959 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
11960 {
11961 if(checkedExp->type == 25)
11962 {
11963 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
11964 }
11965 else
11966 checkedExp = (*checkedExp->list).last;
11967 }
11968 else if(checkedExp->type == 11)
11969 checkedExp = checkedExp->cast.exp;
11970 }
11971 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
11972 {
11973 newExp = checkedExp->op.exp2;
11974 checkedExp->op.exp2 = (((void *)0));
11975 FreeExpContents(checkedExp);
11976 if(e->expType && e->expType->passAsTemplate)
11977 {
11978 char size[100];
11979
11980 ComputeTypeSize(e->expType);
11981 sprintf(size, "%d", e->expType->size);
11982 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))))));
11983 }
11984 ReplaceExpContents(checkedExp, newExp);
11985 e->byReference = 0x1;
11986 }
11987 else if(!e->byReference || (_class && _class->type == 5))
11988 {
11989 struct Expression * checkedExp, * newExp;
11990
11991 {
11992 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;
11993
11994 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
11995 {
11996 struct Context * context = PushContext();
11997 struct Declarator * decl;
11998 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11999 char typeString[1024];
12000 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12001
12002 typeString[0] = '\0';
12003 *newExp = *e;
12004 newExp->prev = (((void *)0));
12005 newExp->next = (((void *)0));
12006 newExp->expType = (((void *)0));
12007 PrintType(e->expType, typeString, 0x0, 0x1);
12008 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12009 newExp->destType = ProcessType(specs, decl);
12010 curContext = context;
12011 e->type = 25;
12012 if(curCompound)
12013 {
12014 char name[100];
12015 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
12016
12017 sprintf(name, "__internalValue%03X", internalValueCounter++);
12018 if(!curCompound->compound.declarations)
12019 curCompound->compound.declarations = MkList();
12020 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
12021 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
12022 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
12023 e->compound = MkCompoundStmt((((void *)0)), stmts);
12024 }
12025 else
12026 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
12027 {
12028 struct Type * type = e->destType;
12029
12030 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12031 CopyTypeInto(e->destType, type);
12032 e->destType->refCount = 1;
12033 e->destType->classObjectType = 0;
12034 FreeType(type);
12035 }
12036 e->compound->compound.context = context;
12037 PopContext(context);
12038 curContext = context->parent;
12039 }
12040 }
12041 checkedExp = e;
12042 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12043 {
12044 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12045 {
12046 if(checkedExp->type == 25)
12047 {
12048 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12049 }
12050 else
12051 checkedExp = (*checkedExp->list).last;
12052 }
12053 else if(checkedExp->type == 11)
12054 checkedExp = checkedExp->cast.exp;
12055 }
12056 {
12057 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12058
12059 *operand = *checkedExp;
12060 checkedExp->destType = (((void *)0));
12061 checkedExp->expType = (((void *)0));
12062 __ecereMethod_Expression_Clear(checkedExp);
12063 checkedExp->type = 4;
12064 checkedExp->op.op = '&';
12065 checkedExp->op.exp1 = (((void *)0));
12066 checkedExp->op.exp2 = operand;
12067 }
12068 }
12069 }
12070 }
12071 }
12072 }
12073 {
12074 }
12075 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))))
12076 {
12077 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && !strcmp(e->expType->_class->registered->name, "class"))
12078 {
12079 return ;
12080 }
12081 else
12082 {
12083 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12084
12085 *thisExp = *e;
12086 thisExp->prev = (((void *)0));
12087 thisExp->next = (((void *)0));
12088 __ecereMethod_Expression_Clear(e);
12089 e->type = 5;
12090 e->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpBrackets(MkListOne(thisExp))));
12091 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
12092 ((struct Expression *)(*e->list).first)->byReference = 0x1;
12093 {
12094 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12095 CopyTypeInto(e->expType, thisExp->expType);
12096 e->expType->byReference = 0x0;
12097 e->expType->refCount = 1;
12098 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))
12099 {
12100 e->expType->classObjectType = 0;
12101 }
12102 }
12103 }
12104 }
12105 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
12106 {
12107 if(destType->kind == 14)
12108 {
12109 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unspecified type\n", (((void *)0))));
12110 }
12111 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
12112 {
12113 unsigned int byReference = e->expType->byReference;
12114 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12115 struct Declarator * decl;
12116 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12117 char typeString[1024];
12118 struct Type * type;
12119 int backupClassObjectType;
12120
12121 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
12122 type = e->expType;
12123 else
12124 type = destType;
12125 backupClassObjectType = type->classObjectType;
12126 type->classObjectType = 0;
12127 typeString[0] = '\0';
12128 PrintType(type, typeString, 0x0, 0x1);
12129 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12130 type->classObjectType = backupClassObjectType;
12131 *thisExp = *e;
12132 thisExp->prev = (((void *)0));
12133 thisExp->next = (((void *)0));
12134 __ecereMethod_Expression_Clear(e);
12135 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)))
12136 {
12137 e->type = 4;
12138 e->op.op = '*';
12139 e->op.exp1 = (((void *)0));
12140 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
12141 }
12142 else
12143 {
12144 e->type = 11;
12145 e->cast.typeName = MkTypeName(specs, decl);
12146 e->cast.exp = thisExp;
12147 e->byReference = 0x1;
12148 }
12149 e->expType = type;
12150 e->destType = destType;
12151 type->refCount++;
12152 destType->refCount++;
12153 }
12154 }
12155 }
12156
12157 extern char *  strstr(const char * , const char * );
12158
12159 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
12160
12161 struct __ecereNameSpace__ecere__com__DefinedExpression
12162 {
12163 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
12164 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
12165 char *  name;
12166 char *  value;
12167 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
12168 } __attribute__ ((gcc_struct));
12169
12170 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12171
12172 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12173
12174 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
12175
12176 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
12177
12178 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
12179
12180 extern struct Expression * CopyExpression(struct Expression * exp);
12181
12182 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
12183
12184 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
12185
12186 static void ProcessStatement(struct Statement * stmt);
12187
12188 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
12189
12190 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
12191
12192 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
12193
12194 extern char *  sourceFile;
12195
12196 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
12197
12198 void ProcessExpressionType(struct Expression * exp)
12199 {
12200 void * __ecereTemp2;
12201 void * __ecereTemp1;
12202 unsigned int unresolved = 0x0;
12203 struct Location oldyylloc = yylloc;
12204 unsigned int notByReference = 0x0;
12205
12206 if(!exp || exp->expType)
12207 return ;
12208 yylloc = exp->loc;
12209 switch(exp->type)
12210 {
12211 case 0:
12212 {
12213 struct Identifier * id = exp->identifier;
12214
12215 if(!id)
12216 return ;
12217 if(id->_class && id->_class->name)
12218 {
12219 id->classSym = id->_class->symbol;
12220 }
12221 if(strstr(id->string, "__ecereClass") == id->string)
12222 {
12223 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
12224 break;
12225 }
12226 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
12227 {
12228 ReplaceClassMembers(exp, thisClass);
12229 if(exp->type != 0)
12230 {
12231 ProcessExpressionType(exp);
12232 break;
12233 }
12234 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
12235 break;
12236 }
12237 else
12238 {
12239 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12240
12241 if(!symbol)
12242 {
12243 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
12244 break;
12245 else
12246 {
12247 if(thisClass)
12248 {
12249 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
12250 if(exp->type != 0)
12251 {
12252 ProcessExpressionType(exp);
12253 break;
12254 }
12255 }
12256 else if(currentClass && !id->_class)
12257 {
12258 if(ResolveIdWithClass(exp, currentClass, 0x1))
12259 break;
12260 }
12261 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12262 }
12263 }
12264 if(symbol)
12265 {
12266 struct Type * type = symbol->type;
12267 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
12268
12269 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
12270 {
12271 struct Context * context = SetupTemplatesContext(_class);
12272
12273 type = ReplaceThisClassType(_class);
12274 FinishTemplatesContext(context);
12275 if(type)
12276 type->refCount = 0;
12277 }
12278 FreeSpecifier(id->_class);
12279 id->_class = (((void *)0));
12280 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12281 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
12282 id->classSym = (((void *)0));
12283 exp->expType = type;
12284 if(type)
12285 type->refCount++;
12286 if(type && (type->kind == 15 || (_class && _class->type == 4)))
12287 exp->isConstant = 0x1;
12288 if(symbol->isParam || !strcmp(id->string, "this"))
12289 {
12290 if(_class && _class->type == 1)
12291 exp->byReference = 0x1;
12292 }
12293 if(symbol->isIterator)
12294 {
12295 if(symbol->isIterator == 3)
12296 {
12297 exp->type = 5;
12298 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
12299 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
12300 exp->expType = (((void *)0));
12301 ProcessExpressionType(exp);
12302 }
12303 else if(symbol->isIterator != 4)
12304 {
12305 exp->type = 8;
12306 exp->member.exp = MkExpIdentifier(exp->identifier);
12307 exp->member.exp->expType = exp->expType;
12308 exp->member.member = MkIdentifier("data");
12309 exp->expType = (((void *)0));
12310 ProcessExpressionType(exp);
12311 }
12312 }
12313 break;
12314 }
12315 else
12316 {
12317 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
12318
12319 if(thisNameSpace && !(id->_class && !id->_class->name))
12320 {
12321 char name[1024];
12322
12323 strcpy(name, thisNameSpace);
12324 strcat(name, "::");
12325 strcat(name, id->string);
12326 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
12327 }
12328 if(!definedExp)
12329 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
12330 if(definedExp)
12331 {
12332 int c;
12333
12334 for(c = 0; c < definedExpStackPos; c++)
12335 if(definedExpStack[c] == definedExp)
12336 break;
12337 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
12338 {
12339 struct Location backupYylloc = yylloc;
12340
12341 definedExpStack[definedExpStackPos++] = definedExp;
12342 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
12343 ((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));
12344 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
12345 echoOn = 0x0;
12346 parsedExpression = (((void *)0));
12347 resetScanner();
12348 expression_yyparse();
12349 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
12350 yylloc = backupYylloc;
12351 if(parsedExpression)
12352 {
12353 FreeIdentifier(id);
12354 exp->type = 5;
12355 exp->list = MkListOne(parsedExpression);
12356 parsedExpression->loc = yylloc;
12357 ProcessExpressionType(exp);
12358 definedExpStackPos--;
12359 return ;
12360 }
12361 definedExpStackPos--;
12362 }
12363 else
12364 {
12365 if(inCompiler)
12366 {
12367 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
12368 }
12369 }
12370 }
12371 else
12372 {
12373 struct GlobalData * data = (((void *)0));
12374
12375 if(thisNameSpace && !(id->_class && !id->_class->name))
12376 {
12377 char name[1024];
12378
12379 strcpy(name, thisNameSpace);
12380 strcat(name, "::");
12381 strcat(name, id->string);
12382 data = FindGlobalData(name);
12383 }
12384 if(!data)
12385 data = FindGlobalData(id->string);
12386 if(data)
12387 {
12388 DeclareGlobalData(data);
12389 exp->expType = data->dataType;
12390 if(data->dataType)
12391 data->dataType->refCount++;
12392 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12393 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12394 FreeSpecifier(id->_class);
12395 id->_class = (((void *)0));
12396 break;
12397 }
12398 else
12399 {
12400 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((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 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12410 }
12411 if(!function)
12412 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12413 if(function)
12414 {
12415 char name[1024];
12416
12417 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12418 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12419 name[0] = (char)0;
12420 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12421 strcpy(name, "__ecereFunction_");
12422 FullClassNameCat(name, id->string, 0x0);
12423 if(DeclareFunction(function, name))
12424 {
12425 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12426 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12427 }
12428 exp->expType = function->dataType;
12429 if(function->dataType)
12430 function->dataType->refCount++;
12431 FreeSpecifier(id->_class);
12432 id->_class = (((void *)0));
12433 break;
12434 }
12435 }
12436 }
12437 }
12438 }
12439 unresolved = 0x1;
12440 break;
12441 }
12442 case 1:
12443 {
12444 struct __ecereNameSpace__ecere__com__Class * _class;
12445
12446 if(!exp->instance->_class)
12447 {
12448 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12449 {
12450 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12451 }
12452 }
12453 ProcessInstantiationType(exp->instance);
12454 exp->isConstant = exp->instance->isConstant;
12455 if(exp->instance->_class)
12456 {
12457 exp->expType = MkClassType(exp->instance->_class->name);
12458 }
12459 break;
12460 }
12461 case 2:
12462 {
12463 if(!exp->expType)
12464 {
12465 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12466
12467 exp->expType = type;
12468 if(exp->constant[0] == '\'')
12469 {
12470 if((int)((unsigned char *)exp->constant)[1] > 127)
12471 {
12472 int nb;
12473 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12474
12475 if(nb < 2)
12476 ch = exp->constant[1];
12477 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12478 exp->constant = PrintUInt(ch);
12479 type->kind = 8;
12480 type->_class = FindClass("unichar");
12481 type->isSigned = 0x0;
12482 }
12483 else
12484 {
12485 type->kind = 1;
12486 type->isSigned = 0x1;
12487 }
12488 }
12489 else if(strchr(exp->constant, '.'))
12490 {
12491 char ch = exp->constant[strlen(exp->constant) - 1];
12492
12493 if(ch == 'f')
12494 type->kind = 6;
12495 else
12496 type->kind = 7;
12497 type->isSigned = 0x1;
12498 }
12499 else
12500 {
12501 if(exp->constant[0] == '0' && exp->constant[1])
12502 type->isSigned = 0x0;
12503 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12504 type->isSigned = 0x0;
12505 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12506 type->isSigned = 0x0;
12507 else
12508 type->isSigned = 0x1;
12509 type->kind = 3;
12510 }
12511 exp->isConstant = 0x1;
12512 }
12513 break;
12514 }
12515 case 3:
12516 {
12517 exp->isConstant = 0x1;
12518 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));
12519 break;
12520 }
12521 case 13:
12522 case 28:
12523 ProcessExpressionType(exp->_new.size);
12524 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));
12525 DeclareType(exp->expType->type, 0x0, 0x0);
12526 break;
12527 case 14:
12528 case 29:
12529 ProcessExpressionType(exp->_renew.size);
12530 ProcessExpressionType(exp->_renew.exp);
12531 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));
12532 DeclareType(exp->expType->type, 0x0, 0x0);
12533 break;
12534 case 4:
12535 {
12536 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12537 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12538 unsigned int useDestType = 0x0, useSideType = 0x0;
12539 struct Location oldyylloc = yylloc;
12540 unsigned int useSideUnit = 0x0;
12541 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
12542
12543 switch(exp->op.op)
12544 {
12545 case '=':
12546 case MUL_ASSIGN:
12547 case DIV_ASSIGN:
12548 case MOD_ASSIGN:
12549 case ADD_ASSIGN:
12550 case SUB_ASSIGN:
12551 case LEFT_ASSIGN:
12552 case RIGHT_ASSIGN:
12553 case AND_ASSIGN:
12554 case XOR_ASSIGN:
12555 case OR_ASSIGN:
12556 assign = 0x1;
12557 break;
12558 case '!':
12559 break;
12560 case AND_OP:
12561 case OR_OP:
12562 boolOps = 0x1;
12563 boolResult = 0x1;
12564 break;
12565 case EQ_OP:
12566 case '<':
12567 case '>':
12568 case LE_OP:
12569 case GE_OP:
12570 case NE_OP:
12571 boolResult = 0x1;
12572 useSideType = 0x1;
12573 break;
12574 case '+':
12575 case '-':
12576 useSideUnit = 0x1;
12577 case '|':
12578 case '&':
12579 case '^':
12580 case '/':
12581 case '%':
12582 case '*':
12583 if(exp->op.op != '*' || exp->op.exp1)
12584 {
12585 useSideType = 0x1;
12586 useDestType = 0x1;
12587 }
12588 break;
12589 }
12590 if(exp->op.op == '&')
12591 {
12592 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12593 {
12594 struct Identifier * id = exp->op.exp2->identifier;
12595 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12596
12597 if(symbol && symbol->isIterator == 2)
12598 {
12599 exp->type = 8;
12600 exp->member.exp = exp->op.exp2;
12601 exp->member.member = MkIdentifier("key");
12602 exp->expType = (((void *)0));
12603 exp->op.exp2->expType = symbol->type;
12604 symbol->type->refCount++;
12605 ProcessExpressionType(exp);
12606 FreeType(dummy);
12607 break;
12608 }
12609 }
12610 }
12611 if(exp->op.exp1)
12612 {
12613 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))
12614 {
12615 if(exp->op.exp1->destType)
12616 FreeType(exp->op.exp1->destType);
12617 exp->op.exp1->destType = exp->destType;
12618 if(exp->destType)
12619 exp->destType->refCount++;
12620 }
12621 else if(!assign)
12622 {
12623 if(exp->op.exp1->destType)
12624 FreeType(exp->op.exp1->destType);
12625 exp->op.exp1->destType = dummy;
12626 dummy->refCount++;
12627 }
12628 if(exp->op.exp1->destType && exp->op.op != '=')
12629 exp->op.exp1->destType->count++;
12630 ProcessExpressionType(exp->op.exp1);
12631 if(exp->op.exp1->destType && exp->op.op != '=')
12632 exp->op.exp1->destType->count--;
12633 if(exp->op.exp1->destType == dummy)
12634 {
12635 FreeType(dummy);
12636 exp->op.exp1->destType = (((void *)0));
12637 }
12638 type1 = exp->op.exp1->expType;
12639 }
12640 if(exp->op.exp2)
12641 {
12642 char expString[10240];
12643
12644 expString[0] = '\0';
12645 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12646 {
12647 if(exp->op.exp1)
12648 {
12649 exp->op.exp2->destType = exp->op.exp1->expType;
12650 if(exp->op.exp1->expType)
12651 exp->op.exp1->expType->refCount++;
12652 }
12653 else
12654 {
12655 exp->op.exp2->destType = exp->destType;
12656 if(exp->destType)
12657 exp->destType->refCount++;
12658 }
12659 if(type1)
12660 type1->refCount++;
12661 exp->expType = type1;
12662 }
12663 else if(assign)
12664 {
12665 if(inCompiler)
12666 PrintExpression(exp->op.exp2, expString);
12667 if(type1 && type1->kind == 13)
12668 {
12669 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)
12670 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12671 else if(exp->op.op == '=')
12672 {
12673 if(exp->op.exp2->destType)
12674 FreeType(exp->op.exp2->destType);
12675 exp->op.exp2->destType = type1;
12676 if(type1)
12677 type1->refCount++;
12678 }
12679 }
12680 else
12681 {
12682 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)
12683 ;
12684 else
12685 {
12686 if(exp->op.exp2->destType)
12687 FreeType(exp->op.exp2->destType);
12688 exp->op.exp2->destType = type1;
12689 if(type1)
12690 type1->refCount++;
12691 }
12692 }
12693 if(type1)
12694 type1->refCount++;
12695 exp->expType = type1;
12696 }
12697 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)))
12698 {
12699 if(exp->op.exp2->destType)
12700 FreeType(exp->op.exp2->destType);
12701 exp->op.exp2->destType = exp->destType;
12702 if(exp->destType)
12703 exp->destType->refCount++;
12704 }
12705 else
12706 {
12707 if(exp->op.exp2->destType)
12708 FreeType(exp->op.exp2->destType);
12709 exp->op.exp2->destType = dummy;
12710 dummy->refCount++;
12711 }
12712 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12713 {
12714 FreeType(exp->op.exp2->destType);
12715 exp->op.exp2->destType = type1;
12716 type1->refCount++;
12717 }
12718 if(exp->op.exp2->destType && exp->op.op != '=')
12719 exp->op.exp2->destType->count++;
12720 ProcessExpressionType(exp->op.exp2);
12721 if(exp->op.exp2->destType && exp->op.op != '=')
12722 exp->op.exp2->destType->count--;
12723 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12724 {
12725 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)
12726 {
12727 if(exp->op.op != '=' && type1->type->kind == 0)
12728 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12729 }
12730 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)))
12731 {
12732 if(exp->op.op == ADD_ASSIGN)
12733 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12734 }
12735 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))
12736 {
12737 if(exp->op.op == ADD_ASSIGN)
12738 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12739 }
12740 else if(inCompiler)
12741 {
12742 char type1String[1024];
12743 char type2String[1024];
12744
12745 type1String[0] = '\0';
12746 type2String[0] = '\0';
12747 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12748 PrintType(type1, type2String, 0x0, 0x1);
12749 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12750 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12751 }
12752 }
12753 if(exp->op.exp2->destType == dummy)
12754 {
12755 FreeType(dummy);
12756 exp->op.exp2->destType = (((void *)0));
12757 }
12758 type2 = exp->op.exp2->expType;
12759 }
12760 dummy->kind = 0;
12761 if(exp->op.op == SIZEOF)
12762 {
12763 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
12764 exp->isConstant = 0x1;
12765 }
12766 else if(exp->op.op == '*' && !exp->op.exp1)
12767 {
12768 exp->expType = Dereference(type2);
12769 if(type2 && type2->kind == 8)
12770 notByReference = 0x1;
12771 }
12772 else if(exp->op.op == '&' && !exp->op.exp1)
12773 exp->expType = Reference(type2);
12774 else if(!assign)
12775 {
12776 if(boolOps)
12777 {
12778 if(exp->op.exp1)
12779 {
12780 if(exp->op.exp1->destType)
12781 FreeType(exp->op.exp1->destType);
12782 exp->op.exp1->destType = MkClassType("bool");
12783 exp->op.exp1->destType->truth = 0x1;
12784 if(!exp->op.exp1->expType)
12785 ProcessExpressionType(exp->op.exp1);
12786 else
12787 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12788 FreeType(exp->op.exp1->expType);
12789 exp->op.exp1->expType = MkClassType("bool");
12790 exp->op.exp1->expType->truth = 0x1;
12791 }
12792 if(exp->op.exp2)
12793 {
12794 if(exp->op.exp2->destType)
12795 FreeType(exp->op.exp2->destType);
12796 exp->op.exp2->destType = MkClassType("bool");
12797 exp->op.exp2->destType->truth = 0x1;
12798 if(!exp->op.exp2->expType)
12799 ProcessExpressionType(exp->op.exp2);
12800 else
12801 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12802 FreeType(exp->op.exp2->expType);
12803 exp->op.exp2->expType = MkClassType("bool");
12804 exp->op.exp2->expType->truth = 0x1;
12805 }
12806 }
12807 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")))))
12808 {
12809 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
12810 {
12811 if(exp->op.exp2->destType)
12812 FreeType(exp->op.exp2->destType);
12813 exp->op.exp2->destType = type1;
12814 type1->refCount++;
12815 if(exp->op.exp1->destType)
12816 FreeType(exp->op.exp1->destType);
12817 exp->op.exp1->destType = type2;
12818 type2->refCount++;
12819 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)
12820 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);
12821 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
12822 {
12823 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12824
12825 if(argExp)
12826 {
12827 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12828
12829 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
12830 ProcessExpressionType(exp->op.exp1);
12831 if(type2->kind != 13)
12832 {
12833 ProcessExpressionType(classExp);
12834 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"))))))));
12835 if(!exp->op.exp2->expType)
12836 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
12837 ProcessExpressionType(exp->op.exp2);
12838 }
12839 }
12840 }
12841 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)))
12842 {
12843 if(type1->kind != 8 && type1->type->kind == 0)
12844 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12845 exp->expType = type1;
12846 if(type1)
12847 type1->refCount++;
12848 }
12849 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)))
12850 {
12851 if(type2->kind != 8 && type2->type->kind == 0)
12852 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12853 exp->expType = type2;
12854 if(type2)
12855 type2->refCount++;
12856 }
12857 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))
12858 {
12859 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
12860 }
12861 else
12862 {
12863 unsigned int success = 0x0;
12864
12865 if(type1->kind == 13 && type2->kind == 13)
12866 {
12867 if(exp->op.op == '+')
12868 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12869 else if(exp->op.op == '-')
12870 {
12871 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
12872 {
12873 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
12874 success = 0x1;
12875 if(type1->type->kind == 20)
12876 {
12877 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12878
12879 if(argExp)
12880 {
12881 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12882
12883 ProcessExpressionType(classExp);
12884 exp->type = 5;
12885 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")))))));
12886 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
12887 FreeType(dummy);
12888 return ;
12889 }
12890 }
12891 }
12892 }
12893 }
12894 if(!success && exp->op.exp1->type == 2)
12895 {
12896 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12897 {
12898 if(exp->expType)
12899 FreeType(exp->expType);
12900 exp->expType = exp->op.exp1->destType;
12901 if(exp->op.exp1->destType)
12902 exp->op.exp1->destType->refCount++;
12903 success = 0x1;
12904 }
12905 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12906 {
12907 if(exp->expType)
12908 FreeType(exp->expType);
12909 exp->expType = exp->op.exp2->destType;
12910 if(exp->op.exp2->destType)
12911 exp->op.exp2->destType->refCount++;
12912 success = 0x1;
12913 }
12914 }
12915 else if(!success)
12916 {
12917 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12918 {
12919 if(exp->expType)
12920 FreeType(exp->expType);
12921 exp->expType = exp->op.exp2->destType;
12922 if(exp->op.exp2->destType)
12923 exp->op.exp2->destType->refCount++;
12924 success = 0x1;
12925 }
12926 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12927 {
12928 if(exp->expType)
12929 FreeType(exp->expType);
12930 exp->expType = exp->op.exp1->destType;
12931 if(exp->op.exp1->destType)
12932 exp->op.exp1->destType->refCount++;
12933 success = 0x1;
12934 }
12935 }
12936 if(!success)
12937 {
12938 char expString1[10240];
12939 char expString2[10240];
12940 char type1[1024];
12941 char type2[1024];
12942
12943 expString1[0] = '\0';
12944 expString2[0] = '\0';
12945 type1[0] = '\0';
12946 type2[0] = '\0';
12947 if(inCompiler)
12948 {
12949 PrintExpression(exp->op.exp1, expString1);
12950 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12951 PrintExpression(exp->op.exp2, expString2);
12952 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12953 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
12954 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
12955 }
12956 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
12957 }
12958 }
12959 }
12960 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12961 {
12962 if(exp->op.exp1->destType)
12963 FreeType(exp->op.exp1->destType);
12964 exp->op.exp1->destType = type2->_class->registered->dataType;
12965 if(type2->_class->registered->dataType)
12966 type2->_class->registered->dataType->refCount++;
12967 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12968 exp->expType = type2;
12969 if(type2)
12970 type2->refCount++;
12971 }
12972 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
12973 {
12974 if(exp->op.exp2->destType)
12975 FreeType(exp->op.exp2->destType);
12976 exp->op.exp2->destType = type1->_class->registered->dataType;
12977 if(type1->_class->registered->dataType)
12978 type1->_class->registered->dataType->refCount++;
12979 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12980 exp->expType = type1;
12981 if(type1)
12982 type1->refCount++;
12983 }
12984 else if(type1)
12985 {
12986 unsigned int valid = 0x0;
12987
12988 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
12989 {
12990 if(exp->op.exp2->destType)
12991 FreeType(exp->op.exp2->destType);
12992 if(!type1->_class->registered->dataType)
12993 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
12994 exp->op.exp2->destType = type1->_class->registered->dataType;
12995 exp->op.exp2->destType->refCount++;
12996 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12997 type2 = exp->op.exp2->destType;
12998 exp->expType = type2;
12999 type2->refCount++;
13000 }
13001 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
13002 {
13003 if(exp->op.exp1->destType)
13004 FreeType(exp->op.exp1->destType);
13005 if(!type2->_class->registered->dataType)
13006 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
13007 exp->op.exp1->destType = type2->_class->registered->dataType;
13008 exp->op.exp1->destType->refCount++;
13009 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13010 type1 = exp->op.exp1->destType;
13011 exp->expType = type1;
13012 type1->refCount++;
13013 }
13014 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
13015 {
13016 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
13017 {
13018 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
13019 {
13020 if(exp->expType)
13021 FreeType(exp->expType);
13022 exp->expType = exp->op.exp1->expType;
13023 if(exp->op.exp2->expType)
13024 exp->op.exp1->expType->refCount++;
13025 valid = 0x1;
13026 }
13027 }
13028 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
13029 {
13030 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
13031 {
13032 if(exp->expType)
13033 FreeType(exp->expType);
13034 exp->expType = exp->op.exp2->expType;
13035 if(exp->op.exp2->expType)
13036 exp->op.exp2->expType->refCount++;
13037 valid = 0x1;
13038 }
13039 }
13040 }
13041 if(!valid)
13042 {
13043 if(exp->op.exp2->destType)
13044 FreeType(exp->op.exp2->destType);
13045 exp->op.exp2->destType = type1;
13046 type1->refCount++;
13047 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13048 {
13049 if(exp->expType)
13050 FreeType(exp->expType);
13051 exp->expType = exp->op.exp2->destType;
13052 if(exp->op.exp2->destType)
13053 exp->op.exp2->destType->refCount++;
13054 }
13055 else if(type1 && type2)
13056 {
13057 char expString1[10240];
13058 char expString2[10240];
13059 char type1String[1024];
13060 char type2String[1024];
13061
13062 expString1[0] = '\0';
13063 expString2[0] = '\0';
13064 type1String[0] = '\0';
13065 type2String[0] = '\0';
13066 if(inCompiler)
13067 {
13068 PrintExpression(exp->op.exp1, expString1);
13069 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13070 PrintExpression(exp->op.exp2, expString2);
13071 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13072 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
13073 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
13074 }
13075 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
13076 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
13077 {
13078 exp->expType = exp->op.exp1->expType;
13079 if(exp->op.exp1->expType)
13080 exp->op.exp1->expType->refCount++;
13081 }
13082 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13083 {
13084 exp->expType = exp->op.exp2->expType;
13085 if(exp->op.exp2->expType)
13086 exp->op.exp2->expType->refCount++;
13087 }
13088 }
13089 }
13090 }
13091 else if(type2)
13092 {
13093 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13094 {
13095 struct Type * oldType = exp->op.exp1->expType;
13096
13097 exp->op.exp1->expType = (((void *)0));
13098 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13099 FreeType(oldType);
13100 else
13101 exp->op.exp1->expType = oldType;
13102 }
13103 if(exp->op.exp1->destType)
13104 FreeType(exp->op.exp1->destType);
13105 exp->op.exp1->destType = type2;
13106 type2->refCount++;
13107 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13108 {
13109 if(exp->expType)
13110 FreeType(exp->expType);
13111 exp->expType = exp->op.exp1->destType;
13112 if(exp->op.exp1->destType)
13113 exp->op.exp1->destType->refCount++;
13114 }
13115 }
13116 }
13117 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
13118 {
13119 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13120 {
13121 if(exp->op.exp1->destType)
13122 FreeType(exp->op.exp1->destType);
13123 exp->op.exp1->destType = type2->_class->registered->dataType;
13124 if(type2->_class->registered->dataType)
13125 type2->_class->registered->dataType->refCount++;
13126 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13127 }
13128 if(exp->op.op == '!')
13129 {
13130 exp->expType = MkClassType("bool");
13131 exp->expType->truth = 0x1;
13132 }
13133 else
13134 {
13135 exp->expType = type2;
13136 if(type2)
13137 type2->refCount++;
13138 }
13139 }
13140 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
13141 {
13142 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13143 {
13144 if(exp->op.exp2->destType)
13145 FreeType(exp->op.exp2->destType);
13146 exp->op.exp2->destType = type1->_class->registered->dataType;
13147 if(type1->_class->registered->dataType)
13148 type1->_class->registered->dataType->refCount++;
13149 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13150 }
13151 exp->expType = type1;
13152 if(type1)
13153 type1->refCount++;
13154 }
13155 }
13156 yylloc = exp->loc;
13157 if(exp->op.exp1 && !exp->op.exp1->expType)
13158 {
13159 char expString[10000];
13160
13161 expString[0] = '\0';
13162 if(inCompiler)
13163 {
13164 PrintExpression(exp->op.exp1, expString);
13165 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13166 }
13167 if(expString[0])
13168 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13169 }
13170 if(exp->op.exp2 && !exp->op.exp2->expType)
13171 {
13172 char expString[10240];
13173
13174 expString[0] = '\0';
13175 if(inCompiler)
13176 {
13177 PrintExpression(exp->op.exp2, expString);
13178 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13179 }
13180 if(expString[0])
13181 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13182 }
13183 if(boolResult)
13184 {
13185 FreeType(exp->expType);
13186 exp->expType = MkClassType("bool");
13187 exp->expType->truth = 0x1;
13188 }
13189 if(exp->op.op != SIZEOF)
13190 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
13191 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
13192 {
13193 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
13194 }
13195 yylloc = oldyylloc;
13196 FreeType(dummy);
13197 break;
13198 }
13199 case 5:
13200 case 34:
13201 {
13202 struct Expression * e;
13203
13204 exp->isConstant = 0x1;
13205 for(e = (*exp->list).first; e; e = e->next)
13206 {
13207 unsigned int inced = 0x0;
13208
13209 if(!e->next)
13210 {
13211 FreeType(e->destType);
13212 e->destType = exp->destType;
13213 if(e->destType)
13214 {
13215 exp->destType->refCount++;
13216 e->destType->count++;
13217 inced = 0x1;
13218 }
13219 }
13220 ProcessExpressionType(e);
13221 if(inced)
13222 exp->destType->count--;
13223 if(!exp->expType && !e->next)
13224 {
13225 exp->expType = e->expType;
13226 if(e->expType)
13227 e->expType->refCount++;
13228 }
13229 if(!e->isConstant)
13230 exp->isConstant = 0x0;
13231 }
13232 e = (*exp->list).first;
13233 if(!e->next && e->type == 8)
13234 {
13235 struct Expression * next = exp->next, * prev = exp->prev;
13236
13237 FreeType(exp->expType);
13238 FreeType(exp->destType);
13239 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
13240 *exp = *e;
13241 exp->prev = prev;
13242 exp->next = next;
13243 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
13244 ProcessExpressionType(exp);
13245 }
13246 break;
13247 }
13248 case 6:
13249 {
13250 struct Expression * e;
13251
13252 exp->isConstant = 0x1;
13253 ProcessExpressionType(exp->index.exp);
13254 if(!exp->index.exp->isConstant)
13255 exp->isConstant = 0x0;
13256 if(exp->index.exp->expType)
13257 {
13258 struct Type * source = exp->index.exp->expType;
13259
13260 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)
13261 {
13262 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
13263
13264 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
13265 if(exp->index.index && (*exp->index.index).last)
13266 {
13267 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
13268 }
13269 }
13270 }
13271 for(e = (*exp->index.index).first; e; e = e->next)
13272 {
13273 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
13274 {
13275 if(e->destType)
13276 FreeType(e->destType);
13277 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
13278 }
13279 ProcessExpressionType(e);
13280 if(!e->next)
13281 {
13282 }
13283 if(!e->isConstant)
13284 exp->isConstant = 0x0;
13285 }
13286 if(!exp->expType)
13287 exp->expType = Dereference(exp->index.exp->expType);
13288 if(exp->expType)
13289 DeclareType(exp->expType, 0x0, 0x0);
13290 break;
13291 }
13292 case 7:
13293 {
13294 struct Expression * e;
13295 struct Type * functionType;
13296 struct Type * methodType = (((void *)0));
13297 char name[1024];
13298
13299 name[0] = '\0';
13300 if(inCompiler)
13301 {
13302 PrintExpression(exp->call.exp, name);
13303 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
13304 {
13305 PrintExpression(exp->call.exp, name);
13306 }
13307 }
13308 if(exp->call.exp->type == 0)
13309 {
13310 struct Expression * idExp = exp->call.exp;
13311 struct Identifier * id = idExp->identifier;
13312
13313 if(!strcmp(id->string, "__builtin_frame_address"))
13314 {
13315 exp->expType = ProcessTypeString("void *", 0x1);
13316 if(exp->call.arguments && (*exp->call.arguments).first)
13317 ProcessExpressionType((*exp->call.arguments).first);
13318 break;
13319 }
13320 else if(!strcmp(id->string, "__ENDIAN_PAD"))
13321 {
13322 exp->expType = ProcessTypeString("int", 0x1);
13323 if(exp->call.arguments && (*exp->call.arguments).first)
13324 ProcessExpressionType((*exp->call.arguments).first);
13325 break;
13326 }
13327 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
13328 {
13329 struct Expression * a = (((void *)0));
13330 struct Expression * b = (((void *)0));
13331 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
13332
13333 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
13334 {
13335 a = (*exp->call.arguments).first;
13336 b = (*exp->call.arguments).last;
13337 tempExp1 = a;
13338 tempExp2 = b;
13339 }
13340 else if((*exp->call.arguments).count == 1)
13341 {
13342 a = (*exp->call.arguments).first;
13343 tempExp1 = a;
13344 }
13345 if(a)
13346 {
13347 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
13348 idExp->identifier = (((void *)0));
13349 FreeExpContents(exp);
13350 ProcessExpressionType(a);
13351 if(b)
13352 ProcessExpressionType(b);
13353 exp->type = 5;
13354 exp->list = MkList();
13355 if(a->expType && (!b || b->expType))
13356 {
13357 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
13358 {
13359 if(inCompiler)
13360 {
13361 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13362 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
13363 struct Declaration * decl;
13364 char temp1[1024], temp2[1024];
13365
13366 GetTypeSpecs(a->expType, specs);
13367 if(a && !a->isConstant && a->type != 0)
13368 {
13369 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
13370 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
13371 tempExp1 = QMkExpId(temp1);
13372 tempExp1->expType = a->expType;
13373 if(a->expType)
13374 a->expType->refCount++;
13375 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
13376 }
13377 if(b && !b->isConstant && b->type != 0)
13378 {
13379 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
13380 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
13381 tempExp2 = QMkExpId(temp2);
13382 tempExp2->expType = b->expType;
13383 if(b->expType)
13384 b->expType->refCount++;
13385 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
13386 }
13387 decl = MkDeclaration(specs, decls);
13388 if(!curCompound->compound.declarations)
13389 curCompound->compound.declarations = MkList();
13390 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
13391 }
13392 }
13393 }
13394 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13395 {
13396 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13397
13398 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13399 exp->expType = a->expType;
13400 if(a->expType)
13401 a->expType->refCount++;
13402 }
13403 else if(!strcmp(id->string, "Abs"))
13404 {
13405 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13406 exp->expType = a->expType;
13407 if(a->expType)
13408 a->expType->refCount++;
13409 }
13410 else if(!strcmp(id->string, "Sgn"))
13411 {
13412 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"))))));
13413 exp->expType = ProcessTypeString("int", 0x0);
13414 }
13415 FreeExpression(tempExp1);
13416 if(tempExp2)
13417 FreeExpression(tempExp2);
13418 FreeIdentifier(id);
13419 break;
13420 }
13421 }
13422 }
13423 {
13424 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
13425
13426 if(!exp->call.exp->destType)
13427 {
13428 exp->call.exp->destType = dummy;
13429 dummy->refCount++;
13430 }
13431 ProcessExpressionType(exp->call.exp);
13432 if(exp->call.exp->destType == dummy)
13433 {
13434 FreeType(dummy);
13435 exp->call.exp->destType = (((void *)0));
13436 }
13437 FreeType(dummy);
13438 }
13439 functionType = exp->call.exp->expType;
13440 if(functionType && functionType->kind == 16)
13441 {
13442 methodType = functionType;
13443 functionType = methodType->method->dataType;
13444 if(exp->call.exp->expType->usedClass)
13445 {
13446 char typeString[1024];
13447
13448 typeString[0] = '\0';
13449 PrintType(functionType, typeString, 0x1, 0x1);
13450 if(strstr(typeString, "thisclass"))
13451 {
13452 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13453 struct Declarator * decl;
13454
13455 {
13456 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13457
13458 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13459 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13460 thisClassParams = 0x0;
13461 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13462 {
13463 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13464
13465 thisClass = exp->call.exp->expType->usedClass;
13466 ProcessDeclarator(decl);
13467 thisClass = backupThisClass;
13468 }
13469 thisClassParams = 0x1;
13470 functionType = ProcessType(specs, decl);
13471 functionType->refCount = 0;
13472 FinishTemplatesContext(context);
13473 }
13474 FreeList(specs, FreeSpecifier);
13475 FreeDeclarator(decl);
13476 }
13477 }
13478 }
13479 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13480 {
13481 struct Type * type = functionType->type;
13482
13483 if(!functionType->refCount)
13484 {
13485 functionType->type = (((void *)0));
13486 FreeType(functionType);
13487 }
13488 functionType = type;
13489 }
13490 if(functionType && functionType->kind != 11)
13491 {
13492 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13493 }
13494 else if(functionType)
13495 {
13496 unsigned int emptyParams = 0x0, noParams = 0x0;
13497 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13498 struct Type * type = functionType->params.first;
13499 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13500 int extra = 0;
13501 struct Location oldyylloc = yylloc;
13502
13503 if(!type)
13504 emptyParams = 0x1;
13505 if(functionType->extraParam && e && functionType->thisClass)
13506 {
13507 e->destType = MkClassType(functionType->thisClass->string);
13508 e = e->next;
13509 }
13510 if(!functionType->staticMethod)
13511 {
13512 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13513 {
13514 type = MkClassType(memberExp->member.exp->expType->_class->string);
13515 if(e)
13516 {
13517 e->destType = type;
13518 e = e->next;
13519 type = functionType->params.first;
13520 }
13521 else
13522 type->refCount = 0;
13523 }
13524 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13525 {
13526 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13527 if(e)
13528 {
13529 e->destType = type;
13530 e = e->next;
13531 type = functionType->params.first;
13532 }
13533 else
13534 type->refCount = 0;
13535 }
13536 }
13537 if(type && type->kind == 0)
13538 {
13539 noParams = 0x1;
13540 if(!type->refCount)
13541 FreeType(type);
13542 type = (((void *)0));
13543 }
13544 for(; e; e = e->next)
13545 {
13546 if(!type && !emptyParams)
13547 {
13548 yylloc = e->loc;
13549 if(methodType && methodType->methodClass)
13550 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);
13551 else
13552 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);
13553 break;
13554 }
13555 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13556 {
13557 struct Type * templatedType = (((void *)0));
13558 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13559 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13560 int id = 0;
13561
13562 if(_class && _class->templateArgs)
13563 {
13564 struct __ecereNameSpace__ecere__com__Class * sClass;
13565
13566 for(sClass = _class; sClass; sClass = sClass->base)
13567 {
13568 if(sClass->templateClass)
13569 sClass = sClass->templateClass;
13570 id = 0;
13571 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13572 {
13573 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13574 {
13575 struct __ecereNameSpace__ecere__com__Class * nextClass;
13576
13577 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13578 {
13579 if(nextClass->templateClass)
13580 nextClass = nextClass->templateClass;
13581 id += nextClass->templateParams.count;
13582 }
13583 break;
13584 }
13585 id++;
13586 }
13587 if(curParam)
13588 break;
13589 }
13590 }
13591 if(curParam && _class->templateArgs[id].dataTypeString)
13592 {
13593 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13594
13595 {
13596 struct Context * context = SetupTemplatesContext(_class);
13597
13598 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13599 FinishTemplatesContext(context);
13600 }
13601 e->destType = templatedType;
13602 if(templatedType)
13603 {
13604 templatedType->passAsTemplate = 0x1;
13605 }
13606 }
13607 else
13608 {
13609 e->destType = type;
13610 if(type)
13611 type->refCount++;
13612 }
13613 }
13614 else
13615 {
13616 e->destType = type;
13617 if(type)
13618 type->refCount++;
13619 }
13620 if(type && type->kind != 14)
13621 {
13622 struct Type * next = type->next;
13623
13624 if(!type->refCount)
13625 FreeType(type);
13626 type = next;
13627 }
13628 }
13629 if(type && type->kind != 14)
13630 {
13631 if(methodType && methodType->methodClass)
13632 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);
13633 else
13634 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);
13635 }
13636 yylloc = oldyylloc;
13637 if(type && !type->refCount)
13638 FreeType(type);
13639 }
13640 else
13641 {
13642 functionType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 0, ((struct Type *)__ecereTemp1)->kind = 11, ((struct Type *)__ecereTemp1));
13643 if(exp->call.exp->type == 0)
13644 {
13645 char * string = exp->call.exp->identifier->string;
13646
13647 if(inCompiler)
13648 {
13649 struct Symbol * symbol;
13650 struct Location oldyylloc = yylloc;
13651
13652 yylloc = exp->call.exp->identifier->loc;
13653 if(strstr(string, "__builtin_") == string)
13654 ;
13655 else
13656 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13657 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));
13658 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13659 if(strstr(symbol->string, "::"))
13660 globalContext->hasNameSpace = 0x1;
13661 yylloc = oldyylloc;
13662 }
13663 }
13664 else if(exp->call.exp->type == 8)
13665 {
13666 }
13667 else
13668 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13669 if(!functionType->returnType)
13670 {
13671 functionType->returnType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
13672 }
13673 }
13674 if(functionType && functionType->kind == 11)
13675 {
13676 exp->expType = functionType->returnType;
13677 if(functionType->returnType)
13678 functionType->returnType->refCount++;
13679 if(!functionType->refCount)
13680 FreeType(functionType);
13681 }
13682 if(exp->call.arguments)
13683 {
13684 for(e = (*exp->call.arguments).first; e; e = e->next)
13685 {
13686 struct Type * destType = e->destType;
13687
13688 ProcessExpressionType(e);
13689 }
13690 }
13691 break;
13692 }
13693 case 8:
13694 {
13695 struct Type * type;
13696 struct Location oldyylloc = yylloc;
13697 unsigned int thisPtr = (exp->member.exp && exp->member.exp->type == 0 && !strcmp(exp->member.exp->identifier->string, "this"));
13698
13699 exp->thisPtr = thisPtr;
13700 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13701 {
13702 exp->member.member->classSym = exp->member.member->_class->symbol;
13703 }
13704 ProcessExpressionType(exp->member.exp);
13705 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)
13706 {
13707 exp->isConstant = 0x0;
13708 }
13709 else
13710 exp->isConstant = exp->member.exp->isConstant;
13711 type = exp->member.exp->expType;
13712 yylloc = exp->loc;
13713 if(type && (type->kind == 20))
13714 {
13715 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13716 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13717
13718 if(_class)
13719 {
13720 for(param = _class->templateParams.first; param; param = param->next)
13721 {
13722 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
13723 break;
13724 }
13725 }
13726 if(param && param->defaultArg.member)
13727 {
13728 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
13729
13730 if(argExp)
13731 {
13732 struct Expression * expMember = exp->member.exp;
13733 struct Declarator * decl;
13734 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13735 char thisClassTypeString[1024];
13736
13737 FreeIdentifier(exp->member.member);
13738 ProcessExpressionType(argExp);
13739 {
13740 char * colon = strstr(param->defaultArg.memberString, "::");
13741
13742 if(colon)
13743 {
13744 char className[1024];
13745 struct __ecereNameSpace__ecere__com__Class * sClass;
13746
13747 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
13748 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
13749 }
13750 else
13751 strcpy(thisClassTypeString, _class->fullName);
13752 }
13753 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
13754 exp->expType = ProcessType(specs, decl);
13755 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
13756 {
13757 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13758 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13759 int c;
13760 int paramCount = 0;
13761 int lastParam = -1;
13762 char templateString[1024];
13763 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13764
13765 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13766 for(cClass = expClass; cClass; cClass = cClass->base)
13767 {
13768 int p = 0;
13769
13770 for(param = cClass->templateParams.first; param; param = param->next)
13771 {
13772 int id = p;
13773 struct __ecereNameSpace__ecere__com__Class * sClass;
13774 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13775
13776 for(sClass = cClass->base; sClass; sClass = sClass->base)
13777 id += sClass->templateParams.count;
13778 arg = expClass->templateArgs[id];
13779 for(sClass = _class; sClass; sClass = sClass->base)
13780 {
13781 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
13782 int p = 0;
13783 struct __ecereNameSpace__ecere__com__Class * nextClass;
13784
13785 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13786 p += nextClass->templateParams.count;
13787 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
13788 {
13789 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
13790 {
13791 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13792 {
13793 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
13794 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
13795 break;
13796 }
13797 }
13798 }
13799 }
13800 {
13801 char argument[256];
13802
13803 argument[0] = '\0';
13804 switch(param->type)
13805 {
13806 case 2:
13807 {
13808 char expString[1024];
13809 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13810 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13811 struct Expression * exp;
13812 char * string = PrintHexUInt64(arg.expression.ui64);
13813
13814 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13815 ProcessExpressionType(exp);
13816 ComputeExpression(exp);
13817 expString[0] = '\0';
13818 PrintExpression(exp, expString);
13819 strcat(argument, expString);
13820 FreeExpression(exp);
13821 break;
13822 }
13823 case 1:
13824 {
13825 strcat(argument, arg.member->name);
13826 break;
13827 }
13828 case 0:
13829 {
13830 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13831 {
13832 if(!strcmp(arg.dataTypeString, "thisclass"))
13833 strcat(argument, thisClassTypeString);
13834 else
13835 strcat(argument, arg.dataTypeString);
13836 }
13837 break;
13838 }
13839 }
13840 if(argument[0])
13841 {
13842 if(paramCount)
13843 strcat(templateString, ", ");
13844 if(lastParam != p - 1)
13845 {
13846 strcat(templateString, param->name);
13847 strcat(templateString, " = ");
13848 }
13849 strcat(templateString, argument);
13850 paramCount++;
13851 lastParam = p;
13852 }
13853 p++;
13854 }
13855 }
13856 }
13857 {
13858 int len = strlen(templateString);
13859
13860 if(templateString[len - 1] == '>')
13861 templateString[len++] = ' ';
13862 templateString[len++] = '>';
13863 templateString[len++] = '\0';
13864 }
13865 {
13866 struct Context * context = SetupTemplatesContext(_class);
13867
13868 FreeType(exp->expType);
13869 exp->expType = ProcessTypeString(templateString, 0x0);
13870 FinishTemplatesContext(context);
13871 }
13872 }
13873 exp->type = 5;
13874 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")))))))));
13875 }
13876 }
13877 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
13878 {
13879 type = ProcessTemplateParameterType(type->templateParameter);
13880 }
13881 }
13882 if(type && (type->kind == 20))
13883 ;
13884 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13885 {
13886 struct Identifier * id = exp->member.member;
13887 int typeKind = type->kind;
13888 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));
13889
13890 if(typeKind == 19 && exp->member.exp->type == 26)
13891 {
13892 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
13893 typeKind = 8;
13894 }
13895 if(id && (typeKind == 3 || typeKind == 15))
13896 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
13897 if(_class && id)
13898 {
13899 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
13900 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
13901 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
13902 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
13903 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
13904
13905 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
13906 exp->member.memberType = 1;
13907 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
13908 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
13909 if(typeKind != 19)
13910 {
13911 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
13912 {
13913 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13914 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
13915 {
13916 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13917 if(prop)
13918 member = (((void *)0));
13919 }
13920 if(!member && !prop)
13921 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13922 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
13923 exp->member.thisPtr = 0x1;
13924 }
13925 else
13926 {
13927 if(!id->classSym)
13928 {
13929 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
13930 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13931 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
13932 }
13933 if(!prop && !member)
13934 {
13935 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
13936 if(!method)
13937 {
13938 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13939 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13940 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13941 }
13942 }
13943 if(member && prop)
13944 {
13945 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
13946 prop = (((void *)0));
13947 else
13948 member = (((void *)0));
13949 }
13950 }
13951 }
13952 if(!prop && !member)
13953 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
13954 if(!prop && !member && !method)
13955 {
13956 if(typeKind == 19)
13957 {
13958 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
13959 if(classProp)
13960 {
13961 exp->member.memberType = 5;
13962 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
13963 }
13964 else
13965 {
13966 char structName[1024];
13967 struct Identifier * id = exp->member.member;
13968 struct Expression * classExp = exp->member.exp;
13969
13970 type->refCount++;
13971 FreeType(classExp->expType);
13972 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
13973 strcpy(structName, "__ecereClassData_");
13974 FullClassNameCat(structName, type->_class->string, 0x0);
13975 exp->type = 9;
13976 exp->member.member = id;
13977 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"))))))));
13978 FreeType(type);
13979 ProcessExpressionType(exp);
13980 return ;
13981 }
13982 }
13983 else
13984 {
13985 struct Symbol * classSym = FindClass(id->string);
13986
13987 if(classSym)
13988 {
13989 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
13990
13991 if(convertClass)
13992 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
13993 }
13994 }
13995 }
13996 if(prop)
13997 {
13998 exp->member.memberType = 1;
13999 if(!prop->dataType)
14000 ProcessPropertyType(prop);
14001 exp->expType = prop->dataType;
14002 if(prop->dataType)
14003 prop->dataType->refCount++;
14004 }
14005 else if(member)
14006 {
14007 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14008 {
14009 FreeExpContents(exp);
14010 exp->type = 0;
14011 exp->identifier = MkIdentifier("class");
14012 ProcessExpressionType(exp);
14013 return ;
14014 }
14015 exp->member.memberType = 3;
14016 DeclareStruct(_class->fullName, 0x0);
14017 if(!member->dataType)
14018 {
14019 struct Context * context = SetupTemplatesContext(_class);
14020
14021 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
14022 FinishTemplatesContext(context);
14023 }
14024 exp->expType = member->dataType;
14025 if(member->dataType)
14026 member->dataType->refCount++;
14027 }
14028 else if(revConvert)
14029 {
14030 exp->member.memberType = 4;
14031 exp->expType = MkClassType(revConvert->_class->fullName);
14032 }
14033 else if(method)
14034 {
14035 if(inCompiler)
14036 {
14037 exp->member.memberType = 2;
14038 }
14039 if(!method->dataType)
14040 ProcessMethodType(method);
14041 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));
14042 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
14043 exp->expType->usedClass = _class;
14044 }
14045 else if(!classProp)
14046 {
14047 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14048 {
14049 FreeExpContents(exp);
14050 exp->type = 0;
14051 exp->identifier = MkIdentifier("class");
14052 ProcessExpressionType(exp);
14053 return ;
14054 }
14055 yylloc = exp->member.member->loc;
14056 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
14057 if(inCompiler)
14058 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
14059 }
14060 if(_class && exp->expType)
14061 {
14062 struct __ecereNameSpace__ecere__com__Class * tClass;
14063
14064 tClass = _class;
14065 while(tClass && !tClass->templateClass)
14066 tClass = tClass->base;
14067 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
14068 {
14069 int id = 0;
14070 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14071 struct __ecereNameSpace__ecere__com__Class * sClass;
14072
14073 for(sClass = tClass; sClass; sClass = sClass->base)
14074 {
14075 id = 0;
14076 if(sClass->templateClass)
14077 sClass = sClass->templateClass;
14078 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14079 {
14080 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
14081 {
14082 for(sClass = sClass->base; sClass; sClass = sClass->base)
14083 id += sClass->templateParams.count;
14084 break;
14085 }
14086 id++;
14087 }
14088 if(curParam)
14089 break;
14090 }
14091 if(curParam && tClass->templateArgs[id].dataTypeString)
14092 {
14093 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14094 struct Context * context = SetupTemplatesContext(tClass);
14095
14096 FreeType(exp->expType);
14097 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
14098 if(exp->expType)
14099 {
14100 if(exp->expType->kind == 21)
14101 {
14102 FreeType(exp->expType);
14103 exp->expType = ReplaceThisClassType(_class);
14104 }
14105 if(tClass->templateClass)
14106 exp->expType->passAsTemplate = 0x1;
14107 if(!exp->destType)
14108 {
14109 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
14110 if(exp->destType->kind == 21)
14111 {
14112 FreeType(exp->destType);
14113 exp->destType = ReplaceThisClassType(_class);
14114 }
14115 }
14116 }
14117 FinishTemplatesContext(context);
14118 }
14119 }
14120 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
14121 {
14122 int id = 0;
14123 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14124 struct __ecereNameSpace__ecere__com__Class * sClass;
14125
14126 for(sClass = tClass; sClass; sClass = sClass->base)
14127 {
14128 id = 0;
14129 if(sClass->templateClass)
14130 sClass = sClass->templateClass;
14131 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14132 {
14133 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
14134 {
14135 for(sClass = sClass->base; sClass; sClass = sClass->base)
14136 id += sClass->templateParams.count;
14137 break;
14138 }
14139 id++;
14140 }
14141 if(curParam)
14142 break;
14143 }
14144 if(curParam)
14145 {
14146 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14147 struct Context * context = SetupTemplatesContext(tClass);
14148 struct Type * basicType;
14149
14150 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
14151 if(basicType)
14152 {
14153 if(basicType->kind == 21)
14154 {
14155 FreeType(basicType);
14156 basicType = ReplaceThisClassType(_class);
14157 }
14158 FreeType(exp->expType);
14159 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));
14160 if(!exp->destType)
14161 {
14162 exp->destType = exp->expType;
14163 exp->destType->refCount++;
14164 }
14165 {
14166 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14167 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14168 struct Declarator * decl;
14169
14170 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
14171 *newExp = *exp;
14172 if(exp->destType)
14173 exp->destType->refCount++;
14174 if(exp->expType)
14175 exp->expType->refCount++;
14176 exp->type = 11;
14177 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
14178 exp->cast.exp = newExp;
14179 }
14180 }
14181 FinishTemplatesContext(context);
14182 }
14183 }
14184 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
14185 {
14186 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
14187
14188 if(expClass)
14189 {
14190 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
14191 int c;
14192 int p = 0;
14193 int paramCount = 0;
14194 int lastParam = -1;
14195 char templateString[1024];
14196 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
14197
14198 sprintf(templateString, "%s<", expClass->templateClass->fullName);
14199 while(cClass != expClass)
14200 {
14201 struct __ecereNameSpace__ecere__com__Class * sClass;
14202
14203 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
14204 ;
14205 cClass = sClass;
14206 for(param = cClass->templateParams.first; param; param = param->next)
14207 {
14208 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
14209 int c;
14210 int cp = 0;
14211 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
14212 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
14213
14214 while(cClassCur != tClass && !paramCur)
14215 {
14216 struct __ecereNameSpace__ecere__com__Class * sClassCur;
14217
14218 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
14219 ;
14220 cClassCur = sClassCur;
14221 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
14222 {
14223 if(!strcmp(paramCur->name, param->name))
14224 {
14225 break;
14226 }
14227 cp++;
14228 }
14229 }
14230 if(paramCur && paramCur->type == 0)
14231 arg = tClass->templateArgs[cp];
14232 else
14233 arg = expClass->templateArgs[p];
14234 {
14235 char argument[256];
14236
14237 argument[0] = '\0';
14238 switch(param->type)
14239 {
14240 case 2:
14241 {
14242 char expString[1024];
14243 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14244 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14245 struct Expression * exp;
14246 char * string = PrintHexUInt64(arg.expression.ui64);
14247
14248 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14249 ProcessExpressionType(exp);
14250 ComputeExpression(exp);
14251 expString[0] = '\0';
14252 PrintExpression(exp, expString);
14253 strcat(argument, expString);
14254 FreeExpression(exp);
14255 break;
14256 }
14257 case 1:
14258 {
14259 strcat(argument, arg.member->name);
14260 break;
14261 }
14262 case 0:
14263 {
14264 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14265 strcat(argument, arg.dataTypeString);
14266 break;
14267 }
14268 }
14269 if(argument[0])
14270 {
14271 if(paramCount)
14272 strcat(templateString, ", ");
14273 if(lastParam != p - 1)
14274 {
14275 strcat(templateString, param->name);
14276 strcat(templateString, " = ");
14277 }
14278 strcat(templateString, argument);
14279 paramCount++;
14280 lastParam = p;
14281 }
14282 }
14283 p++;
14284 }
14285 }
14286 {
14287 int len = strlen(templateString);
14288
14289 if(templateString[len - 1] == '>')
14290 templateString[len++] = ' ';
14291 templateString[len++] = '>';
14292 templateString[len++] = '\0';
14293 }
14294 FreeType(exp->expType);
14295 {
14296 struct Context * context = SetupTemplatesContext(tClass);
14297
14298 exp->expType = ProcessTypeString(templateString, 0x0);
14299 FinishTemplatesContext(context);
14300 }
14301 }
14302 }
14303 }
14304 }
14305 else
14306 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)");
14307 }
14308 else if(type && (type->kind == 9 || type->kind == 10))
14309 {
14310 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
14311
14312 if(memberType)
14313 {
14314 exp->expType = memberType;
14315 if(memberType)
14316 memberType->refCount++;
14317 }
14318 }
14319 else
14320 {
14321 char expString[10240];
14322
14323 expString[0] = '\0';
14324 if(inCompiler)
14325 {
14326 PrintExpression(exp, expString);
14327 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14328 }
14329 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
14330 }
14331 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
14332 {
14333 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
14334 {
14335 struct Identifier * id = exp->member.member;
14336 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));
14337
14338 if(_class)
14339 {
14340 FreeType(exp->expType);
14341 exp->expType = ReplaceThisClassType(_class);
14342 }
14343 }
14344 }
14345 yylloc = oldyylloc;
14346 break;
14347 }
14348 case 9:
14349 {
14350 struct Type * destType = exp->destType;
14351
14352 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
14353 {
14354 exp->member.member->classSym = exp->member.member->_class->symbol;
14355 }
14356 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
14357 exp->type = 8;
14358 if(destType)
14359 destType->count++;
14360 ProcessExpressionType(exp);
14361 if(destType)
14362 destType->count--;
14363 break;
14364 }
14365 case 15:
14366 {
14367 struct Symbol * classSym = exp->_class->symbol;
14368
14369 if(classSym && classSym->registered)
14370 {
14371 if(classSym->registered->type == 5)
14372 {
14373 char name[1024];
14374
14375 name[0] = '\0';
14376 DeclareStruct(classSym->string, 0x0);
14377 FreeSpecifier(exp->_class);
14378 exp->type = 10;
14379 FullClassNameCat(name, classSym->string, 0x0);
14380 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
14381 }
14382 else
14383 {
14384 if(classSym->registered->fixed)
14385 {
14386 FreeSpecifier(exp->_class);
14387 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
14388 exp->type = 2;
14389 }
14390 else
14391 {
14392 char className[1024];
14393
14394 strcpy(className, "__ecereClass_");
14395 FullClassNameCat(className, classSym->string, 0x1);
14396 MangleClassName(className);
14397 DeclareClass(classSym, className);
14398 FreeExpContents(exp);
14399 exp->type = 9;
14400 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14401 exp->member.member = MkIdentifier("structSize");
14402 }
14403 }
14404 }
14405 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14406 break;
14407 }
14408 case 10:
14409 {
14410 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
14411
14412 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14413 exp->isConstant = 0x1;
14414 DeclareType(type, 0x0, 0x0);
14415 FreeType(type);
14416 break;
14417 }
14418 case 11:
14419 {
14420 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14421
14422 type->count = (unsigned int)1;
14423 FreeType(exp->cast.exp->destType);
14424 exp->cast.exp->destType = type;
14425 type->refCount++;
14426 ProcessExpressionType(exp->cast.exp);
14427 type->count = (unsigned int)0;
14428 exp->expType = type;
14429 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14430 {
14431 void * prev = exp->prev, * next = exp->next;
14432 struct Type * expType = exp->cast.exp->destType;
14433 struct Expression * castExp = exp->cast.exp;
14434 struct Type * destType = exp->destType;
14435
14436 if(expType)
14437 expType->refCount++;
14438 FreeType(exp->expType);
14439 FreeTypeName(exp->cast.typeName);
14440 *exp = *castExp;
14441 FreeType(exp->expType);
14442 FreeType(exp->destType);
14443 exp->expType = expType;
14444 exp->destType = destType;
14445 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14446 exp->prev = prev;
14447 exp->next = next;
14448 }
14449 else
14450 {
14451 exp->isConstant = exp->cast.exp->isConstant;
14452 }
14453 break;
14454 }
14455 case 35:
14456 {
14457 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14458
14459 type->refCount++;
14460 exp->expType = type;
14461 break;
14462 }
14463 case 36:
14464 {
14465 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14466
14467 ProcessExpressionType(exp->vaArg.exp);
14468 type->refCount++;
14469 exp->expType = type;
14470 break;
14471 }
14472 case 12:
14473 {
14474 struct Expression * e;
14475
14476 exp->isConstant = 0x1;
14477 FreeType(exp->cond.cond->destType);
14478 exp->cond.cond->destType = MkClassType("bool");
14479 exp->cond.cond->destType->truth = 0x1;
14480 ProcessExpressionType(exp->cond.cond);
14481 if(!exp->cond.cond->isConstant)
14482 exp->isConstant = 0x0;
14483 for(e = (*exp->cond.exp).first; e; e = e->next)
14484 {
14485 if(!e->next)
14486 {
14487 FreeType(e->destType);
14488 e->destType = exp->destType;
14489 if(e->destType)
14490 e->destType->refCount++;
14491 }
14492 ProcessExpressionType(e);
14493 if(!e->next)
14494 {
14495 exp->expType = e->expType;
14496 if(e->expType)
14497 e->expType->refCount++;
14498 }
14499 if(!e->isConstant)
14500 exp->isConstant = 0x0;
14501 }
14502 FreeType(exp->cond.elseExp->destType);
14503 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14504 if(exp->cond.elseExp->destType)
14505 exp->cond.elseExp->destType->refCount++;
14506 ProcessExpressionType(exp->cond.elseExp);
14507 if(!exp->cond.elseExp->isConstant)
14508 exp->isConstant = 0x0;
14509 break;
14510 }
14511 case 25:
14512 {
14513 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14514 {
14515 struct Statement * last = (*exp->compound->compound.statements).last;
14516
14517 if(last->type == 3 && last->expressions && (*last->expressions).last)
14518 {
14519 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14520 if(exp->destType)
14521 exp->destType->refCount++;
14522 }
14523 ProcessStatement(exp->compound);
14524 exp->expType = ((struct Expression *)(*last->expressions).last)->expType;
14525 if(((struct Expression *)(*last->expressions).last)->expType)
14526 exp->expType->refCount++;
14527 }
14528 break;
14529 }
14530 case 26:
14531 {
14532 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14533
14534 if(spec && spec->type == 1)
14535 {
14536 exp->expType = MkClassType(spec->name);
14537 exp->expType->kind = 19;
14538 exp->byReference = 0x1;
14539 }
14540 else
14541 {
14542 exp->expType = MkClassType("ecere::com::Class");
14543 exp->byReference = 0x1;
14544 }
14545 break;
14546 }
14547 case 27:
14548 {
14549 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14550
14551 if(_class)
14552 {
14553 struct Identifier * id = exp->classData.id;
14554 char structName[1024];
14555 struct Expression * classExp;
14556
14557 strcpy(structName, "__ecereClassData_");
14558 FullClassNameCat(structName, _class->fullName, 0x0);
14559 exp->type = 9;
14560 exp->member.member = id;
14561 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14562 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14563 else
14564 classExp = MkExpIdentifier(MkIdentifier("class"));
14565 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"))))))));
14566 ProcessExpressionType(exp);
14567 return ;
14568 }
14569 break;
14570 }
14571 case 37:
14572 {
14573 struct Type * type = (((void *)0));
14574 char * typeString = (((void *)0));
14575 char typeStringBuf[1024];
14576
14577 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))
14578 {
14579 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14580
14581 typeString = templateClass->templateArgs[2].dataTypeString;
14582 }
14583 else if(exp->list)
14584 {
14585 struct Expression * e;
14586
14587 for(e = (*exp->list).first; e; e = e->next)
14588 {
14589 ProcessExpressionType(e);
14590 if(e->expType)
14591 {
14592 if(!type)
14593 {
14594 type = e->expType;
14595 type->refCount++;
14596 }
14597 else
14598 {
14599 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14600 {
14601 FreeType(type);
14602 type = e->expType;
14603 e->expType = (((void *)0));
14604 e = (*exp->list).first;
14605 ProcessExpressionType(e);
14606 if(e->expType)
14607 {
14608 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14609 {
14610 FreeType(e->expType);
14611 e->expType = (((void *)0));
14612 FreeType(type);
14613 type = (((void *)0));
14614 break;
14615 }
14616 }
14617 }
14618 }
14619 if(e->expType)
14620 {
14621 FreeType(e->expType);
14622 e->expType = (((void *)0));
14623 }
14624 }
14625 }
14626 if(type)
14627 {
14628 typeStringBuf[0] = '\0';
14629 PrintType(type, typeStringBuf, 0x0, 0x1);
14630 typeString = typeStringBuf;
14631 FreeType(type);
14632 type = (((void *)0));
14633 }
14634 }
14635 if(typeString)
14636 {
14637 char templateString[1024];
14638 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14639 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14640 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14641 struct Expression * expExt;
14642 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14643
14644 sprintf(templateString, "Container<%s>", typeString);
14645 if(exp->list)
14646 {
14647 struct Expression * e;
14648
14649 type = ProcessTypeString(typeString, 0x0);
14650 while(e = (*exp->list).first)
14651 {
14652 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14653 e->destType = type;
14654 type->refCount++;
14655 ProcessExpressionType(e);
14656 ListAdd(initializers, MkInitializerAssignment(e));
14657 }
14658 FreeType(type);
14659 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14660 }
14661 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
14662 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
14663 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14664 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
14665 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14666 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
14667 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14668 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
14669 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14670 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))));
14671 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14672 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
14673 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14674 exp->expType = ProcessTypeString(templateString, 0x0);
14675 exp->type = 5;
14676 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
14677 ProcessExpressionType(expExt);
14678 }
14679 else
14680 {
14681 exp->expType = ProcessTypeString("Container", 0x0);
14682 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
14683 }
14684 break;
14685 }
14686 }
14687 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
14688 {
14689 FreeType(exp->expType);
14690 exp->expType = ReplaceThisClassType(thisClass);
14691 }
14692 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
14693 {
14694 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
14695
14696 if(symbol)
14697 {
14698 if(exp->expType->kind != 15)
14699 {
14700 struct Type * member;
14701 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
14702
14703 FreeType(exp->expType);
14704 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14705 exp->expType->kind = symbol->type->kind;
14706 exp->expType->refCount++;
14707 exp->expType->enumName = enumName;
14708 exp->expType->members = symbol->type->members;
14709 for(member = symbol->type->members.first; member; member = member->next)
14710 member->refCount++;
14711 }
14712 else
14713 {
14714 struct __ecereNameSpace__ecere__sys__NamedLink * member;
14715
14716 for(member = symbol->type->members.first; member; member = member->next)
14717 {
14718 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(structSize_NamedLink), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
14719
14720 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
14721 }
14722 }
14723 }
14724 }
14725 yylloc = exp->loc;
14726 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
14727 ;
14728 else if(exp->destType && !exp->destType->keepCast)
14729 {
14730 if(!CheckExpressionType(exp, exp->destType, 0x0))
14731 {
14732 if(!exp->destType->count || unresolved)
14733 {
14734 if(!exp->expType)
14735 {
14736 yylloc = exp->loc;
14737 if(exp->destType->kind != 14)
14738 {
14739 char type2[1024];
14740
14741 type2[0] = '\0';
14742 if(inCompiler)
14743 {
14744 char expString[10240];
14745
14746 expString[0] = '\0';
14747 PrintType(exp->destType, type2, 0x0, 0x1);
14748 if(inCompiler)
14749 {
14750 PrintExpression(exp, expString);
14751 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14752 }
14753 if(unresolved)
14754 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
14755 else if(exp->type != 16)
14756 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
14757 }
14758 }
14759 else
14760 {
14761 char expString[10240];
14762
14763 expString[0] = '\0';
14764 if(inCompiler)
14765 {
14766 PrintExpression(exp, expString);
14767 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14768 }
14769 if(unresolved)
14770 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
14771 else if(exp->type != 16)
14772 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14773 }
14774 }
14775 else
14776 {
14777 char type1[1024];
14778 char type2[1024];
14779
14780 type1[0] = '\0';
14781 type2[0] = '\0';
14782 if(inCompiler)
14783 {
14784 PrintType(exp->expType, type1, 0x0, 0x1);
14785 PrintType(exp->destType, type2, 0x0, 0x1);
14786 }
14787 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)))
14788 ;
14789 else
14790 {
14791 char expString[10240];
14792
14793 expString[0] = '\0';
14794 if(inCompiler)
14795 {
14796 PrintExpression(exp, expString);
14797 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14798 }
14799 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
14800 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
14801 FreeType(exp->expType);
14802 exp->destType->refCount++;
14803 exp->expType = exp->destType;
14804 }
14805 }
14806 }
14807 }
14808 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
14809 {
14810 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14811 char typeString[1024];
14812 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14813 struct Declarator * decl;
14814
14815 typeString[0] = '\0';
14816 *newExp = *exp;
14817 if(exp->expType)
14818 exp->expType->refCount++;
14819 if(exp->expType)
14820 exp->expType->refCount++;
14821 exp->type = 11;
14822 newExp->destType = exp->expType;
14823 PrintType(exp->expType, typeString, 0x0, 0x0);
14824 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14825 exp->cast.typeName = MkTypeName(specs, decl);
14826 exp->cast.exp = newExp;
14827 }
14828 }
14829 else if(unresolved)
14830 {
14831 if(exp->identifier->_class && exp->identifier->_class->name)
14832 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
14833 else if(exp->identifier->string && exp->identifier->string[0])
14834 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
14835 }
14836 else if(!exp->expType && exp->type != 16)
14837 {
14838 char expString[10240];
14839
14840 expString[0] = '\0';
14841 if(inCompiler)
14842 {
14843 PrintExpression(exp, expString);
14844 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14845 }
14846 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14847 }
14848 ApplyAnyObjectLogic(exp);
14849 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5)
14850 {
14851 exp->byReference = 0x1;
14852 }
14853 yylloc = oldyylloc;
14854 }
14855
14856 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)
14857 {
14858 if(*curMember)
14859 {
14860 *curMember = (*curMember)->next;
14861 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
14862 {
14863 *curMember = subMemberStack[--(*subMemberStackPos)];
14864 *curMember = (*curMember)->next;
14865 }
14866 while((*curMember) && (*curMember)->isProperty)
14867 *curMember = (*curMember)->next;
14868 if(subMemberStackPos)
14869 {
14870 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14871 {
14872 subMemberStack[(*subMemberStackPos)++] = *curMember;
14873 *curMember = (*curMember)->members.first;
14874 while(*curMember && (*curMember)->isProperty)
14875 *curMember = (*curMember)->next;
14876 }
14877 }
14878 }
14879 while(!*curMember)
14880 {
14881 if(!*curMember)
14882 {
14883 if(subMemberStackPos && *subMemberStackPos)
14884 {
14885 *curMember = subMemberStack[--(*subMemberStackPos)];
14886 *curMember = (*curMember)->next;
14887 }
14888 else
14889 {
14890 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
14891
14892 if(*curClass == _class)
14893 break;
14894 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
14895 ;
14896 *curMember = (*curClass)->membersAndProperties.first;
14897 }
14898 while((*curMember) && (*curMember)->isProperty)
14899 *curMember = (*curMember)->next;
14900 if(subMemberStackPos)
14901 {
14902 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14903 {
14904 subMemberStack[(*subMemberStackPos)++] = *curMember;
14905 *curMember = (*curMember)->members.first;
14906 while(*curMember && (*curMember)->isProperty)
14907 *curMember = (*curMember)->next;
14908 }
14909 }
14910 }
14911 }
14912 }
14913
14914 static void ProcessInitializer(struct Initializer * init, struct Type * type)
14915 {
14916 switch(init->type)
14917 {
14918 case 0:
14919 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
14920 {
14921 if(init->exp && !init->exp->destType)
14922 {
14923 FreeType(init->exp->destType);
14924 init->exp->destType = type;
14925 if(type)
14926 type->refCount++;
14927 }
14928 if(init->exp)
14929 {
14930 ProcessExpressionType(init->exp);
14931 init->isConstant = init->exp->isConstant;
14932 }
14933 break;
14934 }
14935 else
14936 {
14937 struct Expression * exp = init->exp;
14938 struct Instantiation * inst = exp->instance;
14939 struct MembersInit * members;
14940
14941 init->type = 1;
14942 init->list = MkList();
14943 if(inst->members)
14944 {
14945 for(members = (*inst->members).first; members; members = members->next)
14946 {
14947 if(members->type == 0)
14948 {
14949 struct MemberInit * member;
14950
14951 for(member = (*members->dataMembers).first; member; member = member->next)
14952 {
14953 ListAdd(init->list, member->initializer);
14954 member->initializer = (((void *)0));
14955 }
14956 }
14957 }
14958 }
14959 FreeExpression(exp);
14960 }
14961 case 1:
14962 {
14963 struct Initializer * i;
14964 struct Type * initializerType = (((void *)0));
14965 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
14966 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
14967 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
14968 int subMemberStackPos = 0;
14969
14970 if(type && type->kind == 12)
14971 initializerType = Dereference(type);
14972 else if(type && (type->kind == 9 || type->kind == 10))
14973 initializerType = type->members.first;
14974 for(i = (*init->list).first; i; i = i->next)
14975 {
14976 if(type && type->kind == 8 && type->_class && type->_class->registered)
14977 {
14978 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
14979 if(curMember)
14980 {
14981 if(!curMember->dataType)
14982 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
14983 initializerType = curMember->dataType;
14984 }
14985 }
14986 ProcessInitializer(i, initializerType);
14987 if(initializerType && type && (type->kind == 9 || type->kind == 10))
14988 initializerType = initializerType->next;
14989 if(!i->isConstant)
14990 init->isConstant = 0x0;
14991 }
14992 if(type && type->kind == 12)
14993 FreeType(initializerType);
14994 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
14995 {
14996 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
14997 }
14998 break;
14999 }
15000 }
15001 }
15002
15003 extern struct Symbol * FindType(struct Context * ctx, char *  name);
15004
15005 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
15006
15007 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
15008 {
15009 switch(spec->type)
15010 {
15011 case 0:
15012 {
15013 if(spec->specifier == THISCLASS)
15014 {
15015 if(thisClass)
15016 {
15017 spec->type = 1;
15018 spec->name = ReplaceThisClass(thisClass);
15019 spec->symbol = FindClass(spec->name);
15020 ProcessSpecifier(spec, declareStruct);
15021 }
15022 }
15023 break;
15024 }
15025 case 1:
15026 {
15027 struct Symbol * symbol = FindType(curContext, spec->name);
15028
15029 if(symbol)
15030 DeclareType(symbol->type, 0x1, 0x1);
15031 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
15032 DeclareStruct(spec->name, 0x0);
15033 break;
15034 }
15035 case 2:
15036 {
15037 struct Enumerator * e;
15038
15039 if(spec->list)
15040 {
15041 for(e = (*spec->list).first; e; e = e->next)
15042 {
15043 if(e->exp)
15044 ProcessExpressionType(e->exp);
15045 }
15046 }
15047 break;
15048 }
15049 case 3:
15050 case 4:
15051 {
15052 if(spec->definitions)
15053 {
15054 struct ClassDef * def;
15055 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
15056
15057 ProcessClass(spec->definitions, symbol);
15058 }
15059 break;
15060 }
15061 }
15062 }
15063
15064 static void ProcessDeclarator(struct Declarator * decl)
15065 {
15066 switch(decl->type)
15067 {
15068 case 1:
15069 if(decl->identifier->classSym)
15070 {
15071 FreeSpecifier(decl->identifier->_class);
15072 decl->identifier->_class = (((void *)0));
15073 }
15074 break;
15075 case 3:
15076 if(decl->array.exp)
15077 ProcessExpressionType(decl->array.exp);
15078 case 0:
15079 case 2:
15080 case 4:
15081 case 5:
15082 case 6:
15083 case 7:
15084 if(decl->declarator)
15085 ProcessDeclarator(decl->declarator);
15086 if(decl->type == 4)
15087 {
15088 struct Identifier * id = GetDeclId(decl);
15089
15090 if(id && id->_class)
15091 {
15092 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
15093
15094 if(!decl->function.parameters)
15095 decl->function.parameters = MkList();
15096 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
15097 id->_class = (((void *)0));
15098 }
15099 if(decl->function.parameters)
15100 {
15101 struct TypeName * param;
15102
15103 for(param = (*decl->function.parameters).first; param; param = param->next)
15104 {
15105 if(param->qualifiers && (*param->qualifiers).first)
15106 {
15107 struct Specifier * spec = (*param->qualifiers).first;
15108
15109 if(spec && spec->specifier == TYPED_OBJECT)
15110 {
15111 struct Declarator * d = param->declarator;
15112 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);
15113
15114 FreeList(param->qualifiers, FreeSpecifier);
15115 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
15116 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
15117 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
15118 param = newParam;
15119 }
15120 else if(spec && spec->specifier == ANY_OBJECT)
15121 {
15122 struct Declarator * d = param->declarator;
15123
15124 FreeList(param->qualifiers, FreeSpecifier);
15125 param->qualifiers = MkListOne(MkSpecifier(VOID));
15126 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
15127 }
15128 else if(spec->specifier == THISCLASS)
15129 {
15130 if(thisClass)
15131 {
15132 spec->type = 1;
15133 spec->name = ReplaceThisClass(thisClass);
15134 spec->symbol = FindClass(spec->name);
15135 ProcessSpecifier(spec, 0x0);
15136 }
15137 }
15138 }
15139 if(param->declarator)
15140 ProcessDeclarator(param->declarator);
15141 }
15142 }
15143 }
15144 break;
15145 }
15146 }
15147
15148 extern struct Identifier * CopyIdentifier(struct Identifier * id);
15149
15150 extern void FreeInitDeclarator(struct InitDeclarator * decl);
15151
15152 static void ProcessDeclaration(struct Declaration * decl)
15153 {
15154 yylloc = decl->loc;
15155 switch(decl->type)
15156 {
15157 case 1:
15158 {
15159 unsigned int declareStruct = 0x0;
15160
15161 if(decl->declarators)
15162 {
15163 struct InitDeclarator * d;
15164
15165 for(d = (*decl->declarators).first; d; d = d->next)
15166 {
15167 struct Type * type, * subType;
15168
15169 ProcessDeclarator(d->declarator);
15170 type = ProcessType(decl->specifiers, d->declarator);
15171 if(d->initializer)
15172 {
15173 ProcessInitializer(d->initializer, type);
15174 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
15175 {
15176 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
15177 {
15178 struct Instantiation * inst = d->initializer->exp->instance;
15179
15180 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
15181 d->initializer->exp->instance = (((void *)0));
15182 if(decl->specifiers)
15183 FreeList(decl->specifiers, FreeSpecifier);
15184 FreeList(decl->declarators, FreeInitDeclarator);
15185 d = (((void *)0));
15186 decl->type = 2;
15187 decl->inst = inst;
15188 }
15189 }
15190 }
15191 for(subType = type; subType; )
15192 {
15193 if(subType->kind == 8)
15194 {
15195 declareStruct = 0x1;
15196 break;
15197 }
15198 else if(subType->kind == 13)
15199 break;
15200 else if(subType->kind == 12)
15201 subType = subType->arrayType;
15202 else
15203 break;
15204 }
15205 FreeType(type);
15206 if(!d)
15207 break;
15208 }
15209 }
15210 if(decl->specifiers)
15211 {
15212 struct Specifier * s;
15213
15214 for(s = (*decl->specifiers).first; s; s = s->next)
15215 {
15216 ProcessSpecifier(s, declareStruct);
15217 }
15218 }
15219 break;
15220 }
15221 case 2:
15222 {
15223 ProcessInstantiationType(decl->inst);
15224 break;
15225 }
15226 case 0:
15227 {
15228 struct Specifier * spec;
15229 struct Declarator * d;
15230 unsigned int declareStruct = 0x0;
15231
15232 if(decl->declarators)
15233 {
15234 for(d = (*decl->declarators).first; d; d = d->next)
15235 {
15236 struct Type * type = ProcessType(decl->specifiers, d->declarator);
15237 struct Type * subType;
15238
15239 ProcessDeclarator(d);
15240 for(subType = type; subType; )
15241 {
15242 if(subType->kind == 8)
15243 {
15244 declareStruct = 0x1;
15245 break;
15246 }
15247 else if(subType->kind == 13)
15248 break;
15249 else if(subType->kind == 12)
15250 subType = subType->arrayType;
15251 else
15252 break;
15253 }
15254 FreeType(type);
15255 }
15256 }
15257 if(decl->specifiers)
15258 {
15259 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
15260 ProcessSpecifier(spec, declareStruct);
15261 }
15262 break;
15263 }
15264 }
15265 }
15266
15267 static struct FunctionDefinition * curFunction;
15268
15269 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
15270 {
15271 char propName[1024], propNameM[1024];
15272 char getName[1024], setName[1024];
15273 struct __ecereNameSpace__ecere__sys__OldList * args;
15274
15275 DeclareProperty(prop, setName, getName);
15276 strcpy(propName, "__ecereProp_");
15277 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15278 strcat(propName, "_");
15279 FullClassNameCat(propName, prop->name, 0x1);
15280 MangleClassName(propName);
15281 strcpy(propNameM, "__ecerePropM_");
15282 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
15283 strcat(propNameM, "_");
15284 FullClassNameCat(propNameM, prop->name, 0x1);
15285 MangleClassName(propNameM);
15286 if(prop->isWatchable)
15287 {
15288 args = MkList();
15289 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15290 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15291 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15292 args = MkList();
15293 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15294 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15295 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15296 }
15297 {
15298 args = MkList();
15299 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15300 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15301 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15302 args = MkList();
15303 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15304 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15305 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15306 }
15307 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15308 curFunction->propSet->fireWatchersDone = 0x1;
15309 }
15310
15311 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
15312
15313 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
15314
15315 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
15316
15317 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
15318
15319 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
15320
15321 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
15322
15323 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
15324
15325 extern void FreePropertyWatch(struct PropertyWatch * watcher);
15326
15327 static void ProcessStatement(struct Statement * stmt)
15328 {
15329 yylloc = stmt->loc;
15330 switch(stmt->type)
15331 {
15332 case 0:
15333 ProcessStatement(stmt->labeled.stmt);
15334 break;
15335 case 1:
15336 if(stmt->caseStmt.exp)
15337 {
15338 FreeType(stmt->caseStmt.exp->destType);
15339 stmt->caseStmt.exp->destType = curSwitchType;
15340 if(curSwitchType)
15341 curSwitchType->refCount++;
15342 ProcessExpressionType(stmt->caseStmt.exp);
15343 ComputeExpression(stmt->caseStmt.exp);
15344 }
15345 if(stmt->caseStmt.stmt)
15346 ProcessStatement(stmt->caseStmt.stmt);
15347 break;
15348 case 2:
15349 {
15350 if(stmt->compound.context)
15351 {
15352 struct Declaration * decl;
15353 struct Statement * s;
15354 struct Statement * prevCompound = curCompound;
15355 struct Context * prevContext = curContext;
15356
15357 if(!stmt->compound.isSwitch)
15358 {
15359 curCompound = stmt;
15360 curContext = stmt->compound.context;
15361 }
15362 if(stmt->compound.declarations)
15363 {
15364 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
15365 ProcessDeclaration(decl);
15366 }
15367 if(stmt->compound.statements)
15368 {
15369 for(s = (*stmt->compound.statements).first; s; s = s->next)
15370 ProcessStatement(s);
15371 }
15372 curContext = prevContext;
15373 curCompound = prevCompound;
15374 }
15375 break;
15376 }
15377 case 3:
15378 {
15379 struct Expression * exp;
15380
15381 if(stmt->expressions)
15382 {
15383 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15384 ProcessExpressionType(exp);
15385 }
15386 break;
15387 }
15388 case 4:
15389 {
15390 struct Expression * exp;
15391
15392 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15393 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15394 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15395 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15396 {
15397 ProcessExpressionType(exp);
15398 }
15399 if(stmt->ifStmt.stmt)
15400 ProcessStatement(stmt->ifStmt.stmt);
15401 if(stmt->ifStmt.elseStmt)
15402 ProcessStatement(stmt->ifStmt.elseStmt);
15403 break;
15404 }
15405 case 5:
15406 {
15407 struct Type * oldSwitchType = curSwitchType;
15408
15409 if(stmt->switchStmt.exp)
15410 {
15411 struct Expression * exp;
15412
15413 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15414 {
15415 if(!exp->next)
15416 {
15417 ProcessExpressionType(exp);
15418 }
15419 if(!exp->next)
15420 curSwitchType = exp->expType;
15421 }
15422 }
15423 ProcessStatement(stmt->switchStmt.stmt);
15424 curSwitchType = oldSwitchType;
15425 break;
15426 }
15427 case 6:
15428 {
15429 if(stmt->whileStmt.exp)
15430 {
15431 struct Expression * exp;
15432
15433 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15434 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15435 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15436 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15437 {
15438 ProcessExpressionType(exp);
15439 }
15440 }
15441 if(stmt->whileStmt.stmt)
15442 ProcessStatement(stmt->whileStmt.stmt);
15443 break;
15444 }
15445 case 7:
15446 {
15447 if(stmt->doWhile.exp)
15448 {
15449 struct Expression * exp;
15450
15451 if((*stmt->doWhile.exp).last)
15452 {
15453 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15454 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15455 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15456 }
15457 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15458 {
15459 ProcessExpressionType(exp);
15460 }
15461 }
15462 if(stmt->doWhile.stmt)
15463 ProcessStatement(stmt->doWhile.stmt);
15464 break;
15465 }
15466 case 8:
15467 {
15468 struct Expression * exp;
15469
15470 if(stmt->forStmt.init)
15471 ProcessStatement(stmt->forStmt.init);
15472 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15473 {
15474 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15475 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15476 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15477 }
15478 if(stmt->forStmt.check)
15479 ProcessStatement(stmt->forStmt.check);
15480 if(stmt->forStmt.increment)
15481 {
15482 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15483 ProcessExpressionType(exp);
15484 }
15485 if(stmt->forStmt.stmt)
15486 ProcessStatement(stmt->forStmt.stmt);
15487 break;
15488 }
15489 case 18:
15490 {
15491 struct Identifier * id = stmt->forEachStmt.id;
15492 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15493 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15494 struct Statement * block = stmt->forEachStmt.stmt;
15495 char iteratorType[1024];
15496 struct Type * source;
15497 struct Expression * e;
15498 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));
15499 struct Expression * arrayExp;
15500 char * typeString = (((void *)0));
15501 int builtinCount = 0;
15502
15503 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15504 {
15505 if(!e->next)
15506 {
15507 FreeType(e->destType);
15508 e->destType = ProcessTypeString("Container", 0x0);
15509 }
15510 if(!isBuiltin || e->next)
15511 ProcessExpressionType(e);
15512 }
15513 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15514 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15515 {
15516 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15517 struct Symbol * symbol;
15518 struct Expression * expIt = (((void *)0));
15519 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15520 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15521 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15522 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15523
15524 stmt->type = 2;
15525 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15526 stmt->compound.context->parent = curContext;
15527 curContext = stmt->compound.context;
15528 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15529 {
15530 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15531 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15532
15533 isCustomAVLTree = 0x1;
15534 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15535 isAVLTree = 0x1;
15536 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15537 isMap = 0x1;
15538 }
15539 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15540 isArray = 0x1;
15541 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15542 {
15543 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15544
15545 isLinkList = 0x1;
15546 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15547 }
15548 if(isArray)
15549 {
15550 struct Declarator * decl;
15551 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15552
15553 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15554 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15555 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15556 }
15557 else if(isBuiltin)
15558 {
15559 struct Type * type = (((void *)0));
15560 char typeStringBuf[1024];
15561
15562 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15563 if(((struct Expression *)(*exp).last)->type == 11)
15564 {
15565 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15566
15567 if(typeName)
15568 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15569 }
15570 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)
15571 {
15572 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15573
15574 typeString = templateClass->templateArgs[2].dataTypeString;
15575 }
15576 else if(arrayExp->list)
15577 {
15578 struct Expression * e;
15579
15580 for(e = (*arrayExp->list).first; e; e = e->next)
15581 {
15582 ProcessExpressionType(e);
15583 if(e->expType)
15584 {
15585 if(!type)
15586 {
15587 type = e->expType;
15588 type->refCount++;
15589 }
15590 else
15591 {
15592 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15593 {
15594 FreeType(type);
15595 type = e->expType;
15596 e->expType = (((void *)0));
15597 e = (*arrayExp->list).first;
15598 ProcessExpressionType(e);
15599 if(e->expType)
15600 {
15601 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15602 {
15603 FreeType(e->expType);
15604 e->expType = (((void *)0));
15605 FreeType(type);
15606 type = (((void *)0));
15607 break;
15608 }
15609 }
15610 }
15611 }
15612 if(e->expType)
15613 {
15614 FreeType(e->expType);
15615 e->expType = (((void *)0));
15616 }
15617 }
15618 }
15619 if(type)
15620 {
15621 typeStringBuf[0] = '\0';
15622 PrintType(type, typeStringBuf, 0x0, 0x1);
15623 typeString = typeStringBuf;
15624 FreeType(type);
15625 }
15626 }
15627 if(typeString)
15628 {
15629 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15630 struct Declarator * decl;
15631 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15632
15633 if(arrayExp->list)
15634 {
15635 struct Expression * e;
15636
15637 builtinCount = (*arrayExp->list).count;
15638 type = ProcessTypeString(typeString, 0x0);
15639 while(e = (*arrayExp->list).first)
15640 {
15641 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15642 e->destType = type;
15643 type->refCount++;
15644 ProcessExpressionType(e);
15645 ListAdd(initializers, MkInitializerAssignment(e));
15646 }
15647 FreeType(type);
15648 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15649 }
15650 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15651 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15652 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorArray(PlugDeclarator(decl, MkDeclaratorIdentifier(MkIdentifier("__internalArray"))), (((void *)0))), MkInitializerList(initializers)))));
15653 FreeList(exp, FreeExpression);
15654 }
15655 else
15656 {
15657 arrayExp->expType = ProcessTypeString("Container", 0x0);
15658 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15659 }
15660 }
15661 else if(isLinkList && !isList)
15662 {
15663 struct Declarator * decl;
15664 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15665
15666 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15667 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15668 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15669 }
15670 else if(_class->templateArgs)
15671 {
15672 if(isMap)
15673 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15674 else
15675 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
15676 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
15677 }
15678 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
15679 if(block && block->type == 2 && block->compound.context)
15680 {
15681 block->compound.context->parent = stmt->compound.context;
15682 }
15683 if(filter)
15684 {
15685 block = MkIfStmt(filter, block, (((void *)0)));
15686 }
15687 if(isArray)
15688 {
15689 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));
15690 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15691 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15692 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15693 }
15694 else if(isBuiltin)
15695 {
15696 char count[128];
15697
15698 sprintf(count, "%d", builtinCount);
15699 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));
15700 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15701 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15702 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15703 }
15704 else if(isLinkList && !isList)
15705 {
15706 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
15707 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
15708
15709 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
15710 {
15711 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));
15712 }
15713 else
15714 {
15715 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15716 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
15717
15718 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));
15719 }
15720 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15721 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15722 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15723 }
15724 else
15725 {
15726 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
15727 }
15728 ProcessExpressionType(expIt);
15729 if((*stmt->compound.declarations).first)
15730 ProcessDeclaration((*stmt->compound.declarations).first);
15731 if(symbol)
15732 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
15733 ProcessStatement(stmt);
15734 curContext = stmt->compound.context->parent;
15735 break;
15736 }
15737 else
15738 {
15739 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
15740 }
15741 break;
15742 }
15743 case 9:
15744 break;
15745 case 10:
15746 break;
15747 case 11:
15748 break;
15749 case 12:
15750 {
15751 struct Expression * exp;
15752
15753 if(stmt->expressions)
15754 {
15755 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15756 {
15757 if(!exp->next)
15758 {
15759 if(curFunction && !curFunction->type)
15760 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
15761 FreeType(exp->destType);
15762 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
15763 if(exp->destType)
15764 exp->destType->refCount++;
15765 }
15766 ProcessExpressionType(exp);
15767 }
15768 }
15769 break;
15770 }
15771 case 14:
15772 {
15773 ProcessDeclaration(stmt->decl);
15774 break;
15775 }
15776 case 13:
15777 {
15778 struct AsmField * field;
15779
15780 if(stmt->asmStmt.inputFields)
15781 {
15782 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
15783 if(field->expression)
15784 ProcessExpressionType(field->expression);
15785 }
15786 if(stmt->asmStmt.outputFields)
15787 {
15788 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
15789 if(field->expression)
15790 ProcessExpressionType(field->expression);
15791 }
15792 if(stmt->asmStmt.clobberedFields)
15793 {
15794 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
15795 {
15796 if(field->expression)
15797 ProcessExpressionType(field->expression);
15798 }
15799 }
15800 break;
15801 }
15802 case 17:
15803 {
15804 struct PropertyWatch * propWatch;
15805 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15806 struct Expression * object = stmt->_watch.object;
15807 struct Expression * watcher = stmt->_watch.watcher;
15808
15809 if(watcher)
15810 ProcessExpressionType(watcher);
15811 if(object)
15812 ProcessExpressionType(object);
15813 if(inCompiler)
15814 {
15815 if(watcher || thisClass)
15816 {
15817 struct External * external = curExternal;
15818 struct Context * context = curContext;
15819
15820 stmt->type = 3;
15821 stmt->expressions = MkList();
15822 curExternal = external->prev;
15823 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15824 {
15825 struct ClassFunction * func;
15826 char watcherName[1024];
15827 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
15828 struct External * createdExternal;
15829 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
15830
15831 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
15832 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
15833 if(propWatch->deleteWatch)
15834 strcat(watcherName, "_delete");
15835 else
15836 {
15837 struct Identifier * propID;
15838
15839 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15840 {
15841 strcat(watcherName, "_");
15842 strcat(watcherName, propID->string);
15843 }
15844 }
15845 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
15846 {
15847 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
15848 ProcessClassFunctionBody(func, propWatch->compound);
15849 propWatch->compound = (((void *)0));
15850 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
15851 createdExternal->symbol->idCode = external->symbol->idCode;
15852 curExternal = createdExternal;
15853 ProcessFunction(createdExternal->function);
15854 {
15855 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
15856
15857 externalDecl->declaration = decl;
15858 if(decl->symbol && !decl->symbol->pointerExternal)
15859 decl->symbol->pointerExternal = externalDecl;
15860 }
15861 if(propWatch->deleteWatch)
15862 {
15863 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15864
15865 ListAdd(args, CopyExpression(object));
15866 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15867 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15868 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
15869 }
15870 else
15871 {
15872 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
15873 struct Identifier * propID;
15874
15875 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15876 {
15877 char propName[1024];
15878 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15879
15880 if(prop)
15881 {
15882 char getName[1024], setName[1024];
15883 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15884
15885 DeclareProperty(prop, setName, getName);
15886 strcpy(propName, "__ecereProp_");
15887 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15888 strcat(propName, "_");
15889 FullClassNameCat(propName, prop->name, 0x1);
15890 ListAdd(args, CopyExpression(object));
15891 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15892 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15893 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15894 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
15895 }
15896 else
15897 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
15898 }
15899 }
15900 }
15901 else
15902 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
15903 }
15904 curExternal = external;
15905 curContext = context;
15906 if(watcher)
15907 FreeExpression(watcher);
15908 if(object)
15909 FreeExpression(object);
15910 FreeList(watches, FreePropertyWatch);
15911 }
15912 else
15913 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
15914 }
15915 else
15916 {
15917 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15918 {
15919 ProcessStatement(propWatch->compound);
15920 }
15921 }
15922 break;
15923 }
15924 case 15:
15925 {
15926 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15927 struct Expression * object = stmt->_watch.object;
15928 struct __ecereNameSpace__ecere__com__Class * _class;
15929
15930 if(object)
15931 ProcessExpressionType(object);
15932 if(inCompiler)
15933 {
15934 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
15935 if(_class)
15936 {
15937 struct Identifier * propID;
15938
15939 stmt->type = 3;
15940 stmt->expressions = MkList();
15941 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15942 {
15943 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
15944 }
15945 else if(!watches)
15946 {
15947 }
15948 if(watches)
15949 {
15950 for(propID = (*watches).first; propID; propID = propID->next)
15951 {
15952 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15953
15954 if(prop)
15955 {
15956 CreateFireWatcher(prop, object, stmt);
15957 }
15958 else
15959 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
15960 }
15961 }
15962 else
15963 {
15964 struct __ecereNameSpace__ecere__com__Property * prop;
15965 struct __ecereNameSpace__ecere__com__Class * base;
15966
15967 for(base = _class; base; base = base->base)
15968 {
15969 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
15970 {
15971 if(prop->isProperty && prop->isWatchable)
15972 {
15973 CreateFireWatcher(prop, object, stmt);
15974 }
15975 }
15976 }
15977 }
15978 if(object)
15979 FreeExpression(object);
15980 FreeList(watches, FreeIdentifier);
15981 }
15982 else
15983 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
15984 }
15985 break;
15986 }
15987 case 16:
15988 {
15989 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15990 struct Expression * object = stmt->_watch.object;
15991 struct Expression * watcher = stmt->_watch.watcher;
15992 struct __ecereNameSpace__ecere__com__Class * _class;
15993
15994 if(object)
15995 ProcessExpressionType(object);
15996 if(watcher)
15997 ProcessExpressionType(watcher);
15998 if(inCompiler)
15999 {
16000 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
16001 if(watcher || thisClass)
16002 {
16003 if(_class)
16004 {
16005 struct Identifier * propID;
16006
16007 stmt->type = 3;
16008 stmt->expressions = MkList();
16009 if(!watches)
16010 {
16011 struct __ecereNameSpace__ecere__sys__OldList * args;
16012
16013 args = MkList();
16014 ListAdd(args, CopyExpression(object));
16015 ListAdd(args, MkExpConstant("0"));
16016 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16017 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16018 }
16019 else
16020 {
16021 for(propID = (*watches).first; propID; propID = propID->next)
16022 {
16023 char propName[1024];
16024 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16025
16026 if(prop)
16027 {
16028 char getName[1024], setName[1024];
16029 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16030
16031 DeclareProperty(prop, setName, getName);
16032 strcpy(propName, "__ecereProp_");
16033 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16034 strcat(propName, "_");
16035 FullClassNameCat(propName, prop->name, 0x1);
16036 MangleClassName(propName);
16037 ListAdd(args, CopyExpression(object));
16038 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16039 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16040 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16041 }
16042 else
16043 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16044 }
16045 }
16046 if(object)
16047 FreeExpression(object);
16048 if(watcher)
16049 FreeExpression(watcher);
16050 FreeList(watches, FreeIdentifier);
16051 }
16052 else
16053 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16054 }
16055 else
16056 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
16057 }
16058 break;
16059 }
16060 }
16061 }
16062
16063 extern struct Expression * QBrackets(struct Expression * exp);
16064
16065 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
16066
16067 extern struct Declarator * QMkPtrDecl(char *  id);
16068
16069 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
16070
16071 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
16072
16073 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
16074
16075 static void ProcessFunction(struct FunctionDefinition * function)
16076 {
16077 void * __ecereTemp2;
16078 void * __ecereTemp1;
16079 struct Identifier * id = GetDeclId(function->declarator);
16080 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
16081 struct Type * type = symbol ? symbol->type : (((void *)0));
16082 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
16083 struct Context * oldTopContext = topContext;
16084
16085 yylloc = function->loc;
16086 if(type && type->thisClass)
16087 {
16088 struct Symbol * classSym = type->thisClass;
16089 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
16090 char className[1024];
16091 char structName[1024];
16092 struct Declarator * funcDecl;
16093 struct Symbol * thisSymbol;
16094 unsigned int typedObject = 0x0;
16095
16096 if(_class && !_class->base)
16097 {
16098 _class = currentClass;
16099 if(_class && !_class->symbol)
16100 _class->symbol = FindClass(_class->fullName);
16101 classSym = _class ? _class->symbol : (((void *)0));
16102 typedObject = 0x1;
16103 }
16104 thisClass = _class;
16105 if(inCompiler && _class)
16106 {
16107 if(type->kind == 11)
16108 {
16109 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
16110 {
16111 struct Type * param = symbol->type->params.first;
16112
16113 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
16114 FreeType(param);
16115 }
16116 if(type->classObjectType != 1)
16117 {
16118 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
16119 symbol->type->staticMethod = 0x1;
16120 symbol->type->thisClass = (((void *)0));
16121 symbol->type->extraParam = 0x0;
16122 }
16123 }
16124 strcpy(className, "__ecereClass_");
16125 FullClassNameCat(className, _class->fullName, 0x1);
16126 MangleClassName(className);
16127 structName[0] = (char)0;
16128 FullClassNameCat(structName, _class->fullName, 0x0);
16129 funcDecl = GetFuncDecl(function->declarator);
16130 if(funcDecl)
16131 {
16132 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16133 {
16134 struct TypeName * param = (*funcDecl->function.parameters).first;
16135
16136 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16137 {
16138 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16139 FreeTypeName(param);
16140 }
16141 }
16142 if(!function->propertyNoThis)
16143 {
16144 struct TypeName * thisParam;
16145
16146 if(type->classObjectType != 1)
16147 {
16148 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16149 if(!funcDecl->function.parameters)
16150 funcDecl->function.parameters = MkList();
16151 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16152 }
16153 if(typedObject)
16154 {
16155 if(type->classObjectType != 1)
16156 {
16157 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
16158 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
16159 }
16160 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));
16161 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16162 }
16163 }
16164 }
16165 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16166 {
16167 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16168
16169 funcDecl = GetFuncDecl(initDecl->declarator);
16170 if(funcDecl)
16171 {
16172 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16173 {
16174 struct TypeName * param = (*funcDecl->function.parameters).first;
16175
16176 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16177 {
16178 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16179 FreeTypeName(param);
16180 }
16181 }
16182 if(type->classObjectType != 1)
16183 {
16184 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
16185 {
16186 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16187
16188 if(!funcDecl->function.parameters)
16189 funcDecl->function.parameters = MkList();
16190 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16191 }
16192 }
16193 }
16194 }
16195 }
16196 if(function->body)
16197 {
16198 if(type->classObjectType != 1)
16199 {
16200 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));
16201 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16202 if(typedObject && thisSymbol->type)
16203 {
16204 thisSymbol->type->classObjectType = 2;
16205 thisSymbol->type->byReference = type->byReference;
16206 }
16207 }
16208 }
16209 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
16210 {
16211 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
16212
16213 {
16214 struct __ecereNameSpace__ecere__com__Class * base;
16215
16216 for(base = _class; base && base->type != 1000; base = base->next)
16217 {
16218 for(member = base->membersAndProperties.first; member; member = member->next)
16219 if(!member->isProperty)
16220 break;
16221 if(member)
16222 break;
16223 }
16224 }
16225 for(member = _class->membersAndProperties.first; member; member = member->next)
16226 if(!member->isProperty)
16227 break;
16228 if(member)
16229 {
16230 char pointerName[1024];
16231 struct Declaration * decl;
16232 struct Initializer * initializer;
16233 struct Expression * exp, * bytePtr;
16234
16235 strcpy(pointerName, "__ecerePointer_");
16236 FullClassNameCat(pointerName, _class->fullName, 0x0);
16237 {
16238 char className[1024];
16239
16240 strcpy(className, "__ecereClass_");
16241 FullClassNameCat(className, classSym->string, 0x1);
16242 MangleClassName(className);
16243 DeclareClass(classSym, className);
16244 }
16245 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
16246 if(_class->fixed)
16247 {
16248 char string[256];
16249
16250 sprintf(string, "%d", _class->offset);
16251 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
16252 }
16253 else
16254 {
16255 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
16256 }
16257 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
16258 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));
16259 if(function->body)
16260 {
16261 yylloc = function->body->loc;
16262 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
16263 {
16264 struct Context * prevContext = curContext;
16265
16266 curContext = function->body->compound.context;
16267 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
16268 curContext = prevContext;
16269 }
16270 decl->symbol = (((void *)0));
16271 if(!function->body->compound.declarations)
16272 function->body->compound.declarations = MkList();
16273 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
16274 }
16275 }
16276 }
16277 }
16278 else
16279 thisClass = (((void *)0));
16280 if(id)
16281 {
16282 FreeSpecifier(id->_class);
16283 id->_class = (((void *)0));
16284 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16285 {
16286 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16287
16288 id = GetDeclId(initDecl->declarator);
16289 FreeSpecifier(id->_class);
16290 id->_class = (((void *)0));
16291 }
16292 }
16293 if(function->body)
16294 topContext = function->body->compound.context;
16295 {
16296 struct FunctionDefinition * oldFunction = curFunction;
16297
16298 curFunction = function;
16299 if(function->body)
16300 ProcessStatement(function->body);
16301 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
16302 {
16303 struct Statement * prevCompound = curCompound;
16304 struct Context * prevContext = curContext;
16305 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
16306
16307 if(!function->body->compound.statements)
16308 function->body->compound.statements = MkList();
16309 ListAdd(function->body->compound.statements, fireWatchers);
16310 curCompound = function->body;
16311 curContext = function->body->compound.context;
16312 ProcessStatement(fireWatchers);
16313 curContext = prevContext;
16314 curCompound = prevCompound;
16315 }
16316 curFunction = oldFunction;
16317 }
16318 if(function->declarator)
16319 {
16320 ProcessDeclarator(function->declarator);
16321 }
16322 topContext = oldTopContext;
16323 thisClass = oldThisClass;
16324 }
16325
16326 extern void FreeSymbol(struct Symbol * symbol);
16327
16328 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
16329
16330 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
16331 {
16332 struct ClassDef * def;
16333 struct External * external = curExternal;
16334 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
16335
16336 for(def = definitions->first; def; def = def->next)
16337 {
16338 if(def->type == 0)
16339 {
16340 if(def->function->declarator)
16341 curExternal = def->function->declarator->symbol->pointerExternal;
16342 else
16343 curExternal = external;
16344 ProcessFunction((struct FunctionDefinition *)def->function);
16345 }
16346 else if(def->type == 2)
16347 {
16348 if(def->decl->type == 2)
16349 {
16350 thisClass = regClass;
16351 ProcessInstantiationType(def->decl->inst);
16352 thisClass = (((void *)0));
16353 }
16354 else
16355 {
16356 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
16357
16358 if(regClass)
16359 thisClass = regClass;
16360 ProcessDeclaration(def->decl);
16361 thisClass = backThisClass;
16362 }
16363 }
16364 else if(def->type == 1 && def->defProperties)
16365 {
16366 struct MemberInit * defProperty;
16367 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);
16368
16369 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16370 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
16371 {
16372 thisClass = regClass;
16373 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
16374 thisClass = (((void *)0));
16375 }
16376 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16377 FreeSymbol(thisSymbol);
16378 }
16379 else if(def->type == 3 && def->propertyDef)
16380 {
16381 struct PropertyDef * prop = def->propertyDef;
16382
16383 thisClass = regClass;
16384 if(prop->setStmt)
16385 {
16386 if(regClass)
16387 {
16388 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16389
16390 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16391 }
16392 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16393 ProcessStatement(prop->setStmt);
16394 }
16395 if(prop->getStmt)
16396 {
16397 if(regClass)
16398 {
16399 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16400
16401 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16402 }
16403 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16404 ProcessStatement(prop->getStmt);
16405 }
16406 if(prop->issetStmt)
16407 {
16408 if(regClass)
16409 {
16410 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16411
16412 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16413 }
16414 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16415 ProcessStatement(prop->issetStmt);
16416 }
16417 thisClass = (((void *)0));
16418 }
16419 else if(def->type == 4 && def->propertyWatch)
16420 {
16421 struct PropertyWatch * propertyWatch = def->propertyWatch;
16422
16423 thisClass = regClass;
16424 if(propertyWatch->compound)
16425 {
16426 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);
16427
16428 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16429 curExternal = (((void *)0));
16430 ProcessStatement(propertyWatch->compound);
16431 }
16432 thisClass = (((void *)0));
16433 }
16434 }
16435 }
16436
16437 void DeclareFunctionUtil(char * s)
16438 {
16439 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
16440
16441 if(function)
16442 {
16443 char name[1024];
16444
16445 name[0] = (char)0;
16446 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
16447 strcpy(name, "__ecereFunction_");
16448 FullClassNameCat(name, s, 0x0);
16449 DeclareFunction(function, name);
16450 }
16451 }
16452
16453 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16454
16455 void ComputeDataTypes()
16456 {
16457 void * __ecereTemp1;
16458 struct External * external;
16459 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16460 struct External * after = (((void *)0));
16461
16462 currentClass = (((void *)0));
16463 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16464 for(external = (*ast).first; external; external = external->next)
16465 {
16466 if(external->type == 1)
16467 {
16468 struct Declaration * decl = external->declaration;
16469
16470 if(decl)
16471 {
16472 struct __ecereNameSpace__ecere__sys__OldList * decls = decl->declarators;
16473
16474 if(decls)
16475 {
16476 struct InitDeclarator * initDecl = (*decls).first;
16477
16478 if(initDecl)
16479 {
16480 struct Declarator * declarator = initDecl->declarator;
16481
16482 if(declarator && declarator->type == 1)
16483 {
16484 struct Identifier * id = declarator->identifier;
16485
16486 if(id && id->string)
16487 {
16488 if(!strcmp(id->string, "uintptr_t") || !strcmp(id->string, "intptr_t") || !strcmp(id->string, "size_t") || !strcmp(id->string, "ssize_t"))
16489 {
16490 external->symbol->id = -1001, external->symbol->idCode = -1001;
16491 after = external;
16492 }
16493 }
16494 }
16495 }
16496 }
16497 }
16498 }
16499 }
16500 temp->symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->id = -1000, ((struct Symbol *)__ecereTemp1)->idCode = -1000, ((struct Symbol *)__ecereTemp1));
16501 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), after, temp);
16502 curExternal = temp;
16503 DeclareFunctionUtil("eSystem_New");
16504 DeclareFunctionUtil("eSystem_New0");
16505 DeclareFunctionUtil("eSystem_Renew");
16506 DeclareFunctionUtil("eSystem_Renew0");
16507 DeclareFunctionUtil("eClass_GetProperty");
16508 DeclareStruct("ecere::com::Class", 0x0);
16509 DeclareStruct("ecere::com::Instance", 0x0);
16510 DeclareStruct("ecere::com::Property", 0x0);
16511 DeclareStruct("ecere::com::DataMember", 0x0);
16512 DeclareStruct("ecere::com::Method", 0x0);
16513 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16514 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16515 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16516 for(external = (*ast).first; external; external = external->next)
16517 {
16518 afterExternal = curExternal = external;
16519 if(external->type == 0)
16520 {
16521 currentClass = external->function->_class;
16522 ProcessFunction(external->function);
16523 }
16524 else if(external->type == 1)
16525 {
16526 currentClass = (((void *)0));
16527 ProcessDeclaration(external->declaration);
16528 }
16529 else if(external->type == 2)
16530 {
16531 struct ClassDefinition * _class = external->_class;
16532
16533 currentClass = external->symbol->registered;
16534 if(_class->definitions)
16535 {
16536 ProcessClass(_class->definitions, _class->symbol);
16537 }
16538 if(inCompiler)
16539 {
16540 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16541 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16542 }
16543 }
16544 else if(external->type == 4)
16545 {
16546 thisNameSpace = external->id->string;
16547 }
16548 }
16549 currentClass = (((void *)0));
16550 thisNameSpace = (((void *)0));
16551 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16552 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16553 }
16554
16555 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);
16556
16557 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);
16558
16559 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16560 {
16561 struct __ecereNameSpace__ecere__com__Class * class;
16562
16563 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16564 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16565 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16566 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16567 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16568 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16569 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16570 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16571 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16572 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16573 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16574 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16575 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16576 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16577 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16578 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16579 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16580 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16581 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16582 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16583 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16584 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16585 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
16586 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
16587 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntSize", "bool GetIntSize(Expression exp, intsize * value2)", GetIntSize, module, 1);
16588 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntSize", "bool GetUIntSize(Expression exp, uintsize * value2)", GetUIntSize, module, 1);
16589 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16590 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16591 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16592 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16593 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16594 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16595 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16596 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16597 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16598 __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);
16599 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16600 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16601 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16602 __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);
16603 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16604 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16605 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16606 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16607 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16608 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16609 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16610 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16611 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16612 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16613 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16614 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16615 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16616 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
16617 __ecereClass_Conversion = class;
16618 __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);
16619 __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);
16620 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16621 __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);
16622 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16623 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16624 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16625 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16626 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16627 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16628 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16629 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16630 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16631 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16632 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16633 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16634 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16635 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16636 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16637 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
16638 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16639 }
16640
16641 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16642 {
16643
16644 }
16645