compiler/libec; bootstrap: Improved anonymous instantiations implementation
[sdk] / compiler / bootstrap / libec / bootstrap / pass15.c
1 #if defined(__GNUC__)
2 typedef long long int64;
3 typedef unsigned long long uint64;
4 #ifndef _WIN32
5 #define __declspec(x)
6 #endif
7 #elif defined(__TINYC__)
8 #include <stdarg.h>
9 #define __builtin_va_list va_list
10 #define __builtin_va_start va_start
11 #define __builtin_va_end va_end
12 #ifdef _WIN32
13 #define strcasecmp stricmp
14 #define strncasecmp strnicmp
15 #define __declspec(x) __attribute__((x))
16 #else
17 #define __declspec(x)
18 #endif
19 typedef long long int64;
20 typedef unsigned long long uint64;
21 #else
22 typedef __int64 int64;
23 typedef unsigned __int64 uint64;
24 #endif
25 #ifdef __BIG_ENDIAN__
26 #define __ENDIAN_PAD(x) (8 - (x))
27 #else
28 #define __ENDIAN_PAD(x) 0
29 #endif
30 #include <stdint.h>
31 #include <sys/types.h>
32
33 #if /*defined(_W64) || */(defined(__WORDSIZE) && __WORDSIZE == 8) || defined(__x86_64__)
34 #define _64BIT 1
35 #else
36 #define _64BIT 0
37 #endif
38
39 #define arch_PointerSize                  sizeof(void *)
40 #define structSize_Instance               (_64BIT ? 24 : 12)
41 #define structSize_Module                 (_64BIT ? 560 : 300)
42 #define structSize_NamedLink              (_64BIT ? 32 : 16)
43
44 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
45
46 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
47
48 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
49
50 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
51
52 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
53
54 struct __ecereNameSpace__ecere__sys__BTNode;
55
56 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;
57
58 struct __ecereNameSpace__ecere__sys__BinaryTree
59 {
60 struct __ecereNameSpace__ecere__sys__BTNode * root;
61 int count;
62 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
63 void (*  FreeKey)(void *  key);
64 } __attribute__ ((gcc_struct));
65
66 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;
67
68 struct __ecereNameSpace__ecere__sys__OldList
69 {
70 void *  first;
71 void *  last;
72 int count;
73 unsigned int offset;
74 unsigned int circ;
75 } __attribute__ ((gcc_struct));
76
77 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;
78
79 struct __ecereNameSpace__ecere__com__Method
80 {
81 char *  name;
82 struct __ecereNameSpace__ecere__com__Method * parent;
83 struct __ecereNameSpace__ecere__com__Method * left;
84 struct __ecereNameSpace__ecere__com__Method * right;
85 int depth;
86 int (*  function)();
87 int vid;
88 int type;
89 struct __ecereNameSpace__ecere__com__Class * _class;
90 void *  symbol;
91 char *  dataTypeString;
92 struct Type * dataType;
93 int memberAccess;
94 } __attribute__ ((gcc_struct));
95
96 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;
97
98 struct __ecereNameSpace__ecere__com__Property
99 {
100 struct __ecereNameSpace__ecere__com__Property * prev;
101 struct __ecereNameSpace__ecere__com__Property * next;
102 char *  name;
103 unsigned int isProperty;
104 int memberAccess;
105 int id;
106 struct __ecereNameSpace__ecere__com__Class * _class;
107 char *  dataTypeString;
108 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
109 struct Type * dataType;
110 void (*  Set)(void * , int);
111 int (*  Get)(void * );
112 unsigned int (*  IsSet)(void * );
113 void *  data;
114 void *  symbol;
115 int vid;
116 unsigned int conversion;
117 unsigned int watcherOffset;
118 char *  category;
119 unsigned int compiled;
120 unsigned int selfWatchable;
121 unsigned int isWatchable;
122 } __attribute__ ((gcc_struct));
123
124 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
125
126 struct CodePosition
127 {
128 int line;
129 int charPos;
130 int pos;
131 unsigned int included;
132 } __attribute__ ((gcc_struct));
133
134 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
135
136 struct Location
137 {
138 struct CodePosition start;
139 struct CodePosition end;
140 } __attribute__ ((gcc_struct));
141
142 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attrib;
143
144 struct Attrib;
145
146 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ExtDecl;
147
148 struct ExtDecl
149 {
150 struct Location loc;
151 int type;
152 union
153 {
154 char * s;
155 struct Attrib * attr;
156 } __attribute__ ((gcc_struct));
157 } __attribute__ ((gcc_struct));
158
159 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
160
161 struct ClassDefinition
162 {
163 struct ClassDefinition * prev;
164 struct ClassDefinition * next;
165 struct Location loc;
166 struct Specifier * _class;
167 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
168 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
169 struct Symbol * symbol;
170 struct Location blockStart;
171 struct Location nameLoc;
172 int endid;
173 int declMode;
174 unsigned int deleteWatchable;
175 } __attribute__ ((gcc_struct));
176
177 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
178
179 struct Context
180 {
181 struct Context * parent;
182 struct __ecereNameSpace__ecere__sys__BinaryTree types;
183 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
184 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
185 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
186 int nextID;
187 int simpleID;
188 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
189 struct ClassDefinition * classDef;
190 unsigned int templateTypesOnly;
191 unsigned int hasNameSpace;
192 } __attribute__ ((gcc_struct));
193
194 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
195
196 struct Instantiation
197 {
198 struct Instantiation * prev;
199 struct Instantiation * next;
200 struct Location loc;
201 struct Specifier * _class;
202 struct Expression * exp;
203 struct __ecereNameSpace__ecere__sys__OldList *  members;
204 struct Symbol * symbol;
205 unsigned int fullSet;
206 unsigned int isConstant;
207 unsigned char *  data;
208 struct Location nameLoc;
209 struct Location insideLoc;
210 unsigned int built;
211 } __attribute__ ((gcc_struct));
212
213 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
214
215 struct Declaration
216 {
217 struct Declaration * prev;
218 struct Declaration * next;
219 struct Location loc;
220 int type;
221 union
222 {
223 struct
224 {
225 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
226 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
227 } __attribute__ ((gcc_struct));
228 struct Instantiation * inst;
229 struct
230 {
231 struct Identifier * id;
232 struct Expression * exp;
233 } __attribute__ ((gcc_struct));
234 } __attribute__ ((gcc_struct));
235 struct Specifier * extStorage;
236 struct Symbol * symbol;
237 int declMode;
238 } __attribute__ ((gcc_struct));
239
240 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
241
242 struct Statement
243 {
244 struct Statement * prev;
245 struct Statement * next;
246 struct Location loc;
247 int type;
248 union
249 {
250 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
251 struct
252 {
253 struct Identifier * id;
254 struct Statement * stmt;
255 } __attribute__ ((gcc_struct)) labeled;
256 struct
257 {
258 struct Expression * exp;
259 struct Statement * stmt;
260 } __attribute__ ((gcc_struct)) caseStmt;
261 struct
262 {
263 struct __ecereNameSpace__ecere__sys__OldList * declarations;
264 struct __ecereNameSpace__ecere__sys__OldList * statements;
265 struct Context * context;
266 unsigned int isSwitch;
267 } __attribute__ ((gcc_struct)) compound;
268 struct
269 {
270 struct __ecereNameSpace__ecere__sys__OldList * exp;
271 struct Statement * stmt;
272 struct Statement * elseStmt;
273 } __attribute__ ((gcc_struct)) ifStmt;
274 struct
275 {
276 struct __ecereNameSpace__ecere__sys__OldList * exp;
277 struct Statement * stmt;
278 } __attribute__ ((gcc_struct)) switchStmt;
279 struct
280 {
281 struct __ecereNameSpace__ecere__sys__OldList * exp;
282 struct Statement * stmt;
283 } __attribute__ ((gcc_struct)) whileStmt;
284 struct
285 {
286 struct __ecereNameSpace__ecere__sys__OldList * exp;
287 struct Statement * stmt;
288 } __attribute__ ((gcc_struct)) doWhile;
289 struct
290 {
291 struct Statement * init;
292 struct Statement * check;
293 struct __ecereNameSpace__ecere__sys__OldList * increment;
294 struct Statement * stmt;
295 } __attribute__ ((gcc_struct)) forStmt;
296 struct
297 {
298 struct Identifier * id;
299 } __attribute__ ((gcc_struct)) gotoStmt;
300 struct
301 {
302 struct Specifier * spec;
303 char * statements;
304 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
305 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
306 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
307 } __attribute__ ((gcc_struct)) asmStmt;
308 struct
309 {
310 struct Expression * watcher;
311 struct Expression * object;
312 struct __ecereNameSpace__ecere__sys__OldList * watches;
313 } __attribute__ ((gcc_struct)) _watch;
314 struct
315 {
316 struct Identifier * id;
317 struct __ecereNameSpace__ecere__sys__OldList * exp;
318 struct __ecereNameSpace__ecere__sys__OldList * filter;
319 struct Statement * stmt;
320 } __attribute__ ((gcc_struct)) forEachStmt;
321 struct Declaration * decl;
322 } __attribute__ ((gcc_struct));
323 } __attribute__ ((gcc_struct));
324
325 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
326
327 struct TypeName
328 {
329 struct TypeName * prev;
330 struct TypeName * next;
331 struct Location loc;
332 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
333 struct Declarator * declarator;
334 int classObjectType;
335 struct Expression * bitCount;
336 } __attribute__ ((gcc_struct));
337
338 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
339
340 struct Initializer
341 {
342 struct Initializer * prev;
343 struct Initializer * next;
344 struct Location loc;
345 int type;
346 union
347 {
348 struct Expression * exp;
349 struct __ecereNameSpace__ecere__sys__OldList *  list;
350 } __attribute__ ((gcc_struct));
351 unsigned int isConstant;
352 } __attribute__ ((gcc_struct));
353
354 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
355
356 struct __ecereNameSpace__ecere__com__DataValue
357 {
358 union
359 {
360 char c;
361 unsigned char uc;
362 short s;
363 unsigned short us;
364 int i;
365 unsigned int ui;
366 void *  p;
367 float f;
368 double d;
369 long long i64;
370 uint64 ui64;
371 } __attribute__ ((gcc_struct));
372 } __attribute__ ((gcc_struct));
373
374 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
375
376 struct Expression
377 {
378 struct Expression * prev;
379 struct Expression * next;
380 struct Location loc;
381 int type;
382 union
383 {
384 struct
385 {
386 char *  constant;
387 struct Identifier * identifier;
388 } __attribute__ ((gcc_struct));
389 struct Statement * compound;
390 struct Instantiation * instance;
391 char *  string;
392 struct __ecereNameSpace__ecere__sys__OldList *  list;
393 struct
394 {
395 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
396 struct Declarator * decl;
397 } __attribute__ ((gcc_struct)) _classExp;
398 struct
399 {
400 struct Identifier * id;
401 } __attribute__ ((gcc_struct)) classData;
402 struct
403 {
404 struct Expression * exp;
405 struct __ecereNameSpace__ecere__sys__OldList * arguments;
406 struct Location argLoc;
407 } __attribute__ ((gcc_struct)) call;
408 struct
409 {
410 struct Expression * exp;
411 struct __ecereNameSpace__ecere__sys__OldList * index;
412 } __attribute__ ((gcc_struct)) index;
413 struct
414 {
415 struct Expression * exp;
416 struct Identifier * member;
417 int memberType;
418 unsigned int thisPtr;
419 } __attribute__ ((gcc_struct)) member;
420 struct
421 {
422 int op;
423 struct Expression * exp1;
424 struct Expression * exp2;
425 } __attribute__ ((gcc_struct)) op;
426 struct TypeName * typeName;
427 struct Specifier * _class;
428 struct
429 {
430 struct TypeName * typeName;
431 struct Expression * exp;
432 } __attribute__ ((gcc_struct)) cast;
433 struct
434 {
435 struct Expression * cond;
436 struct __ecereNameSpace__ecere__sys__OldList * exp;
437 struct Expression * elseExp;
438 } __attribute__ ((gcc_struct)) cond;
439 struct
440 {
441 struct TypeName * typeName;
442 struct Expression * size;
443 } __attribute__ ((gcc_struct)) _new;
444 struct
445 {
446 struct TypeName * typeName;
447 struct Expression * size;
448 struct Expression * exp;
449 } __attribute__ ((gcc_struct)) _renew;
450 struct
451 {
452 char * table;
453 struct Identifier * id;
454 } __attribute__ ((gcc_struct)) db;
455 struct
456 {
457 struct Expression * ds;
458 struct Expression * name;
459 } __attribute__ ((gcc_struct)) dbopen;
460 struct
461 {
462 struct TypeName * typeName;
463 struct Initializer * initializer;
464 } __attribute__ ((gcc_struct)) initializer;
465 struct
466 {
467 struct Expression * exp;
468 struct TypeName * typeName;
469 } __attribute__ ((gcc_struct)) vaArg;
470 } __attribute__ ((gcc_struct));
471 unsigned int debugValue;
472 struct __ecereNameSpace__ecere__com__DataValue val;
473 uint64 address;
474 unsigned int hasAddress;
475 struct Type * expType;
476 struct Type * destType;
477 unsigned int usage;
478 int tempCount;
479 unsigned int byReference;
480 unsigned int isConstant;
481 unsigned int addedThis;
482 unsigned int needCast;
483 unsigned int thisPtr;
484 } __attribute__ ((gcc_struct));
485
486 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
487
488 struct TemplateDatatype
489 {
490 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
491 struct Declarator * decl;
492 } __attribute__ ((gcc_struct));
493
494 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
495
496 struct TemplateArgument;
497
498 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
499
500 struct TemplateParameter
501 {
502 struct TemplateParameter * prev;
503 struct TemplateParameter * next;
504 struct Location loc;
505 int type;
506 struct Identifier * identifier;
507 union
508 {
509 struct TemplateDatatype * dataType;
510 int memberType;
511 } __attribute__ ((gcc_struct));
512 struct TemplateArgument * defaultArgument;
513 char *  dataTypeString;
514 struct Type * baseType;
515 } __attribute__ ((gcc_struct));
516
517 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
518
519 struct Specifier
520 {
521 struct Specifier * prev;
522 struct Specifier * next;
523 struct Location loc;
524 int type;
525 union
526 {
527 int specifier;
528 struct
529 {
530 struct ExtDecl * extDecl;
531 char *  name;
532 struct Symbol * symbol;
533 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
534 } __attribute__ ((gcc_struct));
535 struct
536 {
537 struct Identifier * id;
538 struct __ecereNameSpace__ecere__sys__OldList *  list;
539 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
540 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
541 unsigned int addNameSpace;
542 struct Context * ctx;
543 struct ExtDecl * extDeclStruct;
544 } __attribute__ ((gcc_struct));
545 struct Expression * expression;
546 struct Specifier * _class;
547 struct TemplateParameter * templateParameter;
548 } __attribute__ ((gcc_struct));
549 } __attribute__ ((gcc_struct));
550
551 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
552
553 struct Identifier
554 {
555 struct Identifier * prev;
556 struct Identifier * next;
557 struct Location loc;
558 struct Symbol * classSym;
559 struct Specifier * _class;
560 char *  string;
561 struct Identifier * badID;
562 } __attribute__ ((gcc_struct));
563
564 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
565
566 struct Pointer;
567
568 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
569
570 struct Declarator
571 {
572 struct Declarator * prev;
573 struct Declarator * next;
574 struct Location loc;
575 int type;
576 struct Symbol * symbol;
577 struct Declarator * declarator;
578 union
579 {
580 struct Identifier * identifier;
581 struct
582 {
583 struct Expression * exp;
584 struct Expression * posExp;
585 struct Attrib * attrib;
586 } __attribute__ ((gcc_struct)) structDecl;
587 struct
588 {
589 struct Expression * exp;
590 struct Specifier * enumClass;
591 } __attribute__ ((gcc_struct)) array;
592 struct
593 {
594 struct __ecereNameSpace__ecere__sys__OldList * parameters;
595 } __attribute__ ((gcc_struct)) function;
596 struct
597 {
598 struct Pointer * pointer;
599 } __attribute__ ((gcc_struct)) pointer;
600 struct
601 {
602 struct ExtDecl * extended;
603 } __attribute__ ((gcc_struct)) extended;
604 } __attribute__ ((gcc_struct));
605 } __attribute__ ((gcc_struct));
606
607 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
608
609 struct FunctionDefinition
610 {
611 struct FunctionDefinition * prev;
612 struct FunctionDefinition * next;
613 struct Location loc;
614 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
615 struct Declarator * declarator;
616 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
617 struct Statement * body;
618 struct __ecereNameSpace__ecere__com__Class * _class;
619 struct __ecereNameSpace__ecere__sys__OldList attached;
620 int declMode;
621 struct Type * type;
622 struct Symbol * propSet;
623 int tempCount;
624 unsigned int propertyNoThis;
625 } __attribute__ ((gcc_struct));
626
627 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
628
629 struct DBTableDef;
630
631 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
632
633 struct External
634 {
635 struct External * prev;
636 struct External * next;
637 struct Location loc;
638 int type;
639 struct Symbol * symbol;
640 union
641 {
642 struct FunctionDefinition * function;
643 struct ClassDefinition * _class;
644 struct Declaration * declaration;
645 char *  importString;
646 struct Identifier * id;
647 struct DBTableDef * table;
648 } __attribute__ ((gcc_struct));
649 int importType;
650 } __attribute__ ((gcc_struct));
651
652 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
653
654 struct ModuleImport
655 {
656 struct ModuleImport * prev;
657 struct ModuleImport * next;
658 char *  name;
659 struct __ecereNameSpace__ecere__sys__OldList classes;
660 struct __ecereNameSpace__ecere__sys__OldList functions;
661 int importType;
662 int importAccess;
663 } __attribute__ ((gcc_struct));
664
665 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
666
667 struct ClassImport
668 {
669 struct ClassImport * prev;
670 struct ClassImport * next;
671 char *  name;
672 struct __ecereNameSpace__ecere__sys__OldList methods;
673 struct __ecereNameSpace__ecere__sys__OldList properties;
674 unsigned int itself;
675 unsigned int isRemote;
676 } __attribute__ ((gcc_struct));
677
678 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
679
680 struct Symbol
681 {
682 char *  string;
683 struct Symbol * parent;
684 struct Symbol * left;
685 struct Symbol * right;
686 int depth;
687 struct Type * type;
688 union
689 {
690 struct __ecereNameSpace__ecere__com__Method * method;
691 struct __ecereNameSpace__ecere__com__Property * _property;
692 struct __ecereNameSpace__ecere__com__Class * registered;
693 } __attribute__ ((gcc_struct));
694 int id;
695 int idCode;
696 union
697 {
698 struct
699 {
700 struct External * pointerExternal;
701 struct External * structExternal;
702 } __attribute__ ((gcc_struct));
703 struct
704 {
705 struct External * externalGet;
706 struct External * externalSet;
707 struct External * externalPtr;
708 struct External * externalIsSet;
709 } __attribute__ ((gcc_struct));
710 struct
711 {
712 struct External * methodExternal;
713 struct External * methodCodeExternal;
714 } __attribute__ ((gcc_struct));
715 } __attribute__ ((gcc_struct));
716 unsigned int imported;
717 unsigned int declaredStructSym;
718 struct __ecereNameSpace__ecere__com__Class * _class;
719 unsigned int declaredStruct;
720 unsigned int needConstructor;
721 unsigned int needDestructor;
722 char *  constructorName;
723 char *  structName;
724 char *  className;
725 char *  destructorName;
726 struct ModuleImport * module;
727 struct ClassImport * _import;
728 struct Location nameLoc;
729 unsigned int isParam;
730 unsigned int isRemote;
731 unsigned int isStruct;
732 unsigned int fireWatchersDone;
733 int declaring;
734 unsigned int classData;
735 unsigned int isStatic;
736 char *  shortName;
737 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
738 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
739 struct Context * ctx;
740 int isIterator;
741 struct Expression * propCategory;
742 } __attribute__ ((gcc_struct));
743
744 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
745
746 struct Type
747 {
748 struct Type * prev;
749 struct Type * next;
750 int refCount;
751 union
752 {
753 struct Symbol * _class;
754 struct
755 {
756 struct __ecereNameSpace__ecere__sys__OldList members;
757 char *  enumName;
758 } __attribute__ ((gcc_struct));
759 struct
760 {
761 struct Type * returnType;
762 struct __ecereNameSpace__ecere__sys__OldList params;
763 struct Symbol * thisClass;
764 unsigned int staticMethod;
765 struct TemplateParameter * thisClassTemplate;
766 } __attribute__ ((gcc_struct));
767 struct
768 {
769 struct __ecereNameSpace__ecere__com__Method * method;
770 struct __ecereNameSpace__ecere__com__Class * methodClass;
771 struct __ecereNameSpace__ecere__com__Class * usedClass;
772 } __attribute__ ((gcc_struct));
773 struct
774 {
775 struct Type * arrayType;
776 int arraySize;
777 struct Expression * arraySizeExp;
778 unsigned int freeExp;
779 struct Symbol * enumClass;
780 } __attribute__ ((gcc_struct));
781 struct Type * type;
782 struct TemplateParameter * templateParameter;
783 } __attribute__ ((gcc_struct));
784 unsigned int isSigned;
785 int kind;
786 unsigned int constant;
787 unsigned int size;
788 char *  name;
789 char *  typeName;
790 unsigned int count;
791 unsigned int truth;
792 int classObjectType;
793 unsigned int byReference;
794 unsigned int extraParam;
795 int alignment;
796 unsigned int directClassAccess;
797 unsigned int computing;
798 unsigned int dllExport;
799 unsigned int offset;
800 unsigned int keepCast;
801 unsigned int passAsTemplate;
802 int bitFieldCount;
803 } __attribute__ ((gcc_struct));
804
805 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
806
807 struct __ecereNameSpace__ecere__com__Class
808 {
809 struct __ecereNameSpace__ecere__com__Class * prev;
810 struct __ecereNameSpace__ecere__com__Class * next;
811 char *  name;
812 int offset;
813 int structSize;
814 int (* *  _vTbl)();
815 int vTblSize;
816 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
817 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
818 int offsetClass;
819 int sizeClass;
820 struct __ecereNameSpace__ecere__com__Class * base;
821 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
822 struct __ecereNameSpace__ecere__sys__BinaryTree members;
823 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
824 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
825 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
826 struct __ecereNameSpace__ecere__sys__OldList derivatives;
827 int memberID;
828 int startMemberID;
829 int type;
830 struct __ecereNameSpace__ecere__com__Instance * module;
831 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
832 char *  dataTypeString;
833 struct Type * dataType;
834 int typeSize;
835 int defaultAlignment;
836 void (*  Initialize)();
837 int memberOffset;
838 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
839 char *  designerClass;
840 unsigned int noExpansion;
841 char *  defaultProperty;
842 unsigned int comRedefinition;
843 int count;
844 unsigned int isRemote;
845 unsigned int internalDecl;
846 void *  data;
847 unsigned int computeSize;
848 int structAlignment;
849 int destructionWatchOffset;
850 unsigned int fixed;
851 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
852 int inheritanceAccess;
853 char *  fullName;
854 void *  symbol;
855 struct __ecereNameSpace__ecere__sys__OldList conversions;
856 struct __ecereNameSpace__ecere__sys__OldList templateParams;
857 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
858 struct __ecereNameSpace__ecere__com__Class * templateClass;
859 struct __ecereNameSpace__ecere__sys__OldList templatized;
860 int numParams;
861 } __attribute__ ((gcc_struct));
862
863 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
864
865 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
866
867 struct __ecereNameSpace__ecere__com__Instance
868 {
869 int (* *  _vTbl)();
870 struct __ecereNameSpace__ecere__com__Class * _class;
871 int _refCount;
872 } __attribute__ ((gcc_struct));
873
874 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
875
876 struct __ecereNameSpace__ecere__com__DataMember
877 {
878 struct __ecereNameSpace__ecere__com__DataMember * prev;
879 struct __ecereNameSpace__ecere__com__DataMember * next;
880 char *  name;
881 unsigned int isProperty;
882 int memberAccess;
883 int id;
884 struct __ecereNameSpace__ecere__com__Class * _class;
885 char *  dataTypeString;
886 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
887 struct Type * dataType;
888 int type;
889 int offset;
890 int memberID;
891 struct __ecereNameSpace__ecere__sys__OldList members;
892 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
893 int memberOffset;
894 int structAlignment;
895 } __attribute__ ((gcc_struct));
896
897 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
898
899 struct __ecereNameSpace__ecere__com__SerialBuffer
900 {
901 unsigned char *  _buffer;
902 unsigned int count;
903 unsigned int _size;
904 unsigned int pos;
905 } __attribute__ ((gcc_struct));
906
907 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
908
909 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
910 {
911 union
912 {
913 struct
914 {
915 char *  dataTypeString;
916 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
917 } __attribute__ ((gcc_struct));
918 struct __ecereNameSpace__ecere__com__DataValue expression;
919 struct
920 {
921 char *  memberString;
922 union
923 {
924 struct __ecereNameSpace__ecere__com__DataMember * member;
925 struct __ecereNameSpace__ecere__com__Property * prop;
926 struct __ecereNameSpace__ecere__com__Method * method;
927 } __attribute__ ((gcc_struct));
928 } __attribute__ ((gcc_struct));
929 } __attribute__ ((gcc_struct));
930 } __attribute__ ((gcc_struct));
931
932 void exit(int status);
933
934 void * calloc(size_t nmemb, size_t size);
935
936 void free(void * ptr);
937
938 void * malloc(size_t size);
939
940 void * realloc(void * ptr, size_t size);
941
942 long int strtol(const char * nptr, char ** endptr, int base);
943
944 long long int strtoll(const char * nptr, char ** endptr, int base);
945
946 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
947
948 enum yytokentype
949 {
950 IDENTIFIER = 258, CONSTANT = 259, STRING_LITERAL = 260, SIZEOF = 261, PTR_OP = 262, INC_OP = 263, DEC_OP = 264, LEFT_OP = 265, RIGHT_OP = 266, LE_OP = 267, GE_OP = 268, EQ_OP = 269, NE_OP = 270, AND_OP = 271, OR_OP = 272, MUL_ASSIGN = 273, DIV_ASSIGN = 274, MOD_ASSIGN = 275, ADD_ASSIGN = 276, SUB_ASSIGN = 277, LEFT_ASSIGN = 278, RIGHT_ASSIGN = 279, AND_ASSIGN = 280, XOR_ASSIGN = 281, OR_ASSIGN = 282, TYPE_NAME = 283, TYPEDEF = 284, EXTERN = 285, STATIC = 286, AUTO = 287, REGISTER = 288, CHAR = 289, SHORT = 290, INT = 291, UINT = 292, INT64 = 293, LONG = 294, SIGNED = 295, UNSIGNED = 296, FLOAT = 297, DOUBLE = 298, CONST = 299, VOLATILE = 300, VOID = 301, VALIST = 302, STRUCT = 303, UNION = 304, ENUM = 305, ELLIPSIS = 306, CASE = 307, DEFAULT = 308, IF = 309, SWITCH = 310, WHILE = 311, DO = 312, FOR = 313, GOTO = 314, CONTINUE = 315, BREAK = 316, RETURN = 317, IFX = 318, ELSE = 319, CLASS = 320, THISCLASS = 321, CLASS_NAME = 322, PROPERTY = 323, SETPROP = 324, GETPROP = 325, NEWOP = 326, RENEW = 327, DELETE = 328, EXT_DECL = 329, EXT_STORAGE = 330, IMPORT = 331, DEFINE = 332, VIRTUAL = 333, ATTRIB = 334, PUBLIC = 335, PRIVATE = 336, TYPED_OBJECT = 337, ANY_OBJECT = 338, _INCREF = 339, EXTENSION = 340, ASM = 341, TYPEOF = 342, WATCH = 343, STOPWATCHING = 344, FIREWATCHERS = 345, WATCHABLE = 346, CLASS_DESIGNER = 347, CLASS_NO_EXPANSION = 348, CLASS_FIXED = 349, ISPROPSET = 350, CLASS_DEFAULT_PROPERTY = 351, PROPERTY_CATEGORY = 352, CLASS_DATA = 353, CLASS_PROPERTY = 354, SUBCLASS = 355, NAMESPACE = 356, NEW0OP = 357, RENEW0 = 358, VAARG = 359, DBTABLE = 360, DBFIELD = 361, DBINDEX = 362, DATABASE_OPEN = 363, ALIGNOF = 364, ATTRIB_DEP = 365, __ATTRIB = 366
951 };
952
953 typedef union YYSTYPE
954 {
955 int specifierType;
956 int i;
957 int declMode;
958 struct Identifier * id;
959 struct Expression * exp;
960 struct Specifier * specifier;
961 struct __ecereNameSpace__ecere__sys__OldList * list;
962 struct Enumerator * enumerator;
963 struct Declarator * declarator;
964 struct Pointer * pointer;
965 struct Initializer * initializer;
966 struct InitDeclarator * initDeclarator;
967 struct TypeName * typeName;
968 struct Declaration * declaration;
969 struct Statement * stmt;
970 struct FunctionDefinition * function;
971 struct External * external;
972 struct Context * context;
973 struct AsmField * asmField;
974 struct Attrib * attrib;
975 struct ExtDecl * extDecl;
976 struct Attribute * attribute;
977 struct Instantiation * instance;
978 struct MembersInit * membersInit;
979 struct MemberInit * memberInit;
980 struct ClassFunction * classFunction;
981 struct ClassDefinition * _class;
982 struct ClassDef * classDef;
983 struct PropertyDef * prop;
984 char * string;
985 struct Symbol * symbol;
986 struct PropertyWatch * propertyWatch;
987 struct TemplateParameter * templateParameter;
988 struct TemplateArgument * templateArgument;
989 struct TemplateDatatype * templateDatatype;
990 struct DBTableEntry * dbtableEntry;
991 struct DBIndexItem * dbindexItem;
992 struct DBTableDef * dbtableDef;
993 } __attribute__ ((gcc_struct)) YYSTYPE;
994
995 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
996
997 struct Enumerator
998 {
999 struct Enumerator * prev;
1000 struct Enumerator * next;
1001 struct Location loc;
1002 struct Identifier * id;
1003 struct Expression * exp;
1004 } __attribute__ ((gcc_struct));
1005
1006 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
1007
1008 struct InitDeclarator
1009 {
1010 struct InitDeclarator * prev;
1011 struct InitDeclarator * next;
1012 struct Location loc;
1013 struct Declarator * declarator;
1014 struct Initializer * initializer;
1015 } __attribute__ ((gcc_struct));
1016
1017 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
1018
1019 struct AsmField
1020 {
1021 struct AsmField * prev;
1022 struct AsmField * next;
1023 struct Location loc;
1024 char *  command;
1025 struct Expression * expression;
1026 } __attribute__ ((gcc_struct));
1027
1028 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
1029
1030 struct Attribute;
1031
1032 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
1033
1034 struct ClassFunction
1035 {
1036 struct ClassFunction * prev;
1037 struct ClassFunction * next;
1038 struct Location loc;
1039 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1040 struct Declarator * declarator;
1041 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1042 struct Statement * body;
1043 struct __ecereNameSpace__ecere__com__Class * _class;
1044 struct __ecereNameSpace__ecere__sys__OldList attached;
1045 int declMode;
1046 struct Type * type;
1047 struct Symbol * propSet;
1048 unsigned int isVirtual;
1049 unsigned int isConstructor;
1050 unsigned int isDestructor;
1051 unsigned int dontMangle;
1052 int id;
1053 int idCode;
1054 } __attribute__ ((gcc_struct));
1055
1056 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1057
1058 struct MembersInit
1059 {
1060 struct MembersInit * prev;
1061 struct MembersInit * next;
1062 struct Location loc;
1063 int type;
1064 union
1065 {
1066 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1067 struct ClassFunction * function;
1068 } __attribute__ ((gcc_struct));
1069 } __attribute__ ((gcc_struct));
1070
1071 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1072
1073 struct MemberInit
1074 {
1075 struct MemberInit * prev;
1076 struct MemberInit * next;
1077 struct Location loc;
1078 struct Location realLoc;
1079 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1080 struct Initializer * initializer;
1081 unsigned int used;
1082 unsigned int variable;
1083 unsigned int takeOutExp;
1084 } __attribute__ ((gcc_struct));
1085
1086 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1087
1088 struct PropertyDef
1089 {
1090 struct PropertyDef * prev;
1091 struct PropertyDef * next;
1092 struct Location loc;
1093 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1094 struct Declarator * declarator;
1095 struct Identifier * id;
1096 struct Statement * getStmt;
1097 struct Statement * setStmt;
1098 struct Statement * issetStmt;
1099 struct Symbol * symbol;
1100 unsigned int conversion;
1101 unsigned int isWatchable;
1102 struct Expression * category;
1103 } __attribute__ ((gcc_struct));
1104
1105 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1106
1107 struct PropertyWatch
1108 {
1109 struct PropertyWatch * prev;
1110 struct PropertyWatch * next;
1111 struct Location loc;
1112 struct Statement * compound;
1113 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1114 unsigned int deleteWatch;
1115 } __attribute__ ((gcc_struct));
1116
1117 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1118
1119 struct ClassDef
1120 {
1121 struct ClassDef * prev;
1122 struct ClassDef * next;
1123 struct Location loc;
1124 int type;
1125 union
1126 {
1127 struct Declaration * decl;
1128 struct ClassFunction * function;
1129 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1130 struct PropertyDef * propertyDef;
1131 struct PropertyWatch * propertyWatch;
1132 char *  designer;
1133 struct Identifier * defaultProperty;
1134 struct
1135 {
1136 struct Identifier * id;
1137 struct Initializer * initializer;
1138 } __attribute__ ((gcc_struct));
1139 } __attribute__ ((gcc_struct));
1140 int memberAccess;
1141 void *  object;
1142 } __attribute__ ((gcc_struct));
1143
1144 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1145
1146 struct DBTableEntry;
1147
1148 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1149
1150 struct DBIndexItem;
1151
1152 extern YYSTYPE yylval;
1153
1154 extern struct Location yylloc;
1155
1156 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1157
1158 extern int returnCode;
1159
1160 extern struct Expression * parsedExpression;
1161
1162 extern unsigned int yydebug;
1163
1164 void SetYydebug(unsigned int b)
1165 {
1166 yydebug = b;
1167 }
1168
1169 extern unsigned int echoOn;
1170
1171 void resetScanner();
1172
1173 int propWatcherID;
1174
1175 int expression_yyparse();
1176
1177 static struct Statement * curCompound;
1178
1179 struct External * curExternal, * afterExternal;
1180
1181 static struct Type * curSwitchType;
1182
1183 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1184
1185 struct __ecereNameSpace__ecere__com__Class * thisClass;
1186
1187 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1188 {
1189 thisClass = c;
1190 }
1191
1192 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1193 {
1194 return thisClass;
1195 }
1196
1197 static char * thisNameSpace;
1198
1199 struct __ecereNameSpace__ecere__com__Class * containerClass;
1200
1201 unsigned int thisClassParams = 0x1;
1202
1203 unsigned int internalValueCounter;
1204
1205 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1206
1207 extern size_t strlen(const char * );
1208
1209 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1210
1211 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1212
1213 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1214
1215 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1216
1217 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1218
1219 void PrintExpression(struct Expression * exp, char * string)
1220 {
1221 {
1222 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1223 int count;
1224
1225 if(exp)
1226 OutputExpression(exp, f);
1227 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1228 count = strlen(string);
1229 count += ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Read])(f, string + count, 1, 1023);
1230 string[count] = '\0';
1231 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1232 }
1233 }
1234
1235 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1236
1237 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1238
1239 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1240 {
1241 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1242 {
1243 if(!param->baseType)
1244 {
1245 if(param->dataTypeString)
1246 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1247 else
1248 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1249 }
1250 return param->baseType;
1251 }
1252 return (((void *)0));
1253 }
1254
1255 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1256 {
1257 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1258 return 0x1;
1259 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1260 {
1261 return 0x0;
1262 }
1263 if(type1->kind == type2->kind)
1264 {
1265 switch(type1->kind)
1266 {
1267 case 1:
1268 case 2:
1269 case 3:
1270 case 4:
1271 case 22:
1272 case 23:
1273 if(type1->passAsTemplate && !type2->passAsTemplate)
1274 return 0x1;
1275 return type1->isSigned != type2->isSigned;
1276 case 8:
1277 return type1->_class != type2->_class;
1278 case 13:
1279 return NeedCast(type1->type, type2->type);
1280 default:
1281 return 0x1;
1282 }
1283 }
1284 return 0x1;
1285 }
1286
1287 extern int strcmp(const char * , const char * );
1288
1289 extern struct Context * curContext;
1290
1291 extern struct Context * topContext;
1292
1293 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1294
1295 extern struct __ecereNameSpace__ecere__com__Property * __ecereNameSpace__ecere__com__eClass_FindProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, struct __ecereNameSpace__ecere__com__Instance * module);
1296
1297 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1298
1299 extern struct __ecereNameSpace__ecere__com__Method * __ecereNameSpace__ecere__com__eClass_FindMethod(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, struct __ecereNameSpace__ecere__com__Instance * module);
1300
1301 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_FindDataMember(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, struct __ecereNameSpace__ecere__com__Instance * module, struct __ecereNameSpace__ecere__com__DataMember **  subMemberStack, int *  subMemberStackPos);
1302
1303 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1304
1305 struct __ecereNameSpace__ecere__com__ClassProperty
1306 {
1307 char *  name;
1308 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1309 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1310 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1311 int depth;
1312 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, long long);
1313 long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1314 char *  dataTypeString;
1315 struct Type * dataType;
1316 unsigned int constant;
1317 } __attribute__ ((gcc_struct));
1318
1319 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1320
1321 extern struct Expression * QMkExpId(char *  id);
1322
1323 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1324
1325 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1326 {
1327 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1328 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1329 char *  name;
1330 int type;
1331 union
1332 {
1333 char *  dataTypeString;
1334 int memberType;
1335 } __attribute__ ((gcc_struct));
1336 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1337 void *  param;
1338 } __attribute__ ((gcc_struct));
1339
1340 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1341
1342 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1343
1344 extern void FreeIdentifier(struct Identifier * id);
1345
1346 void ProcessExpressionType(struct Expression * exp);
1347
1348 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1349
1350 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1351
1352 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1353
1354 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1355
1356 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1357
1358 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1359
1360 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1361
1362 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1363
1364 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1365 {
1366 if(exp->type == 0 && exp->identifier)
1367 {
1368 struct Identifier * id = exp->identifier;
1369 struct Context * ctx;
1370 struct Symbol * symbol = (((void *)0));
1371
1372 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1373 {
1374 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1375 {
1376 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1377 if(symbol)
1378 break;
1379 }
1380 }
1381 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1382 {
1383 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1384 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1385 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1386 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
1387
1388 if(!prop)
1389 {
1390 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1391 }
1392 if(!prop && !method)
1393 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1394 if(!prop && !method && !member)
1395 {
1396 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1397 }
1398 if(prop || method || member || classProp)
1399 {
1400 exp->type = 8;
1401 exp->member.member = id;
1402 exp->member.memberType = 0;
1403 exp->member.exp = QMkExpId("this");
1404 exp->addedThis = 0x1;
1405 }
1406 else if(_class && _class->templateParams.first)
1407 {
1408 struct __ecereNameSpace__ecere__com__Class * sClass;
1409
1410 for(sClass = _class; sClass; sClass = sClass->base)
1411 {
1412 if(sClass->templateParams.first)
1413 {
1414 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1415
1416 for(param = sClass->templateParams.first; param; param = param->next)
1417 {
1418 if(param->type == 2 && !strcmp(param->name, id->string))
1419 {
1420 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1421
1422 if(argExp)
1423 {
1424 struct Declarator * decl;
1425 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1426
1427 FreeIdentifier(exp->member.member);
1428 ProcessExpressionType(argExp);
1429 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1430 exp->expType = ProcessType(specs, decl);
1431 exp->type = 5;
1432 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1433 }
1434 }
1435 }
1436 }
1437 }
1438 }
1439 }
1440 }
1441 }
1442
1443 extern int sprintf(char * , char * , ...);
1444
1445 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1446
1447 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1448
1449 char * PrintInt(long long result)
1450 {
1451 char temp[100];
1452
1453 if(result > (((long long)0x7fffffffffffffffLL)))
1454 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1455 else
1456 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1457 return __ecereNameSpace__ecere__sys__CopyString(temp);
1458 }
1459
1460 char * PrintUInt(uint64 result)
1461 {
1462 char temp[100];
1463
1464 if(result > (0xffffffff))
1465 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1466 else if(result > (((int)0x7fffffff)))
1467 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1468 else
1469 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1470 return __ecereNameSpace__ecere__sys__CopyString(temp);
1471 }
1472
1473 char * PrintInt64(long long result)
1474 {
1475 char temp[100];
1476
1477 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1478 return __ecereNameSpace__ecere__sys__CopyString(temp);
1479 }
1480
1481 char * PrintUInt64(uint64 result)
1482 {
1483 char temp[100];
1484
1485 if(result > (((long long)0x7fffffffffffffffLL)))
1486 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1487 else
1488 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1489 return __ecereNameSpace__ecere__sys__CopyString(temp);
1490 }
1491
1492 char * PrintHexUInt(uint64 result)
1493 {
1494 char temp[100];
1495
1496 if(result > (0xffffffff))
1497 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1498 else
1499 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1500 return __ecereNameSpace__ecere__sys__CopyString(temp);
1501 }
1502
1503 char * PrintHexUInt64(uint64 result)
1504 {
1505 char temp[100];
1506
1507 if(result > (0xffffffff))
1508 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1509 else
1510 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1511 return __ecereNameSpace__ecere__sys__CopyString(temp);
1512 }
1513
1514 char * PrintShort(short result)
1515 {
1516 char temp[100];
1517
1518 sprintf(temp, "%d", (unsigned short)result);
1519 return __ecereNameSpace__ecere__sys__CopyString(temp);
1520 }
1521
1522 char * PrintUShort(unsigned short result)
1523 {
1524 char temp[100];
1525
1526 if(result > (unsigned short)32767)
1527 sprintf(temp, "0x%X", (int)result);
1528 else
1529 sprintf(temp, "%d", result);
1530 return __ecereNameSpace__ecere__sys__CopyString(temp);
1531 }
1532
1533 extern int isprint(int c);
1534
1535 char * PrintChar(char result)
1536 {
1537 char temp[100];
1538
1539 if(result > (char)0 && isprint(result))
1540 sprintf(temp, "'%c'", result);
1541 else if(result < (char)0)
1542 sprintf(temp, "%d", result);
1543 else
1544 sprintf(temp, "0x%X", (unsigned char)result);
1545 return __ecereNameSpace__ecere__sys__CopyString(temp);
1546 }
1547
1548 char * PrintUChar(unsigned char result)
1549 {
1550 char temp[100];
1551
1552 sprintf(temp, "0x%X", result);
1553 return __ecereNameSpace__ecere__sys__CopyString(temp);
1554 }
1555
1556 char * PrintFloat(float result)
1557 {
1558 char temp[350];
1559
1560 sprintf(temp, "%.16ff", result);
1561 return __ecereNameSpace__ecere__sys__CopyString(temp);
1562 }
1563
1564 char * PrintDouble(double result)
1565 {
1566 char temp[350];
1567
1568 sprintf(temp, "%.16f", result);
1569 return __ecereNameSpace__ecere__sys__CopyString(temp);
1570 }
1571
1572 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1573
1574 struct OpTable
1575 {
1576 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1577 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1578 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1579 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1580 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1581 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1582 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1583 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1584 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1585 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1586 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1587 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1588 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1589 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1590 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1591 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1592 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1593 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1594 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1595 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1596 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1597 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1598 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1599 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1600 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1601 unsigned int (*  Not)(struct Expression *, struct Operand *);
1602 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1603 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1604 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1605 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1606 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1607 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1608 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1609 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1610 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1611 } __attribute__ ((gcc_struct));
1612
1613 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1614
1615 struct Operand
1616 {
1617 int kind;
1618 struct Type * type;
1619 unsigned int ptrSize;
1620 union
1621 {
1622 char c;
1623 unsigned char uc;
1624 short s;
1625 unsigned short us;
1626 int i;
1627 unsigned int ui;
1628 float f;
1629 double d;
1630 long long i64;
1631 uint64 ui64;
1632 } __attribute__ ((gcc_struct));
1633 struct OpTable ops;
1634 } __attribute__ ((gcc_struct));
1635
1636 struct Operand GetOperand(struct Expression * exp);
1637
1638 unsigned int GetInt(struct Expression * exp, int * value2)
1639 {
1640 struct Operand op2 = GetOperand(exp);
1641
1642 if(op2.kind == 3 && op2.type->isSigned)
1643 *value2 = op2.i;
1644 else if(op2.kind == 3)
1645 *value2 = (int)op2.ui;
1646 else if(op2.kind == 4 && op2.type->isSigned)
1647 *value2 = (int)op2.i64;
1648 else if(op2.kind == 4)
1649 *value2 = (int)op2.ui64;
1650 else if(op2.kind == 23 && op2.type->isSigned)
1651 *value2 = (int)op2.i64;
1652 else if(op2.kind == 23)
1653 *value2 = (int)op2.ui64;
1654 else if(op2.kind == 22 && op2.type->isSigned)
1655 *value2 = (int)op2.i64;
1656 else if(op2.kind == 22)
1657 *value2 = (int)op2.ui64;
1658 else if(op2.kind == 2 && op2.type->isSigned)
1659 *value2 = (int)op2.s;
1660 else if(op2.kind == 2)
1661 *value2 = (int)op2.us;
1662 else if(op2.kind == 1 && op2.type->isSigned)
1663 *value2 = (int)op2.c;
1664 else if(op2.kind == 1)
1665 *value2 = (int)op2.uc;
1666 else if(op2.kind == 6)
1667 *value2 = (int)op2.f;
1668 else if(op2.kind == 7)
1669 *value2 = (int)op2.d;
1670 else if(op2.kind == 13)
1671 *value2 = (int)op2.ui64;
1672 else
1673 return 0x0;
1674 return 0x1;
1675 }
1676
1677 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1678 {
1679 struct Operand op2 = GetOperand(exp);
1680
1681 if(op2.kind == 3 && op2.type->isSigned)
1682 *value2 = (unsigned int)op2.i;
1683 else if(op2.kind == 3)
1684 *value2 = op2.ui;
1685 else if(op2.kind == 4 && op2.type->isSigned)
1686 *value2 = (unsigned int)op2.i64;
1687 else if(op2.kind == 4)
1688 *value2 = (unsigned int)op2.ui64;
1689 else if(op2.kind == 23 && op2.type->isSigned)
1690 *value2 = (unsigned int)op2.i64;
1691 else if(op2.kind == 23)
1692 *value2 = (unsigned int)op2.ui64;
1693 else if(op2.kind == 22 && op2.type->isSigned)
1694 *value2 = (unsigned int)op2.i64;
1695 else if(op2.kind == 22)
1696 *value2 = (unsigned int)op2.ui64;
1697 else if(op2.kind == 2 && op2.type->isSigned)
1698 *value2 = (unsigned int)op2.s;
1699 else if(op2.kind == 2)
1700 *value2 = (unsigned int)op2.us;
1701 else if(op2.kind == 1 && op2.type->isSigned)
1702 *value2 = (unsigned int)op2.c;
1703 else if(op2.kind == 1)
1704 *value2 = (unsigned int)op2.uc;
1705 else if(op2.kind == 6)
1706 *value2 = (unsigned int)op2.f;
1707 else if(op2.kind == 7)
1708 *value2 = (unsigned int)op2.d;
1709 else if(op2.kind == 13)
1710 *value2 = (unsigned int)op2.ui64;
1711 else
1712 return 0x0;
1713 return 0x1;
1714 }
1715
1716 unsigned int GetInt64(struct Expression * exp, long long * value2)
1717 {
1718 struct Operand op2 = GetOperand(exp);
1719
1720 if(op2.kind == 3 && op2.type->isSigned)
1721 *value2 = (long long)op2.i;
1722 else if(op2.kind == 3)
1723 *value2 = (long long)op2.ui;
1724 else if(op2.kind == 4 && op2.type->isSigned)
1725 *value2 = op2.i64;
1726 else if(op2.kind == 4)
1727 *value2 = (long long)op2.ui64;
1728 else if(op2.kind == 23 && op2.type->isSigned)
1729 *value2 = op2.i64;
1730 else if(op2.kind == 23)
1731 *value2 = (long long)op2.ui64;
1732 else if(op2.kind == 22 && op2.type->isSigned)
1733 *value2 = op2.i64;
1734 else if(op2.kind == 22)
1735 *value2 = (long long)op2.ui64;
1736 else if(op2.kind == 2 && op2.type->isSigned)
1737 *value2 = (long long)op2.s;
1738 else if(op2.kind == 2)
1739 *value2 = (long long)op2.us;
1740 else if(op2.kind == 1 && op2.type->isSigned)
1741 *value2 = (long long)op2.c;
1742 else if(op2.kind == 1)
1743 *value2 = (long long)op2.uc;
1744 else if(op2.kind == 6)
1745 *value2 = (long long)op2.f;
1746 else if(op2.kind == 7)
1747 *value2 = (long long)op2.d;
1748 else if(op2.kind == 13)
1749 *value2 = (long long)op2.ui64;
1750 else
1751 return 0x0;
1752 return 0x1;
1753 }
1754
1755 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1756 {
1757 struct Operand op2 = GetOperand(exp);
1758
1759 if(op2.kind == 3 && op2.type->isSigned)
1760 *value2 = (uint64)op2.i;
1761 else if(op2.kind == 3)
1762 *value2 = (uint64)op2.ui;
1763 else if(op2.kind == 4 && op2.type->isSigned)
1764 *value2 = (uint64)op2.i64;
1765 else if(op2.kind == 4)
1766 *value2 = op2.ui64;
1767 else if(op2.kind == 23 && op2.type->isSigned)
1768 *value2 = (uint64)op2.i64;
1769 else if(op2.kind == 23)
1770 *value2 = op2.ui64;
1771 else if(op2.kind == 22 && op2.type->isSigned)
1772 *value2 = (uint64)op2.i64;
1773 else if(op2.kind == 22)
1774 *value2 = op2.ui64;
1775 else if(op2.kind == 2 && op2.type->isSigned)
1776 *value2 = (uint64)op2.s;
1777 else if(op2.kind == 2)
1778 *value2 = (uint64)op2.us;
1779 else if(op2.kind == 1 && op2.type->isSigned)
1780 *value2 = (uint64)op2.c;
1781 else if(op2.kind == 1)
1782 *value2 = (uint64)op2.uc;
1783 else if(op2.kind == 6)
1784 *value2 = (uint64)op2.f;
1785 else if(op2.kind == 7)
1786 *value2 = (uint64)op2.d;
1787 else if(op2.kind == 13)
1788 *value2 = op2.ui64;
1789 else
1790 return 0x0;
1791 return 0x1;
1792 }
1793
1794 unsigned int GetIntPtr(struct Expression * exp, intptr_t * value2)
1795 {
1796 struct Operand op2 = GetOperand(exp);
1797
1798 if(op2.kind == 3 && op2.type->isSigned)
1799 *value2 = (intptr_t)op2.i;
1800 else if(op2.kind == 3)
1801 *value2 = (intptr_t)op2.ui;
1802 else if(op2.kind == 4 && op2.type->isSigned)
1803 *value2 = (intptr_t)op2.i64;
1804 else if(op2.kind == 4)
1805 *value2 = (intptr_t)op2.ui64;
1806 else if(op2.kind == 23 && op2.type->isSigned)
1807 *value2 = (intptr_t)op2.i64;
1808 else if(op2.kind == 23)
1809 *value2 = (intptr_t)op2.ui64;
1810 else if(op2.kind == 22 && op2.type->isSigned)
1811 *value2 = (intptr_t)op2.i64;
1812 else if(op2.kind == 22)
1813 *value2 = (intptr_t)op2.ui64;
1814 else if(op2.kind == 2 && op2.type->isSigned)
1815 *value2 = (intptr_t)op2.s;
1816 else if(op2.kind == 2)
1817 *value2 = (intptr_t)op2.us;
1818 else if(op2.kind == 1 && op2.type->isSigned)
1819 *value2 = (intptr_t)op2.c;
1820 else if(op2.kind == 1)
1821 *value2 = (intptr_t)op2.uc;
1822 else if(op2.kind == 6)
1823 *value2 = (intptr_t)op2.f;
1824 else if(op2.kind == 7)
1825 *value2 = (intptr_t)op2.d;
1826 else if(op2.kind == 13)
1827 *value2 = (intptr_t)op2.ui64;
1828 else
1829 return 0x0;
1830 return 0x1;
1831 }
1832
1833 unsigned int GetUIntPtr(struct Expression * exp, uintptr_t * value2)
1834 {
1835 struct Operand op2 = GetOperand(exp);
1836
1837 if(op2.kind == 3 && op2.type->isSigned)
1838 *value2 = (uintptr_t)op2.i;
1839 else if(op2.kind == 3)
1840 *value2 = (uintptr_t)op2.ui;
1841 else if(op2.kind == 4 && op2.type->isSigned)
1842 *value2 = (uintptr_t)op2.i64;
1843 else if(op2.kind == 4)
1844 *value2 = (uintptr_t)op2.ui64;
1845 else if(op2.kind == 23 && op2.type->isSigned)
1846 *value2 = (uintptr_t)op2.i64;
1847 else if(op2.kind == 23)
1848 *value2 = (uintptr_t)op2.ui64;
1849 else if(op2.kind == 22 && op2.type->isSigned)
1850 *value2 = (uintptr_t)op2.i64;
1851 else if(op2.kind == 22)
1852 *value2 = (uintptr_t)op2.ui64;
1853 else if(op2.kind == 2 && op2.type->isSigned)
1854 *value2 = (uintptr_t)op2.s;
1855 else if(op2.kind == 2)
1856 *value2 = (uintptr_t)op2.us;
1857 else if(op2.kind == 1 && op2.type->isSigned)
1858 *value2 = (uintptr_t)op2.c;
1859 else if(op2.kind == 1)
1860 *value2 = (uintptr_t)op2.uc;
1861 else if(op2.kind == 6)
1862 *value2 = (uintptr_t)op2.f;
1863 else if(op2.kind == 7)
1864 *value2 = (uintptr_t)op2.d;
1865 else if(op2.kind == 13)
1866 *value2 = (uintptr_t)op2.ui64;
1867 else
1868 return 0x0;
1869 return 0x1;
1870 }
1871
1872 unsigned int GetIntSize(struct Expression * exp, ssize_t * value2)
1873 {
1874 struct Operand op2 = GetOperand(exp);
1875
1876 if(op2.kind == 3 && op2.type->isSigned)
1877 *value2 = (ssize_t)op2.i;
1878 else if(op2.kind == 3)
1879 *value2 = (ssize_t)op2.ui;
1880 else if(op2.kind == 4 && op2.type->isSigned)
1881 *value2 = (ssize_t)op2.i64;
1882 else if(op2.kind == 4)
1883 *value2 = (ssize_t)op2.ui64;
1884 else if(op2.kind == 23 && op2.type->isSigned)
1885 *value2 = (ssize_t)op2.i64;
1886 else if(op2.kind == 23)
1887 *value2 = (ssize_t)op2.ui64;
1888 else if(op2.kind == 22 && op2.type->isSigned)
1889 *value2 = (ssize_t)op2.i64;
1890 else if(op2.kind == 22)
1891 *value2 = (ssize_t)op2.ui64;
1892 else if(op2.kind == 2 && op2.type->isSigned)
1893 *value2 = (ssize_t)op2.s;
1894 else if(op2.kind == 2)
1895 *value2 = (ssize_t)op2.us;
1896 else if(op2.kind == 1 && op2.type->isSigned)
1897 *value2 = (ssize_t)op2.c;
1898 else if(op2.kind == 1)
1899 *value2 = (ssize_t)op2.uc;
1900 else if(op2.kind == 6)
1901 *value2 = (ssize_t)op2.f;
1902 else if(op2.kind == 7)
1903 *value2 = (ssize_t)op2.d;
1904 else if(op2.kind == 13)
1905 *value2 = (ssize_t)op2.ui64;
1906 else
1907 return 0x0;
1908 return 0x1;
1909 }
1910
1911 unsigned int GetUIntSize(struct Expression * exp, size_t * value2)
1912 {
1913 struct Operand op2 = GetOperand(exp);
1914
1915 if(op2.kind == 3 && op2.type->isSigned)
1916 *value2 = (size_t)op2.i;
1917 else if(op2.kind == 3)
1918 *value2 = (size_t)op2.ui;
1919 else if(op2.kind == 4 && op2.type->isSigned)
1920 *value2 = (size_t)op2.i64;
1921 else if(op2.kind == 4)
1922 *value2 = (size_t)op2.ui64;
1923 else if(op2.kind == 23 && op2.type->isSigned)
1924 *value2 = (size_t)op2.i64;
1925 else if(op2.kind == 23)
1926 *value2 = (size_t)op2.ui64;
1927 else if(op2.kind == 22 && op2.type->isSigned)
1928 *value2 = (size_t)op2.i64;
1929 else if(op2.kind == 22)
1930 *value2 = (size_t)op2.ui64;
1931 else if(op2.kind == 2 && op2.type->isSigned)
1932 *value2 = (size_t)op2.s;
1933 else if(op2.kind == 2)
1934 *value2 = (size_t)op2.us;
1935 else if(op2.kind == 1 && op2.type->isSigned)
1936 *value2 = (size_t)op2.c;
1937 else if(op2.kind == 1)
1938 *value2 = (size_t)op2.uc;
1939 else if(op2.kind == 6)
1940 *value2 = (size_t)op2.f;
1941 else if(op2.kind == 7)
1942 *value2 = (size_t)op2.d;
1943 else if(op2.kind == 13)
1944 *value2 = (size_t)op2.ui64;
1945 else
1946 return 0x0;
1947 return 0x1;
1948 }
1949
1950 unsigned int GetShort(struct Expression * exp, short * value2)
1951 {
1952 struct Operand op2 = GetOperand(exp);
1953
1954 if(op2.kind == 3 && op2.type->isSigned)
1955 *value2 = (short)op2.i;
1956 else if(op2.kind == 3)
1957 *value2 = (short)op2.ui;
1958 else if(op2.kind == 4 && op2.type->isSigned)
1959 *value2 = (short)op2.i64;
1960 else if(op2.kind == 4)
1961 *value2 = (short)op2.ui64;
1962 else if(op2.kind == 23 && op2.type->isSigned)
1963 *value2 = (short)op2.i64;
1964 else if(op2.kind == 23)
1965 *value2 = (short)op2.ui64;
1966 else if(op2.kind == 22 && op2.type->isSigned)
1967 *value2 = (short)op2.i64;
1968 else if(op2.kind == 22)
1969 *value2 = (short)op2.ui64;
1970 else if(op2.kind == 2 && op2.type->isSigned)
1971 *value2 = op2.s;
1972 else if(op2.kind == 2)
1973 *value2 = (short)op2.us;
1974 else if(op2.kind == 1 && op2.type->isSigned)
1975 *value2 = (short)op2.c;
1976 else if(op2.kind == 1)
1977 *value2 = (short)op2.uc;
1978 else if(op2.kind == 6)
1979 *value2 = (short)op2.f;
1980 else if(op2.kind == 7)
1981 *value2 = (short)op2.d;
1982 else if(op2.kind == 13)
1983 *value2 = (short)op2.ui64;
1984 else
1985 return 0x0;
1986 return 0x1;
1987 }
1988
1989 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
1990 {
1991 struct Operand op2 = GetOperand(exp);
1992
1993 if(op2.kind == 3 && op2.type->isSigned)
1994 *value2 = (unsigned short)op2.i;
1995 else if(op2.kind == 3)
1996 *value2 = (unsigned short)op2.ui;
1997 else if(op2.kind == 4 && op2.type->isSigned)
1998 *value2 = (unsigned short)op2.i64;
1999 else if(op2.kind == 4)
2000 *value2 = (unsigned short)op2.ui64;
2001 else if(op2.kind == 23 && op2.type->isSigned)
2002 *value2 = (unsigned short)op2.i64;
2003 else if(op2.kind == 23)
2004 *value2 = (unsigned short)op2.ui64;
2005 else if(op2.kind == 22 && op2.type->isSigned)
2006 *value2 = (unsigned short)op2.i64;
2007 else if(op2.kind == 22)
2008 *value2 = (unsigned short)op2.ui64;
2009 else if(op2.kind == 2 && op2.type->isSigned)
2010 *value2 = (unsigned short)op2.s;
2011 else if(op2.kind == 2)
2012 *value2 = op2.us;
2013 else if(op2.kind == 1 && op2.type->isSigned)
2014 *value2 = (unsigned short)op2.c;
2015 else if(op2.kind == 1)
2016 *value2 = (unsigned short)op2.uc;
2017 else if(op2.kind == 6)
2018 *value2 = (unsigned short)op2.f;
2019 else if(op2.kind == 7)
2020 *value2 = (unsigned short)op2.d;
2021 else if(op2.kind == 13)
2022 *value2 = (unsigned short)op2.ui64;
2023 else
2024 return 0x0;
2025 return 0x1;
2026 }
2027
2028 unsigned int GetChar(struct Expression * exp, char * value2)
2029 {
2030 struct Operand op2 = GetOperand(exp);
2031
2032 if(op2.kind == 3 && op2.type->isSigned)
2033 *value2 = (char)op2.i;
2034 else if(op2.kind == 3)
2035 *value2 = (char)op2.ui;
2036 else if(op2.kind == 4 && op2.type->isSigned)
2037 *value2 = (char)op2.i64;
2038 else if(op2.kind == 4)
2039 *value2 = (char)op2.ui64;
2040 else if(op2.kind == 23 && op2.type->isSigned)
2041 *value2 = (char)op2.i64;
2042 else if(op2.kind == 23)
2043 *value2 = (char)op2.ui64;
2044 else if(op2.kind == 22 && op2.type->isSigned)
2045 *value2 = (char)op2.i64;
2046 else if(op2.kind == 22)
2047 *value2 = (char)op2.ui64;
2048 else if(op2.kind == 2 && op2.type->isSigned)
2049 *value2 = (char)op2.s;
2050 else if(op2.kind == 2)
2051 *value2 = (char)op2.us;
2052 else if(op2.kind == 1 && op2.type->isSigned)
2053 *value2 = op2.c;
2054 else if(op2.kind == 1)
2055 *value2 = (char)op2.uc;
2056 else if(op2.kind == 6)
2057 *value2 = (char)op2.f;
2058 else if(op2.kind == 7)
2059 *value2 = (char)op2.d;
2060 else if(op2.kind == 13)
2061 *value2 = (char)op2.ui64;
2062 else
2063 return 0x0;
2064 return 0x1;
2065 }
2066
2067 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
2068 {
2069 struct Operand op2 = GetOperand(exp);
2070
2071 if(op2.kind == 3 && op2.type->isSigned)
2072 *value2 = (unsigned char)op2.i;
2073 else if(op2.kind == 3)
2074 *value2 = (unsigned char)op2.ui;
2075 else if(op2.kind == 4 && op2.type->isSigned)
2076 *value2 = (unsigned char)op2.i64;
2077 else if(op2.kind == 4)
2078 *value2 = (unsigned char)op2.ui64;
2079 else if(op2.kind == 23 && op2.type->isSigned)
2080 *value2 = (unsigned char)op2.i64;
2081 else if(op2.kind == 23)
2082 *value2 = (unsigned char)op2.ui64;
2083 else if(op2.kind == 22 && op2.type->isSigned)
2084 *value2 = (unsigned char)op2.i64;
2085 else if(op2.kind == 22)
2086 *value2 = (unsigned char)op2.ui64;
2087 else if(op2.kind == 2 && op2.type->isSigned)
2088 *value2 = (unsigned char)op2.s;
2089 else if(op2.kind == 2)
2090 *value2 = (unsigned char)op2.us;
2091 else if(op2.kind == 1 && op2.type->isSigned)
2092 *value2 = (unsigned char)op2.c;
2093 else if(op2.kind == 1)
2094 *value2 = op2.uc;
2095 else if(op2.kind == 6)
2096 *value2 = (unsigned char)op2.f;
2097 else if(op2.kind == 7)
2098 *value2 = (unsigned char)op2.d;
2099 else if(op2.kind == 13)
2100 *value2 = (unsigned char)op2.ui64;
2101 else
2102 return 0x0;
2103 return 0x1;
2104 }
2105
2106 unsigned int GetFloat(struct Expression * exp, float * value2)
2107 {
2108 struct Operand op2 = GetOperand(exp);
2109
2110 if(op2.kind == 3 && op2.type->isSigned)
2111 *value2 = (float)(float)op2.i;
2112 else if(op2.kind == 3)
2113 *value2 = (float)(float)op2.ui;
2114 else if(op2.kind == 4 && op2.type->isSigned)
2115 *value2 = (float)(float)op2.i64;
2116 else if(op2.kind == 4)
2117 *value2 = (float)(float)op2.ui64;
2118 else if(op2.kind == 23 && op2.type->isSigned)
2119 *value2 = (float)(float)op2.i64;
2120 else if(op2.kind == 23)
2121 *value2 = (float)(float)op2.ui64;
2122 else if(op2.kind == 22 && op2.type->isSigned)
2123 *value2 = (float)(float)op2.i64;
2124 else if(op2.kind == 22)
2125 *value2 = (float)(float)op2.ui64;
2126 else if(op2.kind == 2 && op2.type->isSigned)
2127 *value2 = (float)(float)op2.s;
2128 else if(op2.kind == 2)
2129 *value2 = (float)(float)op2.us;
2130 else if(op2.kind == 1 && op2.type->isSigned)
2131 *value2 = (float)(float)op2.c;
2132 else if(op2.kind == 1)
2133 *value2 = (float)(float)op2.uc;
2134 else if(op2.kind == 6)
2135 *value2 = (float)op2.f;
2136 else if(op2.kind == 7)
2137 *value2 = (float)op2.d;
2138 else if(op2.kind == 13)
2139 *value2 = (float)(float)op2.ui64;
2140 else
2141 return 0x0;
2142 return 0x1;
2143 }
2144
2145 unsigned int GetDouble(struct Expression * exp, double * value2)
2146 {
2147 struct Operand op2 = GetOperand(exp);
2148
2149 if(op2.kind == 3 && op2.type->isSigned)
2150 *value2 = (double)(double)op2.i;
2151 else if(op2.kind == 3)
2152 *value2 = (double)(double)op2.ui;
2153 else if(op2.kind == 4 && op2.type->isSigned)
2154 *value2 = (double)(double)op2.i64;
2155 else if(op2.kind == 4)
2156 *value2 = (double)(double)op2.ui64;
2157 else if(op2.kind == 23 && op2.type->isSigned)
2158 *value2 = (double)(double)op2.i64;
2159 else if(op2.kind == 23)
2160 *value2 = (double)(double)op2.ui64;
2161 else if(op2.kind == 22 && op2.type->isSigned)
2162 *value2 = (double)(double)op2.i64;
2163 else if(op2.kind == 22)
2164 *value2 = (double)(double)op2.ui64;
2165 else if(op2.kind == 2 && op2.type->isSigned)
2166 *value2 = (double)(double)op2.s;
2167 else if(op2.kind == 2)
2168 *value2 = (double)(double)op2.us;
2169 else if(op2.kind == 1 && op2.type->isSigned)
2170 *value2 = (double)(double)op2.c;
2171 else if(op2.kind == 1)
2172 *value2 = (double)(double)op2.uc;
2173 else if(op2.kind == 6)
2174 *value2 = (double)op2.f;
2175 else if(op2.kind == 7)
2176 *value2 = (double)op2.d;
2177 else if(op2.kind == 13)
2178 *value2 = (double)(double)op2.ui64;
2179 else
2180 return 0x0;
2181 return 0x1;
2182 }
2183
2184 void ComputeExpression(struct Expression * exp);
2185
2186 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2187
2188 extern int targetBits;
2189
2190 int ComputeTypeSize(struct Type * type);
2191
2192 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2193
2194 struct __ecereNameSpace__ecere__com__BitMember
2195 {
2196 struct __ecereNameSpace__ecere__com__BitMember * prev;
2197 struct __ecereNameSpace__ecere__com__BitMember * next;
2198 char *  name;
2199 unsigned int isProperty;
2200 int memberAccess;
2201 int id;
2202 struct __ecereNameSpace__ecere__com__Class * _class;
2203 char *  dataTypeString;
2204 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2205 struct Type * dataType;
2206 int type;
2207 int size;
2208 int pos;
2209 uint64 mask;
2210 } __attribute__ ((gcc_struct));
2211
2212 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2213
2214 struct __ecereNameSpace__ecere__sys__OldLink
2215 {
2216 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2217 struct __ecereNameSpace__ecere__sys__OldLink * next;
2218 void *  data;
2219 } __attribute__ ((gcc_struct));
2220
2221 void FinishTemplatesContext(struct Context * context);
2222
2223 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2224 {
2225 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2226 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2227
2228 if(member || ((_class->type == 2 || _class->type == 0 || _class->type == 1 || _class->type == 5) && (_class->type == 2 || (!_class->structSize || _class->structSize == _class->offset)) && _class->computeSize))
2229 {
2230 int c;
2231 int unionMemberOffset = 0;
2232 int bitFields = 0;
2233
2234 if(member)
2235 {
2236 member->memberOffset = 0;
2237 if(targetBits < sizeof(void *) * 8)
2238 member->structAlignment = 0;
2239 }
2240 else if(targetBits < sizeof(void *) * 8)
2241 _class->structAlignment = 0;
2242 if(!member && ((_class->type == 0 || _class->type == 5) || (_class->type == 1 && _class->memberOffset && _class->memberOffset > _class->base->structSize)))
2243 _class->memberOffset = (_class->base && _class->type == 1) ? _class->base->structSize : 0;
2244 if(!member && _class->destructionWatchOffset)
2245 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2246 {
2247 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2248
2249 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2250 {
2251 if(!dataMember->isProperty)
2252 {
2253 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2254 {
2255 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2256 }
2257 }
2258 }
2259 }
2260 {
2261 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2262
2263 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2264 {
2265 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2266 {
2267 if(!isMember && _class->type == 2 && dataMember->dataType)
2268 {
2269 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2270 uint64 mask = 0;
2271 int d;
2272
2273 ComputeTypeSize(dataMember->dataType);
2274 if(bitMember->pos == -1)
2275 bitMember->pos = _class->memberOffset;
2276 if(!bitMember->size)
2277 bitMember->size = dataMember->dataType->size * 8;
2278 _class->memberOffset = bitMember->pos + bitMember->size;
2279 for(d = 0; d < bitMember->size; d++)
2280 {
2281 if(d)
2282 mask <<= 1;
2283 mask |= 1;
2284 }
2285 bitMember->mask = mask << bitMember->pos;
2286 }
2287 else if(dataMember->type == 0 && dataMember->dataType)
2288 {
2289 int size;
2290 int alignment = 0;
2291
2292 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2293 ComputeTypeSize(dataMember->dataType);
2294 if(dataMember->dataType->bitFieldCount)
2295 {
2296 bitFields += dataMember->dataType->bitFieldCount;
2297 size = 0;
2298 }
2299 else
2300 {
2301 if(bitFields)
2302 {
2303 int size = (bitFields + 7) / 8;
2304
2305 if(isMember)
2306 {
2307 int __simpleStruct0;
2308
2309 if(alignment)
2310 {
2311 int __simpleStruct0;
2312
2313 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2314 if(member->memberOffset % alignment)
2315 member->memberOffset += alignment - (member->memberOffset % alignment);
2316 }
2317 dataMember->offset = member->memberOffset;
2318 if(member->type == 1)
2319 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2320 else
2321 {
2322 member->memberOffset += size;
2323 }
2324 }
2325 else
2326 {
2327 if(alignment)
2328 {
2329 int __simpleStruct0;
2330
2331 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2332 if(_class->memberOffset % alignment)
2333 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2334 }
2335 dataMember->offset = _class->memberOffset;
2336 _class->memberOffset += size;
2337 }
2338 bitFields = 0;
2339 }
2340 size = dataMember->dataType->size;
2341 alignment = dataMember->dataType->alignment;
2342 }
2343 if(isMember)
2344 {
2345 int __simpleStruct0;
2346
2347 if(alignment)
2348 {
2349 int __simpleStruct0;
2350
2351 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2352 if(member->memberOffset % alignment)
2353 member->memberOffset += alignment - (member->memberOffset % alignment);
2354 }
2355 dataMember->offset = member->memberOffset;
2356 if(member->type == 1)
2357 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2358 else
2359 {
2360 member->memberOffset += size;
2361 }
2362 }
2363 else
2364 {
2365 if(alignment)
2366 {
2367 int __simpleStruct0;
2368
2369 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2370 if(_class->memberOffset % alignment)
2371 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2372 }
2373 dataMember->offset = _class->memberOffset;
2374 _class->memberOffset += size;
2375 }
2376 }
2377 else
2378 {
2379 int alignment;
2380
2381 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2382 alignment = dataMember->structAlignment;
2383 if(isMember)
2384 {
2385 int __simpleStruct0;
2386
2387 if(alignment)
2388 {
2389 int __simpleStruct0;
2390
2391 if(member->memberOffset % alignment)
2392 member->memberOffset += alignment - (member->memberOffset % alignment);
2393 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2394 }
2395 dataMember->offset = member->memberOffset;
2396 if(member->type == 1)
2397 unionMemberOffset = (__simpleStruct0 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2398 else
2399 member->memberOffset += dataMember->memberOffset;
2400 }
2401 else
2402 {
2403 if(alignment)
2404 {
2405 int __simpleStruct0;
2406
2407 if(_class->memberOffset % alignment)
2408 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2409 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2410 }
2411 dataMember->offset = _class->memberOffset;
2412 _class->memberOffset += dataMember->memberOffset;
2413 }
2414 }
2415 }
2416 }
2417 if(bitFields)
2418 {
2419 int alignment = 0;
2420 int size = (bitFields + 7) / 8;
2421
2422 if(isMember)
2423 {
2424 int __simpleStruct0;
2425
2426 if(alignment)
2427 {
2428 int __simpleStruct0;
2429
2430 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2431 if(member->memberOffset % alignment)
2432 member->memberOffset += alignment - (member->memberOffset % alignment);
2433 }
2434 if(member->type == 1)
2435 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2436 else
2437 {
2438 member->memberOffset += size;
2439 }
2440 }
2441 else
2442 {
2443 if(alignment)
2444 {
2445 int __simpleStruct0;
2446
2447 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2448 if(_class->memberOffset % alignment)
2449 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2450 }
2451 _class->memberOffset += size;
2452 }
2453 bitFields = 0;
2454 }
2455 }
2456 if(member && member->type == 1)
2457 {
2458 member->memberOffset = unionMemberOffset;
2459 }
2460 if(!isMember)
2461 {
2462 if(_class->type != 2)
2463 {
2464 int extra = 0;
2465
2466 if(_class->structAlignment)
2467 {
2468 if(_class->memberOffset % _class->structAlignment)
2469 extra += _class->structAlignment - (_class->memberOffset % _class->structAlignment);
2470 }
2471 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset + extra;
2472 if(!member)
2473 {
2474 struct __ecereNameSpace__ecere__com__Property * prop;
2475
2476 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2477 {
2478 if(prop->isProperty && prop->isWatchable)
2479 {
2480 prop->watcherOffset = _class->structSize;
2481 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2482 }
2483 }
2484 }
2485 {
2486 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2487
2488 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2489 {
2490 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2491
2492 if(deriv->computeSize)
2493 {
2494 deriv->offset = _class->structSize;
2495 deriv->memberOffset = 0;
2496 deriv->structSize = deriv->offset;
2497 ComputeClassMembers(deriv, 0x0);
2498 }
2499 }
2500 }
2501 }
2502 }
2503 }
2504 if(context)
2505 FinishTemplatesContext(context);
2506 }
2507
2508 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2509
2510 struct __ecereNameSpace__ecere__com__NameSpace
2511 {
2512 char *  name;
2513 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2514 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2515 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2516 int depth;
2517 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2518 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2519 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2520 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2521 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2522 } __attribute__ ((gcc_struct));
2523
2524 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2525
2526 struct __ecereNameSpace__ecere__com__Module
2527 {
2528 struct __ecereNameSpace__ecere__com__Instance * application;
2529 struct __ecereNameSpace__ecere__sys__OldList classes;
2530 struct __ecereNameSpace__ecere__sys__OldList defines;
2531 struct __ecereNameSpace__ecere__sys__OldList functions;
2532 struct __ecereNameSpace__ecere__sys__OldList modules;
2533 struct __ecereNameSpace__ecere__com__Instance * prev;
2534 struct __ecereNameSpace__ecere__com__Instance * next;
2535 char *  name;
2536 void *  library;
2537 void *  Unload;
2538 int importType;
2539 int origImportType;
2540 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2541 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2542 } __attribute__ ((gcc_struct));
2543
2544 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2545 {
2546 struct __ecereNameSpace__ecere__com__Class * _class;
2547 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2548
2549 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
2550 ComputeModuleClasses(subModule->data);
2551 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->classes.first; _class; _class = _class->next)
2552 ComputeClassMembers(_class, 0x0);
2553 }
2554
2555 extern unsigned int inCompiler;
2556
2557 extern void Compiler_Error(char *  format, ...);
2558
2559 extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
2560
2561 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
2562
2563 int ComputeTypeSize(struct Type * type)
2564 {
2565 unsigned int size = type ? type->size : 0;
2566
2567 if(!size && type && !type->computing)
2568 {
2569 type->computing = 0x1;
2570 switch(type->kind)
2571 {
2572 case 1:
2573 type->alignment = size = sizeof(char);
2574 break;
2575 case 3:
2576 type->alignment = size = sizeof(int);
2577 break;
2578 case 4:
2579 type->alignment = size = sizeof(long long);
2580 break;
2581 case 22:
2582 type->alignment = size = targetBits / 8;
2583 break;
2584 case 23:
2585 type->alignment = size = targetBits / 8;
2586 break;
2587 case 5:
2588 type->alignment = size = sizeof(long);
2589 break;
2590 case 2:
2591 type->alignment = size = sizeof(short);
2592 break;
2593 case 6:
2594 type->alignment = size = sizeof(float);
2595 break;
2596 case 7:
2597 type->alignment = size = sizeof(double);
2598 break;
2599 case 8:
2600 {
2601 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2602
2603 if(_class && _class->type == 1)
2604 {
2605 ComputeClassMembers(_class, 0x0);
2606 type->alignment = _class->structAlignment;
2607 size = _class->structSize;
2608 if(type->alignment && size % type->alignment)
2609 size += type->alignment - (size % type->alignment);
2610 }
2611 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2612 {
2613 if(!_class->dataType)
2614 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2615 size = type->alignment = ComputeTypeSize(_class->dataType);
2616 }
2617 else
2618 size = type->alignment = targetBits / 8;
2619 break;
2620 }
2621 case 13:
2622 case 19:
2623 size = type->alignment = targetBits / 8;
2624 break;
2625 case 12:
2626 if(type->arraySizeExp)
2627 {
2628 ProcessExpressionType(type->arraySizeExp);
2629 ComputeExpression(type->arraySizeExp);
2630 if(!type->arraySizeExp->isConstant || (type->arraySizeExp->expType->kind != 3 && type->arraySizeExp->expType->kind != 15 && (type->arraySizeExp->expType->kind != 8 || !type->arraySizeExp->expType->_class->registered || type->arraySizeExp->expType->_class->registered->type != 4)))
2631 {
2632 struct Location oldLoc = yylloc;
2633 char expression[10240];
2634
2635 expression[0] = '\0';
2636 type->arraySizeExp->expType = (((void *)0));
2637 yylloc = type->arraySizeExp->loc;
2638 if(inCompiler)
2639 PrintExpression(type->arraySizeExp, expression);
2640 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Array size not constant int (%s)\n", (((void *)0))), expression);
2641 yylloc = oldLoc;
2642 }
2643 GetInt(type->arraySizeExp, &type->arraySize);
2644 }
2645 else if(type->enumClass)
2646 {
2647 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2648 {
2649 type->arraySize = (int)__ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2650 }
2651 else
2652 type->arraySize = 0;
2653 }
2654 else
2655 {
2656 type->arraySize = 0;
2657 }
2658 size = ComputeTypeSize(type->type) * type->arraySize;
2659 type->alignment = type->type->alignment;
2660 break;
2661 case 9:
2662 {
2663 struct Type * member;
2664
2665 for(member = type->members.first; member; member = member->next)
2666 {
2667 int __simpleStruct0, __simpleStruct1;
2668 unsigned int addSize = ComputeTypeSize(member);
2669
2670 member->offset = size;
2671 if(member->alignment && size % member->alignment)
2672 member->offset += member->alignment - (size % member->alignment);
2673 size = member->offset;
2674 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2675 size += addSize;
2676 }
2677 if(type->alignment && size % type->alignment)
2678 size += type->alignment - (size % type->alignment);
2679 break;
2680 }
2681 case 10:
2682 {
2683 struct Type * member;
2684
2685 for(member = type->members.first; member; member = member->next)
2686 {
2687 int __simpleStruct0, __simpleStruct1;
2688 unsigned int addSize = ComputeTypeSize(member);
2689
2690 member->offset = size;
2691 if(member->alignment && size % member->alignment)
2692 member->offset += member->alignment - (size % member->alignment);
2693 size = member->offset;
2694 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2695 size = ((size > addSize) ? size : addSize);
2696 }
2697 if(type->alignment && size % type->alignment)
2698 size += type->alignment - (size % type->alignment);
2699 break;
2700 }
2701 case 20:
2702 {
2703 struct TemplateParameter * param = type->templateParameter;
2704 struct Type * baseType = ProcessTemplateParameterType(param);
2705
2706 if(baseType)
2707 {
2708 size = ComputeTypeSize(baseType);
2709 type->alignment = baseType->alignment;
2710 }
2711 else
2712 type->alignment = size = sizeof(uint64);
2713 break;
2714 }
2715 case 15:
2716 {
2717 type->alignment = size = sizeof(enum
2718 {
2719 test
2720 });
2721 break;
2722 }
2723 case 21:
2724 {
2725 type->alignment = size = targetBits / 8;
2726 break;
2727 }
2728 }
2729 type->size = size;
2730 type->computing = 0x0;
2731 }
2732 return size;
2733 }
2734
2735 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2736
2737 extern struct Identifier * MkIdentifier(char *  string);
2738
2739 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2740
2741 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2742
2743 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2744
2745 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2746
2747 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2748
2749 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2750
2751 extern void FreeType(struct Type * type);
2752
2753 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2754
2755 extern struct Specifier * MkSpecifier(int specifier);
2756
2757 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2758
2759 extern struct Expression * MkExpConstant(char *  string);
2760
2761 int AddMembers(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember, unsigned int * retSize, struct __ecereNameSpace__ecere__com__Class * topClass, unsigned int * addedPadding)
2762 {
2763 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2764 unsigned int totalSize = 0;
2765 unsigned int maxSize = 0;
2766 int alignment, size;
2767 struct __ecereNameSpace__ecere__com__DataMember * member;
2768 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2769
2770 if(addedPadding)
2771 *addedPadding = 0x0;
2772 if(!isMember && _class->base)
2773 {
2774 maxSize = _class->structSize;
2775 {
2776 if(_class->type == 1 || _class->type == 5)
2777 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass, (((void *)0)));
2778 else
2779 {
2780 unsigned int baseSize = _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2781
2782 if(maxSize > baseSize)
2783 maxSize -= baseSize;
2784 else
2785 maxSize = 0;
2786 }
2787 }
2788 }
2789 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2790 {
2791 if(!member->isProperty)
2792 {
2793 switch(member->type)
2794 {
2795 case 0:
2796 {
2797 if(member->dataTypeString)
2798 {
2799 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2800 struct Declarator * decl;
2801
2802 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2803 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2804 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2805 if(!member->dataType)
2806 member->dataType = ProcessType(specs, decl);
2807 ReplaceThisClassSpecifiers(specs, topClass);
2808 {
2809 struct Type * type = ProcessType(specs, decl);
2810
2811 DeclareType(member->dataType, 0x0, 0x0);
2812 FreeType(type);
2813 }
2814 ComputeTypeSize(member->dataType);
2815 size = member->dataType->size;
2816 alignment = member->dataType->alignment;
2817 if(alignment)
2818 {
2819 if(totalSize % alignment)
2820 totalSize += alignment - (totalSize % alignment);
2821 }
2822 totalSize += size;
2823 }
2824 break;
2825 }
2826 case 1:
2827 case 2:
2828 {
2829 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2830
2831 size = 0;
2832 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass, (((void *)0)));
2833 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
2834 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
2835 alignment = member->structAlignment;
2836 if(alignment)
2837 {
2838 if(totalSize % alignment)
2839 totalSize += alignment - (totalSize % alignment);
2840 }
2841 totalSize += size;
2842 break;
2843 }
2844 }
2845 }
2846 }
2847 if(retSize)
2848 {
2849 unsigned int __simpleStruct0;
2850
2851 if(topMember && topMember->type == 1)
2852 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
2853 else
2854 *retSize += totalSize;
2855 }
2856 else if(totalSize < maxSize && _class->type != 1000)
2857 {
2858 int autoPadding = 0;
2859
2860 if(!isMember && _class->structAlignment && totalSize % _class->structAlignment)
2861 autoPadding = _class->structAlignment - (totalSize % _class->structAlignment);
2862 if(totalSize + autoPadding < maxSize)
2863 {
2864 char sizeString[50];
2865
2866 sprintf(sizeString, "%d", maxSize - totalSize);
2867 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
2868 if(addedPadding)
2869 *addedPadding = 0x1;
2870 }
2871 }
2872 if(context)
2873 FinishTemplatesContext(context);
2874 return topMember ? topMember->memberID : _class->memberID;
2875 }
2876
2877 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2878 {
2879 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2880 unsigned int totalSize = 0;
2881 struct __ecereNameSpace__ecere__com__DataMember * member;
2882 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2883
2884 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
2885 DeclareMembers(_class->base, 0x0);
2886 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2887 {
2888 if(!member->isProperty)
2889 {
2890 switch(member->type)
2891 {
2892 case 0:
2893 {
2894 if(!member->dataType && member->dataTypeString)
2895 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
2896 if(member->dataType)
2897 DeclareType(member->dataType, 0x0, 0x0);
2898 break;
2899 }
2900 case 1:
2901 case 2:
2902 {
2903 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
2904 break;
2905 }
2906 }
2907 }
2908 }
2909 if(context)
2910 FinishTemplatesContext(context);
2911 return topMember ? topMember->memberID : _class->memberID;
2912 }
2913
2914 extern struct Symbol * FindClass(char *  name);
2915
2916 extern char *  strchr(const char * , int);
2917
2918 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
2919
2920 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (* )(void * ));
2921
2922 extern void FreeClassDef(struct ClassDef * def);
2923
2924 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
2925
2926 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
2927
2928 extern char *  strcpy(char * , const char * );
2929
2930 extern void MangleClassName(char *  className);
2931
2932 extern void DeclareClass(struct Symbol * classSym, char *  className);
2933
2934 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
2935
2936 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
2937
2938 void DeclareStruct(char * name, unsigned int skipNoHead)
2939 {
2940 struct External * external = (((void *)0));
2941 struct Symbol * classSym = FindClass(name);
2942
2943 if(!inCompiler || !classSym)
2944 return ;
2945 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
2946 return ;
2947 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
2948 {
2949 struct Declaration * decl;
2950 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2951 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
2952 char structName[1024];
2953
2954 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
2955 classSym->declaring++;
2956 if(strchr(classSym->string, '<'))
2957 {
2958 if(classSym->registered->templateClass)
2959 {
2960 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
2961 classSym->declaring--;
2962 }
2963 return ;
2964 }
2965 DeclareMembers(classSym->registered, 0x0);
2966 structName[0] = (char)0;
2967 FullClassNameCat(structName, name, 0x0);
2968 if(!skipNoHead)
2969 {
2970 unsigned int addedPadding = 0x0;
2971
2972 classSym->declaredStructSym = 0x1;
2973 declarations = MkList();
2974 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered, &addedPadding);
2975 if(!(*declarations).count || ((*declarations).count == 1 && addedPadding))
2976 {
2977 FreeList(declarations, FreeClassDef);
2978 declarations = (((void *)0));
2979 }
2980 }
2981 if(skipNoHead || declarations)
2982 {
2983 if(external && external->declaration)
2984 {
2985 ((struct Specifier *)(*external->declaration->specifiers).first)->definitions = declarations;
2986 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2987 {
2988 if(classSym->structExternal)
2989 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2990 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2991 classSym->id = curExternal->symbol->idCode;
2992 classSym->idCode = curExternal->symbol->idCode;
2993 }
2994 }
2995 else
2996 {
2997 if(!external)
2998 external = MkExternalDeclaration((((void *)0)));
2999 specifiers = MkList();
3000 declarators = MkList();
3001 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
3002 external->declaration = decl = MkDeclaration(specifiers, declarators);
3003 if(decl->symbol && !decl->symbol->pointerExternal)
3004 decl->symbol->pointerExternal = external;
3005 if(classSym->registered && classSym->registered->type == 1)
3006 {
3007 char className[1024];
3008
3009 strcpy(className, "__ecereClass_");
3010 FullClassNameCat(className, classSym->string, 0x1);
3011 MangleClassName(className);
3012 DeclareClass(classSym, className);
3013 external->symbol = classSym;
3014 classSym->pointerExternal = external;
3015 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3016 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3017 }
3018 else
3019 {
3020 char className[1024];
3021
3022 strcpy(className, "__ecereClass_");
3023 FullClassNameCat(className, classSym->string, 0x1);
3024 MangleClassName(className);
3025 classSym->structExternal = external;
3026 DeclareClass(classSym, className);
3027 external->symbol = classSym;
3028 }
3029 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
3030 }
3031 }
3032 classSym->declaring--;
3033 }
3034 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3035 {
3036 classSym->declaring++;
3037 {
3038 if(classSym->registered)
3039 DeclareMembers(classSym->registered, 0x0);
3040 }
3041 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
3042 {
3043 if(classSym->structExternal)
3044 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3045 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3046 classSym->id = curExternal->symbol->idCode;
3047 classSym->idCode = curExternal->symbol->idCode;
3048 }
3049 classSym->declaring--;
3050 }
3051 }
3052
3053 extern char *  strcat(char * , const char * );
3054
3055 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
3056
3057 extern struct ModuleImport * mainModule;
3058
3059 extern struct Specifier * MkSpecifierName(char *  name);
3060
3061 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
3062
3063 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
3064
3065 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
3066
3067 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
3068
3069 extern void FreeDeclarator(struct Declarator * decl);
3070
3071 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
3072
3073 struct PropertyImport
3074 {
3075 struct PropertyImport * prev;
3076 struct PropertyImport * next;
3077 char *  name;
3078 unsigned int isVirtual;
3079 unsigned int hasSet;
3080 unsigned int hasGet;
3081 } __attribute__ ((gcc_struct));
3082
3083 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3084
3085 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
3086 {
3087 struct Symbol * symbol = prop->symbol;
3088 char propName[1024];
3089
3090 strcpy(setName, "__ecereProp_");
3091 FullClassNameCat(setName, prop->_class->fullName, 0x0);
3092 strcat(setName, "_Set_");
3093 FullClassNameCat(setName, prop->name, 0x1);
3094 strcpy(getName, "__ecereProp_");
3095 FullClassNameCat(getName, prop->_class->fullName, 0x0);
3096 strcat(getName, "_Get_");
3097 FullClassNameCat(getName, prop->name, 0x1);
3098 strcpy(propName, "__ecereProp_");
3099 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3100 strcat(propName, "_");
3101 FullClassNameCat(propName, prop->name, 0x1);
3102 MangleClassName(getName);
3103 MangleClassName(setName);
3104 MangleClassName(propName);
3105 if(prop->_class->type == 1)
3106 DeclareStruct(prop->_class->fullName, 0x0);
3107 if(!symbol || curExternal->symbol->idCode < symbol->id)
3108 {
3109 unsigned int imported = 0x0;
3110 unsigned int dllImport = 0x0;
3111
3112 if(!symbol || symbol->_import)
3113 {
3114 if(!symbol)
3115 {
3116 struct Symbol * classSym;
3117
3118 if(!prop->_class->symbol)
3119 prop->_class->symbol = FindClass(prop->_class->fullName);
3120 classSym = prop->_class->symbol;
3121 if(classSym && !classSym->_import)
3122 {
3123 struct ModuleImport * module;
3124
3125 if(prop->_class->module)
3126 module = FindModule(prop->_class->module);
3127 else
3128 module = mainModule;
3129 classSym->_import = __extension__ ({
3130 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
3131
3132 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), __ecereInstance1->isRemote = prop->_class->isRemote, __ecereInstance1;
3133 });
3134 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3135 }
3136 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3137 symbol->_import = (struct ClassImport *)__extension__ ({
3138 struct PropertyImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport);
3139
3140 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), __ecereInstance1->isVirtual = 0x0, __ecereInstance1->hasSet = prop->Set ? 0x1 : 0x0, __ecereInstance1->hasGet = prop->Get ? 0x1 : 0x0, __ecereInstance1;
3141 });
3142 if(classSym)
3143 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
3144 }
3145 imported = 0x1;
3146 if(prop->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + structSize_Instance)))->importType != 1)
3147 dllImport = 0x1;
3148 }
3149 if(!symbol->type)
3150 {
3151 struct Context * context = SetupTemplatesContext(prop->_class);
3152
3153 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
3154 FinishTemplatesContext(context);
3155 }
3156 if(prop->Get)
3157 {
3158 if(!symbol->externalGet || symbol->externalGet->type == 0)
3159 {
3160 struct Declaration * decl;
3161 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3162 struct Declarator * d;
3163 struct __ecereNameSpace__ecere__sys__OldList * params;
3164 struct Specifier * spec;
3165 struct External * external;
3166 struct Declarator * typeDecl;
3167 unsigned int simple = 0x0;
3168
3169 specifiers = MkList();
3170 declarators = MkList();
3171 params = MkList();
3172 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3173 d = MkDeclaratorIdentifier(MkIdentifier(getName));
3174 if(dllImport)
3175 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3176 {
3177 struct Context * context = SetupTemplatesContext(prop->_class);
3178
3179 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
3180 FinishTemplatesContext(context);
3181 }
3182 for(spec = (*specifiers).first; spec; spec = spec->next)
3183 {
3184 if(spec->type == 1)
3185 {
3186 if((!typeDecl || typeDecl->type == 1))
3187 {
3188 struct Symbol * classSym = spec->symbol;
3189
3190 symbol->_class = classSym->registered;
3191 if(classSym->registered && classSym->registered->type == 1)
3192 {
3193 DeclareStruct(spec->name, 0x0);
3194 simple = 0x1;
3195 }
3196 }
3197 }
3198 }
3199 if(!simple)
3200 d = PlugDeclarator(typeDecl, d);
3201 else
3202 {
3203 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3204 specifiers = MkList();
3205 }
3206 d = MkDeclaratorFunction(d, params);
3207 if(dllImport)
3208 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3209 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3210 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3211 if(simple)
3212 ListAdd(specifiers, MkSpecifier(VOID));
3213 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3214 decl = MkDeclaration(specifiers, declarators);
3215 external = MkExternalDeclaration(decl);
3216 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3217 external->symbol = symbol;
3218 symbol->externalGet = external;
3219 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3220 if(typeDecl)
3221 FreeDeclarator(typeDecl);
3222 }
3223 else
3224 {
3225 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3226 }
3227 }
3228 if(prop->Set)
3229 {
3230 if(!symbol->externalSet || symbol->externalSet->type == 0)
3231 {
3232 struct Declaration * decl;
3233 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3234 struct Declarator * d;
3235 struct __ecereNameSpace__ecere__sys__OldList * params;
3236 struct Specifier * spec;
3237 struct External * external;
3238 struct Declarator * typeDecl;
3239
3240 declarators = MkList();
3241 params = MkList();
3242 if(!prop->conversion || prop->_class->type == 1)
3243 {
3244 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3245 }
3246 specifiers = MkList();
3247 {
3248 struct Context * context = SetupTemplatesContext(prop->_class);
3249
3250 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3251 FinishTemplatesContext(context);
3252 }
3253 ListAdd(params, MkTypeName(specifiers, d));
3254 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3255 if(dllImport)
3256 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3257 d = MkDeclaratorFunction(d, params);
3258 for(spec = (*specifiers).first; spec; spec = spec->next)
3259 {
3260 if(spec->type == 1)
3261 {
3262 if((!typeDecl || typeDecl->type == 1))
3263 {
3264 struct Symbol * classSym = spec->symbol;
3265
3266 symbol->_class = classSym->registered;
3267 if(classSym->registered && classSym->registered->type == 1)
3268 DeclareStruct(spec->name, 0x0);
3269 }
3270 }
3271 }
3272 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3273 specifiers = MkList();
3274 if(dllImport)
3275 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3276 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3277 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3278 if(!prop->conversion || prop->_class->type == 1)
3279 ListAdd(specifiers, MkSpecifier(VOID));
3280 else
3281 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3282 decl = MkDeclaration(specifiers, declarators);
3283 external = MkExternalDeclaration(decl);
3284 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3285 external->symbol = symbol;
3286 symbol->externalSet = external;
3287 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3288 }
3289 else
3290 {
3291 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3292 }
3293 }
3294 if(!symbol->externalPtr)
3295 {
3296 struct Declaration * decl;
3297 struct External * external;
3298 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3299
3300 if(imported)
3301 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3302 else
3303 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3304 ListAdd(specifiers, MkSpecifierName("Property"));
3305 {
3306 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3307
3308 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3309 if(!imported)
3310 {
3311 strcpy(propName, "__ecerePropM_");
3312 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3313 strcat(propName, "_");
3314 FullClassNameCat(propName, prop->name, 0x1);
3315 MangleClassName(propName);
3316 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3317 }
3318 decl = MkDeclaration(specifiers, list);
3319 }
3320 external = MkExternalDeclaration(decl);
3321 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3322 external->symbol = symbol;
3323 symbol->externalPtr = external;
3324 }
3325 else
3326 {
3327 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3328 }
3329 symbol->id = curExternal->symbol->idCode;
3330 }
3331 }
3332
3333 struct Type * Dereference(struct Type * source)
3334 {
3335 struct Type * type = (((void *)0));
3336
3337 if(source)
3338 {
3339 if(source->kind == 13 || source->kind == 12)
3340 {
3341 type = source->type;
3342 source->type->refCount++;
3343 }
3344 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3345 {
3346 type = __extension__ ({
3347 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3348
3349 __ecereInstance1->kind = 1, __ecereInstance1->refCount = 1, __ecereInstance1;
3350 });
3351 }
3352 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3353 {
3354 type = source;
3355 source->refCount++;
3356 }
3357 else
3358 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot dereference type\n", (((void *)0))));
3359 }
3360 return type;
3361 }
3362
3363 static struct Type * Reference(struct Type * source)
3364 {
3365 struct Type * type = (((void *)0));
3366
3367 if(source)
3368 {
3369 type = __extension__ ({
3370 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3371
3372 __ecereInstance1->kind = 13, __ecereInstance1->type = source, __ecereInstance1->refCount = 1, __ecereInstance1;
3373 });
3374 source->refCount++;
3375 }
3376 return type;
3377 }
3378
3379 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);
3380
3381 extern void *  memcpy(void * , const void * , size_t size);
3382
3383 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3384
3385 extern void FreeExpression(struct Expression * exp);
3386
3387 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3388
3389 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);
3390
3391 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3392
3393 extern struct Type * MkClassType(char *  name);
3394
3395 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);
3396
3397 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)
3398 {
3399 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3400 unsigned int found = 0x0;
3401 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3402 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3403 unsigned int freeType = 0x0;
3404
3405 yylloc = member->loc;
3406 if(!ident)
3407 {
3408 if(curMember)
3409 {
3410 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3411 if(*curMember)
3412 {
3413 found = 0x1;
3414 dataMember = *curMember;
3415 }
3416 }
3417 }
3418 else
3419 {
3420 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3421 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3422 int _subMemberStackPos = 0;
3423
3424 if(!thisMember)
3425 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3426 if(thisMember)
3427 {
3428 dataMember = thisMember;
3429 if(curMember && thisMember->memberAccess == 1)
3430 {
3431 *curMember = thisMember;
3432 *curClass = thisMember->_class;
3433 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
3434 *subMemberStackPos = _subMemberStackPos;
3435 }
3436 found = 0x1;
3437 }
3438 else
3439 {
3440 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3441 if(method && method->type == 1)
3442 found = 0x1;
3443 else
3444 method = (((void *)0));
3445 }
3446 }
3447 if(found)
3448 {
3449 struct Type * type = (((void *)0));
3450
3451 if(dataMember)
3452 {
3453 if(!dataMember->dataType && dataMember->dataTypeString)
3454 {
3455 struct Context * context = SetupTemplatesContext(_class);
3456
3457 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3458 FinishTemplatesContext(context);
3459 }
3460 type = dataMember->dataType;
3461 }
3462 else if(method)
3463 {
3464 if(!method->dataType)
3465 ProcessMethodType(method);
3466 type = method->dataType;
3467 }
3468 if(ident && ident->next)
3469 {
3470 for(ident = ident->next; ident && type; ident = ident->next)
3471 {
3472 if(type->kind == 8)
3473 {
3474 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3475 if(!dataMember)
3476 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3477 if(dataMember)
3478 type = dataMember->dataType;
3479 }
3480 else if(type->kind == 9 || type->kind == 10)
3481 {
3482 struct Type * memberType;
3483
3484 for(memberType = type->members.first; memberType; memberType = memberType->next)
3485 {
3486 if(!strcmp(memberType->name, ident->string))
3487 {
3488 type = memberType;
3489 break;
3490 }
3491 }
3492 }
3493 }
3494 }
3495 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3496 {
3497 int id = 0;
3498 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3499 struct __ecereNameSpace__ecere__com__Class * sClass;
3500
3501 for(sClass = _class; sClass; sClass = sClass->base)
3502 {
3503 id = 0;
3504 if(sClass->templateClass)
3505 sClass = sClass->templateClass;
3506 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3507 {
3508 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3509 {
3510 for(sClass = sClass->base; sClass; sClass = sClass->base)
3511 {
3512 if(sClass->templateClass)
3513 sClass = sClass->templateClass;
3514 id += sClass->templateParams.count;
3515 }
3516 break;
3517 }
3518 id++;
3519 }
3520 if(curParam)
3521 break;
3522 }
3523 if(curParam)
3524 {
3525 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3526
3527 if(arg.dataTypeString)
3528 {
3529 type = ProcessTypeString(arg.dataTypeString, 0x0);
3530 freeType = 0x1;
3531 if(type && _class->templateClass)
3532 type->passAsTemplate = 0x1;
3533 if(type)
3534 {
3535 }
3536 }
3537 }
3538 }
3539 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3540 {
3541 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3542 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3543 int c;
3544 int paramCount = 0;
3545 int lastParam = -1;
3546 char templateString[1024];
3547 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3548
3549 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3550 for(cClass = expClass; cClass; cClass = cClass->base)
3551 {
3552 int p = 0;
3553
3554 if(cClass->templateClass)
3555 cClass = cClass->templateClass;
3556 for(param = cClass->templateParams.first; param; param = param->next)
3557 {
3558 int id = p;
3559 struct __ecereNameSpace__ecere__com__Class * sClass;
3560 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3561
3562 for(sClass = cClass->base; sClass; sClass = sClass->base)
3563 {
3564 if(sClass->templateClass)
3565 sClass = sClass->templateClass;
3566 id += sClass->templateParams.count;
3567 }
3568 arg = expClass->templateArgs[id];
3569 for(sClass = _class; sClass; sClass = sClass->base)
3570 {
3571 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3572 int p = 0;
3573 struct __ecereNameSpace__ecere__com__Class * nextClass;
3574
3575 if(sClass->templateClass)
3576 sClass = sClass->templateClass;
3577 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3578 {
3579 if(nextClass->templateClass)
3580 nextClass = nextClass->templateClass;
3581 p += nextClass->templateParams.count;
3582 }
3583 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3584 {
3585 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3586 {
3587 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3588 {
3589 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3590 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3591 break;
3592 }
3593 }
3594 }
3595 }
3596 {
3597 char argument[256];
3598
3599 argument[0] = '\0';
3600 switch(param->type)
3601 {
3602 case 2:
3603 {
3604 char expString[1024];
3605 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3606 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3607 struct Expression * exp;
3608 char * string = PrintHexUInt64(arg.expression.ui64);
3609
3610 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3611 ProcessExpressionType(exp);
3612 ComputeExpression(exp);
3613 expString[0] = '\0';
3614 PrintExpression(exp, expString);
3615 strcat(argument, expString);
3616 FreeExpression(exp);
3617 break;
3618 }
3619 case 1:
3620 {
3621 strcat(argument, arg.member->name);
3622 break;
3623 }
3624 case 0:
3625 {
3626 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3627 strcat(argument, arg.dataTypeString);
3628 break;
3629 }
3630 }
3631 if(argument[0])
3632 {
3633 if(paramCount)
3634 strcat(templateString, ", ");
3635 if(lastParam != p - 1)
3636 {
3637 strcat(templateString, param->name);
3638 strcat(templateString, " = ");
3639 }
3640 strcat(templateString, argument);
3641 paramCount++;
3642 lastParam = p;
3643 }
3644 p++;
3645 }
3646 }
3647 }
3648 {
3649 int len = strlen(templateString);
3650
3651 if(templateString[len - 1] == '<')
3652 len--;
3653 else
3654 {
3655 if(templateString[len - 1] == '>')
3656 templateString[len++] = ' ';
3657 templateString[len++] = '>';
3658 }
3659 templateString[len++] = '\0';
3660 }
3661 {
3662 struct Context * context = SetupTemplatesContext(_class);
3663
3664 if(freeType)
3665 FreeType(type);
3666 type = ProcessTypeString(templateString, 0x0);
3667 freeType = 0x1;
3668 FinishTemplatesContext(context);
3669 }
3670 }
3671 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3672 {
3673 ProcessExpressionType(member->initializer->exp);
3674 if(!member->initializer->exp->expType)
3675 {
3676 if(inCompiler)
3677 {
3678 char expString[10240];
3679
3680 expString[0] = '\0';
3681 PrintExpression(member->initializer->exp, expString);
3682 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3683 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3684 }
3685 }
3686 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3687 {
3688 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible instance method %s\n", (((void *)0))), ident->string);
3689 }
3690 }
3691 else if(member->initializer)
3692 {
3693 ProcessInitializer(member->initializer, type);
3694 }
3695 if(freeType)
3696 FreeType(type);
3697 }
3698 else
3699 {
3700 if(_class && _class->type == 3)
3701 {
3702 if(member->initializer)
3703 {
3704 struct Type * type = MkClassType(_class->fullName);
3705
3706 ProcessInitializer(member->initializer, type);
3707 FreeType(type);
3708 }
3709 }
3710 else
3711 {
3712 if(member->initializer)
3713 {
3714 ProcessInitializer(member->initializer, (((void *)0)));
3715 }
3716 if(ident)
3717 {
3718 if(method)
3719 {
3720 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3721 }
3722 else if(_class)
3723 {
3724 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3725 if(inCompiler)
3726 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3727 }
3728 }
3729 else if(_class)
3730 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3731 }
3732 }
3733 }
3734
3735 extern struct Identifier * GetDeclId(struct Declarator * decl);
3736
3737 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);
3738
3739 extern void FreeSpecifier(struct Specifier * spec);
3740
3741 static void ProcessFunction(struct FunctionDefinition * function);
3742
3743 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (* )(void * ));
3744
3745 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3746
3747 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3748
3749 extern void FreeClassFunction(struct ClassFunction * func);
3750
3751 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3752
3753 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3754
3755 void ProcessInstantiationType(struct Instantiation * inst)
3756 {
3757 yylloc = inst->loc;
3758 if(inst->_class)
3759 {
3760 struct MembersInit * members;
3761 struct Symbol * classSym;
3762 struct __ecereNameSpace__ecere__com__Class * _class;
3763
3764 classSym = inst->_class->symbol;
3765 _class = classSym ? classSym->registered : (((void *)0));
3766 if(!_class || _class->type != 5)
3767 DeclareStruct(inst->_class->name, 0x0);
3768 afterExternal = afterExternal ? afterExternal : curExternal;
3769 if(inst->exp)
3770 ProcessExpressionType(inst->exp);
3771 inst->isConstant = 0x1;
3772 if(inst->members)
3773 {
3774 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3775 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3776 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3777 int subMemberStackPos = 0;
3778
3779 for(members = (*inst->members).first; members; members = members->next)
3780 {
3781 switch(members->type)
3782 {
3783 case 1:
3784 {
3785 char name[1024];
3786 static unsigned int instMethodID = 0;
3787 struct External * external = curExternal;
3788 struct Context * context = curContext;
3789 struct Declarator * declarator = members->function->declarator;
3790 struct Identifier * nameID = GetDeclId(declarator);
3791 char * unmangled = nameID ? nameID->string : (((void *)0));
3792 struct Expression * exp;
3793 struct External * createdExternal = (((void *)0));
3794
3795 if(inCompiler)
3796 {
3797 char number[16];
3798
3799 strcpy(name, "__ecereInstMeth_");
3800 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3801 strcat(name, "_");
3802 strcat(name, nameID->string);
3803 strcat(name, "_");
3804 sprintf(number, "_%08d", instMethodID++);
3805 strcat(name, number);
3806 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3807 }
3808 if(declarator)
3809 {
3810 struct Symbol * symbol = declarator->symbol;
3811 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3812
3813 if(method && method->type == 1)
3814 {
3815 symbol->method = method;
3816 ProcessMethodType(method);
3817 if(!symbol->type->thisClass)
3818 {
3819 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3820 {
3821 if(!currentClass->symbol)
3822 currentClass->symbol = FindClass(currentClass->fullName);
3823 symbol->type->thisClass = currentClass->symbol;
3824 }
3825 else
3826 {
3827 if(!_class->symbol)
3828 _class->symbol = FindClass(_class->fullName);
3829 symbol->type->thisClass = _class->symbol;
3830 }
3831 }
3832 DeclareType(symbol->type, 0x1, 0x1);
3833 }
3834 else if(classSym)
3835 {
3836 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
3837 }
3838 }
3839 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
3840 if(nameID)
3841 {
3842 FreeSpecifier(nameID->_class);
3843 nameID->_class = (((void *)0));
3844 }
3845 if(inCompiler)
3846 {
3847 struct Type * type = declarator->symbol->type;
3848 struct External * oldExternal = curExternal;
3849
3850 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
3851 {
3852 struct External * externalDecl;
3853
3854 externalDecl = MkExternalDeclaration((((void *)0)));
3855 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
3856 if(createdExternal->function)
3857 {
3858 ProcessFunction(createdExternal->function);
3859 {
3860 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
3861
3862 externalDecl->declaration = decl;
3863 if(decl->symbol && !decl->symbol->pointerExternal)
3864 decl->symbol->pointerExternal = externalDecl;
3865 declarator->symbol->pointerExternal = externalDecl;
3866 }
3867 }
3868 }
3869 }
3870 else if(declarator)
3871 {
3872 curExternal = declarator->symbol->pointerExternal;
3873 ProcessFunction((struct FunctionDefinition *)members->function);
3874 }
3875 curExternal = external;
3876 curContext = context;
3877 if(inCompiler)
3878 {
3879 FreeClassFunction(members->function);
3880 exp = QMkExpId(name);
3881 members->type = 0;
3882 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
3883 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
3884 }
3885 break;
3886 }
3887 case 0:
3888 {
3889 if(members->dataMembers && classSym)
3890 {
3891 struct MemberInit * member;
3892 struct Location oldyyloc = yylloc;
3893
3894 for(member = (*members->dataMembers).first; member; member = member->next)
3895 {
3896 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
3897 if(member->initializer && !member->initializer->isConstant)
3898 inst->isConstant = 0x0;
3899 }
3900 yylloc = oldyyloc;
3901 }
3902 break;
3903 }
3904 }
3905 }
3906 }
3907 }
3908 }
3909
3910 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
3911 {
3912 if(inCompiler)
3913 {
3914 if(type->kind == 11)
3915 {
3916 struct Type * param;
3917
3918 if(declareParams)
3919 {
3920 for(param = type->params.first; param; param = param->next)
3921 DeclareType(param, declarePointers, 0x1);
3922 }
3923 DeclareType(type->returnType, declarePointers, 0x1);
3924 }
3925 else if(type->kind == 13 && declarePointers)
3926 DeclareType(type->type, declarePointers, 0x0);
3927 else if(type->kind == 8)
3928 {
3929 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
3930 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
3931 }
3932 else if(type->kind == 9 || type->kind == 10)
3933 {
3934 struct Type * member;
3935
3936 for(member = type->members.first; member; member = member->next)
3937 DeclareType(member, 0x0, 0x0);
3938 }
3939 else if(type->kind == 12)
3940 DeclareType(type->arrayType, declarePointers, 0x0);
3941 }
3942 }
3943
3944 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
3945
3946 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
3947 {
3948 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
3949 int id = 0;
3950 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3951 struct __ecereNameSpace__ecere__com__Class * sClass;
3952
3953 for(sClass = _class; sClass; sClass = sClass->base)
3954 {
3955 id = 0;
3956 if(sClass->templateClass)
3957 sClass = sClass->templateClass;
3958 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3959 {
3960 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
3961 {
3962 for(sClass = sClass->base; sClass; sClass = sClass->base)
3963 {
3964 if(sClass->templateClass)
3965 sClass = sClass->templateClass;
3966 id += sClass->templateParams.count;
3967 }
3968 break;
3969 }
3970 id++;
3971 }
3972 if(curParam)
3973 break;
3974 }
3975 if(curParam)
3976 {
3977 arg = &_class->templateArgs[id];
3978 if(arg && param->type == 0)
3979 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
3980 }
3981 return arg;
3982 }
3983
3984 extern struct Context * PushContext(void);
3985
3986 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
3987
3988 struct TemplatedType
3989 {
3990 uintptr_t key;
3991 struct __ecereNameSpace__ecere__sys__BTNode * parent;
3992 struct __ecereNameSpace__ecere__sys__BTNode * left;
3993 struct __ecereNameSpace__ecere__sys__BTNode * right;
3994 int depth;
3995 struct TemplateParameter * param;
3996 } __attribute__ ((gcc_struct));
3997
3998 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
3999
4000 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
4001 {
4002 struct Context * context = PushContext();
4003
4004 context->templateTypesOnly = 0x1;
4005 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
4006 {
4007 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
4008
4009 for(; param; param = param->next)
4010 {
4011 if(param->type == 0 && param->identifier)
4012 {
4013 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (uintptr_t)param->identifier->string, type->param = param, type);
4014
4015 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4016 }
4017 }
4018 }
4019 else if(_class)
4020 {
4021 struct __ecereNameSpace__ecere__com__Class * sClass;
4022
4023 for(sClass = _class; sClass; sClass = sClass->base)
4024 {
4025 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
4026
4027 for(p = sClass->templateParams.first; p; p = p->next)
4028 {
4029 if(p->type == 0)
4030 {
4031 struct TemplateParameter * param = p->param;
4032 struct TemplatedType * type;
4033
4034 if(!param)
4035 {
4036 p->param = param = __extension__ ({
4037 struct TemplateParameter * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter);
4038
4039 __ecereInstance1->identifier = MkIdentifier(p->name), __ecereInstance1->type = p->type, __ecereInstance1->dataTypeString = p->dataTypeString, __ecereInstance1;
4040 });
4041 }
4042 type = __extension__ ({
4043 struct TemplatedType * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType);
4044
4045 __ecereInstance1->key = (uintptr_t)p->name, __ecereInstance1->param = param, __ecereInstance1;
4046 });
4047 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4048 }
4049 }
4050 }
4051 }
4052 return context;
4053 }
4054
4055 extern void PopContext(struct Context * ctx);
4056
4057 extern void FreeContext(struct Context * context);
4058
4059 void FinishTemplatesContext(struct Context * context)
4060 {
4061 PopContext(context);
4062 FreeContext(context);
4063 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
4064 }
4065
4066 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
4067 {
4068 if(!method->dataType)
4069 {
4070 struct Context * context = SetupTemplatesContext(method->_class);
4071
4072 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4073 FinishTemplatesContext(context);
4074 if(method->type != 1 && method->dataType)
4075 {
4076 if(!method->dataType->thisClass && !method->dataType->staticMethod)
4077 {
4078 if(!method->_class->symbol)
4079 method->_class->symbol = FindClass(method->_class->fullName);
4080 method->dataType->thisClass = method->_class->symbol;
4081 }
4082 }
4083 }
4084 }
4085
4086 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
4087 {
4088 if(!prop->dataType)
4089 {
4090 struct Context * context = SetupTemplatesContext(prop->_class);
4091
4092 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
4093 FinishTemplatesContext(context);
4094 }
4095 }
4096
4097 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
4098
4099 extern void FreeTypeName(struct TypeName * typeName);
4100
4101 static void ProcessDeclarator(struct Declarator * decl);
4102
4103 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
4104
4105 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
4106
4107 struct MethodImport
4108 {
4109 struct MethodImport * prev;
4110 struct MethodImport * next;
4111 char *  name;
4112 unsigned int isVirtual;
4113 } __attribute__ ((gcc_struct));
4114
4115 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
4116
4117 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
4118 {
4119 struct Symbol * symbol = method->symbol;
4120
4121 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
4122 {
4123 unsigned int imported = 0x0;
4124 unsigned int dllImport = 0x0;
4125
4126 if(!method->dataType)
4127 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4128 if(!symbol || symbol->_import || method->type == 1)
4129 {
4130 if(!symbol || method->type == 1)
4131 {
4132 struct Symbol * classSym;
4133
4134 if(!method->_class->symbol)
4135 method->_class->symbol = FindClass(method->_class->fullName);
4136 classSym = method->_class->symbol;
4137 if(!classSym->_import)
4138 {
4139 struct ModuleImport * module;
4140
4141 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->name)
4142 module = FindModule(method->_class->module);
4143 else
4144 module = mainModule;
4145 classSym->_import = __extension__ ({
4146 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
4147
4148 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), __ecereInstance1->isRemote = method->_class->isRemote, __ecereInstance1;
4149 });
4150 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
4151 }
4152 if(!symbol)
4153 {
4154 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4155 }
4156 if(!symbol->_import)
4157 {
4158 symbol->_import = (struct ClassImport *)__extension__ ({
4159 struct MethodImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport);
4160
4161 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->name), __ecereInstance1->isVirtual = method->type == 1, __ecereInstance1;
4162 });
4163 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
4164 }
4165 if(!symbol)
4166 {
4167 symbol->type = method->dataType;
4168 if(symbol->type)
4169 symbol->type->refCount++;
4170 }
4171 }
4172 if(!method->dataType->dllExport)
4173 {
4174 imported = 0x1;
4175 if(method->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->importType != 1)
4176 dllImport = 0x1;
4177 }
4178 }
4179 if(method->type != 1 && method->dataType)
4180 DeclareType(method->dataType, 0x1, 0x1);
4181 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4182 {
4183 struct Declaration * decl;
4184 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4185 struct Declarator * d;
4186 struct Declarator * funcDecl;
4187 struct External * external;
4188
4189 specifiers = MkList();
4190 declarators = MkList();
4191 if(dllImport)
4192 ListAdd(specifiers, MkSpecifier(EXTERN));
4193 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
4194 ListAdd(specifiers, MkSpecifier(STATIC));
4195 if(method->type == 1)
4196 {
4197 ListAdd(specifiers, MkSpecifier(INT));
4198 d = MkDeclaratorIdentifier(MkIdentifier(name));
4199 }
4200 else
4201 {
4202 d = MkDeclaratorIdentifier(MkIdentifier(name));
4203 if(dllImport)
4204 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4205 {
4206 struct Context * context = SetupTemplatesContext(method->_class);
4207
4208 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
4209 FinishTemplatesContext(context);
4210 }
4211 funcDecl = GetFuncDecl(d);
4212 if(dllImport)
4213 {
4214 struct Specifier * spec, * next;
4215
4216 for(spec = (*specifiers).first; spec; spec = next)
4217 {
4218 next = spec->next;
4219 if(spec->type == 5)
4220 {
4221 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4222 FreeSpecifier(spec);
4223 }
4224 }
4225 }
4226 if(method->dataType && !method->dataType->staticMethod)
4227 {
4228 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4229 {
4230 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4231 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")));
4232 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4233 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4234
4235 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4236 {
4237 struct TypeName * param = (*funcDecl->function.parameters).first;
4238
4239 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4240 FreeTypeName(param);
4241 }
4242 if(!funcDecl->function.parameters)
4243 funcDecl->function.parameters = MkList();
4244 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4245 }
4246 }
4247 }
4248 ProcessDeclarator(d);
4249 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4250 decl = MkDeclaration(specifiers, declarators);
4251 ReplaceThisClassSpecifiers(specifiers, method->_class);
4252 if(symbol->pointerExternal)
4253 {
4254 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4255
4256 {
4257 *functionSymbol = *symbol;
4258 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4259 if(functionSymbol->type)
4260 functionSymbol->type->refCount++;
4261 }
4262 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4263 symbol->pointerExternal->symbol = functionSymbol;
4264 }
4265 external = MkExternalDeclaration(decl);
4266 if(curExternal)
4267 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4268 external->symbol = symbol;
4269 symbol->pointerExternal = external;
4270 }
4271 else if(ast)
4272 {
4273 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4274 }
4275 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4276 }
4277 }
4278
4279 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4280 {
4281 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4282 {
4283 unsigned int first = 0x1;
4284 int p = 0;
4285 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4286 int lastParam = -1;
4287 char className[1024];
4288
4289 strcpy(className, _class->fullName);
4290 for(param = _class->templateParams.first; param; param = param->next)
4291 {
4292 {
4293 if(first)
4294 strcat(className, "<");
4295 if(!first)
4296 strcat(className, ", ");
4297 if(lastParam + 1 != p)
4298 {
4299 strcat(className, param->name);
4300 strcat(className, " = ");
4301 }
4302 strcat(className, param->name);
4303 first = 0x0;
4304 lastParam = p;
4305 }
4306 p++;
4307 }
4308 if(!first)
4309 {
4310 int len = strlen(className);
4311
4312 if(className[len - 1] == '>')
4313 className[len++] = ' ';
4314 className[len++] = '>';
4315 className[len++] = '\0';
4316 }
4317 return __ecereNameSpace__ecere__sys__CopyString(className);
4318 }
4319 else
4320 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4321 }
4322
4323 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4324 {
4325 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4326 {
4327 unsigned int first = 0x1;
4328 int p = 0;
4329 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4330 int lastParam = -1;
4331 char className[1024];
4332
4333 strcpy(className, _class->fullName);
4334 for(param = _class->templateParams.first; param; param = param->next)
4335 {
4336 {
4337 if(first)
4338 strcat(className, "<");
4339 if(!first)
4340 strcat(className, ", ");
4341 if(lastParam + 1 != p)
4342 {
4343 strcat(className, param->name);
4344 strcat(className, " = ");
4345 }
4346 strcat(className, param->name);
4347 first = 0x0;
4348 lastParam = p;
4349 }
4350 p++;
4351 }
4352 if(!first)
4353 {
4354 int len = strlen(className);
4355
4356 if(className[len - 1] == '>')
4357 className[len++] = ' ';
4358 className[len++] = '>';
4359 className[len++] = '\0';
4360 }
4361 return MkClassType(className);
4362 }
4363 else
4364 {
4365 return MkClassType(_class->fullName);
4366 }
4367 }
4368
4369 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4370 {
4371 if(specs != (((void *)0)) && _class)
4372 {
4373 struct Specifier * spec;
4374
4375 for(spec = specs->first; spec; spec = spec->next)
4376 {
4377 if(spec->type == 0 && spec->specifier == THISCLASS)
4378 {
4379 spec->type = 1;
4380 spec->name = ReplaceThisClass(_class);
4381 spec->symbol = FindClass(spec->name);
4382 }
4383 }
4384 }
4385 }
4386
4387 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4388
4389 struct __ecereNameSpace__ecere__com__GlobalFunction
4390 {
4391 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4392 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4393 char *  name;
4394 int (*  function)();
4395 struct __ecereNameSpace__ecere__com__Instance * module;
4396 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4397 char *  dataTypeString;
4398 struct Type * dataType;
4399 void *  symbol;
4400 } __attribute__ ((gcc_struct));
4401
4402 extern struct Context * globalContext;
4403
4404 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4405
4406 struct FunctionImport
4407 {
4408 struct FunctionImport * prev;
4409 struct FunctionImport * next;
4410 char *  name;
4411 } __attribute__ ((gcc_struct));
4412
4413 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4414 {
4415 struct Symbol * symbol = function->symbol;
4416
4417 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4418 {
4419 unsigned int imported = 0x0;
4420 unsigned int dllImport = 0x0;
4421
4422 if(!function->dataType)
4423 {
4424 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4425 if(!function->dataType->thisClass)
4426 function->dataType->staticMethod = 0x1;
4427 }
4428 if(inCompiler)
4429 {
4430 if(!symbol)
4431 {
4432 struct ModuleImport * module = FindModule(function->module);
4433
4434 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4435 if(module->name)
4436 {
4437 if(!function->dataType->dllExport)
4438 {
4439 symbol->_import = (struct ClassImport *)__extension__ ({
4440 struct FunctionImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport);
4441
4442 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(function->name), __ecereInstance1;
4443 });
4444 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4445 }
4446 }
4447 {
4448 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4449 if(!symbol->type->thisClass)
4450 symbol->type->staticMethod = 0x1;
4451 }
4452 }
4453 imported = symbol->_import ? 0x1 : 0x0;
4454 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1)
4455 dllImport = 0x1;
4456 }
4457 DeclareType(function->dataType, 0x1, 0x1);
4458 if(inCompiler)
4459 {
4460 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4461 {
4462 struct Declaration * decl;
4463 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4464 struct Declarator * d;
4465 struct Declarator * funcDecl;
4466 struct External * external;
4467
4468 specifiers = MkList();
4469 declarators = MkList();
4470 ListAdd(specifiers, MkSpecifier(EXTERN));
4471 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4472 if(dllImport)
4473 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4474 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4475 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType == 1)
4476 {
4477 struct Specifier * spec;
4478
4479 for(spec = (*specifiers).first; spec; spec = spec->next)
4480 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4481 {
4482 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4483 FreeSpecifier(spec);
4484 break;
4485 }
4486 }
4487 funcDecl = GetFuncDecl(d);
4488 if(funcDecl && !funcDecl->function.parameters)
4489 {
4490 funcDecl->function.parameters = MkList();
4491 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4492 }
4493 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4494 {
4495 struct Context * oldCtx = curContext;
4496
4497 curContext = globalContext;
4498 decl = MkDeclaration(specifiers, declarators);
4499 curContext = oldCtx;
4500 }
4501 if(symbol->pointerExternal)
4502 {
4503 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4504
4505 {
4506 *functionSymbol = *symbol;
4507 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4508 if(functionSymbol->type)
4509 functionSymbol->type->refCount++;
4510 }
4511 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4512 symbol->pointerExternal->symbol = functionSymbol;
4513 }
4514 external = MkExternalDeclaration(decl);
4515 if(curExternal)
4516 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4517 external->symbol = symbol;
4518 symbol->pointerExternal = external;
4519 }
4520 else
4521 {
4522 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4523 }
4524 if(curExternal)
4525 symbol->id = curExternal->symbol->idCode;
4526 }
4527 }
4528 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1) ? 0x1 : 0x0;
4529 }
4530
4531 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4532
4533 struct GlobalData
4534 {
4535 uintptr_t key;
4536 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4537 struct __ecereNameSpace__ecere__sys__BTNode * left;
4538 struct __ecereNameSpace__ecere__sys__BTNode * right;
4539 int depth;
4540 struct __ecereNameSpace__ecere__com__Instance * module;
4541 char *  dataTypeString;
4542 struct Type * dataType;
4543 void *  symbol;
4544 char *  fullName;
4545 } __attribute__ ((gcc_struct));
4546
4547 void DeclareGlobalData(struct GlobalData * data)
4548 {
4549 struct Symbol * symbol = data->symbol;
4550
4551 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4552 {
4553 if(inCompiler)
4554 {
4555 if(!symbol)
4556 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4557 }
4558 if(!data->dataType)
4559 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4560 DeclareType(data->dataType, 0x1, 0x1);
4561 if(inCompiler)
4562 {
4563 if(!symbol->pointerExternal)
4564 {
4565 struct Declaration * decl;
4566 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4567 struct Declarator * d;
4568 struct External * external;
4569
4570 specifiers = MkList();
4571 declarators = MkList();
4572 ListAdd(specifiers, MkSpecifier(EXTERN));
4573 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4574 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4575 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4576 decl = MkDeclaration(specifiers, declarators);
4577 external = MkExternalDeclaration(decl);
4578 if(curExternal)
4579 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4580 external->symbol = symbol;
4581 symbol->pointerExternal = external;
4582 }
4583 else
4584 {
4585 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4586 }
4587 if(curExternal)
4588 symbol->id = curExternal->symbol->idCode;
4589 }
4590 }
4591 }
4592
4593 struct Conversion
4594 {
4595 struct Conversion * prev, * next;
4596 struct __ecereNameSpace__ecere__com__Property * convert;
4597 unsigned int isGet;
4598 struct Type * resultType;
4599 } __attribute__ ((gcc_struct));
4600
4601 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4602
4603 extern void Compiler_Warning(char *  format, ...);
4604
4605 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4606
4607 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)
4608 {
4609 if(source && dest)
4610 {
4611 if(source->kind == 20 && dest->kind != 20)
4612 {
4613 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4614
4615 if(type)
4616 source = type;
4617 }
4618 if(dest->kind == 20 && source->kind != 20)
4619 {
4620 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4621
4622 if(type)
4623 dest = type;
4624 }
4625 if((dest->classObjectType == 2 && source->classObjectType != 3) || (dest->classObjectType == 3 && source->classObjectType != 2))
4626 {
4627 return 0x1;
4628 }
4629 if(source->classObjectType == 3 && dest->classObjectType != 2)
4630 {
4631 return 0x1;
4632 }
4633 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4634 {
4635 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4636 return 0x1;
4637 }
4638 if(dest->kind == 14 && source->kind != 0)
4639 return 0x1;
4640 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))
4641 return 0x1;
4642 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))
4643 return 0x1;
4644 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4645 {
4646 if(source->_class->registered && source->_class->registered->type == 3)
4647 {
4648 if(conversions != (((void *)0)))
4649 {
4650 if(source->_class->registered == dest->_class->registered)
4651 return 0x1;
4652 }
4653 else
4654 {
4655 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4656
4657 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4658 ;
4659 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4660 ;
4661 if(sourceBase == destBase)
4662 return 0x1;
4663 }
4664 }
4665 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))
4666 return 0x1;
4667 else
4668 {
4669 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4 && source->_class && source->_class->registered && source->_class->registered->type != 4)
4670 {
4671 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4672 {
4673 return 0x1;
4674 }
4675 }
4676 }
4677 }
4678 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4679 return 0x1;
4680 if(doConversion)
4681 {
4682 if(source->kind == 8)
4683 {
4684 struct __ecereNameSpace__ecere__com__Class * _class;
4685
4686 for(_class = source->_class ? source->_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 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4695
4696 if(!convert->dataType)
4697 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4698 if(MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x0, 0x1, 0x0, 0x1))
4699 {
4700 if(!conversions && !convert->Get)
4701 return 0x1;
4702 else if(conversions != (((void *)0)))
4703 {
4704 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))
4705 return 0x1;
4706 else
4707 {
4708 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4709
4710 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4711 return 0x1;
4712 }
4713 }
4714 }
4715 }
4716 }
4717 }
4718 }
4719 if(dest->kind == 8)
4720 {
4721 struct __ecereNameSpace__ecere__com__Class * _class;
4722
4723 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4724 {
4725 struct __ecereNameSpace__ecere__com__Property * convert;
4726
4727 for(convert = _class->conversions.first; convert; convert = convert->next)
4728 {
4729 if(convert->memberAccess == 1 || _class->module == privateModule)
4730 {
4731 if(!convert->dataType)
4732 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4733 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4734 {
4735 if(!conversions && !convert->Set)
4736 return 0x1;
4737 else if(conversions != (((void *)0)))
4738 {
4739 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))
4740 return 0x1;
4741 else
4742 {
4743 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4744
4745 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4746 return 0x1;
4747 }
4748 }
4749 }
4750 }
4751 }
4752 }
4753 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4754 {
4755 if(!dest->_class->registered->dataType)
4756 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4757 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4758 {
4759 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4760 {
4761 return 0x1;
4762 }
4763 }
4764 }
4765 }
4766 if(source->kind == 8)
4767 {
4768 struct __ecereNameSpace__ecere__com__Class * _class;
4769
4770 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4771 {
4772 struct __ecereNameSpace__ecere__com__Property * convert;
4773
4774 for(convert = _class->conversions.first; convert; convert = convert->next)
4775 {
4776 if(convert->memberAccess == 1 || _class->module == privateModule)
4777 {
4778 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4779
4780 if(!convert->dataType)
4781 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4782 if(convert->dataType != source && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x1))
4783 {
4784 if(!conversions && !convert->Get)
4785 return 0x1;
4786 else if(conversions != (((void *)0)))
4787 {
4788 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))
4789 return 0x1;
4790 else
4791 {
4792 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4793
4794 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4795 return 0x1;
4796 }
4797 }
4798 }
4799 }
4800 }
4801 }
4802 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4803 {
4804 if(!source->_class->registered->dataType)
4805 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4806 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4807 {
4808 return 0x1;
4809 }
4810 }
4811 }
4812 }
4813 if(source->kind == 8 || source->kind == 19)
4814 ;
4815 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
4816 return 0x1;
4817 else if(dest->kind == 7 && source->kind == 6)
4818 return 0x1;
4819 else if(dest->kind == 2 && source->kind == 1)
4820 return 0x1;
4821 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1 || source->kind == 23))
4822 return 0x1;
4823 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 22 || source->kind == 23))
4824 return 0x1;
4825 else if(dest->kind == 22 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 23 || source->kind == 4))
4826 return 0x1;
4827 else if(dest->kind == 23 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4 || source->kind == 22))
4828 return 0x1;
4829 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))
4830 return 0x1;
4831 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))
4832 return 0x1;
4833 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)))
4834 {
4835 struct Type * paramSource, * paramDest;
4836
4837 if(dest->kind == 16)
4838 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
4839 if(source->kind == 16)
4840 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
4841 if(dest->kind == 13 && dest->type->kind == 11)
4842 dest = dest->type;
4843 if(source->kind == 13 && source->type->kind == 11)
4844 source = source->type;
4845 if(dest->kind == 16)
4846 dest = dest->method->dataType;
4847 if(source->kind == 16)
4848 source = source->method->dataType;
4849 paramSource = source->params.first;
4850 if(paramSource && paramSource->kind == 0)
4851 paramSource = (((void *)0));
4852 paramDest = dest->params.first;
4853 if(paramDest && paramDest->kind == 0)
4854 paramDest = (((void *)0));
4855 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
4856 {
4857 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))))
4858 {
4859 if(paramDest && paramDest->kind == 8)
4860 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
4861 else
4862 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class should not take an object\n", (((void *)0))));
4863 return 0x0;
4864 }
4865 paramDest = paramDest->next;
4866 }
4867 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
4868 {
4869 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
4870 {
4871 if(dest->thisClass)
4872 {
4873 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
4874 {
4875 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4876 return 0x0;
4877 }
4878 }
4879 else
4880 {
4881 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
4882 {
4883 if(owningClassDest)
4884 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
4885 else
4886 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "overriding class expected to be derived from method class\n", (((void *)0))));
4887 return 0x0;
4888 }
4889 }
4890 paramSource = paramSource->next;
4891 }
4892 else
4893 {
4894 if(dest->thisClass)
4895 {
4896 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
4897 {
4898 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4899 return 0x0;
4900 }
4901 }
4902 else
4903 {
4904 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
4905 {
4906 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
4907 return 0x0;
4908 }
4909 }
4910 }
4911 }
4912 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4913 {
4914 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible return type for function\n", (((void *)0))));
4915 return 0x0;
4916 }
4917 for(; paramDest; paramDest = paramDest->next)
4918 {
4919 if(!paramSource)
4920 {
4921 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough parameters\n", (((void *)0))));
4922 return 0x0;
4923 }
4924 {
4925 struct Type * paramDestType = paramDest;
4926 struct Type * paramSourceType = paramSource;
4927 struct Type * type = paramDestType;
4928
4929 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
4930 {
4931 int id = 0;
4932 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4933 struct __ecereNameSpace__ecere__com__Class * sClass;
4934
4935 for(sClass = owningClassSource; sClass; sClass = sClass->base)
4936 {
4937 id = 0;
4938 if(sClass->templateClass)
4939 sClass = sClass->templateClass;
4940 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4941 {
4942 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
4943 {
4944 for(sClass = sClass->base; sClass; sClass = sClass->base)
4945 {
4946 if(sClass->templateClass)
4947 sClass = sClass->templateClass;
4948 id += sClass->templateParams.count;
4949 }
4950 break;
4951 }
4952 id++;
4953 }
4954 if(curParam)
4955 break;
4956 }
4957 if(curParam)
4958 {
4959 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
4960
4961 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
4962 }
4963 }
4964 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)))
4965 {
4966 char type[1024];
4967
4968 type[0] = (char)0;
4969 PrintType(paramDest, type, 0x0, 0x1);
4970 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
4971 if(paramDestType != paramDest)
4972 FreeType(paramDestType);
4973 return 0x0;
4974 }
4975 if(paramDestType != paramDest)
4976 FreeType(paramDestType);
4977 }
4978 paramSource = paramSource->next;
4979 }
4980 if(paramSource)
4981 {
4982 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many parameters\n", (((void *)0))));
4983 return 0x0;
4984 }
4985 return 0x1;
4986 }
4987 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
4988 {
4989 return 0x1;
4990 }
4991 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
4992 {
4993 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4994 return 0x1;
4995 }
4996 }
4997 return 0x0;
4998 }
4999
5000 static void FreeConvert(struct Conversion * convert)
5001 {
5002 if(convert->resultType)
5003 FreeType(convert->resultType);
5004 }
5005
5006 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
5007
5008 struct __ecereNameSpace__ecere__com__BTNamedLink
5009 {
5010 char *  name;
5011 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
5012 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
5013 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
5014 int depth;
5015 void *  data;
5016 } __attribute__ ((gcc_struct));
5017
5018 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
5019
5020 struct __ecereNameSpace__ecere__com__EnumClassData
5021 {
5022 struct __ecereNameSpace__ecere__sys__OldList values;
5023 int largest;
5024 } __attribute__ ((gcc_struct));
5025
5026 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
5027
5028 struct __ecereNameSpace__ecere__sys__NamedLink
5029 {
5030 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
5031 struct __ecereNameSpace__ecere__sys__NamedLink * next;
5032 char *  name;
5033 void *  data;
5034 } __attribute__ ((gcc_struct));
5035
5036 extern void FreeExpContents(struct Expression * exp);
5037
5038 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
5039
5040 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
5041
5042 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
5043
5044 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
5045
5046 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
5047
5048 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5049 {
5050 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
5051
5052 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)))
5053 {
5054 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
5055
5056 if(_class->type == 4)
5057 {
5058 struct __ecereNameSpace__ecere__sys__OldList converts = 
5059 {
5060 0, 0, 0, 0, 0
5061 };
5062 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5063
5064 type->kind = 8;
5065 if(!_class->symbol)
5066 _class->symbol = FindClass(_class->fullName);
5067 type->_class = _class->symbol;
5068 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
5069 {
5070 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5071 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5072
5073 if(enumClass)
5074 {
5075 struct __ecereNameSpace__ecere__com__Class * baseClass;
5076
5077 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
5078 {
5079 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
5080
5081 for(value = e->values.first; value; value = value->next)
5082 {
5083 if(!strcmp(value->name, string))
5084 break;
5085 }
5086 if(value)
5087 {
5088 FreeExpContents(sourceExp);
5089 FreeType(sourceExp->expType);
5090 sourceExp->isConstant = 0x1;
5091 sourceExp->expType = MkClassType(baseClass->fullName);
5092 {
5093 char constant[256];
5094
5095 sourceExp->type = 2;
5096 if(!strcmp(baseClass->dataTypeString, "int"))
5097 sprintf(constant, "%d", value->data);
5098 else
5099 sprintf(constant, "0x%X", value->data);
5100 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5101 }
5102 while(converts.first)
5103 {
5104 struct Conversion * convert = converts.first;
5105
5106 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
5107 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
5108 }
5109 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5110 return 0x1;
5111 }
5112 }
5113 }
5114 }
5115 if(converts.first)
5116 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
5117 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5118 }
5119 }
5120 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)))
5121 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
5122 return 0x1;
5123 return 0x0;
5124 }
5125
5126 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
5127
5128 struct __ecereNameSpace__ecere__com__SubModule
5129 {
5130 struct __ecereNameSpace__ecere__com__SubModule * prev;
5131 struct __ecereNameSpace__ecere__com__SubModule * next;
5132 struct __ecereNameSpace__ecere__com__Instance * module;
5133 int importMode;
5134 } __attribute__ ((gcc_struct));
5135
5136 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
5137 {
5138 struct __ecereNameSpace__ecere__com__SubModule * subModule;
5139
5140 if(searchFor == searchIn)
5141 return 0x1;
5142 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
5143 {
5144 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->application)
5145 {
5146 if(ModuleVisibility(subModule->module, searchFor))
5147 return 0x1;
5148 }
5149 }
5150 return 0x0;
5151 }
5152
5153 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
5154
5155 struct __ecereNameSpace__ecere__com__Application
5156 {
5157 int argc;
5158 char * *  argv;
5159 int exitCode;
5160 unsigned int isGUIApp;
5161 struct __ecereNameSpace__ecere__sys__OldList allModules;
5162 char *  parsedCommand;
5163 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
5164 } __attribute__ ((gcc_struct));
5165
5166 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5167 {
5168 struct __ecereNameSpace__ecere__com__Instance * module;
5169
5170 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))
5171 return 0x1;
5172 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))
5173 return 0x1;
5174 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))
5175 return 0x1;
5176 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)
5177 {
5178 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5179 return 0x1;
5180 }
5181 return 0x0;
5182 }
5183
5184 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
5185
5186 void ReadString(char *  output, char *  string);
5187
5188 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
5189
5190 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
5191
5192 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
5193
5194 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
5195 {
5196 struct Type * source = sourceExp->expType;
5197 struct Type * realDest = dest;
5198 struct Type * backupSourceExpType = (((void *)0));
5199
5200 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5201 return 0x1;
5202 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5203 {
5204 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5205 {
5206 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5207
5208 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5209 ;
5210 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5211 ;
5212 if(sourceBase == destBase)
5213 return 0x1;
5214 }
5215 }
5216 if(source)
5217 {
5218 struct __ecereNameSpace__ecere__sys__OldList * specs;
5219 unsigned int flag = 0x0;
5220 long long value = (((int)0x7fffffff));
5221
5222 source->refCount++;
5223 dest->refCount++;
5224 if(sourceExp->type == 2)
5225 {
5226 if(source->isSigned)
5227 value = strtoll(sourceExp->constant, (((void *)0)), 0);
5228 else
5229 value = strtoull(sourceExp->constant, (((void *)0)), 0);
5230 }
5231 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
5232 {
5233 if(source->isSigned)
5234 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
5235 else
5236 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
5237 }
5238 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5239 {
5240 FreeType(source);
5241 source = __extension__ ({
5242 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5243
5244 __ecereInstance1->kind = 3, __ecereInstance1->isSigned = 0x0, __ecereInstance1->refCount = 1, __ecereInstance1;
5245 });
5246 }
5247 if(dest->kind == 8)
5248 {
5249 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5250
5251 if(_class && _class->type == 3)
5252 {
5253 if(source->kind != 8)
5254 {
5255 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5256 struct Type * tempDest, * tempSource;
5257
5258 for(; _class->base->type != 1000; _class = _class->base)
5259 ;
5260 tempSource = dest;
5261 tempDest = tempType;
5262 tempType->kind = 8;
5263 if(!_class->symbol)
5264 _class->symbol = FindClass(_class->fullName);
5265 tempType->_class = _class->symbol;
5266 tempType->truth = dest->truth;
5267 if(tempType->_class)
5268 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5269 backupSourceExpType = sourceExp->expType;
5270 sourceExp->expType = dest;
5271 dest->refCount++;
5272 flag = 0x1;
5273 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5274 }
5275 }
5276 if(_class && _class->type == 2 && source->kind != 8)
5277 {
5278 if(!dest->_class->registered->dataType)
5279 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5280 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5281 {
5282 FreeType(source);
5283 FreeType(sourceExp->expType);
5284 source = sourceExp->expType = MkClassType(dest->_class->string);
5285 source->refCount++;
5286 }
5287 }
5288 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5289 {
5290 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5291 struct Declarator * decl;
5292 char string[1024];
5293
5294 ReadString(string, sourceExp->string);
5295 decl = SpecDeclFromString(string, specs, (((void *)0)));
5296 FreeExpContents(sourceExp);
5297 FreeType(sourceExp->expType);
5298 sourceExp->type = 26;
5299 sourceExp->_classExp.specifiers = specs;
5300 sourceExp->_classExp.decl = decl;
5301 sourceExp->expType = dest;
5302 dest->refCount++;
5303 FreeType(source);
5304 FreeType(dest);
5305 if(backupSourceExpType)
5306 FreeType(backupSourceExpType);
5307 return 0x1;
5308 }
5309 }
5310 else if(source->kind == 8)
5311 {
5312 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5313
5314 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5315 {
5316 if(dest->kind != 8)
5317 {
5318 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5319 struct Type * tempDest, * tempSource;
5320
5321 if(!source->_class->registered->dataType)
5322 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5323 for(; _class->base->type != 1000; _class = _class->base)
5324 ;
5325 tempDest = source;
5326 tempSource = tempType;
5327 tempType->kind = 8;
5328 tempType->_class = FindClass(_class->fullName);
5329 tempType->truth = source->truth;
5330 tempType->classObjectType = source->classObjectType;
5331 if(tempType->_class)
5332 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5333 if(conversions->last)
5334 {
5335 ((struct Conversion *)conversions->last)->resultType = dest;
5336 dest->refCount++;
5337 }
5338 FreeType(sourceExp->expType);
5339 sourceExp->expType = MkClassType(_class->fullName);
5340 sourceExp->expType->truth = source->truth;
5341 sourceExp->expType->classObjectType = source->classObjectType;
5342 if(!sourceExp->destType)
5343 {
5344 FreeType(sourceExp->destType);
5345 sourceExp->destType = sourceExp->expType;
5346 if(sourceExp->expType)
5347 sourceExp->expType->refCount++;
5348 }
5349 if(!_class->dataType)
5350 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5351 FreeType(dest);
5352 dest = MkClassType(source->_class->string);
5353 dest->truth = source->truth;
5354 dest->classObjectType = source->classObjectType;
5355 FreeType(source);
5356 source = _class->dataType;
5357 source->refCount++;
5358 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5359 }
5360 }
5361 }
5362 if(!flag)
5363 {
5364 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5365 {
5366 FreeType(source);
5367 FreeType(dest);
5368 return 0x1;
5369 }
5370 }
5371 if(dest->kind == 8)
5372 {
5373 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5374
5375 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5376 {
5377 if(_class->type == 0 || _class->type == 5)
5378 {
5379 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5380
5381 *newExp = *sourceExp;
5382 if(sourceExp->destType)
5383 sourceExp->destType->refCount++;
5384 if(sourceExp->expType)
5385 sourceExp->expType->refCount++;
5386 sourceExp->type = 11;
5387 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5388 sourceExp->cast.exp = newExp;
5389 FreeType(sourceExp->expType);
5390 sourceExp->expType = (((void *)0));
5391 ProcessExpressionType(sourceExp);
5392 if(!inCompiler)
5393 {
5394 FreeType(sourceExp->expType);
5395 sourceExp->expType = dest;
5396 }
5397 FreeType(source);
5398 if(inCompiler)
5399 FreeType(dest);
5400 if(backupSourceExpType)
5401 FreeType(backupSourceExpType);
5402 return 0x1;
5403 }
5404 if(!_class->dataType)
5405 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5406 FreeType(dest);
5407 dest = _class->dataType;
5408 dest->refCount++;
5409 }
5410 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5411 {
5412 specs = MkListOne(MkSpecifier(DOUBLE));
5413 }
5414 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 7))
5415 {
5416 specs = MkListOne(MkSpecifier(FLOAT));
5417 }
5418 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5419 {
5420 specs = MkList();
5421 if(!dest->isSigned)
5422 ListAdd(specs, MkSpecifier(UNSIGNED));
5423 ListAdd(specs, MkSpecifier(INT64));
5424 }
5425 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5426 {
5427 specs = MkList();
5428 if(!dest->isSigned)
5429 ListAdd(specs, MkSpecifier(UNSIGNED));
5430 ListAdd(specs, MkSpecifier(INT));
5431 }
5432 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5433 {
5434 specs = MkList();
5435 if(!dest->isSigned)
5436 ListAdd(specs, MkSpecifier(UNSIGNED));
5437 ListAdd(specs, MkSpecifier(SHORT));
5438 }
5439 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5440 {
5441 specs = MkList();
5442 if(!dest->isSigned)
5443 ListAdd(specs, MkSpecifier(UNSIGNED));
5444 ListAdd(specs, MkSpecifier(CHAR));
5445 }
5446 else
5447 {
5448 FreeType(source);
5449 FreeType(dest);
5450 if(backupSourceExpType)
5451 {
5452 if(sourceExp->expType)
5453 FreeType(sourceExp->expType);
5454 sourceExp->expType = backupSourceExpType;
5455 }
5456 return 0x0;
5457 }
5458 }
5459 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))
5460 {
5461 specs = MkListOne(MkSpecifier(DOUBLE));
5462 }
5463 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5464 {
5465 specs = MkListOne(MkSpecifier(FLOAT));
5466 }
5467 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)))
5468 {
5469 specs = MkList();
5470 if(!dest->isSigned)
5471 ListAdd(specs, MkSpecifier(UNSIGNED));
5472 ListAdd(specs, MkSpecifier(CHAR));
5473 }
5474 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)))))
5475 {
5476 specs = MkList();
5477 if(!dest->isSigned)
5478 ListAdd(specs, MkSpecifier(UNSIGNED));
5479 ListAdd(specs, MkSpecifier(SHORT));
5480 }
5481 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3))
5482 {
5483 specs = MkList();
5484 if(!dest->isSigned)
5485 ListAdd(specs, MkSpecifier(UNSIGNED));
5486 ListAdd(specs, MkSpecifier(INT));
5487 }
5488 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5489 {
5490 specs = MkList();
5491 if(!dest->isSigned)
5492 ListAdd(specs, MkSpecifier(UNSIGNED));
5493 ListAdd(specs, MkSpecifier(INT64));
5494 }
5495 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5496 {
5497 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5498 }
5499 else
5500 {
5501 FreeType(source);
5502 FreeType(dest);
5503 if(backupSourceExpType)
5504 {
5505 if(sourceExp->expType)
5506 FreeType(sourceExp->expType);
5507 sourceExp->expType = backupSourceExpType;
5508 }
5509 return 0x0;
5510 }
5511 if(!flag)
5512 {
5513 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5514
5515 *newExp = *sourceExp;
5516 newExp->prev = (((void *)0));
5517 newExp->next = (((void *)0));
5518 if(sourceExp->destType)
5519 sourceExp->destType->refCount++;
5520 if(sourceExp->expType)
5521 sourceExp->expType->refCount++;
5522 sourceExp->type = 11;
5523 if(realDest->kind == 8)
5524 {
5525 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5526 FreeList(specs, FreeSpecifier);
5527 }
5528 else
5529 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5530 if(newExp->type == 4)
5531 {
5532 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5533 }
5534 else
5535 sourceExp->cast.exp = newExp;
5536 FreeType(sourceExp->expType);
5537 sourceExp->expType = (((void *)0));
5538 ProcessExpressionType(sourceExp);
5539 }
5540 else
5541 FreeList(specs, FreeSpecifier);
5542 FreeType(dest);
5543 FreeType(source);
5544 if(backupSourceExpType)
5545 FreeType(backupSourceExpType);
5546 return 0x1;
5547 }
5548 else
5549 {
5550 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5551 sourceExp = (*sourceExp->list).last;
5552 if(sourceExp->type == 0)
5553 {
5554 struct Identifier * id = sourceExp->identifier;
5555
5556 if(dest->kind == 8)
5557 {
5558 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5559 {
5560 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5561 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5562
5563 if(enumClass)
5564 {
5565 for(; _class && _class->type == 4; _class = _class->base)
5566 {
5567 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5568 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5569
5570 for(value = e->values.first; value; value = value->next)
5571 {
5572 if(!strcmp(value->name, id->string))
5573 break;
5574 }
5575 if(value)
5576 {
5577 FreeExpContents(sourceExp);
5578 FreeType(sourceExp->expType);
5579 sourceExp->isConstant = 0x1;
5580 sourceExp->expType = MkClassType(_class->fullName);
5581 {
5582 char constant[256];
5583
5584 sourceExp->type = 2;
5585 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5586 sprintf(constant, "%d", value->data);
5587 else
5588 sprintf(constant, "0x%X", value->data);
5589 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5590 }
5591 return 0x1;
5592 }
5593 }
5594 }
5595 }
5596 }
5597 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5598 return 0x1;
5599 }
5600 }
5601 return 0x0;
5602 }
5603
5604 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5605 {
5606 int value2 = op2->i;
5607
5608 exp->type = 2;
5609 exp->string = PrintInt(op1->i + value2);
5610 if(!exp->expType)
5611 {
5612 exp->expType = op1->type;
5613 if(op1->type)
5614 op1->type->refCount++;
5615 }
5616 return 0x1;
5617 }
5618
5619 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5620 {
5621 unsigned int value2 = op2->ui;
5622
5623 exp->type = 2;
5624 exp->string = PrintUInt(op1->ui + value2);
5625 if(!exp->expType)
5626 {
5627 exp->expType = op1->type;
5628 if(op1->type)
5629 op1->type->refCount++;
5630 }
5631 return 0x1;
5632 }
5633
5634 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5635 {
5636 short value2 = op2->s;
5637
5638 exp->type = 2;
5639 exp->string = PrintShort(op1->s + value2);
5640 if(!exp->expType)
5641 {
5642 exp->expType = op1->type;
5643 if(op1->type)
5644 op1->type->refCount++;
5645 }
5646 return 0x1;
5647 }
5648
5649 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5650 {
5651 unsigned short value2 = op2->us;
5652
5653 exp->type = 2;
5654 exp->string = PrintUShort(op1->us + value2);
5655 if(!exp->expType)
5656 {
5657 exp->expType = op1->type;
5658 if(op1->type)
5659 op1->type->refCount++;
5660 }
5661 return 0x1;
5662 }
5663
5664 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5665 {
5666 char value2 = op2->c;
5667
5668 exp->type = 2;
5669 exp->string = PrintChar(op1->c + value2);
5670 if(!exp->expType)
5671 {
5672 exp->expType = op1->type;
5673 if(op1->type)
5674 op1->type->refCount++;
5675 }
5676 return 0x1;
5677 }
5678
5679 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5680 {
5681 unsigned char value2 = op2->uc;
5682
5683 exp->type = 2;
5684 exp->string = PrintUChar(op1->uc + value2);
5685 if(!exp->expType)
5686 {
5687 exp->expType = op1->type;
5688 if(op1->type)
5689 op1->type->refCount++;
5690 }
5691 return 0x1;
5692 }
5693
5694 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5695 {
5696 float value2 = op2->f;
5697
5698 exp->type = 2;
5699 exp->string = PrintFloat(op1->f + value2);
5700 if(!exp->expType)
5701 {
5702 exp->expType = op1->type;
5703 if(op1->type)
5704 op1->type->refCount++;
5705 }
5706 return 0x1;
5707 }
5708
5709 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5710 {
5711 double value2 = op2->d;
5712
5713 exp->type = 2;
5714 exp->string = PrintDouble(op1->d + value2);
5715 if(!exp->expType)
5716 {
5717 exp->expType = op1->type;
5718 if(op1->type)
5719 op1->type->refCount++;
5720 }
5721 return 0x1;
5722 }
5723
5724 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5725 {
5726 int value2 = op2->i;
5727
5728 exp->type = 2;
5729 exp->string = PrintInt(op1->i - value2);
5730 if(!exp->expType)
5731 {
5732 exp->expType = op1->type;
5733 if(op1->type)
5734 op1->type->refCount++;
5735 }
5736 return 0x1;
5737 }
5738
5739 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5740 {
5741 unsigned int value2 = op2->ui;
5742
5743 exp->type = 2;
5744 exp->string = PrintUInt(op1->ui - value2);
5745 if(!exp->expType)
5746 {
5747 exp->expType = op1->type;
5748 if(op1->type)
5749 op1->type->refCount++;
5750 }
5751 return 0x1;
5752 }
5753
5754 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5755 {
5756 short value2 = op2->s;
5757
5758 exp->type = 2;
5759 exp->string = PrintShort(op1->s - value2);
5760 if(!exp->expType)
5761 {
5762 exp->expType = op1->type;
5763 if(op1->type)
5764 op1->type->refCount++;
5765 }
5766 return 0x1;
5767 }
5768
5769 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5770 {
5771 unsigned short value2 = op2->us;
5772
5773 exp->type = 2;
5774 exp->string = PrintUShort(op1->us - value2);
5775 if(!exp->expType)
5776 {
5777 exp->expType = op1->type;
5778 if(op1->type)
5779 op1->type->refCount++;
5780 }
5781 return 0x1;
5782 }
5783
5784 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5785 {
5786 char value2 = op2->c;
5787
5788 exp->type = 2;
5789 exp->string = PrintChar(op1->c - value2);
5790 if(!exp->expType)
5791 {
5792 exp->expType = op1->type;
5793 if(op1->type)
5794 op1->type->refCount++;
5795 }
5796 return 0x1;
5797 }
5798
5799 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5800 {
5801 unsigned char value2 = op2->uc;
5802
5803 exp->type = 2;
5804 exp->string = PrintUChar(op1->uc - value2);
5805 if(!exp->expType)
5806 {
5807 exp->expType = op1->type;
5808 if(op1->type)
5809 op1->type->refCount++;
5810 }
5811 return 0x1;
5812 }
5813
5814 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5815 {
5816 float value2 = op2->f;
5817
5818 exp->type = 2;
5819 exp->string = PrintFloat(op1->f - value2);
5820 if(!exp->expType)
5821 {
5822 exp->expType = op1->type;
5823 if(op1->type)
5824 op1->type->refCount++;
5825 }
5826 return 0x1;
5827 }
5828
5829 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5830 {
5831 double value2 = op2->d;
5832
5833 exp->type = 2;
5834 exp->string = PrintDouble(op1->d - value2);
5835 if(!exp->expType)
5836 {
5837 exp->expType = op1->type;
5838 if(op1->type)
5839 op1->type->refCount++;
5840 }
5841 return 0x1;
5842 }
5843
5844 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5845 {
5846 int value2 = op2->i;
5847
5848 exp->type = 2;
5849 exp->string = PrintInt(op1->i * value2);
5850 if(!exp->expType)
5851 {
5852 exp->expType = op1->type;
5853 if(op1->type)
5854 op1->type->refCount++;
5855 }
5856 return 0x1;
5857 }
5858
5859 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5860 {
5861 unsigned int value2 = op2->ui;
5862
5863 exp->type = 2;
5864 exp->string = PrintUInt(op1->ui * value2);
5865 if(!exp->expType)
5866 {
5867 exp->expType = op1->type;
5868 if(op1->type)
5869 op1->type->refCount++;
5870 }
5871 return 0x1;
5872 }
5873
5874 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5875 {
5876 short value2 = op2->s;
5877
5878 exp->type = 2;
5879 exp->string = PrintShort(op1->s * value2);
5880 if(!exp->expType)
5881 {
5882 exp->expType = op1->type;
5883 if(op1->type)
5884 op1->type->refCount++;
5885 }
5886 return 0x1;
5887 }
5888
5889 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5890 {
5891 unsigned short value2 = op2->us;
5892
5893 exp->type = 2;
5894 exp->string = PrintUShort(op1->us * value2);
5895 if(!exp->expType)
5896 {
5897 exp->expType = op1->type;
5898 if(op1->type)
5899 op1->type->refCount++;
5900 }
5901 return 0x1;
5902 }
5903
5904 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5905 {
5906 char value2 = op2->c;
5907
5908 exp->type = 2;
5909 exp->string = PrintChar(op1->c * value2);
5910 if(!exp->expType)
5911 {
5912 exp->expType = op1->type;
5913 if(op1->type)
5914 op1->type->refCount++;
5915 }
5916 return 0x1;
5917 }
5918
5919 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5920 {
5921 unsigned char value2 = op2->uc;
5922
5923 exp->type = 2;
5924 exp->string = PrintUChar(op1->uc * value2);
5925 if(!exp->expType)
5926 {
5927 exp->expType = op1->type;
5928 if(op1->type)
5929 op1->type->refCount++;
5930 }
5931 return 0x1;
5932 }
5933
5934 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5935 {
5936 float value2 = op2->f;
5937
5938 exp->type = 2;
5939 exp->string = PrintFloat(op1->f * value2);
5940 if(!exp->expType)
5941 {
5942 exp->expType = op1->type;
5943 if(op1->type)
5944 op1->type->refCount++;
5945 }
5946 return 0x1;
5947 }
5948
5949 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5950 {
5951 double value2 = op2->d;
5952
5953 exp->type = 2;
5954 exp->string = PrintDouble(op1->d * value2);
5955 if(!exp->expType)
5956 {
5957 exp->expType = op1->type;
5958 if(op1->type)
5959 op1->type->refCount++;
5960 }
5961 return 0x1;
5962 }
5963
5964 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5965 {
5966 int value2 = op2->i;
5967
5968 exp->type = 2;
5969 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
5970 if(!exp->expType)
5971 {
5972 exp->expType = op1->type;
5973 if(op1->type)
5974 op1->type->refCount++;
5975 }
5976 return 0x1;
5977 }
5978
5979 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5980 {
5981 unsigned int value2 = op2->ui;
5982
5983 exp->type = 2;
5984 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
5985 if(!exp->expType)
5986 {
5987 exp->expType = op1->type;
5988 if(op1->type)
5989 op1->type->refCount++;
5990 }
5991 return 0x1;
5992 }
5993
5994 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5995 {
5996 short value2 = op2->s;
5997
5998 exp->type = 2;
5999 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
6000 if(!exp->expType)
6001 {
6002 exp->expType = op1->type;
6003 if(op1->type)
6004 op1->type->refCount++;
6005 }
6006 return 0x1;
6007 }
6008
6009 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6010 {
6011 unsigned short value2 = op2->us;
6012
6013 exp->type = 2;
6014 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
6015 if(!exp->expType)
6016 {
6017 exp->expType = op1->type;
6018 if(op1->type)
6019 op1->type->refCount++;
6020 }
6021 return 0x1;
6022 }
6023
6024 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6025 {
6026 char value2 = op2->c;
6027
6028 exp->type = 2;
6029 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
6030 if(!exp->expType)
6031 {
6032 exp->expType = op1->type;
6033 if(op1->type)
6034 op1->type->refCount++;
6035 }
6036 return 0x1;
6037 }
6038
6039 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6040 {
6041 unsigned char value2 = op2->uc;
6042
6043 exp->type = 2;
6044 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
6045 if(!exp->expType)
6046 {
6047 exp->expType = op1->type;
6048 if(op1->type)
6049 op1->type->refCount++;
6050 }
6051 return 0x1;
6052 }
6053
6054 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6055 {
6056 float value2 = op2->f;
6057
6058 exp->type = 2;
6059 exp->string = PrintFloat(value2 ? (op1->f / value2) : (float)0);
6060 if(!exp->expType)
6061 {
6062 exp->expType = op1->type;
6063 if(op1->type)
6064 op1->type->refCount++;
6065 }
6066 return 0x1;
6067 }
6068
6069 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6070 {
6071 double value2 = op2->d;
6072
6073 exp->type = 2;
6074 exp->string = PrintDouble(value2 ? (op1->d / value2) : (double)0);
6075 if(!exp->expType)
6076 {
6077 exp->expType = op1->type;
6078 if(op1->type)
6079 op1->type->refCount++;
6080 }
6081 return 0x1;
6082 }
6083
6084 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6085 {
6086 int value2 = op2->i;
6087
6088 exp->type = 2;
6089 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
6090 if(!exp->expType)
6091 {
6092 exp->expType = op1->type;
6093 if(op1->type)
6094 op1->type->refCount++;
6095 }
6096 return 0x1;
6097 }
6098
6099 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6100 {
6101 unsigned int value2 = op2->ui;
6102
6103 exp->type = 2;
6104 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
6105 if(!exp->expType)
6106 {
6107 exp->expType = op1->type;
6108 if(op1->type)
6109 op1->type->refCount++;
6110 }
6111 return 0x1;
6112 }
6113
6114 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6115 {
6116 short value2 = op2->s;
6117
6118 exp->type = 2;
6119 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
6120 if(!exp->expType)
6121 {
6122 exp->expType = op1->type;
6123 if(op1->type)
6124 op1->type->refCount++;
6125 }
6126 return 0x1;
6127 }
6128
6129 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6130 {
6131 unsigned short value2 = op2->us;
6132
6133 exp->type = 2;
6134 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
6135 if(!exp->expType)
6136 {
6137 exp->expType = op1->type;
6138 if(op1->type)
6139 op1->type->refCount++;
6140 }
6141 return 0x1;
6142 }
6143
6144 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6145 {
6146 char value2 = op2->c;
6147
6148 exp->type = 2;
6149 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
6150 if(!exp->expType)
6151 {
6152 exp->expType = op1->type;
6153 if(op1->type)
6154 op1->type->refCount++;
6155 }
6156 return 0x1;
6157 }
6158
6159 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6160 {
6161 unsigned char value2 = op2->uc;
6162
6163 exp->type = 2;
6164 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
6165 if(!exp->expType)
6166 {
6167 exp->expType = op1->type;
6168 if(op1->type)
6169 op1->type->refCount++;
6170 }
6171 return 0x1;
6172 }
6173
6174 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
6175 {
6176 exp->type = 2;
6177 exp->string = PrintInt(-op1->i);
6178 if(!exp->expType)
6179 {
6180 exp->expType = op1->type;
6181 if(op1->type)
6182 op1->type->refCount++;
6183 }
6184 return 0x1;
6185 }
6186
6187 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
6188 {
6189 exp->type = 2;
6190 exp->string = PrintUInt(-op1->ui);
6191 if(!exp->expType)
6192 {
6193 exp->expType = op1->type;
6194 if(op1->type)
6195 op1->type->refCount++;
6196 }
6197 return 0x1;
6198 }
6199
6200 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
6201 {
6202 exp->type = 2;
6203 exp->string = PrintShort(-op1->s);
6204 if(!exp->expType)
6205 {
6206 exp->expType = op1->type;
6207 if(op1->type)
6208 op1->type->refCount++;
6209 }
6210 return 0x1;
6211 }
6212
6213 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
6214 {
6215 exp->type = 2;
6216 exp->string = PrintUShort(-op1->us);
6217 if(!exp->expType)
6218 {
6219 exp->expType = op1->type;
6220 if(op1->type)
6221 op1->type->refCount++;
6222 }
6223 return 0x1;
6224 }
6225
6226 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
6227 {
6228 exp->type = 2;
6229 exp->string = PrintChar(-op1->c);
6230 if(!exp->expType)
6231 {
6232 exp->expType = op1->type;
6233 if(op1->type)
6234 op1->type->refCount++;
6235 }
6236 return 0x1;
6237 }
6238
6239 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
6240 {
6241 exp->type = 2;
6242 exp->string = PrintUChar(-op1->uc);
6243 if(!exp->expType)
6244 {
6245 exp->expType = op1->type;
6246 if(op1->type)
6247 op1->type->refCount++;
6248 }
6249 return 0x1;
6250 }
6251
6252 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
6253 {
6254 exp->type = 2;
6255 exp->string = PrintFloat(-op1->f);
6256 if(!exp->expType)
6257 {
6258 exp->expType = op1->type;
6259 if(op1->type)
6260 op1->type->refCount++;
6261 }
6262 return 0x1;
6263 }
6264
6265 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6266 {
6267 exp->type = 2;
6268 exp->string = PrintDouble(-op1->d);
6269 if(!exp->expType)
6270 {
6271 exp->expType = op1->type;
6272 if(op1->type)
6273 op1->type->refCount++;
6274 }
6275 return 0x1;
6276 }
6277
6278 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6279 {
6280 exp->type = 2;
6281 exp->string = PrintInt(++op1->i);
6282 if(!exp->expType)
6283 {
6284 exp->expType = op1->type;
6285 if(op1->type)
6286 op1->type->refCount++;
6287 }
6288 return 0x1;
6289 }
6290
6291 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6292 {
6293 exp->type = 2;
6294 exp->string = PrintUInt(++op1->ui);
6295 if(!exp->expType)
6296 {
6297 exp->expType = op1->type;
6298 if(op1->type)
6299 op1->type->refCount++;
6300 }
6301 return 0x1;
6302 }
6303
6304 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6305 {
6306 exp->type = 2;
6307 exp->string = PrintShort(++op1->s);
6308 if(!exp->expType)
6309 {
6310 exp->expType = op1->type;
6311 if(op1->type)
6312 op1->type->refCount++;
6313 }
6314 return 0x1;
6315 }
6316
6317 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6318 {
6319 exp->type = 2;
6320 exp->string = PrintUShort(++op1->us);
6321 if(!exp->expType)
6322 {
6323 exp->expType = op1->type;
6324 if(op1->type)
6325 op1->type->refCount++;
6326 }
6327 return 0x1;
6328 }
6329
6330 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6331 {
6332 exp->type = 2;
6333 exp->string = PrintChar(++op1->c);
6334 if(!exp->expType)
6335 {
6336 exp->expType = op1->type;
6337 if(op1->type)
6338 op1->type->refCount++;
6339 }
6340 return 0x1;
6341 }
6342
6343 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6344 {
6345 exp->type = 2;
6346 exp->string = PrintUChar(++op1->uc);
6347 if(!exp->expType)
6348 {
6349 exp->expType = op1->type;
6350 if(op1->type)
6351 op1->type->refCount++;
6352 }
6353 return 0x1;
6354 }
6355
6356 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6357 {
6358 exp->type = 2;
6359 exp->string = PrintFloat(++op1->f);
6360 if(!exp->expType)
6361 {
6362 exp->expType = op1->type;
6363 if(op1->type)
6364 op1->type->refCount++;
6365 }
6366 return 0x1;
6367 }
6368
6369 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6370 {
6371 exp->type = 2;
6372 exp->string = PrintDouble(++op1->d);
6373 if(!exp->expType)
6374 {
6375 exp->expType = op1->type;
6376 if(op1->type)
6377 op1->type->refCount++;
6378 }
6379 return 0x1;
6380 }
6381
6382 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6383 {
6384 exp->type = 2;
6385 exp->string = PrintInt(--op1->i);
6386 if(!exp->expType)
6387 {
6388 exp->expType = op1->type;
6389 if(op1->type)
6390 op1->type->refCount++;
6391 }
6392 return 0x1;
6393 }
6394
6395 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6396 {
6397 exp->type = 2;
6398 exp->string = PrintUInt(--op1->ui);
6399 if(!exp->expType)
6400 {
6401 exp->expType = op1->type;
6402 if(op1->type)
6403 op1->type->refCount++;
6404 }
6405 return 0x1;
6406 }
6407
6408 static unsigned int ShortDec(struct Expression * exp, struct Operand * op1)
6409 {
6410 exp->type = 2;
6411 exp->string = PrintShort(--op1->s);
6412 if(!exp->expType)
6413 {
6414 exp->expType = op1->type;
6415 if(op1->type)
6416 op1->type->refCount++;
6417 }
6418 return 0x1;
6419 }
6420
6421 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6422 {
6423 exp->type = 2;
6424 exp->string = PrintUShort(--op1->us);
6425 if(!exp->expType)
6426 {
6427 exp->expType = op1->type;
6428 if(op1->type)
6429 op1->type->refCount++;
6430 }
6431 return 0x1;
6432 }
6433
6434 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6435 {
6436 exp->type = 2;
6437 exp->string = PrintChar(--op1->c);
6438 if(!exp->expType)
6439 {
6440 exp->expType = op1->type;
6441 if(op1->type)
6442 op1->type->refCount++;
6443 }
6444 return 0x1;
6445 }
6446
6447 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6448 {
6449 exp->type = 2;
6450 exp->string = PrintUChar(--op1->uc);
6451 if(!exp->expType)
6452 {
6453 exp->expType = op1->type;
6454 if(op1->type)
6455 op1->type->refCount++;
6456 }
6457 return 0x1;
6458 }
6459
6460 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6461 {
6462 exp->type = 2;
6463 exp->string = PrintFloat(--op1->f);
6464 if(!exp->expType)
6465 {
6466 exp->expType = op1->type;
6467 if(op1->type)
6468 op1->type->refCount++;
6469 }
6470 return 0x1;
6471 }
6472
6473 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6474 {
6475 exp->type = 2;
6476 exp->string = PrintDouble(--op1->d);
6477 if(!exp->expType)
6478 {
6479 exp->expType = op1->type;
6480 if(op1->type)
6481 op1->type->refCount++;
6482 }
6483 return 0x1;
6484 }
6485
6486 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6487 {
6488 int value2 = op2->i;
6489
6490 exp->type = 2;
6491 exp->string = PrintInt(op1->i = value2);
6492 if(!exp->expType)
6493 {
6494 exp->expType = op1->type;
6495 if(op1->type)
6496 op1->type->refCount++;
6497 }
6498 return 0x1;
6499 }
6500
6501 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6502 {
6503 unsigned int value2 = op2->ui;
6504
6505 exp->type = 2;
6506 exp->string = PrintUInt(op1->ui = value2);
6507 if(!exp->expType)
6508 {
6509 exp->expType = op1->type;
6510 if(op1->type)
6511 op1->type->refCount++;
6512 }
6513 return 0x1;
6514 }
6515
6516 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6517 {
6518 short value2 = op2->s;
6519
6520 exp->type = 2;
6521 exp->string = PrintShort(op1->s = value2);
6522 if(!exp->expType)
6523 {
6524 exp->expType = op1->type;
6525 if(op1->type)
6526 op1->type->refCount++;
6527 }
6528 return 0x1;
6529 }
6530
6531 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6532 {
6533 unsigned short value2 = op2->us;
6534
6535 exp->type = 2;
6536 exp->string = PrintUShort(op1->us = value2);
6537 if(!exp->expType)
6538 {
6539 exp->expType = op1->type;
6540 if(op1->type)
6541 op1->type->refCount++;
6542 }
6543 return 0x1;
6544 }
6545
6546 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6547 {
6548 char value2 = op2->c;
6549
6550 exp->type = 2;
6551 exp->string = PrintChar(op1->c = value2);
6552 if(!exp->expType)
6553 {
6554 exp->expType = op1->type;
6555 if(op1->type)
6556 op1->type->refCount++;
6557 }
6558 return 0x1;
6559 }
6560
6561 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6562 {
6563 unsigned char value2 = op2->uc;
6564
6565 exp->type = 2;
6566 exp->string = PrintUChar(op1->uc = value2);
6567 if(!exp->expType)
6568 {
6569 exp->expType = op1->type;
6570 if(op1->type)
6571 op1->type->refCount++;
6572 }
6573 return 0x1;
6574 }
6575
6576 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6577 {
6578 float value2 = op2->f;
6579
6580 exp->type = 2;
6581 exp->string = PrintFloat(op1->f = value2);
6582 if(!exp->expType)
6583 {
6584 exp->expType = op1->type;
6585 if(op1->type)
6586 op1->type->refCount++;
6587 }
6588 return 0x1;
6589 }
6590
6591 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6592 {
6593 double value2 = op2->d;
6594
6595 exp->type = 2;
6596 exp->string = PrintDouble(op1->d = value2);
6597 if(!exp->expType)
6598 {
6599 exp->expType = op1->type;
6600 if(op1->type)
6601 op1->type->refCount++;
6602 }
6603 return 0x1;
6604 }
6605
6606 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6607 {
6608 int value2 = op2->i;
6609
6610 exp->type = 2;
6611 exp->string = PrintInt(op1->i += value2);
6612 if(!exp->expType)
6613 {
6614 exp->expType = op1->type;
6615 if(op1->type)
6616 op1->type->refCount++;
6617 }
6618 return 0x1;
6619 }
6620
6621 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6622 {
6623 unsigned int value2 = op2->ui;
6624
6625 exp->type = 2;
6626 exp->string = PrintUInt(op1->ui += value2);
6627 if(!exp->expType)
6628 {
6629 exp->expType = op1->type;
6630 if(op1->type)
6631 op1->type->refCount++;
6632 }
6633 return 0x1;
6634 }
6635
6636 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6637 {
6638 short value2 = op2->s;
6639
6640 exp->type = 2;
6641 exp->string = PrintShort(op1->s += value2);
6642 if(!exp->expType)
6643 {
6644 exp->expType = op1->type;
6645 if(op1->type)
6646 op1->type->refCount++;
6647 }
6648 return 0x1;
6649 }
6650
6651 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6652 {
6653 unsigned short value2 = op2->us;
6654
6655 exp->type = 2;
6656 exp->string = PrintUShort(op1->us += value2);
6657 if(!exp->expType)
6658 {
6659 exp->expType = op1->type;
6660 if(op1->type)
6661 op1->type->refCount++;
6662 }
6663 return 0x1;
6664 }
6665
6666 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6667 {
6668 char value2 = op2->c;
6669
6670 exp->type = 2;
6671 exp->string = PrintChar(op1->c += value2);
6672 if(!exp->expType)
6673 {
6674 exp->expType = op1->type;
6675 if(op1->type)
6676 op1->type->refCount++;
6677 }
6678 return 0x1;
6679 }
6680
6681 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6682 {
6683 unsigned char value2 = op2->uc;
6684
6685 exp->type = 2;
6686 exp->string = PrintUChar(op1->uc += value2);
6687 if(!exp->expType)
6688 {
6689 exp->expType = op1->type;
6690 if(op1->type)
6691 op1->type->refCount++;
6692 }
6693 return 0x1;
6694 }
6695
6696 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6697 {
6698 float value2 = op2->f;
6699
6700 exp->type = 2;
6701 exp->string = PrintFloat(op1->f += value2);
6702 if(!exp->expType)
6703 {
6704 exp->expType = op1->type;
6705 if(op1->type)
6706 op1->type->refCount++;
6707 }
6708 return 0x1;
6709 }
6710
6711 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6712 {
6713 double value2 = op2->d;
6714
6715 exp->type = 2;
6716 exp->string = PrintDouble(op1->d += value2);
6717 if(!exp->expType)
6718 {
6719 exp->expType = op1->type;
6720 if(op1->type)
6721 op1->type->refCount++;
6722 }
6723 return 0x1;
6724 }
6725
6726 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6727 {
6728 int value2 = op2->i;
6729
6730 exp->type = 2;
6731 exp->string = PrintInt(op1->i -= value2);
6732 if(!exp->expType)
6733 {
6734 exp->expType = op1->type;
6735 if(op1->type)
6736 op1->type->refCount++;
6737 }
6738 return 0x1;
6739 }
6740
6741 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6742 {
6743 unsigned int value2 = op2->ui;
6744
6745 exp->type = 2;
6746 exp->string = PrintUInt(op1->ui -= value2);
6747 if(!exp->expType)
6748 {
6749 exp->expType = op1->type;
6750 if(op1->type)
6751 op1->type->refCount++;
6752 }
6753 return 0x1;
6754 }
6755
6756 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6757 {
6758 short value2 = op2->s;
6759
6760 exp->type = 2;
6761 exp->string = PrintShort(op1->s -= value2);
6762 if(!exp->expType)
6763 {
6764 exp->expType = op1->type;
6765 if(op1->type)
6766 op1->type->refCount++;
6767 }
6768 return 0x1;
6769 }
6770
6771 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6772 {
6773 unsigned short value2 = op2->us;
6774
6775 exp->type = 2;
6776 exp->string = PrintUShort(op1->us -= value2);
6777 if(!exp->expType)
6778 {
6779 exp->expType = op1->type;
6780 if(op1->type)
6781 op1->type->refCount++;
6782 }
6783 return 0x1;
6784 }
6785
6786 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6787 {
6788 char value2 = op2->c;
6789
6790 exp->type = 2;
6791 exp->string = PrintChar(op1->c -= value2);
6792 if(!exp->expType)
6793 {
6794 exp->expType = op1->type;
6795 if(op1->type)
6796 op1->type->refCount++;
6797 }
6798 return 0x1;
6799 }
6800
6801 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6802 {
6803 unsigned char value2 = op2->uc;
6804
6805 exp->type = 2;
6806 exp->string = PrintUChar(op1->uc -= value2);
6807 if(!exp->expType)
6808 {
6809 exp->expType = op1->type;
6810 if(op1->type)
6811 op1->type->refCount++;
6812 }
6813 return 0x1;
6814 }
6815
6816 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6817 {
6818 float value2 = op2->f;
6819
6820 exp->type = 2;
6821 exp->string = PrintFloat(op1->f -= value2);
6822 if(!exp->expType)
6823 {
6824 exp->expType = op1->type;
6825 if(op1->type)
6826 op1->type->refCount++;
6827 }
6828 return 0x1;
6829 }
6830
6831 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6832 {
6833 double value2 = op2->d;
6834
6835 exp->type = 2;
6836 exp->string = PrintDouble(op1->d -= value2);
6837 if(!exp->expType)
6838 {
6839 exp->expType = op1->type;
6840 if(op1->type)
6841 op1->type->refCount++;
6842 }
6843 return 0x1;
6844 }
6845
6846 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6847 {
6848 int value2 = op2->i;
6849
6850 exp->type = 2;
6851 exp->string = PrintInt(op1->i *= value2);
6852 if(!exp->expType)
6853 {
6854 exp->expType = op1->type;
6855 if(op1->type)
6856 op1->type->refCount++;
6857 }
6858 return 0x1;
6859 }
6860
6861 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6862 {
6863 unsigned int value2 = op2->ui;
6864
6865 exp->type = 2;
6866 exp->string = PrintUInt(op1->ui *= value2);
6867 if(!exp->expType)
6868 {
6869 exp->expType = op1->type;
6870 if(op1->type)
6871 op1->type->refCount++;
6872 }
6873 return 0x1;
6874 }
6875
6876 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6877 {
6878 short value2 = op2->s;
6879
6880 exp->type = 2;
6881 exp->string = PrintShort(op1->s *= value2);
6882 if(!exp->expType)
6883 {
6884 exp->expType = op1->type;
6885 if(op1->type)
6886 op1->type->refCount++;
6887 }
6888 return 0x1;
6889 }
6890
6891 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6892 {
6893 unsigned short value2 = op2->us;
6894
6895 exp->type = 2;
6896 exp->string = PrintUShort(op1->us *= value2);
6897 if(!exp->expType)
6898 {
6899 exp->expType = op1->type;
6900 if(op1->type)
6901 op1->type->refCount++;
6902 }
6903 return 0x1;
6904 }
6905
6906 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6907 {
6908 char value2 = op2->c;
6909
6910 exp->type = 2;
6911 exp->string = PrintChar(op1->c *= value2);
6912 if(!exp->expType)
6913 {
6914 exp->expType = op1->type;
6915 if(op1->type)
6916 op1->type->refCount++;
6917 }
6918 return 0x1;
6919 }
6920
6921 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6922 {
6923 unsigned char value2 = op2->uc;
6924
6925 exp->type = 2;
6926 exp->string = PrintUChar(op1->uc *= value2);
6927 if(!exp->expType)
6928 {
6929 exp->expType = op1->type;
6930 if(op1->type)
6931 op1->type->refCount++;
6932 }
6933 return 0x1;
6934 }
6935
6936 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6937 {
6938 float value2 = op2->f;
6939
6940 exp->type = 2;
6941 exp->string = PrintFloat(op1->f *= value2);
6942 if(!exp->expType)
6943 {
6944 exp->expType = op1->type;
6945 if(op1->type)
6946 op1->type->refCount++;
6947 }
6948 return 0x1;
6949 }
6950
6951 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6952 {
6953 double value2 = op2->d;
6954
6955 exp->type = 2;
6956 exp->string = PrintDouble(op1->d *= value2);
6957 if(!exp->expType)
6958 {
6959 exp->expType = op1->type;
6960 if(op1->type)
6961 op1->type->refCount++;
6962 }
6963 return 0x1;
6964 }
6965
6966 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6967 {
6968 int value2 = op2->i;
6969
6970 exp->type = 2;
6971 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
6972 if(!exp->expType)
6973 {
6974 exp->expType = op1->type;
6975 if(op1->type)
6976 op1->type->refCount++;
6977 }
6978 return 0x1;
6979 }
6980
6981 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6982 {
6983 unsigned int value2 = op2->ui;
6984
6985 exp->type = 2;
6986 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
6987 if(!exp->expType)
6988 {
6989 exp->expType = op1->type;
6990 if(op1->type)
6991 op1->type->refCount++;
6992 }
6993 return 0x1;
6994 }
6995
6996 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6997 {
6998 short value2 = op2->s;
6999
7000 exp->type = 2;
7001 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
7002 if(!exp->expType)
7003 {
7004 exp->expType = op1->type;
7005 if(op1->type)
7006 op1->type->refCount++;
7007 }
7008 return 0x1;
7009 }
7010
7011 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7012 {
7013 unsigned short value2 = op2->us;
7014
7015 exp->type = 2;
7016 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
7017 if(!exp->expType)
7018 {
7019 exp->expType = op1->type;
7020 if(op1->type)
7021 op1->type->refCount++;
7022 }
7023 return 0x1;
7024 }
7025
7026 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7027 {
7028 char value2 = op2->c;
7029
7030 exp->type = 2;
7031 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
7032 if(!exp->expType)
7033 {
7034 exp->expType = op1->type;
7035 if(op1->type)
7036 op1->type->refCount++;
7037 }
7038 return 0x1;
7039 }
7040
7041 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7042 {
7043 unsigned char value2 = op2->uc;
7044
7045 exp->type = 2;
7046 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
7047 if(!exp->expType)
7048 {
7049 exp->expType = op1->type;
7050 if(op1->type)
7051 op1->type->refCount++;
7052 }
7053 return 0x1;
7054 }
7055
7056 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7057 {
7058 float value2 = op2->f;
7059
7060 exp->type = 2;
7061 exp->string = PrintFloat(value2 ? (op1->f /= value2) : (float)0);
7062 if(!exp->expType)
7063 {
7064 exp->expType = op1->type;
7065 if(op1->type)
7066 op1->type->refCount++;
7067 }
7068 return 0x1;
7069 }
7070
7071 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7072 {
7073 double value2 = op2->d;
7074
7075 exp->type = 2;
7076 exp->string = PrintDouble(value2 ? (op1->d /= value2) : (double)0);
7077 if(!exp->expType)
7078 {
7079 exp->expType = op1->type;
7080 if(op1->type)
7081 op1->type->refCount++;
7082 }
7083 return 0x1;
7084 }
7085
7086 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7087 {
7088 int value2 = op2->i;
7089
7090 exp->type = 2;
7091 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
7092 if(!exp->expType)
7093 {
7094 exp->expType = op1->type;
7095 if(op1->type)
7096 op1->type->refCount++;
7097 }
7098 return 0x1;
7099 }
7100
7101 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7102 {
7103 unsigned int value2 = op2->ui;
7104
7105 exp->type = 2;
7106 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
7107 if(!exp->expType)
7108 {
7109 exp->expType = op1->type;
7110 if(op1->type)
7111 op1->type->refCount++;
7112 }
7113 return 0x1;
7114 }
7115
7116 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7117 {
7118 short value2 = op2->s;
7119
7120 exp->type = 2;
7121 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
7122 if(!exp->expType)
7123 {
7124 exp->expType = op1->type;
7125 if(op1->type)
7126 op1->type->refCount++;
7127 }
7128 return 0x1;
7129 }
7130
7131 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7132 {
7133 unsigned short value2 = op2->us;
7134
7135 exp->type = 2;
7136 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
7137 if(!exp->expType)
7138 {
7139 exp->expType = op1->type;
7140 if(op1->type)
7141 op1->type->refCount++;
7142 }
7143 return 0x1;
7144 }
7145
7146 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7147 {
7148 char value2 = op2->c;
7149
7150 exp->type = 2;
7151 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
7152 if(!exp->expType)
7153 {
7154 exp->expType = op1->type;
7155 if(op1->type)
7156 op1->type->refCount++;
7157 }
7158 return 0x1;
7159 }
7160
7161 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7162 {
7163 unsigned char value2 = op2->uc;
7164
7165 exp->type = 2;
7166 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
7167 if(!exp->expType)
7168 {
7169 exp->expType = op1->type;
7170 if(op1->type)
7171 op1->type->refCount++;
7172 }
7173 return 0x1;
7174 }
7175
7176 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7177 {
7178 int value2 = op2->i;
7179
7180 exp->type = 2;
7181 exp->string = PrintInt(op1->i & value2);
7182 if(!exp->expType)
7183 {
7184 exp->expType = op1->type;
7185 if(op1->type)
7186 op1->type->refCount++;
7187 }
7188 return 0x1;
7189 }
7190
7191 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7192 {
7193 unsigned int value2 = op2->ui;
7194
7195 exp->type = 2;
7196 exp->string = PrintUInt(op1->ui & value2);
7197 if(!exp->expType)
7198 {
7199 exp->expType = op1->type;
7200 if(op1->type)
7201 op1->type->refCount++;
7202 }
7203 return 0x1;
7204 }
7205
7206 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7207 {
7208 short value2 = op2->s;
7209
7210 exp->type = 2;
7211 exp->string = PrintShort(op1->s & value2);
7212 if(!exp->expType)
7213 {
7214 exp->expType = op1->type;
7215 if(op1->type)
7216 op1->type->refCount++;
7217 }
7218 return 0x1;
7219 }
7220
7221 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7222 {
7223 unsigned short value2 = op2->us;
7224
7225 exp->type = 2;
7226 exp->string = PrintUShort(op1->us & value2);
7227 if(!exp->expType)
7228 {
7229 exp->expType = op1->type;
7230 if(op1->type)
7231 op1->type->refCount++;
7232 }
7233 return 0x1;
7234 }
7235
7236 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7237 {
7238 char value2 = op2->c;
7239
7240 exp->type = 2;
7241 exp->string = PrintChar(op1->c & value2);
7242 if(!exp->expType)
7243 {
7244 exp->expType = op1->type;
7245 if(op1->type)
7246 op1->type->refCount++;
7247 }
7248 return 0x1;
7249 }
7250
7251 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7252 {
7253 unsigned char value2 = op2->uc;
7254
7255 exp->type = 2;
7256 exp->string = PrintUChar(op1->uc & value2);
7257 if(!exp->expType)
7258 {
7259 exp->expType = op1->type;
7260 if(op1->type)
7261 op1->type->refCount++;
7262 }
7263 return 0x1;
7264 }
7265
7266 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7267 {
7268 int value2 = op2->i;
7269
7270 exp->type = 2;
7271 exp->string = PrintInt(op1->i | value2);
7272 if(!exp->expType)
7273 {
7274 exp->expType = op1->type;
7275 if(op1->type)
7276 op1->type->refCount++;
7277 }
7278 return 0x1;
7279 }
7280
7281 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7282 {
7283 unsigned int value2 = op2->ui;
7284
7285 exp->type = 2;
7286 exp->string = PrintUInt(op1->ui | value2);
7287 if(!exp->expType)
7288 {
7289 exp->expType = op1->type;
7290 if(op1->type)
7291 op1->type->refCount++;
7292 }
7293 return 0x1;
7294 }
7295
7296 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7297 {
7298 short value2 = op2->s;
7299
7300 exp->type = 2;
7301 exp->string = PrintShort(op1->s | value2);
7302 if(!exp->expType)
7303 {
7304 exp->expType = op1->type;
7305 if(op1->type)
7306 op1->type->refCount++;
7307 }
7308 return 0x1;
7309 }
7310
7311 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7312 {
7313 unsigned short value2 = op2->us;
7314
7315 exp->type = 2;
7316 exp->string = PrintUShort(op1->us | value2);
7317 if(!exp->expType)
7318 {
7319 exp->expType = op1->type;
7320 if(op1->type)
7321 op1->type->refCount++;
7322 }
7323 return 0x1;
7324 }
7325
7326 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7327 {
7328 char value2 = op2->c;
7329
7330 exp->type = 2;
7331 exp->string = PrintChar(op1->c | value2);
7332 if(!exp->expType)
7333 {
7334 exp->expType = op1->type;
7335 if(op1->type)
7336 op1->type->refCount++;
7337 }
7338 return 0x1;
7339 }
7340
7341 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7342 {
7343 unsigned char value2 = op2->uc;
7344
7345 exp->type = 2;
7346 exp->string = PrintUChar(op1->uc | value2);
7347 if(!exp->expType)
7348 {
7349 exp->expType = op1->type;
7350 if(op1->type)
7351 op1->type->refCount++;
7352 }
7353 return 0x1;
7354 }
7355
7356 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7357 {
7358 int value2 = op2->i;
7359
7360 exp->type = 2;
7361 exp->string = PrintInt(op1->i ^ value2);
7362 if(!exp->expType)
7363 {
7364 exp->expType = op1->type;
7365 if(op1->type)
7366 op1->type->refCount++;
7367 }
7368 return 0x1;
7369 }
7370
7371 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7372 {
7373 unsigned int value2 = op2->ui;
7374
7375 exp->type = 2;
7376 exp->string = PrintUInt(op1->ui ^ value2);
7377 if(!exp->expType)
7378 {
7379 exp->expType = op1->type;
7380 if(op1->type)
7381 op1->type->refCount++;
7382 }
7383 return 0x1;
7384 }
7385
7386 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7387 {
7388 short value2 = op2->s;
7389
7390 exp->type = 2;
7391 exp->string = PrintShort(op1->s ^ value2);
7392 if(!exp->expType)
7393 {
7394 exp->expType = op1->type;
7395 if(op1->type)
7396 op1->type->refCount++;
7397 }
7398 return 0x1;
7399 }
7400
7401 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7402 {
7403 unsigned short value2 = op2->us;
7404
7405 exp->type = 2;
7406 exp->string = PrintUShort(op1->us ^ value2);
7407 if(!exp->expType)
7408 {
7409 exp->expType = op1->type;
7410 if(op1->type)
7411 op1->type->refCount++;
7412 }
7413 return 0x1;
7414 }
7415
7416 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7417 {
7418 char value2 = op2->c;
7419
7420 exp->type = 2;
7421 exp->string = PrintChar(op1->c ^ value2);
7422 if(!exp->expType)
7423 {
7424 exp->expType = op1->type;
7425 if(op1->type)
7426 op1->type->refCount++;
7427 }
7428 return 0x1;
7429 }
7430
7431 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7432 {
7433 unsigned char value2 = op2->uc;
7434
7435 exp->type = 2;
7436 exp->string = PrintUChar(op1->uc ^ value2);
7437 if(!exp->expType)
7438 {
7439 exp->expType = op1->type;
7440 if(op1->type)
7441 op1->type->refCount++;
7442 }
7443 return 0x1;
7444 }
7445
7446 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7447 {
7448 int value2 = op2->i;
7449
7450 exp->type = 2;
7451 exp->string = PrintInt(op1->i << value2);
7452 if(!exp->expType)
7453 {
7454 exp->expType = op1->type;
7455 if(op1->type)
7456 op1->type->refCount++;
7457 }
7458 return 0x1;
7459 }
7460
7461 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7462 {
7463 unsigned int value2 = op2->ui;
7464
7465 exp->type = 2;
7466 exp->string = PrintUInt(op1->ui << value2);
7467 if(!exp->expType)
7468 {
7469 exp->expType = op1->type;
7470 if(op1->type)
7471 op1->type->refCount++;
7472 }
7473 return 0x1;
7474 }
7475
7476 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7477 {
7478 short value2 = op2->s;
7479
7480 exp->type = 2;
7481 exp->string = PrintShort(op1->s << value2);
7482 if(!exp->expType)
7483 {
7484 exp->expType = op1->type;
7485 if(op1->type)
7486 op1->type->refCount++;
7487 }
7488 return 0x1;
7489 }
7490
7491 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7492 {
7493 unsigned short value2 = op2->us;
7494
7495 exp->type = 2;
7496 exp->string = PrintUShort(op1->us << value2);
7497 if(!exp->expType)
7498 {
7499 exp->expType = op1->type;
7500 if(op1->type)
7501 op1->type->refCount++;
7502 }
7503 return 0x1;
7504 }
7505
7506 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7507 {
7508 char value2 = op2->c;
7509
7510 exp->type = 2;
7511 exp->string = PrintChar(op1->c << value2);
7512 if(!exp->expType)
7513 {
7514 exp->expType = op1->type;
7515 if(op1->type)
7516 op1->type->refCount++;
7517 }
7518 return 0x1;
7519 }
7520
7521 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7522 {
7523 unsigned char value2 = op2->uc;
7524
7525 exp->type = 2;
7526 exp->string = PrintUChar(op1->uc << value2);
7527 if(!exp->expType)
7528 {
7529 exp->expType = op1->type;
7530 if(op1->type)
7531 op1->type->refCount++;
7532 }
7533 return 0x1;
7534 }
7535
7536 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7537 {
7538 int value2 = op2->i;
7539
7540 exp->type = 2;
7541 exp->string = PrintInt(op1->i >> value2);
7542 if(!exp->expType)
7543 {
7544 exp->expType = op1->type;
7545 if(op1->type)
7546 op1->type->refCount++;
7547 }
7548 return 0x1;
7549 }
7550
7551 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7552 {
7553 unsigned int value2 = op2->ui;
7554
7555 exp->type = 2;
7556 exp->string = PrintUInt(op1->ui >> value2);
7557 if(!exp->expType)
7558 {
7559 exp->expType = op1->type;
7560 if(op1->type)
7561 op1->type->refCount++;
7562 }
7563 return 0x1;
7564 }
7565
7566 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7567 {
7568 short value2 = op2->s;
7569
7570 exp->type = 2;
7571 exp->string = PrintShort(op1->s >> value2);
7572 if(!exp->expType)
7573 {
7574 exp->expType = op1->type;
7575 if(op1->type)
7576 op1->type->refCount++;
7577 }
7578 return 0x1;
7579 }
7580
7581 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7582 {
7583 unsigned short value2 = op2->us;
7584
7585 exp->type = 2;
7586 exp->string = PrintUShort(op1->us >> value2);
7587 if(!exp->expType)
7588 {
7589 exp->expType = op1->type;
7590 if(op1->type)
7591 op1->type->refCount++;
7592 }
7593 return 0x1;
7594 }
7595
7596 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7597 {
7598 char value2 = op2->c;
7599
7600 exp->type = 2;
7601 exp->string = PrintChar(op1->c >> value2);
7602 if(!exp->expType)
7603 {
7604 exp->expType = op1->type;
7605 if(op1->type)
7606 op1->type->refCount++;
7607 }
7608 return 0x1;
7609 }
7610
7611 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7612 {
7613 unsigned char value2 = op2->uc;
7614
7615 exp->type = 2;
7616 exp->string = PrintUChar(op1->uc >> value2);
7617 if(!exp->expType)
7618 {
7619 exp->expType = op1->type;
7620 if(op1->type)
7621 op1->type->refCount++;
7622 }
7623 return 0x1;
7624 }
7625
7626 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
7627 {
7628 exp->type = 2;
7629 exp->string = PrintInt(~op1->i);
7630 if(!exp->expType)
7631 {
7632 exp->expType = op1->type;
7633 if(op1->type)
7634 op1->type->refCount++;
7635 }
7636 return 0x1;
7637 }
7638
7639 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
7640 {
7641 exp->type = 2;
7642 exp->string = PrintUInt(~op1->ui);
7643 if(!exp->expType)
7644 {
7645 exp->expType = op1->type;
7646 if(op1->type)
7647 op1->type->refCount++;
7648 }
7649 return 0x1;
7650 }
7651
7652 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
7653 {
7654 exp->type = 2;
7655 exp->string = PrintShort(~op1->s);
7656 if(!exp->expType)
7657 {
7658 exp->expType = op1->type;
7659 if(op1->type)
7660 op1->type->refCount++;
7661 }
7662 return 0x1;
7663 }
7664
7665 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
7666 {
7667 exp->type = 2;
7668 exp->string = PrintUShort(~op1->us);
7669 if(!exp->expType)
7670 {
7671 exp->expType = op1->type;
7672 if(op1->type)
7673 op1->type->refCount++;
7674 }
7675 return 0x1;
7676 }
7677
7678 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
7679 {
7680 exp->type = 2;
7681 exp->string = PrintChar(~op1->c);
7682 if(!exp->expType)
7683 {
7684 exp->expType = op1->type;
7685 if(op1->type)
7686 op1->type->refCount++;
7687 }
7688 return 0x1;
7689 }
7690
7691 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
7692 {
7693 exp->type = 2;
7694 exp->string = PrintUChar(~op1->uc);
7695 if(!exp->expType)
7696 {
7697 exp->expType = op1->type;
7698 if(op1->type)
7699 op1->type->refCount++;
7700 }
7701 return 0x1;
7702 }
7703
7704 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7705 {
7706 int value2 = op2->i;
7707
7708 exp->type = 2;
7709 exp->string = PrintInt(op1->i &= value2);
7710 if(!exp->expType)
7711 {
7712 exp->expType = op1->type;
7713 if(op1->type)
7714 op1->type->refCount++;
7715 }
7716 return 0x1;
7717 }
7718
7719 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7720 {
7721 unsigned int value2 = op2->ui;
7722
7723 exp->type = 2;
7724 exp->string = PrintUInt(op1->ui &= value2);
7725 if(!exp->expType)
7726 {
7727 exp->expType = op1->type;
7728 if(op1->type)
7729 op1->type->refCount++;
7730 }
7731 return 0x1;
7732 }
7733
7734 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7735 {
7736 short value2 = op2->s;
7737
7738 exp->type = 2;
7739 exp->string = PrintShort(op1->s &= value2);
7740 if(!exp->expType)
7741 {
7742 exp->expType = op1->type;
7743 if(op1->type)
7744 op1->type->refCount++;
7745 }
7746 return 0x1;
7747 }
7748
7749 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7750 {
7751 unsigned short value2 = op2->us;
7752
7753 exp->type = 2;
7754 exp->string = PrintUShort(op1->us &= value2);
7755 if(!exp->expType)
7756 {
7757 exp->expType = op1->type;
7758 if(op1->type)
7759 op1->type->refCount++;
7760 }
7761 return 0x1;
7762 }
7763
7764 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7765 {
7766 char value2 = op2->c;
7767
7768 exp->type = 2;
7769 exp->string = PrintChar(op1->c &= value2);
7770 if(!exp->expType)
7771 {
7772 exp->expType = op1->type;
7773 if(op1->type)
7774 op1->type->refCount++;
7775 }
7776 return 0x1;
7777 }
7778
7779 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7780 {
7781 unsigned char value2 = op2->uc;
7782
7783 exp->type = 2;
7784 exp->string = PrintUChar(op1->uc &= value2);
7785 if(!exp->expType)
7786 {
7787 exp->expType = op1->type;
7788 if(op1->type)
7789 op1->type->refCount++;
7790 }
7791 return 0x1;
7792 }
7793
7794 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7795 {
7796 int value2 = op2->i;
7797
7798 exp->type = 2;
7799 exp->string = PrintInt(op1->i |= value2);
7800 if(!exp->expType)
7801 {
7802 exp->expType = op1->type;
7803 if(op1->type)
7804 op1->type->refCount++;
7805 }
7806 return 0x1;
7807 }
7808
7809 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7810 {
7811 unsigned int value2 = op2->ui;
7812
7813 exp->type = 2;
7814 exp->string = PrintUInt(op1->ui |= value2);
7815 if(!exp->expType)
7816 {
7817 exp->expType = op1->type;
7818 if(op1->type)
7819 op1->type->refCount++;
7820 }
7821 return 0x1;
7822 }
7823
7824 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7825 {
7826 short value2 = op2->s;
7827
7828 exp->type = 2;
7829 exp->string = PrintShort(op1->s |= value2);
7830 if(!exp->expType)
7831 {
7832 exp->expType = op1->type;
7833 if(op1->type)
7834 op1->type->refCount++;
7835 }
7836 return 0x1;
7837 }
7838
7839 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7840 {
7841 unsigned short value2 = op2->us;
7842
7843 exp->type = 2;
7844 exp->string = PrintUShort(op1->us |= value2);
7845 if(!exp->expType)
7846 {
7847 exp->expType = op1->type;
7848 if(op1->type)
7849 op1->type->refCount++;
7850 }
7851 return 0x1;
7852 }
7853
7854 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7855 {
7856 char value2 = op2->c;
7857
7858 exp->type = 2;
7859 exp->string = PrintChar(op1->c |= value2);
7860 if(!exp->expType)
7861 {
7862 exp->expType = op1->type;
7863 if(op1->type)
7864 op1->type->refCount++;
7865 }
7866 return 0x1;
7867 }
7868
7869 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7870 {
7871 unsigned char value2 = op2->uc;
7872
7873 exp->type = 2;
7874 exp->string = PrintUChar(op1->uc |= value2);
7875 if(!exp->expType)
7876 {
7877 exp->expType = op1->type;
7878 if(op1->type)
7879 op1->type->refCount++;
7880 }
7881 return 0x1;
7882 }
7883
7884 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7885 {
7886 int value2 = op2->i;
7887
7888 exp->type = 2;
7889 exp->string = PrintInt(op1->i ^= value2);
7890 if(!exp->expType)
7891 {
7892 exp->expType = op1->type;
7893 if(op1->type)
7894 op1->type->refCount++;
7895 }
7896 return 0x1;
7897 }
7898
7899 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7900 {
7901 unsigned int value2 = op2->ui;
7902
7903 exp->type = 2;
7904 exp->string = PrintUInt(op1->ui ^= value2);
7905 if(!exp->expType)
7906 {
7907 exp->expType = op1->type;
7908 if(op1->type)
7909 op1->type->refCount++;
7910 }
7911 return 0x1;
7912 }
7913
7914 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7915 {
7916 short value2 = op2->s;
7917
7918 exp->type = 2;
7919 exp->string = PrintShort(op1->s ^= value2);
7920 if(!exp->expType)
7921 {
7922 exp->expType = op1->type;
7923 if(op1->type)
7924 op1->type->refCount++;
7925 }
7926 return 0x1;
7927 }
7928
7929 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7930 {
7931 unsigned short value2 = op2->us;
7932
7933 exp->type = 2;
7934 exp->string = PrintUShort(op1->us ^= value2);
7935 if(!exp->expType)
7936 {
7937 exp->expType = op1->type;
7938 if(op1->type)
7939 op1->type->refCount++;
7940 }
7941 return 0x1;
7942 }
7943
7944 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7945 {
7946 char value2 = op2->c;
7947
7948 exp->type = 2;
7949 exp->string = PrintChar(op1->c ^= value2);
7950 if(!exp->expType)
7951 {
7952 exp->expType = op1->type;
7953 if(op1->type)
7954 op1->type->refCount++;
7955 }
7956 return 0x1;
7957 }
7958
7959 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7960 {
7961 unsigned char value2 = op2->uc;
7962
7963 exp->type = 2;
7964 exp->string = PrintUChar(op1->uc ^= value2);
7965 if(!exp->expType)
7966 {
7967 exp->expType = op1->type;
7968 if(op1->type)
7969 op1->type->refCount++;
7970 }
7971 return 0x1;
7972 }
7973
7974 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7975 {
7976 int value2 = op2->i;
7977
7978 exp->type = 2;
7979 exp->string = PrintInt(op1->i <<= value2);
7980 if(!exp->expType)
7981 {
7982 exp->expType = op1->type;
7983 if(op1->type)
7984 op1->type->refCount++;
7985 }
7986 return 0x1;
7987 }
7988
7989 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7990 {
7991 unsigned int value2 = op2->ui;
7992
7993 exp->type = 2;
7994 exp->string = PrintUInt(op1->ui <<= value2);
7995 if(!exp->expType)
7996 {
7997 exp->expType = op1->type;
7998 if(op1->type)
7999 op1->type->refCount++;
8000 }
8001 return 0x1;
8002 }
8003
8004 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8005 {
8006 short value2 = op2->s;
8007
8008 exp->type = 2;
8009 exp->string = PrintShort(op1->s <<= value2);
8010 if(!exp->expType)
8011 {
8012 exp->expType = op1->type;
8013 if(op1->type)
8014 op1->type->refCount++;
8015 }
8016 return 0x1;
8017 }
8018
8019 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8020 {
8021 unsigned short value2 = op2->us;
8022
8023 exp->type = 2;
8024 exp->string = PrintUShort(op1->us <<= value2);
8025 if(!exp->expType)
8026 {
8027 exp->expType = op1->type;
8028 if(op1->type)
8029 op1->type->refCount++;
8030 }
8031 return 0x1;
8032 }
8033
8034 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8035 {
8036 char value2 = op2->c;
8037
8038 exp->type = 2;
8039 exp->string = PrintChar(op1->c <<= value2);
8040 if(!exp->expType)
8041 {
8042 exp->expType = op1->type;
8043 if(op1->type)
8044 op1->type->refCount++;
8045 }
8046 return 0x1;
8047 }
8048
8049 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8050 {
8051 unsigned char value2 = op2->uc;
8052
8053 exp->type = 2;
8054 exp->string = PrintUChar(op1->uc <<= value2);
8055 if(!exp->expType)
8056 {
8057 exp->expType = op1->type;
8058 if(op1->type)
8059 op1->type->refCount++;
8060 }
8061 return 0x1;
8062 }
8063
8064 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8065 {
8066 int value2 = op2->i;
8067
8068 exp->type = 2;
8069 exp->string = PrintInt(op1->i >>= value2);
8070 if(!exp->expType)
8071 {
8072 exp->expType = op1->type;
8073 if(op1->type)
8074 op1->type->refCount++;
8075 }
8076 return 0x1;
8077 }
8078
8079 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8080 {
8081 unsigned int value2 = op2->ui;
8082
8083 exp->type = 2;
8084 exp->string = PrintUInt(op1->ui >>= value2);
8085 if(!exp->expType)
8086 {
8087 exp->expType = op1->type;
8088 if(op1->type)
8089 op1->type->refCount++;
8090 }
8091 return 0x1;
8092 }
8093
8094 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8095 {
8096 short value2 = op2->s;
8097
8098 exp->type = 2;
8099 exp->string = PrintShort(op1->s >>= value2);
8100 if(!exp->expType)
8101 {
8102 exp->expType = op1->type;
8103 if(op1->type)
8104 op1->type->refCount++;
8105 }
8106 return 0x1;
8107 }
8108
8109 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8110 {
8111 unsigned short value2 = op2->us;
8112
8113 exp->type = 2;
8114 exp->string = PrintUShort(op1->us >>= value2);
8115 if(!exp->expType)
8116 {
8117 exp->expType = op1->type;
8118 if(op1->type)
8119 op1->type->refCount++;
8120 }
8121 return 0x1;
8122 }
8123
8124 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8125 {
8126 char value2 = op2->c;
8127
8128 exp->type = 2;
8129 exp->string = PrintChar(op1->c >>= value2);
8130 if(!exp->expType)
8131 {
8132 exp->expType = op1->type;
8133 if(op1->type)
8134 op1->type->refCount++;
8135 }
8136 return 0x1;
8137 }
8138
8139 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8140 {
8141 unsigned char value2 = op2->uc;
8142
8143 exp->type = 2;
8144 exp->string = PrintUChar(op1->uc >>= value2);
8145 if(!exp->expType)
8146 {
8147 exp->expType = op1->type;
8148 if(op1->type)
8149 op1->type->refCount++;
8150 }
8151 return 0x1;
8152 }
8153
8154 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
8155 {
8156 exp->type = 2;
8157 exp->string = PrintInt(!op1->i);
8158 if(!exp->expType)
8159 {
8160 exp->expType = op1->type;
8161 if(op1->type)
8162 op1->type->refCount++;
8163 }
8164 return 0x1;
8165 }
8166
8167 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
8168 {
8169 exp->type = 2;
8170 exp->string = PrintUInt(!op1->ui);
8171 if(!exp->expType)
8172 {
8173 exp->expType = op1->type;
8174 if(op1->type)
8175 op1->type->refCount++;
8176 }
8177 return 0x1;
8178 }
8179
8180 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
8181 {
8182 exp->type = 2;
8183 exp->string = PrintShort(!op1->s);
8184 if(!exp->expType)
8185 {
8186 exp->expType = op1->type;
8187 if(op1->type)
8188 op1->type->refCount++;
8189 }
8190 return 0x1;
8191 }
8192
8193 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
8194 {
8195 exp->type = 2;
8196 exp->string = PrintUShort(!op1->us);
8197 if(!exp->expType)
8198 {
8199 exp->expType = op1->type;
8200 if(op1->type)
8201 op1->type->refCount++;
8202 }
8203 return 0x1;
8204 }
8205
8206 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
8207 {
8208 exp->type = 2;
8209 exp->string = PrintChar(!op1->c);
8210 if(!exp->expType)
8211 {
8212 exp->expType = op1->type;
8213 if(op1->type)
8214 op1->type->refCount++;
8215 }
8216 return 0x1;
8217 }
8218
8219 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
8220 {
8221 exp->type = 2;
8222 exp->string = PrintUChar(!op1->uc);
8223 if(!exp->expType)
8224 {
8225 exp->expType = op1->type;
8226 if(op1->type)
8227 op1->type->refCount++;
8228 }
8229 return 0x1;
8230 }
8231
8232 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8233 {
8234 int value2 = op2->i;
8235
8236 exp->type = 2;
8237 exp->string = PrintInt(op1->i == value2);
8238 if(!exp->expType)
8239 {
8240 exp->expType = op1->type;
8241 if(op1->type)
8242 op1->type->refCount++;
8243 }
8244 return 0x1;
8245 }
8246
8247 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8248 {
8249 unsigned int value2 = op2->ui;
8250
8251 exp->type = 2;
8252 exp->string = PrintUInt(op1->ui == value2);
8253 if(!exp->expType)
8254 {
8255 exp->expType = op1->type;
8256 if(op1->type)
8257 op1->type->refCount++;
8258 }
8259 return 0x1;
8260 }
8261
8262 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8263 {
8264 short value2 = op2->s;
8265
8266 exp->type = 2;
8267 exp->string = PrintShort(op1->s == value2);
8268 if(!exp->expType)
8269 {
8270 exp->expType = op1->type;
8271 if(op1->type)
8272 op1->type->refCount++;
8273 }
8274 return 0x1;
8275 }
8276
8277 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8278 {
8279 unsigned short value2 = op2->us;
8280
8281 exp->type = 2;
8282 exp->string = PrintUShort(op1->us == value2);
8283 if(!exp->expType)
8284 {
8285 exp->expType = op1->type;
8286 if(op1->type)
8287 op1->type->refCount++;
8288 }
8289 return 0x1;
8290 }
8291
8292 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8293 {
8294 char value2 = op2->c;
8295
8296 exp->type = 2;
8297 exp->string = PrintChar(op1->c == value2);
8298 if(!exp->expType)
8299 {
8300 exp->expType = op1->type;
8301 if(op1->type)
8302 op1->type->refCount++;
8303 }
8304 return 0x1;
8305 }
8306
8307 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8308 {
8309 unsigned char value2 = op2->uc;
8310
8311 exp->type = 2;
8312 exp->string = PrintUChar(op1->uc == value2);
8313 if(!exp->expType)
8314 {
8315 exp->expType = op1->type;
8316 if(op1->type)
8317 op1->type->refCount++;
8318 }
8319 return 0x1;
8320 }
8321
8322 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8323 {
8324 float value2 = op2->f;
8325
8326 exp->type = 2;
8327 exp->string = PrintFloat(op1->f == value2);
8328 if(!exp->expType)
8329 {
8330 exp->expType = op1->type;
8331 if(op1->type)
8332 op1->type->refCount++;
8333 }
8334 return 0x1;
8335 }
8336
8337 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8338 {
8339 double value2 = op2->d;
8340
8341 exp->type = 2;
8342 exp->string = PrintDouble(op1->d == value2);
8343 if(!exp->expType)
8344 {
8345 exp->expType = op1->type;
8346 if(op1->type)
8347 op1->type->refCount++;
8348 }
8349 return 0x1;
8350 }
8351
8352 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8353 {
8354 int value2 = op2->i;
8355
8356 exp->type = 2;
8357 exp->string = PrintInt(op1->i != value2);
8358 if(!exp->expType)
8359 {
8360 exp->expType = op1->type;
8361 if(op1->type)
8362 op1->type->refCount++;
8363 }
8364 return 0x1;
8365 }
8366
8367 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8368 {
8369 unsigned int value2 = op2->ui;
8370
8371 exp->type = 2;
8372 exp->string = PrintUInt(op1->ui != value2);
8373 if(!exp->expType)
8374 {
8375 exp->expType = op1->type;
8376 if(op1->type)
8377 op1->type->refCount++;
8378 }
8379 return 0x1;
8380 }
8381
8382 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8383 {
8384 short value2 = op2->s;
8385
8386 exp->type = 2;
8387 exp->string = PrintShort(op1->s != value2);
8388 if(!exp->expType)
8389 {
8390 exp->expType = op1->type;
8391 if(op1->type)
8392 op1->type->refCount++;
8393 }
8394 return 0x1;
8395 }
8396
8397 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8398 {
8399 unsigned short value2 = op2->us;
8400
8401 exp->type = 2;
8402 exp->string = PrintUShort(op1->us != value2);
8403 if(!exp->expType)
8404 {
8405 exp->expType = op1->type;
8406 if(op1->type)
8407 op1->type->refCount++;
8408 }
8409 return 0x1;
8410 }
8411
8412 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8413 {
8414 char value2 = op2->c;
8415
8416 exp->type = 2;
8417 exp->string = PrintChar(op1->c != value2);
8418 if(!exp->expType)
8419 {
8420 exp->expType = op1->type;
8421 if(op1->type)
8422 op1->type->refCount++;
8423 }
8424 return 0x1;
8425 }
8426
8427 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8428 {
8429 unsigned char value2 = op2->uc;
8430
8431 exp->type = 2;
8432 exp->string = PrintUChar(op1->uc != value2);
8433 if(!exp->expType)
8434 {
8435 exp->expType = op1->type;
8436 if(op1->type)
8437 op1->type->refCount++;
8438 }
8439 return 0x1;
8440 }
8441
8442 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8443 {
8444 float value2 = op2->f;
8445
8446 exp->type = 2;
8447 exp->string = PrintFloat(op1->f != value2);
8448 if(!exp->expType)
8449 {
8450 exp->expType = op1->type;
8451 if(op1->type)
8452 op1->type->refCount++;
8453 }
8454 return 0x1;
8455 }
8456
8457 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8458 {
8459 double value2 = op2->d;
8460
8461 exp->type = 2;
8462 exp->string = PrintDouble(op1->d != value2);
8463 if(!exp->expType)
8464 {
8465 exp->expType = op1->type;
8466 if(op1->type)
8467 op1->type->refCount++;
8468 }
8469 return 0x1;
8470 }
8471
8472 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8473 {
8474 int value2 = op2->i;
8475
8476 exp->type = 2;
8477 exp->string = PrintInt(op1->i && value2);
8478 if(!exp->expType)
8479 {
8480 exp->expType = op1->type;
8481 if(op1->type)
8482 op1->type->refCount++;
8483 }
8484 return 0x1;
8485 }
8486
8487 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8488 {
8489 unsigned int value2 = op2->ui;
8490
8491 exp->type = 2;
8492 exp->string = PrintUInt(op1->ui && value2);
8493 if(!exp->expType)
8494 {
8495 exp->expType = op1->type;
8496 if(op1->type)
8497 op1->type->refCount++;
8498 }
8499 return 0x1;
8500 }
8501
8502 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8503 {
8504 short value2 = op2->s;
8505
8506 exp->type = 2;
8507 exp->string = PrintShort(op1->s && value2);
8508 if(!exp->expType)
8509 {
8510 exp->expType = op1->type;
8511 if(op1->type)
8512 op1->type->refCount++;
8513 }
8514 return 0x1;
8515 }
8516
8517 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8518 {
8519 unsigned short value2 = op2->us;
8520
8521 exp->type = 2;
8522 exp->string = PrintUShort(op1->us && value2);
8523 if(!exp->expType)
8524 {
8525 exp->expType = op1->type;
8526 if(op1->type)
8527 op1->type->refCount++;
8528 }
8529 return 0x1;
8530 }
8531
8532 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8533 {
8534 char value2 = op2->c;
8535
8536 exp->type = 2;
8537 exp->string = PrintChar(op1->c && value2);
8538 if(!exp->expType)
8539 {
8540 exp->expType = op1->type;
8541 if(op1->type)
8542 op1->type->refCount++;
8543 }
8544 return 0x1;
8545 }
8546
8547 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8548 {
8549 unsigned char value2 = op2->uc;
8550
8551 exp->type = 2;
8552 exp->string = PrintUChar(op1->uc && value2);
8553 if(!exp->expType)
8554 {
8555 exp->expType = op1->type;
8556 if(op1->type)
8557 op1->type->refCount++;
8558 }
8559 return 0x1;
8560 }
8561
8562 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8563 {
8564 float value2 = op2->f;
8565
8566 exp->type = 2;
8567 exp->string = PrintFloat(op1->f && value2);
8568 if(!exp->expType)
8569 {
8570 exp->expType = op1->type;
8571 if(op1->type)
8572 op1->type->refCount++;
8573 }
8574 return 0x1;
8575 }
8576
8577 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8578 {
8579 double value2 = op2->d;
8580
8581 exp->type = 2;
8582 exp->string = PrintDouble(op1->d && value2);
8583 if(!exp->expType)
8584 {
8585 exp->expType = op1->type;
8586 if(op1->type)
8587 op1->type->refCount++;
8588 }
8589 return 0x1;
8590 }
8591
8592 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8593 {
8594 int value2 = op2->i;
8595
8596 exp->type = 2;
8597 exp->string = PrintInt(op1->i || value2);
8598 if(!exp->expType)
8599 {
8600 exp->expType = op1->type;
8601 if(op1->type)
8602 op1->type->refCount++;
8603 }
8604 return 0x1;
8605 }
8606
8607 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8608 {
8609 unsigned int value2 = op2->ui;
8610
8611 exp->type = 2;
8612 exp->string = PrintUInt(op1->ui || value2);
8613 if(!exp->expType)
8614 {
8615 exp->expType = op1->type;
8616 if(op1->type)
8617 op1->type->refCount++;
8618 }
8619 return 0x1;
8620 }
8621
8622 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8623 {
8624 short value2 = op2->s;
8625
8626 exp->type = 2;
8627 exp->string = PrintShort(op1->s || value2);
8628 if(!exp->expType)
8629 {
8630 exp->expType = op1->type;
8631 if(op1->type)
8632 op1->type->refCount++;
8633 }
8634 return 0x1;
8635 }
8636
8637 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8638 {
8639 unsigned short value2 = op2->us;
8640
8641 exp->type = 2;
8642 exp->string = PrintUShort(op1->us || value2);
8643 if(!exp->expType)
8644 {
8645 exp->expType = op1->type;
8646 if(op1->type)
8647 op1->type->refCount++;
8648 }
8649 return 0x1;
8650 }
8651
8652 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8653 {
8654 char value2 = op2->c;
8655
8656 exp->type = 2;
8657 exp->string = PrintChar(op1->c || value2);
8658 if(!exp->expType)
8659 {
8660 exp->expType = op1->type;
8661 if(op1->type)
8662 op1->type->refCount++;
8663 }
8664 return 0x1;
8665 }
8666
8667 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8668 {
8669 unsigned char value2 = op2->uc;
8670
8671 exp->type = 2;
8672 exp->string = PrintUChar(op1->uc || value2);
8673 if(!exp->expType)
8674 {
8675 exp->expType = op1->type;
8676 if(op1->type)
8677 op1->type->refCount++;
8678 }
8679 return 0x1;
8680 }
8681
8682 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8683 {
8684 float value2 = op2->f;
8685
8686 exp->type = 2;
8687 exp->string = PrintFloat(op1->f || value2);
8688 if(!exp->expType)
8689 {
8690 exp->expType = op1->type;
8691 if(op1->type)
8692 op1->type->refCount++;
8693 }
8694 return 0x1;
8695 }
8696
8697 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8698 {
8699 double value2 = op2->d;
8700
8701 exp->type = 2;
8702 exp->string = PrintDouble(op1->d || value2);
8703 if(!exp->expType)
8704 {
8705 exp->expType = op1->type;
8706 if(op1->type)
8707 op1->type->refCount++;
8708 }
8709 return 0x1;
8710 }
8711
8712 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8713 {
8714 int value2 = op2->i;
8715
8716 exp->type = 2;
8717 exp->string = PrintInt(op1->i > value2);
8718 if(!exp->expType)
8719 {
8720 exp->expType = op1->type;
8721 if(op1->type)
8722 op1->type->refCount++;
8723 }
8724 return 0x1;
8725 }
8726
8727 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8728 {
8729 unsigned int value2 = op2->ui;
8730
8731 exp->type = 2;
8732 exp->string = PrintUInt(op1->ui > value2);
8733 if(!exp->expType)
8734 {
8735 exp->expType = op1->type;
8736 if(op1->type)
8737 op1->type->refCount++;
8738 }
8739 return 0x1;
8740 }
8741
8742 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8743 {
8744 short value2 = op2->s;
8745
8746 exp->type = 2;
8747 exp->string = PrintShort(op1->s > value2);
8748 if(!exp->expType)
8749 {
8750 exp->expType = op1->type;
8751 if(op1->type)
8752 op1->type->refCount++;
8753 }
8754 return 0x1;
8755 }
8756
8757 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8758 {
8759 unsigned short value2 = op2->us;
8760
8761 exp->type = 2;
8762 exp->string = PrintUShort(op1->us > value2);
8763 if(!exp->expType)
8764 {
8765 exp->expType = op1->type;
8766 if(op1->type)
8767 op1->type->refCount++;
8768 }
8769 return 0x1;
8770 }
8771
8772 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8773 {
8774 char value2 = op2->c;
8775
8776 exp->type = 2;
8777 exp->string = PrintChar(op1->c > value2);
8778 if(!exp->expType)
8779 {
8780 exp->expType = op1->type;
8781 if(op1->type)
8782 op1->type->refCount++;
8783 }
8784 return 0x1;
8785 }
8786
8787 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8788 {
8789 unsigned char value2 = op2->uc;
8790
8791 exp->type = 2;
8792 exp->string = PrintUChar(op1->uc > value2);
8793 if(!exp->expType)
8794 {
8795 exp->expType = op1->type;
8796 if(op1->type)
8797 op1->type->refCount++;
8798 }
8799 return 0x1;
8800 }
8801
8802 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8803 {
8804 float value2 = op2->f;
8805
8806 exp->type = 2;
8807 exp->string = PrintFloat(op1->f > value2);
8808 if(!exp->expType)
8809 {
8810 exp->expType = op1->type;
8811 if(op1->type)
8812 op1->type->refCount++;
8813 }
8814 return 0x1;
8815 }
8816
8817 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8818 {
8819 double value2 = op2->d;
8820
8821 exp->type = 2;
8822 exp->string = PrintDouble(op1->d > value2);
8823 if(!exp->expType)
8824 {
8825 exp->expType = op1->type;
8826 if(op1->type)
8827 op1->type->refCount++;
8828 }
8829 return 0x1;
8830 }
8831
8832 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8833 {
8834 int value2 = op2->i;
8835
8836 exp->type = 2;
8837 exp->string = PrintInt(op1->i < value2);
8838 if(!exp->expType)
8839 {
8840 exp->expType = op1->type;
8841 if(op1->type)
8842 op1->type->refCount++;
8843 }
8844 return 0x1;
8845 }
8846
8847 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8848 {
8849 unsigned int value2 = op2->ui;
8850
8851 exp->type = 2;
8852 exp->string = PrintUInt(op1->ui < value2);
8853 if(!exp->expType)
8854 {
8855 exp->expType = op1->type;
8856 if(op1->type)
8857 op1->type->refCount++;
8858 }
8859 return 0x1;
8860 }
8861
8862 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8863 {
8864 short value2 = op2->s;
8865
8866 exp->type = 2;
8867 exp->string = PrintShort(op1->s < value2);
8868 if(!exp->expType)
8869 {
8870 exp->expType = op1->type;
8871 if(op1->type)
8872 op1->type->refCount++;
8873 }
8874 return 0x1;
8875 }
8876
8877 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8878 {
8879 unsigned short value2 = op2->us;
8880
8881 exp->type = 2;
8882 exp->string = PrintUShort(op1->us < value2);
8883 if(!exp->expType)
8884 {
8885 exp->expType = op1->type;
8886 if(op1->type)
8887 op1->type->refCount++;
8888 }
8889 return 0x1;
8890 }
8891
8892 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8893 {
8894 char value2 = op2->c;
8895
8896 exp->type = 2;
8897 exp->string = PrintChar(op1->c < value2);
8898 if(!exp->expType)
8899 {
8900 exp->expType = op1->type;
8901 if(op1->type)
8902 op1->type->refCount++;
8903 }
8904 return 0x1;
8905 }
8906
8907 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8908 {
8909 unsigned char value2 = op2->uc;
8910
8911 exp->type = 2;
8912 exp->string = PrintUChar(op1->uc < value2);
8913 if(!exp->expType)
8914 {
8915 exp->expType = op1->type;
8916 if(op1->type)
8917 op1->type->refCount++;
8918 }
8919 return 0x1;
8920 }
8921
8922 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8923 {
8924 float value2 = op2->f;
8925
8926 exp->type = 2;
8927 exp->string = PrintFloat(op1->f < value2);
8928 if(!exp->expType)
8929 {
8930 exp->expType = op1->type;
8931 if(op1->type)
8932 op1->type->refCount++;
8933 }
8934 return 0x1;
8935 }
8936
8937 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8938 {
8939 double value2 = op2->d;
8940
8941 exp->type = 2;
8942 exp->string = PrintDouble(op1->d < value2);
8943 if(!exp->expType)
8944 {
8945 exp->expType = op1->type;
8946 if(op1->type)
8947 op1->type->refCount++;
8948 }
8949 return 0x1;
8950 }
8951
8952 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8953 {
8954 int value2 = op2->i;
8955
8956 exp->type = 2;
8957 exp->string = PrintInt(op1->i >= value2);
8958 if(!exp->expType)
8959 {
8960 exp->expType = op1->type;
8961 if(op1->type)
8962 op1->type->refCount++;
8963 }
8964 return 0x1;
8965 }
8966
8967 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8968 {
8969 unsigned int value2 = op2->ui;
8970
8971 exp->type = 2;
8972 exp->string = PrintUInt(op1->ui >= value2);
8973 if(!exp->expType)
8974 {
8975 exp->expType = op1->type;
8976 if(op1->type)
8977 op1->type->refCount++;
8978 }
8979 return 0x1;
8980 }
8981
8982 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8983 {
8984 short value2 = op2->s;
8985
8986 exp->type = 2;
8987 exp->string = PrintShort(op1->s >= value2);
8988 if(!exp->expType)
8989 {
8990 exp->expType = op1->type;
8991 if(op1->type)
8992 op1->type->refCount++;
8993 }
8994 return 0x1;
8995 }
8996
8997 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8998 {
8999 unsigned short value2 = op2->us;
9000
9001 exp->type = 2;
9002 exp->string = PrintUShort(op1->us >= value2);
9003 if(!exp->expType)
9004 {
9005 exp->expType = op1->type;
9006 if(op1->type)
9007 op1->type->refCount++;
9008 }
9009 return 0x1;
9010 }
9011
9012 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9013 {
9014 char value2 = op2->c;
9015
9016 exp->type = 2;
9017 exp->string = PrintChar(op1->c >= value2);
9018 if(!exp->expType)
9019 {
9020 exp->expType = op1->type;
9021 if(op1->type)
9022 op1->type->refCount++;
9023 }
9024 return 0x1;
9025 }
9026
9027 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9028 {
9029 unsigned char value2 = op2->uc;
9030
9031 exp->type = 2;
9032 exp->string = PrintUChar(op1->uc >= value2);
9033 if(!exp->expType)
9034 {
9035 exp->expType = op1->type;
9036 if(op1->type)
9037 op1->type->refCount++;
9038 }
9039 return 0x1;
9040 }
9041
9042 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9043 {
9044 float value2 = op2->f;
9045
9046 exp->type = 2;
9047 exp->string = PrintFloat(op1->f >= value2);
9048 if(!exp->expType)
9049 {
9050 exp->expType = op1->type;
9051 if(op1->type)
9052 op1->type->refCount++;
9053 }
9054 return 0x1;
9055 }
9056
9057 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9058 {
9059 double value2 = op2->d;
9060
9061 exp->type = 2;
9062 exp->string = PrintDouble(op1->d >= value2);
9063 if(!exp->expType)
9064 {
9065 exp->expType = op1->type;
9066 if(op1->type)
9067 op1->type->refCount++;
9068 }
9069 return 0x1;
9070 }
9071
9072 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9073 {
9074 int value2 = op2->i;
9075
9076 exp->type = 2;
9077 exp->string = PrintInt(op1->i <= value2);
9078 if(!exp->expType)
9079 {
9080 exp->expType = op1->type;
9081 if(op1->type)
9082 op1->type->refCount++;
9083 }
9084 return 0x1;
9085 }
9086
9087 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9088 {
9089 unsigned int value2 = op2->ui;
9090
9091 exp->type = 2;
9092 exp->string = PrintUInt(op1->ui <= value2);
9093 if(!exp->expType)
9094 {
9095 exp->expType = op1->type;
9096 if(op1->type)
9097 op1->type->refCount++;
9098 }
9099 return 0x1;
9100 }
9101
9102 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9103 {
9104 short value2 = op2->s;
9105
9106 exp->type = 2;
9107 exp->string = PrintShort(op1->s <= value2);
9108 if(!exp->expType)
9109 {
9110 exp->expType = op1->type;
9111 if(op1->type)
9112 op1->type->refCount++;
9113 }
9114 return 0x1;
9115 }
9116
9117 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9118 {
9119 unsigned short value2 = op2->us;
9120
9121 exp->type = 2;
9122 exp->string = PrintUShort(op1->us <= value2);
9123 if(!exp->expType)
9124 {
9125 exp->expType = op1->type;
9126 if(op1->type)
9127 op1->type->refCount++;
9128 }
9129 return 0x1;
9130 }
9131
9132 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9133 {
9134 char value2 = op2->c;
9135
9136 exp->type = 2;
9137 exp->string = PrintChar(op1->c <= value2);
9138 if(!exp->expType)
9139 {
9140 exp->expType = op1->type;
9141 if(op1->type)
9142 op1->type->refCount++;
9143 }
9144 return 0x1;
9145 }
9146
9147 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9148 {
9149 unsigned char value2 = op2->uc;
9150
9151 exp->type = 2;
9152 exp->string = PrintUChar(op1->uc <= value2);
9153 if(!exp->expType)
9154 {
9155 exp->expType = op1->type;
9156 if(op1->type)
9157 op1->type->refCount++;
9158 }
9159 return 0x1;
9160 }
9161
9162 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9163 {
9164 float value2 = op2->f;
9165
9166 exp->type = 2;
9167 exp->string = PrintFloat(op1->f <= value2);
9168 if(!exp->expType)
9169 {
9170 exp->expType = op1->type;
9171 if(op1->type)
9172 op1->type->refCount++;
9173 }
9174 return 0x1;
9175 }
9176
9177 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9178 {
9179 double value2 = op2->d;
9180
9181 exp->type = 2;
9182 exp->string = PrintDouble(op1->d <= value2);
9183 if(!exp->expType)
9184 {
9185 exp->expType = op1->type;
9186 if(op1->type)
9187 op1->type->refCount++;
9188 }
9189 return 0x1;
9190 }
9191
9192 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9193 {
9194 exp->type = 2;
9195 exp->string = PrintInt(op1->i ? op2->i : op3->i);
9196 if(!exp->expType)
9197 {
9198 exp->expType = op1->type;
9199 if(op1->type)
9200 op1->type->refCount++;
9201 }
9202 return 0x1;
9203 }
9204
9205 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9206 {
9207 exp->type = 2;
9208 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
9209 if(!exp->expType)
9210 {
9211 exp->expType = op1->type;
9212 if(op1->type)
9213 op1->type->refCount++;
9214 }
9215 return 0x1;
9216 }
9217
9218 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9219 {
9220 exp->type = 2;
9221 exp->string = PrintShort(op1->s ? op2->s : op3->s);
9222 if(!exp->expType)
9223 {
9224 exp->expType = op1->type;
9225 if(op1->type)
9226 op1->type->refCount++;
9227 }
9228 return 0x1;
9229 }
9230
9231 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9232 {
9233 exp->type = 2;
9234 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
9235 if(!exp->expType)
9236 {
9237 exp->expType = op1->type;
9238 if(op1->type)
9239 op1->type->refCount++;
9240 }
9241 return 0x1;
9242 }
9243
9244 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9245 {
9246 exp->type = 2;
9247 exp->string = PrintChar(op1->c ? op2->c : op3->c);
9248 if(!exp->expType)
9249 {
9250 exp->expType = op1->type;
9251 if(op1->type)
9252 op1->type->refCount++;
9253 }
9254 return 0x1;
9255 }
9256
9257 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9258 {
9259 exp->type = 2;
9260 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
9261 if(!exp->expType)
9262 {
9263 exp->expType = op1->type;
9264 if(op1->type)
9265 op1->type->refCount++;
9266 }
9267 return 0x1;
9268 }
9269
9270 static unsigned int FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9271 {
9272 exp->type = 2;
9273 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
9274 if(!exp->expType)
9275 {
9276 exp->expType = op1->type;
9277 if(op1->type)
9278 op1->type->refCount++;
9279 }
9280 return 0x1;
9281 }
9282
9283 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9284 {
9285 exp->type = 2;
9286 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
9287 if(!exp->expType)
9288 {
9289 exp->expType = op1->type;
9290 if(op1->type)
9291 op1->type->refCount++;
9292 }
9293 return 0x1;
9294 }
9295
9296 struct OpTable intOps = 
9297 {
9298 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
9299 };
9300
9301 struct OpTable uintOps = 
9302 {
9303 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
9304 };
9305
9306 struct OpTable shortOps = 
9307 {
9308 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
9309 };
9310
9311 struct OpTable ushortOps = 
9312 {
9313 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
9314 };
9315
9316 struct OpTable floatOps = 
9317 {
9318 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
9319 };
9320
9321 struct OpTable doubleOps = 
9322 {
9323 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
9324 };
9325
9326 struct OpTable charOps = 
9327 {
9328 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
9329 };
9330
9331 struct OpTable ucharOps = 
9332 {
9333 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
9334 };
9335
9336 void ReadString(char * output, char * string)
9337 {
9338 int len = strlen(string);
9339 int c, d = 0;
9340 unsigned int quoted = 0x0, escaped = 0x0;
9341
9342 for(c = 0; c < len; c++)
9343 {
9344 char ch = string[c];
9345
9346 if(escaped)
9347 {
9348 switch(ch)
9349 {
9350 case 'n':
9351 output[d] = '\n';
9352 break;
9353 case 't':
9354 output[d] = '\t';
9355 break;
9356 case 'a':
9357 output[d] = '\a';
9358 break;
9359 case 'b':
9360 output[d] = '\b';
9361 break;
9362 case 'f':
9363 output[d] = '\f';
9364 break;
9365 case 'r':
9366 output[d] = '\r';
9367 break;
9368 case 'v':
9369 output[d] = '\v';
9370 break;
9371 case '\\':
9372 output[d] = '\\';
9373 break;
9374 case '\"':
9375 output[d] = '\"';
9376 break;
9377 default:
9378 output[d++] = '\\';
9379 output[d] = ch;
9380 }
9381 d++;
9382 escaped = 0x0;
9383 }
9384 else
9385 {
9386 if(ch == '\"')
9387 quoted ^= 0x1;
9388 else if(quoted)
9389 {
9390 if(ch == '\\')
9391 escaped = 0x1;
9392 else
9393 output[d++] = ch;
9394 }
9395 }
9396 }
9397 output[d] = '\0';
9398 }
9399
9400 extern long long __ecereNameSpace__ecere__com___strtoi64(char *  string, char * *  endString, int base);
9401
9402 extern uint64 __ecereNameSpace__ecere__com___strtoui64(char *  string, char * *  endString, int base);
9403
9404 extern double strtod(char * , char * * );
9405
9406 struct Operand GetOperand(struct Expression * exp)
9407 {
9408 struct Operand op = 
9409 {
9410 0, 0, 0, 0, 
9411 {
9412 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
9413 }
9414 };
9415 struct Type * type = exp->expType;
9416
9417 if(type)
9418 {
9419 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9420 {
9421 if(!type->_class->registered->dataType)
9422 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9423 type = type->_class->registered->dataType;
9424 }
9425 op.kind = type->kind;
9426 op.type = exp->expType;
9427 if(exp->isConstant && exp->type == 2)
9428 {
9429 switch(op.kind)
9430 {
9431 case 1:
9432 {
9433 if(exp->constant[0] == '\'')
9434 op.c = exp->constant[1];
9435 else if(type->isSigned)
9436 {
9437 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9438 op.ops = charOps;
9439 }
9440 else
9441 {
9442 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9443 op.ops = ucharOps;
9444 }
9445 break;
9446 }
9447 case 2:
9448 if(type->isSigned)
9449 {
9450 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9451 op.ops = shortOps;
9452 }
9453 else
9454 {
9455 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9456 op.ops = ushortOps;
9457 }
9458 break;
9459 case 3:
9460 case 5:
9461 if(type->isSigned)
9462 {
9463 op.i = strtol(exp->constant, (((void *)0)), 0);
9464 op.ops = intOps;
9465 }
9466 else
9467 {
9468 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9469 op.ops = uintOps;
9470 }
9471 op.kind = 3;
9472 break;
9473 case 4:
9474 if(type->isSigned)
9475 {
9476 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9477 op.ops = intOps;
9478 }
9479 else
9480 {
9481 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9482 op.ops = uintOps;
9483 }
9484 op.kind = 3;
9485 break;
9486 case 22:
9487 if(type->isSigned)
9488 {
9489 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9490 op.ops = intOps;
9491 }
9492 else
9493 {
9494 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9495 op.ops = uintOps;
9496 }
9497 op.kind = 3;
9498 break;
9499 case 23:
9500 if(type->isSigned)
9501 {
9502 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9503 op.ops = intOps;
9504 }
9505 else
9506 {
9507 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9508 op.ops = uintOps;
9509 }
9510 op.kind = 3;
9511 break;
9512 case 6:
9513 op.f = (float)strtod(exp->constant, (((void *)0)));
9514 op.ops = floatOps;
9515 break;
9516 case 7:
9517 op.d = (double)strtod(exp->constant, (((void *)0)));
9518 op.ops = doubleOps;
9519 break;
9520 case 12:
9521 case 13:
9522 case 8:
9523 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9524 op.kind = 13;
9525 op.ops = uintOps;
9526 break;
9527 }
9528 }
9529 }
9530 return op;
9531 }
9532
9533 int __ecereVMethodID_class_OnGetString;
9534
9535 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9536
9537 static void UnusedFunction()
9538 {
9539 int a;
9540
9541 ((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);
9542 }
9543
9544 extern int __ecereVMethodID_class_OnGetString;
9545
9546 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9547 {
9548 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9549
9550 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9551 {
9552 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9553 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9554 else
9555 {
9556 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9557 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9558 struct Type * type;
9559 void * ptr = inst->data + dataMember->offset + offset;
9560 char * result = (((void *)0));
9561
9562 exp->loc = member->loc = inst->loc;
9563 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9564 if(!dataMember->dataType)
9565 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9566 type = dataMember->dataType;
9567 if(type->kind == 8)
9568 {
9569 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9570
9571 if(_class->type == 4)
9572 {
9573 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9574
9575 if(enumClass)
9576 {
9577 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9578 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9579
9580 for(item = e->values.first; item; item = item->next)
9581 {
9582 if((int)item->data == *(int *)ptr)
9583 {
9584 result = item->name;
9585 break;
9586 }
9587 }
9588 if(result)
9589 {
9590 exp->identifier = MkIdentifier(result);
9591 exp->type = 0;
9592 exp->destType = MkClassType(_class->fullName);
9593 ProcessExpressionType(exp);
9594 }
9595 }
9596 }
9597 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9598 {
9599 if(!_class->dataType)
9600 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9601 type = _class->dataType;
9602 }
9603 }
9604 if(!result)
9605 {
9606 switch(type->kind)
9607 {
9608 case 6:
9609 {
9610 FreeExpContents(exp);
9611 exp->constant = PrintFloat(*(float *)ptr);
9612 exp->type = 2;
9613 break;
9614 }
9615 case 7:
9616 {
9617 FreeExpContents(exp);
9618 exp->constant = PrintDouble(*(double *)ptr);
9619 exp->type = 2;
9620 break;
9621 }
9622 case 3:
9623 {
9624 FreeExpContents(exp);
9625 exp->constant = PrintInt(*(int *)ptr);
9626 exp->type = 2;
9627 break;
9628 }
9629 case 4:
9630 {
9631 FreeExpContents(exp);
9632 exp->constant = PrintInt64(*(long long *)ptr);
9633 exp->type = 2;
9634 break;
9635 }
9636 case 22:
9637 {
9638 FreeExpContents(exp);
9639 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9640 exp->type = 2;
9641 break;
9642 }
9643 case 23:
9644 {
9645 FreeExpContents(exp);
9646 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9647 exp->type = 2;
9648 break;
9649 }
9650 default:
9651 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9652 }
9653 }
9654 ListAdd(memberList, member);
9655 }
9656 if(parentDataMember->type == 1)
9657 break;
9658 }
9659 }
9660
9661 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9662
9663 void PopulateInstance(struct Instantiation * inst)
9664 {
9665 struct Symbol * classSym = inst->_class->symbol;
9666 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9667 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9668 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9669
9670 inst->members = MkListOne(MkMembersInitList(memberList));
9671 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9672 {
9673 if(!dataMember->isProperty)
9674 {
9675 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9676 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9677 else
9678 {
9679 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9680 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9681 struct Type * type;
9682 void * ptr = inst->data + dataMember->offset;
9683 char * result = (((void *)0));
9684
9685 exp->loc = member->loc = inst->loc;
9686 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9687 if(!dataMember->dataType)
9688 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9689 type = dataMember->dataType;
9690 if(type->kind == 8)
9691 {
9692 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9693
9694 if(_class->type == 4)
9695 {
9696 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9697
9698 if(enumClass)
9699 {
9700 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9701 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9702
9703 for(item = e->values.first; item; item = item->next)
9704 {
9705 if((int)item->data == *(int *)ptr)
9706 {
9707 result = item->name;
9708 break;
9709 }
9710 }
9711 }
9712 if(result)
9713 {
9714 exp->identifier = MkIdentifier(result);
9715 exp->type = 0;
9716 exp->destType = MkClassType(_class->fullName);
9717 ProcessExpressionType(exp);
9718 }
9719 }
9720 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9721 {
9722 if(!_class->dataType)
9723 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9724 type = _class->dataType;
9725 }
9726 }
9727 if(!result)
9728 {
9729 switch(type->kind)
9730 {
9731 case 6:
9732 {
9733 exp->constant = PrintFloat(*(float *)ptr);
9734 exp->type = 2;
9735 break;
9736 }
9737 case 7:
9738 {
9739 exp->constant = PrintDouble(*(double *)ptr);
9740 exp->type = 2;
9741 break;
9742 }
9743 case 3:
9744 {
9745 exp->constant = PrintInt(*(int *)ptr);
9746 exp->type = 2;
9747 break;
9748 }
9749 case 4:
9750 {
9751 exp->constant = PrintInt64(*(long long *)ptr);
9752 exp->type = 2;
9753 break;
9754 }
9755 case 22:
9756 {
9757 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9758 exp->type = 2;
9759 break;
9760 }
9761 default:
9762 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9763 }
9764 }
9765 ListAdd(memberList, member);
9766 }
9767 }
9768 }
9769 }
9770
9771 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);
9772
9773 extern void FreeInstance(struct Instantiation * inst);
9774
9775 void ComputeInstantiation(struct Expression * exp)
9776 {
9777 struct Instantiation * inst = exp->instance;
9778 struct MembersInit * members;
9779 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9780 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9781 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9782 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9783 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9784 int subMemberStackPos = 0;
9785 uint64 bits = 0;
9786
9787 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9788 {
9789 if(inst->data)
9790 return ;
9791 if(_class->type == 0 || _class->type == 5)
9792 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9793 else
9794 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9795 }
9796 if(inst->members)
9797 {
9798 for(members = (*inst->members).first; members; members = members->next)
9799 {
9800 switch(members->type)
9801 {
9802 case 0:
9803 {
9804 if(members->dataMembers)
9805 {
9806 struct MemberInit * member;
9807
9808 for(member = (*members->dataMembers).first; member; member = member->next)
9809 {
9810 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9811 unsigned int found = 0x0;
9812 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9813 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9814 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9815 unsigned int dataMemberOffset;
9816
9817 if(!ident)
9818 {
9819 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9820 if(curMember)
9821 {
9822 if(curMember->isProperty)
9823 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9824 else
9825 {
9826 dataMember = curMember;
9827 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9828 }
9829 found = 0x1;
9830 }
9831 }
9832 else
9833 {
9834 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9835 if(prop)
9836 {
9837 found = 0x1;
9838 if(prop->memberAccess == 1)
9839 {
9840 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9841 curClass = prop->_class;
9842 }
9843 }
9844 else
9845 {
9846 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9847 int _subMemberStackPos = 0;
9848
9849 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9850 if(dataMember)
9851 {
9852 found = 0x1;
9853 if(dataMember->memberAccess == 1)
9854 {
9855 curMember = dataMember;
9856 curClass = dataMember->_class;
9857 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
9858 subMemberStackPos = _subMemberStackPos;
9859 }
9860 }
9861 }
9862 }
9863 if(found && member->initializer && member->initializer->type == 0)
9864 {
9865 struct Expression * value = member->initializer->exp;
9866 struct Type * type = (((void *)0));
9867
9868 if(prop)
9869 {
9870 type = prop->dataType;
9871 }
9872 else if(dataMember)
9873 {
9874 if(!dataMember->dataType)
9875 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9876 type = dataMember->dataType;
9877 }
9878 if(ident && ident->next)
9879 {
9880 for(ident = ident->next; ident && type; ident = ident->next)
9881 {
9882 if(type->kind == 8)
9883 {
9884 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9885 if(prop)
9886 type = prop->dataType;
9887 else
9888 {
9889 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9890 if(dataMember)
9891 type = dataMember->dataType;
9892 }
9893 }
9894 else if(type->kind == 9 || type->kind == 10)
9895 {
9896 struct Type * memberType;
9897
9898 for(memberType = type->members.first; memberType; memberType = memberType->next)
9899 {
9900 if(!strcmp(memberType->name, ident->string))
9901 {
9902 type = memberType;
9903 break;
9904 }
9905 }
9906 }
9907 }
9908 }
9909 if(value)
9910 {
9911 FreeType(value->destType);
9912 value->destType = type;
9913 if(type)
9914 type->refCount++;
9915 ComputeExpression(value);
9916 }
9917 if(value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9918 {
9919 if(type->kind == 8)
9920 {
9921 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9922
9923 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9924 {
9925 if(!_class->dataType)
9926 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9927 type = _class->dataType;
9928 }
9929 }
9930 if(dataMember)
9931 {
9932 void * ptr = inst->data + dataMemberOffset;
9933
9934 if(value->type == 2)
9935 {
9936 switch(type->kind)
9937 {
9938 case 3:
9939 {
9940 GetInt(value, (int *)ptr);
9941 break;
9942 }
9943 case 4:
9944 {
9945 GetInt64(value, (long long *)ptr);
9946 break;
9947 }
9948 case 22:
9949 {
9950 GetIntPtr(value, (intptr_t *)ptr);
9951 break;
9952 }
9953 case 23:
9954 {
9955 GetIntSize(value, (ssize_t *)ptr);
9956 break;
9957 }
9958 case 6:
9959 {
9960 GetFloat(value, (float *)ptr);
9961 break;
9962 }
9963 case 7:
9964 {
9965 GetDouble(value, (double *)ptr);
9966 break;
9967 }
9968 }
9969 }
9970 else if(value->type == 1)
9971 {
9972 if(type->kind == 8)
9973 {
9974 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9975
9976 if(_class->type == 1)
9977 {
9978 ComputeTypeSize(type);
9979 if(value->instance->data)
9980 memcpy(ptr, value->instance->data, type->size);
9981 }
9982 }
9983 }
9984 }
9985 else if(prop)
9986 {
9987 if(value->type == 1 && value->instance->data)
9988 {
9989 void (* Set)(void *, void *) = (void *)prop->Set;
9990
9991 Set(inst->data, value->instance->data);
9992 PopulateInstance(inst);
9993 }
9994 else if(value->type == 2)
9995 {
9996 switch(type->kind)
9997 {
9998 case 7:
9999 {
10000 void (* Set)(void *, double) = (void *)prop->Set;
10001
10002 Set(inst->data, strtod(value->constant, (((void *)0))));
10003 break;
10004 }
10005 case 6:
10006 {
10007 void (* Set)(void *, float) = (void *)prop->Set;
10008
10009 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
10010 break;
10011 }
10012 case 3:
10013 {
10014 void (* Set)(void *, int) = (void *)prop->Set;
10015
10016 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
10017 break;
10018 }
10019 case 4:
10020 {
10021 void (* Set)(void *, long long) = (void *)prop->Set;
10022
10023 Set(inst->data, __ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10024 break;
10025 }
10026 case 22:
10027 {
10028 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10029
10030 Set(inst->data, (intptr_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10031 break;
10032 }
10033 case 23:
10034 {
10035 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10036
10037 Set(inst->data, (ssize_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10038 break;
10039 }
10040 }
10041 }
10042 else if(value->type == 3)
10043 {
10044 char temp[1024];
10045
10046 ReadString(temp, value->string);
10047 ((void (*)(void *, void *))(void *)prop->Set)(inst->data, temp);
10048 }
10049 }
10050 }
10051 else if(_class->type == 3)
10052 {
10053 if(prop)
10054 {
10055 if(value->type == 2)
10056 {
10057 if(type->kind == 8)
10058 {
10059 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10060
10061 if(_class->type == 3)
10062 {
10063 if(!_class->dataType)
10064 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10065 type = _class->dataType;
10066 }
10067 }
10068 switch(type->kind)
10069 {
10070 case 6:
10071 {
10072 float fValue;
10073 float (* Set)(float) = (void *)prop->Set;
10074
10075 GetFloat(member->initializer->exp, &fValue);
10076 exp->constant = PrintFloat(Set(fValue));
10077 exp->type = 2;
10078 break;
10079 }
10080 case 7:
10081 {
10082 double dValue;
10083 double (* Set)(double) = (void *)prop->Set;
10084
10085 GetDouble(member->initializer->exp, &dValue);
10086 exp->constant = PrintDouble(Set(dValue));
10087 exp->type = 2;
10088 break;
10089 }
10090 }
10091 }
10092 }
10093 }
10094 else if(_class->type == 2)
10095 {
10096 if(prop)
10097 {
10098 if(value->type == 1 && value->instance->data)
10099 {
10100 unsigned int (* Set)(void *) = (void *)prop->Set;
10101
10102 bits = Set(value->instance->data);
10103 }
10104 else if(value->type == 2)
10105 {
10106 }
10107 }
10108 else if(dataMember)
10109 {
10110 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
10111 struct Type * type;
10112 int part = 0;
10113
10114 GetInt(value, &part);
10115 bits = (bits & ~bitMember->mask);
10116 if(!bitMember->dataType)
10117 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
10118 type = bitMember->dataType;
10119 if(type->kind == 8 && type->_class && type->_class->registered)
10120 {
10121 if(!type->_class->registered->dataType)
10122 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
10123 type = type->_class->registered->dataType;
10124 }
10125 switch(type->kind)
10126 {
10127 case 1:
10128 if(type->isSigned)
10129 bits |= ((char)part << bitMember->pos);
10130 else
10131 bits |= ((unsigned char)part << bitMember->pos);
10132 break;
10133 case 2:
10134 if(type->isSigned)
10135 bits |= ((short)part << bitMember->pos);
10136 else
10137 bits |= ((unsigned short)part << bitMember->pos);
10138 break;
10139 case 3:
10140 case 5:
10141 if(type->isSigned)
10142 bits |= (part << bitMember->pos);
10143 else
10144 bits |= ((unsigned int)part << bitMember->pos);
10145 break;
10146 case 4:
10147 if(type->isSigned)
10148 bits |= ((long long)part << bitMember->pos);
10149 else
10150 bits |= ((uint64)part << bitMember->pos);
10151 break;
10152 case 22:
10153 if(type->isSigned)
10154 {
10155 bits |= ((intptr_t)part << bitMember->pos);
10156 }
10157 else
10158 {
10159 bits |= ((uintptr_t)part << bitMember->pos);
10160 }
10161 break;
10162 case 23:
10163 if(type->isSigned)
10164 {
10165 bits |= ((ssize_t)part << bitMember->pos);
10166 }
10167 else
10168 {
10169 bits |= ((size_t)part << bitMember->pos);
10170 }
10171 break;
10172 }
10173 }
10174 }
10175 }
10176 else
10177 {
10178 if(_class && _class->type == 3)
10179 {
10180 ComputeExpression(member->initializer->exp);
10181 exp->constant = member->initializer->exp->constant;
10182 exp->type = 2;
10183 member->initializer->exp->constant = (((void *)0));
10184 }
10185 }
10186 }
10187 }
10188 break;
10189 }
10190 }
10191 }
10192 }
10193 if(_class && _class->type == 2)
10194 {
10195 exp->constant = PrintHexUInt(bits);
10196 exp->type = 2;
10197 }
10198 if(exp->type != 1)
10199 {
10200 FreeInstance(inst);
10201 }
10202 }
10203
10204 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
10205 {
10206 if(exp->op.op == SIZEOF)
10207 {
10208 FreeExpContents(exp);
10209 exp->type = 2;
10210 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
10211 }
10212 else
10213 {
10214 if(!exp->op.exp1)
10215 {
10216 switch(exp->op.op)
10217 {
10218 case '+':
10219 {
10220 struct Expression * exp2 = exp->op.exp2;
10221
10222 exp->op.exp2 = (((void *)0));
10223 FreeExpContents(exp);
10224 FreeType(exp->expType);
10225 FreeType(exp->destType);
10226 *exp = *exp2;
10227 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
10228 break;
10229 }
10230 case '-':
10231 if(op1->ops.Neg)
10232 {
10233 FreeExpContents(exp);
10234 op1->ops.Neg(exp, op1);
10235 }
10236 break;
10237 case '~':
10238 if(op1->ops.BitNot)
10239 {
10240 FreeExpContents(exp);
10241 op1->ops.BitNot(exp, op1);
10242 }
10243 break;
10244 case '!':
10245 if(op1->ops.Not)
10246 {
10247 FreeExpContents(exp);
10248 op1->ops.Not(exp, op1);
10249 }
10250 break;
10251 }
10252 }
10253 else
10254 {
10255 switch(exp->op.op)
10256 {
10257 case '+':
10258 if(op1->ops.Add)
10259 {
10260 FreeExpContents(exp);
10261 op1->ops.Add(exp, op1, op2);
10262 }
10263 break;
10264 case '-':
10265 if(op1->ops.Sub)
10266 {
10267 FreeExpContents(exp);
10268 op1->ops.Sub(exp, op1, op2);
10269 }
10270 break;
10271 case '*':
10272 if(op1->ops.Mul)
10273 {
10274 FreeExpContents(exp);
10275 op1->ops.Mul(exp, op1, op2);
10276 }
10277 break;
10278 case '/':
10279 if(op1->ops.Div)
10280 {
10281 FreeExpContents(exp);
10282 op1->ops.Div(exp, op1, op2);
10283 }
10284 break;
10285 case '%':
10286 if(op1->ops.Mod)
10287 {
10288 FreeExpContents(exp);
10289 op1->ops.Mod(exp, op1, op2);
10290 }
10291 break;
10292 case '&':
10293 if(exp->op.exp2)
10294 {
10295 if(op1->ops.BitAnd)
10296 {
10297 FreeExpContents(exp);
10298 op1->ops.BitAnd(exp, op1, op2);
10299 }
10300 }
10301 break;
10302 case '|':
10303 if(op1->ops.BitOr)
10304 {
10305 FreeExpContents(exp);
10306 op1->ops.BitOr(exp, op1, op2);
10307 }
10308 break;
10309 case '^':
10310 if(op1->ops.BitXor)
10311 {
10312 FreeExpContents(exp);
10313 op1->ops.BitXor(exp, op1, op2);
10314 }
10315 break;
10316 case LEFT_OP:
10317 if(op1->ops.LShift)
10318 {
10319 FreeExpContents(exp);
10320 op1->ops.LShift(exp, op1, op2);
10321 }
10322 break;
10323 case RIGHT_OP:
10324 if(op1->ops.RShift)
10325 {
10326 FreeExpContents(exp);
10327 op1->ops.RShift(exp, op1, op2);
10328 }
10329 break;
10330 case EQ_OP:
10331 if(op1->ops.Equ)
10332 {
10333 FreeExpContents(exp);
10334 op1->ops.Equ(exp, op1, op2);
10335 }
10336 break;
10337 case NE_OP:
10338 if(op1->ops.Nqu)
10339 {
10340 FreeExpContents(exp);
10341 op1->ops.Nqu(exp, op1, op2);
10342 }
10343 break;
10344 case AND_OP:
10345 if(op1->ops.And)
10346 {
10347 FreeExpContents(exp);
10348 op1->ops.And(exp, op1, op2);
10349 }
10350 break;
10351 case OR_OP:
10352 if(op1->ops.Or)
10353 {
10354 FreeExpContents(exp);
10355 op1->ops.Or(exp, op1, op2);
10356 }
10357 break;
10358 case '>':
10359 if(op1->ops.Grt)
10360 {
10361 FreeExpContents(exp);
10362 op1->ops.Grt(exp, op1, op2);
10363 }
10364 break;
10365 case '<':
10366 if(op1->ops.Sma)
10367 {
10368 FreeExpContents(exp);
10369 op1->ops.Sma(exp, op1, op2);
10370 }
10371 break;
10372 case GE_OP:
10373 if(op1->ops.GrtEqu)
10374 {
10375 FreeExpContents(exp);
10376 op1->ops.GrtEqu(exp, op1, op2);
10377 }
10378 break;
10379 case LE_OP:
10380 if(op1->ops.SmaEqu)
10381 {
10382 FreeExpContents(exp);
10383 op1->ops.SmaEqu(exp, op1, op2);
10384 }
10385 break;
10386 }
10387 }
10388 }
10389 }
10390
10391 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10392
10393 void ComputeExpression(struct Expression * exp)
10394 {
10395 char expString[10240];
10396
10397 expString[0] = '\0';
10398 switch(exp->type)
10399 {
10400 case 1:
10401 {
10402 ComputeInstantiation(exp);
10403 break;
10404 }
10405 case 4:
10406 {
10407 struct Expression * exp1, * exp2 = (((void *)0));
10408 struct Operand op1 = 
10409 {
10410 0, 0, 0, 0, 
10411 {
10412 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10413 }
10414 };
10415 struct Operand op2 = 
10416 {
10417 0, 0, 0, 0, 
10418 {
10419 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10420 }
10421 };
10422
10423 if(exp->op.exp2)
10424 ComputeExpression(exp->op.exp2);
10425 if(exp->op.exp1)
10426 {
10427 ComputeExpression(exp->op.exp1);
10428 exp1 = exp->op.exp1;
10429 exp2 = exp->op.exp2;
10430 op1 = GetOperand(exp1);
10431 if(op1.type)
10432 op1.type->refCount++;
10433 if(exp2)
10434 {
10435 op2 = GetOperand(exp2);
10436 if(op2.type)
10437 op2.type->refCount++;
10438 }
10439 }
10440 else
10441 {
10442 exp1 = exp->op.exp2;
10443 op1 = GetOperand(exp1);
10444 if(op1.type)
10445 op1.type->refCount++;
10446 }
10447 CallOperator(exp, exp1, exp2, &op1, &op2);
10448 if(op1.type)
10449 FreeType(op1.type);
10450 if(op2.type)
10451 FreeType(op2.type);
10452 break;
10453 }
10454 case 5:
10455 case 34:
10456 {
10457 struct Expression * e, * n;
10458
10459 for(e = (*exp->list).first; e; e = n)
10460 {
10461 n = e->next;
10462 if(!n)
10463 {
10464 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10465
10466 ComputeExpression(e);
10467 FreeType(exp->expType);
10468 FreeType(exp->destType);
10469 *exp = *e;
10470 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10471 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10472 }
10473 else
10474 {
10475 FreeExpression(e);
10476 }
10477 }
10478 break;
10479 }
10480 case 8:
10481 {
10482 struct Expression * memberExp = exp->member.exp;
10483 struct Identifier * memberID = exp->member.member;
10484 struct Type * type;
10485
10486 ComputeExpression(exp->member.exp);
10487 type = exp->member.exp->expType;
10488 if(type)
10489 {
10490 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)));
10491 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10492 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10493 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10494
10495 if(type->kind == 19 && exp->member.exp->type == 26)
10496 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10497 if(!_class)
10498 {
10499 char string[256];
10500 struct Symbol * classSym;
10501
10502 string[0] = '\0';
10503 PrintType(type, string, 0x0, 0x1);
10504 classSym = FindClass(string);
10505 _class = classSym ? classSym->registered : (((void *)0));
10506 }
10507 if(exp->member.member)
10508 {
10509 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10510 if(!prop)
10511 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10512 }
10513 if(!prop && !member && _class && exp->member.member)
10514 {
10515 struct Symbol * classSym = FindClass(exp->member.member->string);
10516
10517 convertTo = _class;
10518 _class = classSym ? classSym->registered : (((void *)0));
10519 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10520 }
10521 if(prop)
10522 {
10523 if(prop->compiled)
10524 {
10525 struct Type * type = prop->dataType;
10526
10527 if(_class->type == 3)
10528 {
10529 if(type->kind == 8)
10530 {
10531 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10532
10533 if(_class->type == 3)
10534 {
10535 if(!_class->dataType)
10536 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10537 type = _class->dataType;
10538 }
10539 }
10540 switch(type->kind)
10541 {
10542 case 6:
10543 {
10544 float value;
10545 float (* Get)(float) = (void *)prop->Get;
10546
10547 GetFloat(exp->member.exp, &value);
10548 exp->constant = PrintFloat(Get ? Get(value) : value);
10549 exp->type = 2;
10550 break;
10551 }
10552 case 7:
10553 {
10554 double value;
10555 double (* Get)(double);
10556
10557 GetDouble(exp->member.exp, &value);
10558 if(convertTo)
10559 Get = (void *)prop->Set;
10560 else
10561 Get = (void *)prop->Get;
10562 exp->constant = PrintDouble(Get ? Get(value) : value);
10563 exp->type = 2;
10564 break;
10565 }
10566 }
10567 }
10568 else
10569 {
10570 if(convertTo)
10571 {
10572 struct Expression * value = exp->member.exp;
10573 struct Type * type;
10574
10575 if(!prop->dataType)
10576 ProcessPropertyType(prop);
10577 type = prop->dataType;
10578 if(!type)
10579 {
10580 }
10581 else if(_class->type == 1)
10582 {
10583 switch(type->kind)
10584 {
10585 case 8:
10586 {
10587 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10588
10589 if(propertyClass->type == 1 && value->type == 1)
10590 {
10591 void (* Set)(void *, void *) = (void *)prop->Set;
10592
10593 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10594 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10595 exp->instance->_class = MkSpecifierName(_class->fullName);
10596 exp->instance->loc = exp->loc;
10597 exp->type = 1;
10598 Set(exp->instance->data, value->instance->data);
10599 PopulateInstance(exp->instance);
10600 }
10601 break;
10602 }
10603 case 3:
10604 {
10605 int intValue;
10606 void (* Set)(void *, int) = (void *)prop->Set;
10607
10608 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10609 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10610 exp->instance->_class = MkSpecifierName(_class->fullName);
10611 exp->instance->loc = exp->loc;
10612 exp->type = 1;
10613 GetInt(value, &intValue);
10614 Set(exp->instance->data, intValue);
10615 PopulateInstance(exp->instance);
10616 break;
10617 }
10618 case 4:
10619 {
10620 long long intValue;
10621 void (* Set)(void *, long long) = (void *)prop->Set;
10622
10623 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10624 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10625 exp->instance->_class = MkSpecifierName(_class->fullName);
10626 exp->instance->loc = exp->loc;
10627 exp->type = 1;
10628 GetInt64(value, &intValue);
10629 Set(exp->instance->data, intValue);
10630 PopulateInstance(exp->instance);
10631 break;
10632 }
10633 case 22:
10634 {
10635 intptr_t intValue;
10636 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10637
10638 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10639 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10640 exp->instance->_class = MkSpecifierName(_class->fullName);
10641 exp->instance->loc = exp->loc;
10642 exp->type = 1;
10643 GetIntPtr(value, &intValue);
10644 Set(exp->instance->data, intValue);
10645 PopulateInstance(exp->instance);
10646 break;
10647 }
10648 case 23:
10649 {
10650 ssize_t intValue;
10651 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10652
10653 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10654 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10655 exp->instance->_class = MkSpecifierName(_class->fullName);
10656 exp->instance->loc = exp->loc;
10657 exp->type = 1;
10658 GetIntSize(value, &intValue);
10659 Set(exp->instance->data, intValue);
10660 PopulateInstance(exp->instance);
10661 break;
10662 }
10663 case 7:
10664 {
10665 double doubleValue;
10666 void (* Set)(void *, double) = (void *)prop->Set;
10667
10668 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10669 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10670 exp->instance->_class = MkSpecifierName(_class->fullName);
10671 exp->instance->loc = exp->loc;
10672 exp->type = 1;
10673 GetDouble(value, &doubleValue);
10674 Set(exp->instance->data, doubleValue);
10675 PopulateInstance(exp->instance);
10676 break;
10677 }
10678 }
10679 }
10680 else if(_class->type == 2)
10681 {
10682 switch(type->kind)
10683 {
10684 case 8:
10685 {
10686 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10687
10688 if(propertyClass->type == 1 && value->instance->data)
10689 {
10690 unsigned int (* Set)(void *) = (void *)prop->Set;
10691 unsigned int bits = Set(value->instance->data);
10692
10693 exp->constant = PrintHexUInt(bits);
10694 exp->type = 2;
10695 break;
10696 }
10697 else if(_class->type == 2)
10698 {
10699 unsigned int value;
10700 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10701 unsigned int bits;
10702
10703 GetUInt(exp->member.exp, &value);
10704 bits = Set(value);
10705 exp->constant = PrintHexUInt(bits);
10706 exp->type = 2;
10707 }
10708 }
10709 }
10710 }
10711 }
10712 else
10713 {
10714 if(_class->type == 2)
10715 {
10716 unsigned int value;
10717
10718 GetUInt(exp->member.exp, &value);
10719 switch(type->kind)
10720 {
10721 case 8:
10722 {
10723 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10724
10725 if(_class->type == 1)
10726 {
10727 void (* Get)(unsigned int, void *) = (void *)prop->Get;
10728
10729 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10730 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10731 exp->instance->_class = MkSpecifierName(_class->fullName);
10732 exp->instance->loc = exp->loc;
10733 exp->type = 1;
10734 Get(value, exp->instance->data);
10735 PopulateInstance(exp->instance);
10736 }
10737 else if(_class->type == 2)
10738 {
10739 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10740 uint64 bits = Get(value);
10741
10742 exp->constant = PrintHexUInt64(bits);
10743 exp->type = 2;
10744 }
10745 break;
10746 }
10747 }
10748 }
10749 else if(_class->type == 1)
10750 {
10751 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10752
10753 switch(type->kind)
10754 {
10755 case 8:
10756 {
10757 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10758
10759 if(_class->type == 1 && value)
10760 {
10761 void (* Get)(void *, void *) = (void *)prop->Get;
10762
10763 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10764 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10765 exp->instance->_class = MkSpecifierName(_class->fullName);
10766 exp->instance->loc = exp->loc;
10767 exp->type = 1;
10768 Get(value, exp->instance->data);
10769 PopulateInstance(exp->instance);
10770 }
10771 break;
10772 }
10773 }
10774 }
10775 }
10776 }
10777 }
10778 else
10779 {
10780 exp->isConstant = 0x0;
10781 }
10782 }
10783 else if(member)
10784 {
10785 }
10786 }
10787 if(exp->type != 8)
10788 {
10789 FreeExpression(memberExp);
10790 FreeIdentifier(memberID);
10791 }
10792 break;
10793 }
10794 case 10:
10795 {
10796 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10797
10798 FreeExpContents(exp);
10799 exp->constant = PrintUInt(ComputeTypeSize(type));
10800 exp->type = 2;
10801 FreeType(type);
10802 break;
10803 }
10804 case 15:
10805 {
10806 struct Symbol * classSym = exp->_class->symbol;
10807
10808 if(classSym && classSym->registered)
10809 {
10810 if(classSym->registered->fixed)
10811 {
10812 FreeSpecifier(exp->_class);
10813 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10814 exp->type = 2;
10815 }
10816 else
10817 {
10818 char className[1024];
10819
10820 strcpy(className, "__ecereClass_");
10821 FullClassNameCat(className, classSym->string, 0x1);
10822 MangleClassName(className);
10823 FreeExpContents(exp);
10824 exp->type = 9;
10825 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10826 exp->member.member = MkIdentifier("structSize");
10827 }
10828 }
10829 break;
10830 }
10831 case 11:
10832 {
10833 struct Type * type;
10834 struct Expression * e = exp;
10835
10836 if(exp->type == 11)
10837 {
10838 if(exp->cast.exp)
10839 ComputeExpression(exp->cast.exp);
10840 e = exp->cast.exp;
10841 }
10842 if(e && exp->expType)
10843 {
10844 type = exp->expType;
10845 if(type->kind == 8)
10846 {
10847 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10848
10849 if(_class && (_class->type == 3 || _class->type == 2))
10850 {
10851 if(!_class->dataType)
10852 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10853 type = _class->dataType;
10854 }
10855 }
10856 switch(type->kind)
10857 {
10858 case 1:
10859 if(type->isSigned)
10860 {
10861 char value;
10862
10863 GetChar(e, &value);
10864 FreeExpContents(exp);
10865 exp->constant = PrintChar(value);
10866 exp->type = 2;
10867 }
10868 else
10869 {
10870 unsigned char value;
10871
10872 GetUChar(e, &value);
10873 FreeExpContents(exp);
10874 exp->constant = PrintUChar(value);
10875 exp->type = 2;
10876 }
10877 break;
10878 case 2:
10879 if(type->isSigned)
10880 {
10881 short value;
10882
10883 GetShort(e, &value);
10884 FreeExpContents(exp);
10885 exp->constant = PrintShort(value);
10886 exp->type = 2;
10887 }
10888 else
10889 {
10890 unsigned short value;
10891
10892 GetUShort(e, &value);
10893 FreeExpContents(exp);
10894 exp->constant = PrintUShort(value);
10895 exp->type = 2;
10896 }
10897 break;
10898 case 3:
10899 if(type->isSigned)
10900 {
10901 int value;
10902
10903 GetInt(e, &value);
10904 FreeExpContents(exp);
10905 exp->constant = PrintInt(value);
10906 exp->type = 2;
10907 }
10908 else
10909 {
10910 unsigned int value;
10911
10912 GetUInt(e, &value);
10913 FreeExpContents(exp);
10914 exp->constant = PrintUInt(value);
10915 exp->type = 2;
10916 }
10917 break;
10918 case 4:
10919 if(type->isSigned)
10920 {
10921 long long value;
10922
10923 GetInt64(e, &value);
10924 FreeExpContents(exp);
10925 exp->constant = PrintInt64(value);
10926 exp->type = 2;
10927 }
10928 else
10929 {
10930 uint64 value;
10931
10932 GetUInt64(e, &value);
10933 FreeExpContents(exp);
10934 exp->constant = PrintUInt64(value);
10935 exp->type = 2;
10936 }
10937 break;
10938 case 22:
10939 if(type->isSigned)
10940 {
10941 intptr_t value;
10942
10943 GetIntPtr(e, &value);
10944 FreeExpContents(exp);
10945 exp->constant = PrintInt64((long long)value);
10946 exp->type = 2;
10947 }
10948 else
10949 {
10950 uintptr_t value;
10951
10952 GetUIntPtr(e, &value);
10953 FreeExpContents(exp);
10954 exp->constant = PrintUInt64((uint64)value);
10955 exp->type = 2;
10956 }
10957 break;
10958 case 23:
10959 if(type->isSigned)
10960 {
10961 ssize_t value;
10962
10963 GetIntSize(e, &value);
10964 FreeExpContents(exp);
10965 exp->constant = PrintInt64((long long)value);
10966 exp->type = 2;
10967 }
10968 else
10969 {
10970 size_t value;
10971
10972 GetUIntSize(e, &value);
10973 FreeExpContents(exp);
10974 exp->constant = PrintUInt64((uint64)value);
10975 exp->type = 2;
10976 }
10977 break;
10978 case 6:
10979 {
10980 float value;
10981
10982 GetFloat(e, &value);
10983 FreeExpContents(exp);
10984 exp->constant = PrintFloat(value);
10985 exp->type = 2;
10986 break;
10987 }
10988 case 7:
10989 {
10990 double value;
10991
10992 GetDouble(e, &value);
10993 FreeExpContents(exp);
10994 exp->constant = PrintDouble(value);
10995 exp->type = 2;
10996 break;
10997 }
10998 }
10999 }
11000 break;
11001 }
11002 case 12:
11003 {
11004 struct Operand op1 = 
11005 {
11006 0, 0, 0, 0, 
11007 {
11008 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11009 }
11010 };
11011 struct Operand op2 = 
11012 {
11013 0, 0, 0, 0, 
11014 {
11015 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11016 }
11017 };
11018 struct Operand op3 = 
11019 {
11020 0, 0, 0, 0, 
11021 {
11022 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11023 }
11024 };
11025
11026 if(exp->cond.exp)
11027 ComputeExpression((*exp->cond.exp).last);
11028 if(exp->cond.elseExp)
11029 ComputeExpression(exp->cond.elseExp);
11030 if(exp->cond.cond)
11031 ComputeExpression(exp->cond.cond);
11032 op1 = GetOperand(exp->cond.cond);
11033 if(op1.type)
11034 op1.type->refCount++;
11035 op2 = GetOperand((*exp->cond.exp).last);
11036 if(op2.type)
11037 op2.type->refCount++;
11038 op3 = GetOperand(exp->cond.elseExp);
11039 if(op3.type)
11040 op3.type->refCount++;
11041 if(op1.ops.Cond)
11042 {
11043 FreeExpContents(exp);
11044 op1.ops.Cond(exp, &op1, &op2, &op3);
11045 }
11046 if(op1.type)
11047 FreeType(op1.type);
11048 if(op2.type)
11049 FreeType(op2.type);
11050 if(op3.type)
11051 FreeType(op3.type);
11052 break;
11053 }
11054 }
11055 }
11056
11057 void ApplyAnyObjectLogic(struct Expression * e);
11058
11059 extern void CopyTypeInto(struct Type * type, struct Type * src);
11060
11061 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
11062 {
11063 unsigned int result = 0x1;
11064
11065 if(destType)
11066 {
11067 struct __ecereNameSpace__ecere__sys__OldList converts = 
11068 {
11069 0, 0, 0, 0, 0
11070 };
11071 struct Conversion * convert;
11072
11073 if(destType->kind == 0)
11074 return 0x0;
11075 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
11076 result = 0x0;
11077 if(converts.count)
11078 {
11079 for(convert = converts.first; convert; convert = convert->next)
11080 {
11081 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
11082
11083 if(!empty)
11084 {
11085 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11086 int objectType = exp->expType ? exp->expType->classObjectType : 0;
11087
11088 *newExp = *exp;
11089 newExp->destType = (((void *)0));
11090 if(convert->isGet)
11091 {
11092 exp->type = 8;
11093 exp->addedThis = 0x1;
11094 exp->member.exp = newExp;
11095 FreeType(exp->member.exp->expType);
11096 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
11097 exp->member.exp->expType->classObjectType = objectType;
11098 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
11099 exp->member.memberType = 1;
11100 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11101 exp->needCast = 0x1;
11102 if(exp->expType)
11103 exp->expType->refCount++;
11104 ApplyAnyObjectLogic(exp->member.exp);
11105 }
11106 else
11107 {
11108 {
11109 exp->type = 8;
11110 exp->addedThis = 0x1;
11111 exp->member.exp = newExp;
11112 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
11113 {
11114 newExp->byReference = 0x1;
11115 }
11116 FreeType(exp->member.exp->expType);
11117 exp->member.exp->expType = (((void *)0));
11118 if(convert->convert->dataType)
11119 {
11120 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11121 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
11122 exp->member.exp->expType->refCount = 1;
11123 exp->member.exp->expType->classObjectType = objectType;
11124 ApplyAnyObjectLogic(exp->member.exp);
11125 }
11126 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
11127 exp->member.memberType = 4;
11128 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11129 exp->needCast = 0x1;
11130 if(convert->resultType)
11131 convert->resultType->refCount++;
11132 }
11133 }
11134 }
11135 else
11136 {
11137 FreeType(exp->expType);
11138 if(convert->isGet)
11139 {
11140 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11141 exp->needCast = 0x1;
11142 if(exp->expType)
11143 exp->expType->refCount++;
11144 }
11145 else
11146 {
11147 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11148 exp->needCast = 0x1;
11149 if(convert->resultType)
11150 convert->resultType->refCount++;
11151 }
11152 }
11153 }
11154 if(exp->isConstant && inCompiler)
11155 ComputeExpression(exp);
11156 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
11157 }
11158 if(!result && exp->expType && converts.count)
11159 {
11160 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
11161 }
11162 if(!result && exp->expType && exp->destType)
11163 {
11164 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))
11165 result = 0x1;
11166 }
11167 }
11168 return result;
11169 }
11170
11171 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
11172
11173 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
11174
11175 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
11176
11177 void CheckTemplateTypes(struct Expression * exp)
11178 {
11179 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
11180 {
11181 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11182 struct Statement * compound;
11183 struct Context * context;
11184
11185 *newExp = *exp;
11186 if(exp->destType)
11187 exp->destType->refCount++;
11188 if(exp->expType)
11189 exp->expType->refCount++;
11190 newExp->prev = (((void *)0));
11191 newExp->next = (((void *)0));
11192 switch(exp->expType->kind)
11193 {
11194 case 7:
11195 if(exp->destType->classObjectType)
11196 {
11197 if(exp->destType)
11198 exp->destType->refCount--;
11199 if(exp->expType)
11200 exp->expType->refCount--;
11201 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11202 }
11203 else
11204 {
11205 struct __ecereNameSpace__ecere__sys__OldList * specs;
11206 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11207 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11208
11209 context = PushContext();
11210 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11211 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11212 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11213 exp->type = 25;
11214 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11215 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
11216 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
11217 exp->compound->compound.context = context;
11218 PopContext(context);
11219 }
11220 break;
11221 default:
11222 exp->type = 11;
11223 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
11224 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11225 break;
11226 }
11227 }
11228 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
11229 {
11230 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11231 struct Statement * compound;
11232 struct Context * context;
11233
11234 *newExp = *exp;
11235 if(exp->destType)
11236 exp->destType->refCount++;
11237 if(exp->expType)
11238 exp->expType->refCount++;
11239 newExp->prev = (((void *)0));
11240 newExp->next = (((void *)0));
11241 switch(exp->expType->kind)
11242 {
11243 case 7:
11244 if(exp->destType->classObjectType)
11245 {
11246 if(exp->destType)
11247 exp->destType->refCount--;
11248 if(exp->expType)
11249 exp->expType->refCount--;
11250 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11251 }
11252 else
11253 {
11254 struct __ecereNameSpace__ecere__sys__OldList * specs;
11255 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11256 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11257
11258 context = PushContext();
11259 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11260 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11261 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11262 exp->type = 25;
11263 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11264 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
11265 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
11266 exp->compound->compound.context = context;
11267 PopContext(context);
11268 }
11269 break;
11270 case 8:
11271 {
11272 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
11273 {
11274 exp->type = 5;
11275 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
11276 ProcessExpressionType((*exp->list).first);
11277 break;
11278 }
11279 else
11280 {
11281 exp->type = 5;
11282 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
11283 newExp->needCast = 0x1;
11284 ProcessExpressionType((*exp->list).first);
11285 break;
11286 }
11287 }
11288 default:
11289 {
11290 if(exp->expType->kind == 20)
11291 {
11292 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
11293
11294 if(type)
11295 {
11296 FreeType(exp->destType);
11297 FreeType(exp->expType);
11298 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11299 break;
11300 }
11301 }
11302 if(newExp->type == 8 && newExp->member.memberType == 3)
11303 {
11304 exp->type = 4;
11305 exp->op.op = '*';
11306 exp->op.exp1 = (((void *)0));
11307 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
11308 }
11309 else
11310 {
11311 char typeString[1024];
11312 struct Declarator * decl;
11313 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11314
11315 typeString[0] = '\0';
11316 PrintType(exp->expType, typeString, 0x0, 0x0);
11317 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11318 exp->type = 11;
11319 exp->cast.typeName = MkTypeName(specs, decl);
11320 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11321 exp->cast.exp->needCast = 0x1;
11322 }
11323 break;
11324 }
11325 }
11326 }
11327 }
11328
11329 extern int strncmp(const char * , const char * , size_t n);
11330
11331 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
11332
11333 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
11334 {
11335 int nsLen = strlen(nameSpace);
11336 struct Symbol * symbol;
11337
11338 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)))
11339 {
11340 char * s = symbol->string;
11341
11342 if(!strncmp(s, nameSpace, nsLen))
11343 {
11344 int c;
11345 char * namePart;
11346
11347 for(c = strlen(s) - 1; c >= 0; c--)
11348 if(s[c] == ':')
11349 break;
11350 namePart = s + c + 1;
11351 if(!strcmp(namePart, name))
11352 {
11353 return symbol;
11354 }
11355 }
11356 else
11357 break;
11358 }
11359 return (((void *)0));
11360 }
11361
11362 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
11363 {
11364 int c;
11365 char nameSpace[1024];
11366 char * namePart;
11367 unsigned int gotColon = 0x0;
11368
11369 nameSpace[0] = '\0';
11370 for(c = strlen(name) - 1; c >= 0; c--)
11371 if(name[c] == ':')
11372 {
11373 gotColon = 0x1;
11374 break;
11375 }
11376 namePart = name + c + 1;
11377 while(c >= 0 && name[c] == ':')
11378 c--;
11379 if(c >= 0)
11380 {
11381 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
11382
11383 if(symbol)
11384 return symbol;
11385 memcpy(nameSpace, name, c + 1);
11386 nameSpace[c + 1] = (char)0;
11387 return ScanWithNameSpace(tree, nameSpace, namePart);
11388 }
11389 else if(gotColon)
11390 {
11391 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11392
11393 return symbol;
11394 }
11395 else
11396 {
11397 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11398
11399 if(symbol)
11400 return symbol;
11401 return ScanWithNameSpace(tree, "", namePart);
11402 }
11403 return (((void *)0));
11404 }
11405
11406 static void ProcessDeclaration(struct Declaration * decl);
11407
11408 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
11409 {
11410 struct Context * ctx;
11411 struct Symbol * symbol = (((void *)0));
11412
11413 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
11414 {
11415 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
11416 {
11417 symbol = (((void *)0));
11418 if(thisNameSpace)
11419 {
11420 char curName[1024];
11421
11422 strcpy(curName, thisNameSpace);
11423 strcat(curName, "::");
11424 strcat(curName, name);
11425 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
11426 }
11427 if(!symbol)
11428 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
11429 }
11430 else
11431 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
11432 if(symbol || ctx == endContext)
11433 break;
11434 }
11435 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
11436 {
11437 if(symbol->pointerExternal->type == 0)
11438 {
11439 struct FunctionDefinition * function = symbol->pointerExternal->function;
11440 struct Context * tmpContext = curContext;
11441
11442 curContext = (((void *)0));
11443 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
11444 curContext = tmpContext;
11445 symbol->pointerExternal->symbol = symbol;
11446 DeclareType(symbol->type, 0x1, 0x1);
11447 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
11448 symbol->id = curExternal->symbol->idCode;
11449 }
11450 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
11451 {
11452 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
11453 symbol->id = curExternal->symbol->idCode;
11454 }
11455 }
11456 return symbol;
11457 }
11458
11459 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
11460 {
11461 if(!type->isSigned && type->kind != 22 && type->kind != 23)
11462 ListAdd(specs, MkSpecifier(UNSIGNED));
11463 switch(type->kind)
11464 {
11465 case 8:
11466 {
11467 if(type->_class->registered)
11468 {
11469 if(!type->_class->registered->dataType)
11470 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11471 GetTypeSpecs(type->_class->registered->dataType, specs);
11472 }
11473 break;
11474 }
11475 case 7:
11476 ListAdd(specs, MkSpecifier(DOUBLE));
11477 break;
11478 case 6:
11479 ListAdd(specs, MkSpecifier(FLOAT));
11480 break;
11481 case 1:
11482 ListAdd(specs, MkSpecifier(CHAR));
11483 break;
11484 case 2:
11485 ListAdd(specs, MkSpecifier(SHORT));
11486 break;
11487 case 4:
11488 ListAdd(specs, MkSpecifier(INT64));
11489 break;
11490 case 22:
11491 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
11492 break;
11493 case 23:
11494 ListAdd(specs, MkSpecifierName(type->isSigned ? "intsize" : "uintsize"));
11495 break;
11496 case 3:
11497 default:
11498 ListAdd(specs, MkSpecifier(INT));
11499 break;
11500 }
11501 }
11502
11503 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
11504
11505 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int printFunction, unsigned int fullName)
11506 {
11507 if(type)
11508 {
11509 switch(type->kind)
11510 {
11511 case 8:
11512 if(type->_class && type->_class->string)
11513 {
11514 if(type->classObjectType == 2)
11515 strcat(string, "typed_object");
11516 else if(fullName)
11517 strcat(string, type->_class->string);
11518 else
11519 {
11520 if(type->_class->registered)
11521 strcat(string, type->_class->registered->name);
11522 else
11523 strcat(string, type->_class->string);
11524 }
11525 }
11526 break;
11527 case 13:
11528 {
11529 {
11530 _PrintType(type->type, string, 0x0, printFunction, fullName);
11531 strcat(string, " *");
11532 }
11533 break;
11534 }
11535 case 0:
11536 strcat(string, "void");
11537 break;
11538 case 3:
11539 strcat(string, type->isSigned ? "int" : "uint");
11540 break;
11541 case 4:
11542 strcat(string, type->isSigned ? "int64" : "uint64");
11543 break;
11544 case 22:
11545 strcat(string, type->isSigned ? "intptr" : "uintptr");
11546 break;
11547 case 23:
11548 strcat(string, type->isSigned ? "intsize" : "uintsize");
11549 break;
11550 case 1:
11551 strcat(string, type->isSigned ? "char" : "byte");
11552 break;
11553 case 2:
11554 strcat(string, type->isSigned ? "short" : "uint16");
11555 break;
11556 case 6:
11557 strcat(string, "float");
11558 break;
11559 case 7:
11560 strcat(string, "double");
11561 break;
11562 case 9:
11563 if(type->enumName)
11564 {
11565 strcat(string, "struct ");
11566 strcat(string, type->enumName);
11567 }
11568 else if(type->typeName)
11569 {
11570 strcat(string, type->typeName);
11571 }
11572 else
11573 {
11574 struct Type * member;
11575
11576 strcat(string, "struct {");
11577 for(member = type->members.first; member; member = member->next)
11578 {
11579 PrintType(member, string, 0x1, fullName);
11580 strcat(string, "; ");
11581 }
11582 strcat(string, "}");
11583 }
11584 break;
11585 case 10:
11586 if(type->enumName)
11587 {
11588 strcat(string, "union ");
11589 strcat(string, type->enumName);
11590 }
11591 else if(type->typeName)
11592 {
11593 strcat(string, type->typeName);
11594 }
11595 else
11596 {
11597 strcat(string, "union ");
11598 strcat(string, "(unnamed)");
11599 }
11600 break;
11601 case 15:
11602 if(type->enumName)
11603 {
11604 strcat(string, "enum ");
11605 strcat(string, type->enumName);
11606 }
11607 else if(type->typeName)
11608 {
11609 strcat(string, type->typeName);
11610 }
11611 else
11612 strcat(string, "enum");
11613 break;
11614 case 11:
11615 {
11616 if(printFunction)
11617 {
11618 if(type->dllExport)
11619 strcat(string, "dllexport ");
11620 PrintType(type->returnType, string, 0x0, fullName);
11621 strcat(string, " ");
11622 }
11623 if(printName)
11624 {
11625 if(type->name)
11626 {
11627 if(fullName)
11628 strcat(string, type->name);
11629 else
11630 {
11631 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11632
11633 if(name)
11634 name += 2;
11635 else
11636 name = type->name;
11637 strcat(string, name);
11638 }
11639 }
11640 }
11641 if(printFunction)
11642 {
11643 struct Type * param;
11644
11645 strcat(string, "(");
11646 for(param = type->params.first; param; param = param->next)
11647 {
11648 PrintType(param, string, 0x1, fullName);
11649 if(param->next)
11650 strcat(string, ", ");
11651 }
11652 strcat(string, ")");
11653 }
11654 break;
11655 }
11656 case 12:
11657 {
11658 {
11659 char baseType[1024], size[256];
11660 struct Type * arrayType = type;
11661
11662 baseType[0] = '\0';
11663 size[0] = '\0';
11664 while(arrayType->kind == 12)
11665 {
11666 strcat(size, "[");
11667 if(arrayType->enumClass)
11668 strcat(size, arrayType->enumClass->string);
11669 else if(arrayType->arraySizeExp)
11670 PrintExpression(arrayType->arraySizeExp, size);
11671 strcat(size, "]");
11672 arrayType = arrayType->arrayType;
11673 }
11674 _PrintType(arrayType, baseType, printName, printFunction, fullName);
11675 strcat(string, baseType);
11676 strcat(string, size);
11677 }
11678 printName = 0x0;
11679 break;
11680 }
11681 case 14:
11682 strcat(string, "...");
11683 break;
11684 case 16:
11685 _PrintType(type->method->dataType, string, 0x0, printFunction, fullName);
11686 break;
11687 case 19:
11688 strcat(string, "subclass(");
11689 strcat(string, type->_class ? type->_class->string : "int");
11690 strcat(string, ")");
11691 break;
11692 case 20:
11693 strcat(string, type->templateParameter->identifier->string);
11694 break;
11695 case 21:
11696 strcat(string, "thisclass");
11697 break;
11698 case 17:
11699 strcat(string, "__builtin_va_list");
11700 break;
11701 }
11702 if(type->name && printName && type->kind != 11 && (type->kind != 13 || type->type->kind != 11))
11703 {
11704 strcat(string, " ");
11705 strcat(string, type->name);
11706 }
11707 }
11708 }
11709
11710 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11711 {
11712 struct Type * funcType;
11713
11714 for(funcType = type; funcType && (funcType->kind == 13 || funcType->kind == 12); funcType = funcType->type)
11715 ;
11716 if(funcType && funcType->kind == 11 && type != funcType)
11717 {
11718 char typeString[1024];
11719 struct Type * param;
11720
11721 PrintType(funcType->returnType, string, 0x0, fullName);
11722 strcat(string, "(");
11723 _PrintType(type, string, printName, 0x0, fullName);
11724 strcat(string, ")");
11725 strcat(string, "(");
11726 for(param = funcType->params.first; param; param = param->next)
11727 {
11728 PrintType(param, string, 0x1, fullName);
11729 if(param->next)
11730 strcat(string, ", ");
11731 }
11732 strcat(string, ")");
11733 }
11734 else
11735 _PrintType(type, string, printName, 0x1, fullName);
11736 if(type->bitFieldCount)
11737 {
11738 char count[100];
11739
11740 sprintf(count, ":%d", type->bitFieldCount);
11741 strcat(string, count);
11742 }
11743 }
11744
11745 static struct Type * FindMember(struct Type * type, char * string)
11746 {
11747 struct Type * memberType;
11748
11749 for(memberType = type->members.first; memberType; memberType = memberType->next)
11750 {
11751 if(!memberType->name)
11752 {
11753 struct Type * subType = FindMember(memberType, string);
11754
11755 if(subType)
11756 return subType;
11757 }
11758 else if(!strcmp(memberType->name, string))
11759 return memberType;
11760 }
11761 return (((void *)0));
11762 }
11763
11764 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11765 {
11766 struct Type * memberType;
11767
11768 for(memberType = type->members.first; memberType; memberType = memberType->next)
11769 {
11770 if(!memberType->name)
11771 {
11772 struct Type * subType = FindMember(memberType, string);
11773
11774 if(subType)
11775 {
11776 *offset += memberType->offset;
11777 return subType;
11778 }
11779 }
11780 else if(!strcmp(memberType->name, string))
11781 {
11782 *offset += memberType->offset;
11783 return memberType;
11784 }
11785 }
11786 return (((void *)0));
11787 }
11788
11789 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11790
11791 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11792
11793 struct Expression * ParseExpressionString(char * expression)
11794 {
11795 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11796 ((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));
11797 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11798 echoOn = 0x0;
11799 parsedExpression = (((void *)0));
11800 resetScanner();
11801 expression_yyparse();
11802 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11803 return parsedExpression;
11804 }
11805
11806 extern char *  QMkString(char *  source);
11807
11808 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11809 {
11810 struct Identifier * id = exp->identifier;
11811 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11812 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11813 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11814 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11815
11816 if(_class && _class->type == 4)
11817 {
11818 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11819 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11820
11821 if(enumClass)
11822 {
11823 struct __ecereNameSpace__ecere__com__Class * baseClass;
11824
11825 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11826 {
11827 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11828
11829 for(value = e->values.first; value; value = value->next)
11830 {
11831 if(!strcmp(value->name, id->string))
11832 break;
11833 }
11834 if(value)
11835 {
11836 char constant[256];
11837
11838 FreeExpContents(exp);
11839 exp->type = 2;
11840 exp->isConstant = 0x1;
11841 if(!strcmp(baseClass->dataTypeString, "int"))
11842 sprintf(constant, "%d", value->data);
11843 else
11844 sprintf(constant, "0x%X", value->data);
11845 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11846 exp->expType = MkClassType(baseClass->fullName);
11847 break;
11848 }
11849 }
11850 }
11851 if(value)
11852 return 0x1;
11853 }
11854 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11855 {
11856 ProcessMethodType(method);
11857 exp->expType = __extension__ ({
11858 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11859
11860 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), __ecereInstance1;
11861 });
11862 return 0x1;
11863 }
11864 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11865 {
11866 if(!prop->dataType)
11867 ProcessPropertyType(prop);
11868 exp->expType = prop->dataType;
11869 if(prop->dataType)
11870 prop->dataType->refCount++;
11871 return 0x1;
11872 }
11873 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11874 {
11875 if(!member->dataType)
11876 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11877 exp->expType = member->dataType;
11878 if(member->dataType)
11879 member->dataType->refCount++;
11880 return 0x1;
11881 }
11882 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11883 {
11884 if(!classProp->dataType)
11885 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11886 if(classProp->constant)
11887 {
11888 FreeExpContents(exp);
11889 exp->isConstant = 0x1;
11890 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
11891 {
11892 exp->type = 3;
11893 exp->constant = QMkString((char *)classProp->Get(_class));
11894 }
11895 else
11896 {
11897 char constant[256];
11898
11899 exp->type = 2;
11900 sprintf(constant, "%d", (int)classProp->Get(_class));
11901 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11902 }
11903 }
11904 else
11905 {
11906 }
11907 exp->expType = classProp->dataType;
11908 if(classProp->dataType)
11909 classProp->dataType->refCount++;
11910 return 0x1;
11911 }
11912 return 0x0;
11913 }
11914
11915 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
11916 {
11917 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
11918 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
11919 struct __ecereNameSpace__ecere__com__NameSpace * child;
11920
11921 if(!data)
11922 {
11923 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)))
11924 {
11925 data = ScanGlobalData(child, name);
11926 if(data)
11927 break;
11928 }
11929 }
11930 return data;
11931 }
11932
11933 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
11934
11935 extern char *  strncpy(char * , const char * , size_t n);
11936
11937 static struct GlobalData * FindGlobalData(char * name)
11938 {
11939 int start = 0, c;
11940 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
11941
11942 nameSpace = globalData;
11943 for(c = 0; name[c]; c++)
11944 {
11945 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
11946 {
11947 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
11948 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
11949
11950 strncpy(spaceName, name + start, c - start);
11951 spaceName[c - start] = '\0';
11952 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
11953 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
11954 if(!newSpace)
11955 return (((void *)0));
11956 nameSpace = newSpace;
11957 if(name[c] == ':')
11958 c++;
11959 start = c + 1;
11960 }
11961 }
11962 if(c - start)
11963 {
11964 return ScanGlobalData(nameSpace, name + start);
11965 }
11966 return (((void *)0));
11967 }
11968
11969 static int definedExpStackPos;
11970
11971 static void * definedExpStack[512];
11972
11973 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
11974 {
11975 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
11976
11977 FreeExpContents(checkedExp);
11978 FreeType(checkedExp->expType);
11979 FreeType(checkedExp->destType);
11980 *checkedExp = *newExp;
11981 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11982 checkedExp->prev = prev;
11983 checkedExp->next = next;
11984 }
11985
11986 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
11987
11988 extern int printf(char * , ...);
11989
11990 void __ecereMethod_Expression_Clear();
11991
11992 void ApplyAnyObjectLogic(struct Expression * e)
11993 {
11994 struct Type * destType = e->destType;
11995
11996 if(destType && (destType->classObjectType == 3))
11997 {
11998 if(e && e->expType)
11999 {
12000 struct Type * type = e->expType;
12001 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
12002
12003 if(type->kind == 8 && type->_class && type->_class->registered)
12004 {
12005 _class = type->_class->registered;
12006 }
12007 else if(type->kind == 19)
12008 {
12009 _class = FindClass("ecere::com::Class")->registered;
12010 }
12011 else
12012 {
12013 char string[1024] = "";
12014 struct Symbol * classSym;
12015
12016 PrintType(type, string, 0x0, 0x1);
12017 classSym = FindClass(string);
12018 if(classSym)
12019 _class = classSym->registered;
12020 }
12021 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)))
12022 {
12023 if(!_class || strcmp(_class->fullName, "char *"))
12024 {
12025 struct Expression * checkedExp = e, * newExp;
12026
12027 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12028 {
12029 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12030 {
12031 if(checkedExp->type == 25)
12032 {
12033 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12034 }
12035 else
12036 checkedExp = (*checkedExp->list).last;
12037 }
12038 else if(checkedExp->type == 11)
12039 checkedExp = checkedExp->cast.exp;
12040 }
12041 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
12042 {
12043 newExp = checkedExp->op.exp2;
12044 checkedExp->op.exp2 = (((void *)0));
12045 FreeExpContents(checkedExp);
12046 if(e->expType && e->expType->passAsTemplate)
12047 {
12048 char size[100];
12049
12050 ComputeTypeSize(e->expType);
12051 sprintf(size, "%d", e->expType->size);
12052 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))))));
12053 }
12054 ReplaceExpContents(checkedExp, newExp);
12055 e->byReference = 0x1;
12056 }
12057 else if(!e->byReference || (_class && _class->type == 5))
12058 {
12059 struct Expression * checkedExp, * newExp;
12060
12061 {
12062 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;
12063
12064 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
12065 {
12066 struct Context * context = PushContext();
12067 struct Declarator * decl;
12068 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12069 char typeString[1024];
12070 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12071
12072 typeString[0] = '\0';
12073 *newExp = *e;
12074 newExp->prev = (((void *)0));
12075 newExp->next = (((void *)0));
12076 newExp->expType = (((void *)0));
12077 PrintType(e->expType, typeString, 0x0, 0x1);
12078 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12079 newExp->destType = ProcessType(specs, decl);
12080 curContext = context;
12081 e->type = 25;
12082 if(curCompound)
12083 {
12084 char name[100];
12085 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
12086
12087 sprintf(name, "__internalValue%03X", internalValueCounter++);
12088 if(!curCompound->compound.declarations)
12089 curCompound->compound.declarations = MkList();
12090 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
12091 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
12092 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
12093 e->compound = MkCompoundStmt((((void *)0)), stmts);
12094 }
12095 else
12096 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
12097 {
12098 struct Type * type = e->destType;
12099
12100 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12101 CopyTypeInto(e->destType, type);
12102 e->destType->refCount = 1;
12103 e->destType->classObjectType = 0;
12104 FreeType(type);
12105 }
12106 e->compound->compound.context = context;
12107 PopContext(context);
12108 curContext = context->parent;
12109 }
12110 }
12111 checkedExp = e;
12112 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12113 {
12114 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12115 {
12116 if(checkedExp->type == 25)
12117 {
12118 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12119 }
12120 else
12121 checkedExp = (*checkedExp->list).last;
12122 }
12123 else if(checkedExp->type == 11)
12124 checkedExp = checkedExp->cast.exp;
12125 }
12126 {
12127 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12128
12129 *operand = *checkedExp;
12130 checkedExp->destType = (((void *)0));
12131 checkedExp->expType = (((void *)0));
12132 __ecereMethod_Expression_Clear(checkedExp);
12133 checkedExp->type = 4;
12134 checkedExp->op.op = '&';
12135 checkedExp->op.exp1 = (((void *)0));
12136 checkedExp->op.exp2 = operand;
12137 }
12138 }
12139 }
12140 }
12141 }
12142 }
12143 {
12144 }
12145 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))))
12146 {
12147 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && !strcmp(e->expType->_class->registered->name, "class"))
12148 {
12149 return ;
12150 }
12151 else
12152 {
12153 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12154
12155 *thisExp = *e;
12156 thisExp->prev = (((void *)0));
12157 thisExp->next = (((void *)0));
12158 __ecereMethod_Expression_Clear(e);
12159 e->type = 5;
12160 e->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpBrackets(MkListOne(thisExp))));
12161 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
12162 ((struct Expression *)(*e->list).first)->byReference = 0x1;
12163 {
12164 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12165 CopyTypeInto(e->expType, thisExp->expType);
12166 e->expType->byReference = 0x0;
12167 e->expType->refCount = 1;
12168 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))
12169 {
12170 e->expType->classObjectType = 0;
12171 }
12172 }
12173 }
12174 }
12175 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
12176 {
12177 if(destType->kind == 14)
12178 {
12179 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unspecified type\n", (((void *)0))));
12180 }
12181 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
12182 {
12183 unsigned int byReference = e->expType->byReference;
12184 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12185 struct Declarator * decl;
12186 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12187 char typeString[1024];
12188 struct Type * type;
12189 int backupClassObjectType;
12190
12191 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
12192 type = e->expType;
12193 else
12194 type = destType;
12195 backupClassObjectType = type->classObjectType;
12196 type->classObjectType = 0;
12197 typeString[0] = '\0';
12198 PrintType(type, typeString, 0x0, 0x1);
12199 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12200 type->classObjectType = backupClassObjectType;
12201 *thisExp = *e;
12202 thisExp->prev = (((void *)0));
12203 thisExp->next = (((void *)0));
12204 __ecereMethod_Expression_Clear(e);
12205 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)))
12206 {
12207 e->type = 4;
12208 e->op.op = '*';
12209 e->op.exp1 = (((void *)0));
12210 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
12211 }
12212 else
12213 {
12214 e->type = 11;
12215 e->cast.typeName = MkTypeName(specs, decl);
12216 e->cast.exp = thisExp;
12217 e->byReference = 0x1;
12218 }
12219 e->expType = type;
12220 e->destType = destType;
12221 type->refCount++;
12222 destType->refCount++;
12223 }
12224 }
12225 }
12226
12227 extern char *  strstr(const char * , const char * );
12228
12229 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
12230
12231 struct __ecereNameSpace__ecere__com__DefinedExpression
12232 {
12233 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
12234 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
12235 char *  name;
12236 char *  value;
12237 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
12238 } __attribute__ ((gcc_struct));
12239
12240 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12241
12242 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12243
12244 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
12245
12246 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
12247
12248 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
12249
12250 extern struct Expression * CopyExpression(struct Expression * exp);
12251
12252 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
12253
12254 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
12255
12256 static void ProcessStatement(struct Statement * stmt);
12257
12258 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
12259
12260 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
12261
12262 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
12263
12264 extern char *  sourceFile;
12265
12266 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
12267
12268 void ProcessExpressionType(struct Expression * exp)
12269 {
12270 unsigned int unresolved = 0x0;
12271 struct Location oldyylloc = yylloc;
12272 unsigned int notByReference = 0x0;
12273
12274 if(!exp || exp->expType)
12275 return ;
12276 yylloc = exp->loc;
12277 switch(exp->type)
12278 {
12279 case 0:
12280 {
12281 struct Identifier * id = exp->identifier;
12282
12283 if(!id)
12284 return ;
12285 if(id->_class && id->_class->name)
12286 {
12287 id->classSym = id->_class->symbol;
12288 }
12289 if(strstr(id->string, "__ecereClass") == id->string)
12290 {
12291 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
12292 break;
12293 }
12294 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
12295 {
12296 ReplaceClassMembers(exp, thisClass);
12297 if(exp->type != 0)
12298 {
12299 ProcessExpressionType(exp);
12300 break;
12301 }
12302 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
12303 break;
12304 }
12305 else
12306 {
12307 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12308
12309 if(!symbol)
12310 {
12311 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
12312 break;
12313 else
12314 {
12315 if(thisClass)
12316 {
12317 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
12318 if(exp->type != 0)
12319 {
12320 ProcessExpressionType(exp);
12321 break;
12322 }
12323 }
12324 else if(currentClass && !id->_class)
12325 {
12326 if(ResolveIdWithClass(exp, currentClass, 0x1))
12327 break;
12328 }
12329 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12330 }
12331 }
12332 if(symbol)
12333 {
12334 struct Type * type = symbol->type;
12335 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
12336
12337 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
12338 {
12339 struct Context * context = SetupTemplatesContext(_class);
12340
12341 type = ReplaceThisClassType(_class);
12342 FinishTemplatesContext(context);
12343 if(type)
12344 type->refCount = 0;
12345 }
12346 FreeSpecifier(id->_class);
12347 id->_class = (((void *)0));
12348 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12349 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
12350 id->classSym = (((void *)0));
12351 exp->expType = type;
12352 if(type)
12353 type->refCount++;
12354 if(type && (type->kind == 15 || (_class && _class->type == 4)))
12355 exp->isConstant = 0x1;
12356 if(symbol->isParam || !strcmp(id->string, "this"))
12357 {
12358 if(_class && _class->type == 1)
12359 exp->byReference = 0x1;
12360 }
12361 if(symbol->isIterator)
12362 {
12363 if(symbol->isIterator == 3)
12364 {
12365 exp->type = 5;
12366 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
12367 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
12368 exp->expType = (((void *)0));
12369 ProcessExpressionType(exp);
12370 }
12371 else if(symbol->isIterator != 4)
12372 {
12373 exp->type = 8;
12374 exp->member.exp = MkExpIdentifier(exp->identifier);
12375 exp->member.exp->expType = exp->expType;
12376 exp->member.member = MkIdentifier("data");
12377 exp->expType = (((void *)0));
12378 ProcessExpressionType(exp);
12379 }
12380 }
12381 break;
12382 }
12383 else
12384 {
12385 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
12386
12387 if(thisNameSpace && !(id->_class && !id->_class->name))
12388 {
12389 char name[1024];
12390
12391 strcpy(name, thisNameSpace);
12392 strcat(name, "::");
12393 strcat(name, id->string);
12394 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
12395 }
12396 if(!definedExp)
12397 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
12398 if(definedExp)
12399 {
12400 int c;
12401
12402 for(c = 0; c < definedExpStackPos; c++)
12403 if(definedExpStack[c] == definedExp)
12404 break;
12405 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
12406 {
12407 struct Location backupYylloc = yylloc;
12408
12409 definedExpStack[definedExpStackPos++] = definedExp;
12410 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
12411 ((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));
12412 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
12413 echoOn = 0x0;
12414 parsedExpression = (((void *)0));
12415 resetScanner();
12416 expression_yyparse();
12417 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
12418 yylloc = backupYylloc;
12419 if(parsedExpression)
12420 {
12421 FreeIdentifier(id);
12422 exp->type = 5;
12423 exp->list = MkListOne(parsedExpression);
12424 parsedExpression->loc = yylloc;
12425 ProcessExpressionType(exp);
12426 definedExpStackPos--;
12427 return ;
12428 }
12429 definedExpStackPos--;
12430 }
12431 else
12432 {
12433 if(inCompiler)
12434 {
12435 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
12436 }
12437 }
12438 }
12439 else
12440 {
12441 struct GlobalData * data = (((void *)0));
12442
12443 if(thisNameSpace && !(id->_class && !id->_class->name))
12444 {
12445 char name[1024];
12446
12447 strcpy(name, thisNameSpace);
12448 strcat(name, "::");
12449 strcat(name, id->string);
12450 data = FindGlobalData(name);
12451 }
12452 if(!data)
12453 data = FindGlobalData(id->string);
12454 if(data)
12455 {
12456 DeclareGlobalData(data);
12457 exp->expType = data->dataType;
12458 if(data->dataType)
12459 data->dataType->refCount++;
12460 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12461 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12462 FreeSpecifier(id->_class);
12463 id->_class = (((void *)0));
12464 break;
12465 }
12466 else
12467 {
12468 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
12469
12470 if(thisNameSpace && !(id->_class && !id->_class->name))
12471 {
12472 char name[1024];
12473
12474 strcpy(name, thisNameSpace);
12475 strcat(name, "::");
12476 strcat(name, id->string);
12477 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12478 }
12479 if(!function)
12480 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12481 if(function)
12482 {
12483 char name[1024];
12484
12485 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12486 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12487 name[0] = (char)0;
12488 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12489 strcpy(name, "__ecereFunction_");
12490 FullClassNameCat(name, id->string, 0x0);
12491 if(DeclareFunction(function, name))
12492 {
12493 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12494 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12495 }
12496 exp->expType = function->dataType;
12497 if(function->dataType)
12498 function->dataType->refCount++;
12499 FreeSpecifier(id->_class);
12500 id->_class = (((void *)0));
12501 break;
12502 }
12503 }
12504 }
12505 }
12506 }
12507 unresolved = 0x1;
12508 break;
12509 }
12510 case 1:
12511 {
12512 struct __ecereNameSpace__ecere__com__Class * _class;
12513
12514 if(!exp->instance->_class)
12515 {
12516 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12517 {
12518 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12519 }
12520 }
12521 ProcessInstantiationType(exp->instance);
12522 exp->isConstant = exp->instance->isConstant;
12523 if(exp->instance->_class)
12524 {
12525 exp->expType = MkClassType(exp->instance->_class->name);
12526 }
12527 break;
12528 }
12529 case 2:
12530 {
12531 if(!exp->expType)
12532 {
12533 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12534
12535 exp->expType = type;
12536 if(exp->constant[0] == '\'')
12537 {
12538 if((int)((unsigned char *)exp->constant)[1] > 127)
12539 {
12540 int nb;
12541 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12542
12543 if(nb < 2)
12544 ch = exp->constant[1];
12545 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12546 exp->constant = PrintUInt(ch);
12547 type->kind = 8;
12548 type->_class = FindClass("unichar");
12549 type->isSigned = 0x0;
12550 }
12551 else
12552 {
12553 type->kind = 1;
12554 type->isSigned = 0x1;
12555 }
12556 }
12557 else if(strchr(exp->constant, '.'))
12558 {
12559 char ch = exp->constant[strlen(exp->constant) - 1];
12560
12561 if(ch == 'f')
12562 type->kind = 6;
12563 else
12564 type->kind = 7;
12565 type->isSigned = 0x1;
12566 }
12567 else
12568 {
12569 if(exp->constant[0] == '0' && exp->constant[1])
12570 type->isSigned = 0x0;
12571 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12572 type->isSigned = 0x0;
12573 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12574 type->isSigned = 0x0;
12575 else
12576 type->isSigned = 0x1;
12577 type->kind = 3;
12578 }
12579 exp->isConstant = 0x1;
12580 }
12581 break;
12582 }
12583 case 3:
12584 {
12585 exp->isConstant = 0x1;
12586 exp->expType = __extension__ ({
12587 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12588
12589 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
12590 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12591
12592 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 1, __ecereInstance1->constant = 0x1, __ecereInstance1;
12593 }), __ecereInstance2;
12594 });
12595 break;
12596 }
12597 case 13:
12598 case 28:
12599 ProcessExpressionType(exp->_new.size);
12600 exp->expType = __extension__ ({
12601 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12602
12603 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_new.typeName->qualifiers, exp->_new.typeName->declarator), __ecereInstance1;
12604 });
12605 DeclareType(exp->expType->type, 0x0, 0x0);
12606 break;
12607 case 14:
12608 case 29:
12609 ProcessExpressionType(exp->_renew.size);
12610 ProcessExpressionType(exp->_renew.exp);
12611 exp->expType = __extension__ ({
12612 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12613
12614 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), __ecereInstance1;
12615 });
12616 DeclareType(exp->expType->type, 0x0, 0x0);
12617 break;
12618 case 4:
12619 {
12620 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12621 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12622 unsigned int useDestType = 0x0, useSideType = 0x0;
12623 struct Location oldyylloc = yylloc;
12624 unsigned int useSideUnit = 0x0;
12625 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
12626
12627 switch(exp->op.op)
12628 {
12629 case '=':
12630 case MUL_ASSIGN:
12631 case DIV_ASSIGN:
12632 case MOD_ASSIGN:
12633 case ADD_ASSIGN:
12634 case SUB_ASSIGN:
12635 case LEFT_ASSIGN:
12636 case RIGHT_ASSIGN:
12637 case AND_ASSIGN:
12638 case XOR_ASSIGN:
12639 case OR_ASSIGN:
12640 assign = 0x1;
12641 break;
12642 case '!':
12643 break;
12644 case AND_OP:
12645 case OR_OP:
12646 boolOps = 0x1;
12647 boolResult = 0x1;
12648 break;
12649 case EQ_OP:
12650 case '<':
12651 case '>':
12652 case LE_OP:
12653 case GE_OP:
12654 case NE_OP:
12655 boolResult = 0x1;
12656 useSideType = 0x1;
12657 break;
12658 case '+':
12659 case '-':
12660 useSideUnit = 0x1;
12661 case '|':
12662 case '&':
12663 case '^':
12664 case '/':
12665 case '%':
12666 case '*':
12667 if(exp->op.op != '*' || exp->op.exp1)
12668 {
12669 useSideType = 0x1;
12670 useDestType = 0x1;
12671 }
12672 break;
12673 }
12674 if(exp->op.op == '&')
12675 {
12676 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12677 {
12678 struct Identifier * id = exp->op.exp2->identifier;
12679 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12680
12681 if(symbol && symbol->isIterator == 2)
12682 {
12683 exp->type = 8;
12684 exp->member.exp = exp->op.exp2;
12685 exp->member.member = MkIdentifier("key");
12686 exp->expType = (((void *)0));
12687 exp->op.exp2->expType = symbol->type;
12688 symbol->type->refCount++;
12689 ProcessExpressionType(exp);
12690 FreeType(dummy);
12691 break;
12692 }
12693 }
12694 }
12695 if(exp->op.exp1)
12696 {
12697 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))
12698 {
12699 if(exp->op.exp1->destType)
12700 FreeType(exp->op.exp1->destType);
12701 exp->op.exp1->destType = exp->destType;
12702 if(exp->destType)
12703 exp->destType->refCount++;
12704 }
12705 else if(!assign)
12706 {
12707 if(exp->op.exp1->destType)
12708 FreeType(exp->op.exp1->destType);
12709 exp->op.exp1->destType = dummy;
12710 dummy->refCount++;
12711 }
12712 if(exp->op.exp1->destType && exp->op.op != '=')
12713 exp->op.exp1->destType->count++;
12714 ProcessExpressionType(exp->op.exp1);
12715 if(exp->op.exp1->destType && exp->op.op != '=')
12716 exp->op.exp1->destType->count--;
12717 if(exp->op.exp1->destType == dummy)
12718 {
12719 FreeType(dummy);
12720 exp->op.exp1->destType = (((void *)0));
12721 }
12722 type1 = exp->op.exp1->expType;
12723 }
12724 if(exp->op.exp2)
12725 {
12726 char expString[10240];
12727
12728 expString[0] = '\0';
12729 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12730 {
12731 if(exp->op.exp1)
12732 {
12733 exp->op.exp2->destType = exp->op.exp1->expType;
12734 if(exp->op.exp1->expType)
12735 exp->op.exp1->expType->refCount++;
12736 }
12737 else
12738 {
12739 exp->op.exp2->destType = exp->destType;
12740 if(exp->destType)
12741 exp->destType->refCount++;
12742 }
12743 if(type1)
12744 type1->refCount++;
12745 exp->expType = type1;
12746 }
12747 else if(assign)
12748 {
12749 if(inCompiler)
12750 PrintExpression(exp->op.exp2, expString);
12751 if(type1 && type1->kind == 13)
12752 {
12753 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)
12754 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12755 else if(exp->op.op == '=')
12756 {
12757 if(exp->op.exp2->destType)
12758 FreeType(exp->op.exp2->destType);
12759 exp->op.exp2->destType = type1;
12760 if(type1)
12761 type1->refCount++;
12762 }
12763 }
12764 else
12765 {
12766 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)
12767 ;
12768 else
12769 {
12770 if(exp->op.exp2->destType)
12771 FreeType(exp->op.exp2->destType);
12772 exp->op.exp2->destType = type1;
12773 if(type1)
12774 type1->refCount++;
12775 }
12776 }
12777 if(type1)
12778 type1->refCount++;
12779 exp->expType = type1;
12780 }
12781 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)))
12782 {
12783 if(exp->op.exp2->destType)
12784 FreeType(exp->op.exp2->destType);
12785 exp->op.exp2->destType = exp->destType;
12786 if(exp->destType)
12787 exp->destType->refCount++;
12788 }
12789 else
12790 {
12791 if(exp->op.exp2->destType)
12792 FreeType(exp->op.exp2->destType);
12793 exp->op.exp2->destType = dummy;
12794 dummy->refCount++;
12795 }
12796 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12797 {
12798 FreeType(exp->op.exp2->destType);
12799 exp->op.exp2->destType = type1;
12800 type1->refCount++;
12801 }
12802 if(exp->op.exp2->destType && exp->op.op != '=')
12803 exp->op.exp2->destType->count++;
12804 ProcessExpressionType(exp->op.exp2);
12805 if(exp->op.exp2->destType && exp->op.op != '=')
12806 exp->op.exp2->destType->count--;
12807 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12808 {
12809 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)
12810 {
12811 if(exp->op.op != '=' && type1->type->kind == 0)
12812 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12813 }
12814 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)))
12815 {
12816 if(exp->op.op == ADD_ASSIGN)
12817 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12818 }
12819 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))
12820 {
12821 if(exp->op.op == ADD_ASSIGN)
12822 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12823 }
12824 else if(inCompiler)
12825 {
12826 char type1String[1024];
12827 char type2String[1024];
12828
12829 type1String[0] = '\0';
12830 type2String[0] = '\0';
12831 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12832 PrintType(type1, type2String, 0x0, 0x1);
12833 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12834 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12835 }
12836 }
12837 if(exp->op.exp2->destType == dummy)
12838 {
12839 FreeType(dummy);
12840 exp->op.exp2->destType = (((void *)0));
12841 }
12842 type2 = exp->op.exp2->expType;
12843 }
12844 dummy->kind = 0;
12845 if(exp->op.op == SIZEOF)
12846 {
12847 exp->expType = __extension__ ({
12848 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12849
12850 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
12851 });
12852 exp->isConstant = 0x1;
12853 }
12854 else if(exp->op.op == '*' && !exp->op.exp1)
12855 {
12856 exp->expType = Dereference(type2);
12857 if(type2 && type2->kind == 8)
12858 notByReference = 0x1;
12859 }
12860 else if(exp->op.op == '&' && !exp->op.exp1)
12861 exp->expType = Reference(type2);
12862 else if(!assign)
12863 {
12864 if(boolOps)
12865 {
12866 if(exp->op.exp1)
12867 {
12868 if(exp->op.exp1->destType)
12869 FreeType(exp->op.exp1->destType);
12870 exp->op.exp1->destType = MkClassType("bool");
12871 exp->op.exp1->destType->truth = 0x1;
12872 if(!exp->op.exp1->expType)
12873 ProcessExpressionType(exp->op.exp1);
12874 else
12875 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12876 FreeType(exp->op.exp1->expType);
12877 exp->op.exp1->expType = MkClassType("bool");
12878 exp->op.exp1->expType->truth = 0x1;
12879 }
12880 if(exp->op.exp2)
12881 {
12882 if(exp->op.exp2->destType)
12883 FreeType(exp->op.exp2->destType);
12884 exp->op.exp2->destType = MkClassType("bool");
12885 exp->op.exp2->destType->truth = 0x1;
12886 if(!exp->op.exp2->expType)
12887 ProcessExpressionType(exp->op.exp2);
12888 else
12889 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12890 FreeType(exp->op.exp2->expType);
12891 exp->op.exp2->expType = MkClassType("bool");
12892 exp->op.exp2->expType->truth = 0x1;
12893 }
12894 }
12895 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")))))
12896 {
12897 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
12898 {
12899 if(exp->op.exp2->destType)
12900 FreeType(exp->op.exp2->destType);
12901 exp->op.exp2->destType = type1;
12902 type1->refCount++;
12903 if(exp->op.exp1->destType)
12904 FreeType(exp->op.exp1->destType);
12905 exp->op.exp1->destType = type2;
12906 type2->refCount++;
12907 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)
12908 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);
12909 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
12910 {
12911 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12912
12913 if(argExp)
12914 {
12915 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12916
12917 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
12918 ProcessExpressionType(exp->op.exp1);
12919 if(type2->kind != 13)
12920 {
12921 ProcessExpressionType(classExp);
12922 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"))))))));
12923 if(!exp->op.exp2->expType)
12924 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
12925 ProcessExpressionType(exp->op.exp2);
12926 }
12927 }
12928 }
12929 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)))
12930 {
12931 if(type1->kind != 8 && type1->type->kind == 0)
12932 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12933 exp->expType = type1;
12934 if(type1)
12935 type1->refCount++;
12936 }
12937 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)))
12938 {
12939 if(type2->kind != 8 && type2->type->kind == 0)
12940 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12941 exp->expType = type2;
12942 if(type2)
12943 type2->refCount++;
12944 }
12945 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))
12946 {
12947 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
12948 }
12949 else
12950 {
12951 unsigned int success = 0x0;
12952
12953 if(type1->kind == 13 && type2->kind == 13)
12954 {
12955 if(exp->op.op == '+')
12956 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12957 else if(exp->op.op == '-')
12958 {
12959 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
12960 {
12961 exp->expType = __extension__ ({
12962 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12963
12964 __ecereInstance1->kind = 3, __ecereInstance1->refCount = 1, __ecereInstance1;
12965 });
12966 success = 0x1;
12967 if(type1->type->kind == 20)
12968 {
12969 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12970
12971 if(argExp)
12972 {
12973 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12974
12975 ProcessExpressionType(classExp);
12976 exp->type = 5;
12977 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")))))));
12978 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
12979 FreeType(dummy);
12980 return ;
12981 }
12982 }
12983 }
12984 }
12985 }
12986 if(!success && exp->op.exp1->type == 2)
12987 {
12988 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12989 {
12990 if(exp->expType)
12991 FreeType(exp->expType);
12992 exp->expType = exp->op.exp1->destType;
12993 if(exp->op.exp1->destType)
12994 exp->op.exp1->destType->refCount++;
12995 success = 0x1;
12996 }
12997 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12998 {
12999 if(exp->expType)
13000 FreeType(exp->expType);
13001 exp->expType = exp->op.exp2->destType;
13002 if(exp->op.exp2->destType)
13003 exp->op.exp2->destType->refCount++;
13004 success = 0x1;
13005 }
13006 }
13007 else if(!success)
13008 {
13009 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13010 {
13011 if(exp->expType)
13012 FreeType(exp->expType);
13013 exp->expType = exp->op.exp2->destType;
13014 if(exp->op.exp2->destType)
13015 exp->op.exp2->destType->refCount++;
13016 success = 0x1;
13017 }
13018 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13019 {
13020 if(exp->expType)
13021 FreeType(exp->expType);
13022 exp->expType = exp->op.exp1->destType;
13023 if(exp->op.exp1->destType)
13024 exp->op.exp1->destType->refCount++;
13025 success = 0x1;
13026 }
13027 }
13028 if(!success)
13029 {
13030 char expString1[10240];
13031 char expString2[10240];
13032 char type1[1024];
13033 char type2[1024];
13034
13035 expString1[0] = '\0';
13036 expString2[0] = '\0';
13037 type1[0] = '\0';
13038 type2[0] = '\0';
13039 if(inCompiler)
13040 {
13041 PrintExpression(exp->op.exp1, expString1);
13042 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13043 PrintExpression(exp->op.exp2, expString2);
13044 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13045 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
13046 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
13047 }
13048 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
13049 }
13050 }
13051 }
13052 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13053 {
13054 if(exp->op.exp1->destType)
13055 FreeType(exp->op.exp1->destType);
13056 exp->op.exp1->destType = type2->_class->registered->dataType;
13057 if(type2->_class->registered->dataType)
13058 type2->_class->registered->dataType->refCount++;
13059 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13060 exp->expType = type2;
13061 if(type2)
13062 type2->refCount++;
13063 }
13064 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13065 {
13066 if(exp->op.exp2->destType)
13067 FreeType(exp->op.exp2->destType);
13068 exp->op.exp2->destType = type1->_class->registered->dataType;
13069 if(type1->_class->registered->dataType)
13070 type1->_class->registered->dataType->refCount++;
13071 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13072 exp->expType = type1;
13073 if(type1)
13074 type1->refCount++;
13075 }
13076 else if(type1)
13077 {
13078 unsigned int valid = 0x0;
13079
13080 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
13081 {
13082 if(exp->op.exp2->destType)
13083 FreeType(exp->op.exp2->destType);
13084 if(!type1->_class->registered->dataType)
13085 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
13086 exp->op.exp2->destType = type1->_class->registered->dataType;
13087 exp->op.exp2->destType->refCount++;
13088 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13089 type2 = exp->op.exp2->destType;
13090 exp->expType = type2;
13091 type2->refCount++;
13092 }
13093 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
13094 {
13095 if(exp->op.exp1->destType)
13096 FreeType(exp->op.exp1->destType);
13097 if(!type2->_class->registered->dataType)
13098 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
13099 exp->op.exp1->destType = type2->_class->registered->dataType;
13100 exp->op.exp1->destType->refCount++;
13101 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13102 type1 = exp->op.exp1->destType;
13103 exp->expType = type1;
13104 type1->refCount++;
13105 }
13106 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
13107 {
13108 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
13109 {
13110 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
13111 {
13112 if(exp->expType)
13113 FreeType(exp->expType);
13114 exp->expType = exp->op.exp1->expType;
13115 if(exp->op.exp2->expType)
13116 exp->op.exp1->expType->refCount++;
13117 valid = 0x1;
13118 }
13119 }
13120 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
13121 {
13122 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
13123 {
13124 if(exp->expType)
13125 FreeType(exp->expType);
13126 exp->expType = exp->op.exp2->expType;
13127 if(exp->op.exp2->expType)
13128 exp->op.exp2->expType->refCount++;
13129 valid = 0x1;
13130 }
13131 }
13132 }
13133 if(!valid)
13134 {
13135 if(exp->op.exp2->destType)
13136 FreeType(exp->op.exp2->destType);
13137 exp->op.exp2->destType = type1;
13138 type1->refCount++;
13139 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13140 {
13141 if(exp->expType)
13142 FreeType(exp->expType);
13143 exp->expType = exp->op.exp2->destType;
13144 if(exp->op.exp2->destType)
13145 exp->op.exp2->destType->refCount++;
13146 }
13147 else if(type1 && type2)
13148 {
13149 char expString1[10240];
13150 char expString2[10240];
13151 char type1String[1024];
13152 char type2String[1024];
13153
13154 expString1[0] = '\0';
13155 expString2[0] = '\0';
13156 type1String[0] = '\0';
13157 type2String[0] = '\0';
13158 if(inCompiler)
13159 {
13160 PrintExpression(exp->op.exp1, expString1);
13161 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13162 PrintExpression(exp->op.exp2, expString2);
13163 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13164 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
13165 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
13166 }
13167 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
13168 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
13169 {
13170 exp->expType = exp->op.exp1->expType;
13171 if(exp->op.exp1->expType)
13172 exp->op.exp1->expType->refCount++;
13173 }
13174 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13175 {
13176 exp->expType = exp->op.exp2->expType;
13177 if(exp->op.exp2->expType)
13178 exp->op.exp2->expType->refCount++;
13179 }
13180 }
13181 }
13182 }
13183 else if(type2)
13184 {
13185 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13186 {
13187 struct Type * oldType = exp->op.exp1->expType;
13188
13189 exp->op.exp1->expType = (((void *)0));
13190 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13191 FreeType(oldType);
13192 else
13193 exp->op.exp1->expType = oldType;
13194 }
13195 if(exp->op.exp1->destType)
13196 FreeType(exp->op.exp1->destType);
13197 exp->op.exp1->destType = type2;
13198 type2->refCount++;
13199 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13200 {
13201 if(exp->expType)
13202 FreeType(exp->expType);
13203 exp->expType = exp->op.exp1->destType;
13204 if(exp->op.exp1->destType)
13205 exp->op.exp1->destType->refCount++;
13206 }
13207 }
13208 }
13209 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
13210 {
13211 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13212 {
13213 if(exp->op.exp1->destType)
13214 FreeType(exp->op.exp1->destType);
13215 exp->op.exp1->destType = type2->_class->registered->dataType;
13216 if(type2->_class->registered->dataType)
13217 type2->_class->registered->dataType->refCount++;
13218 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13219 }
13220 if(exp->op.op == '!')
13221 {
13222 exp->expType = MkClassType("bool");
13223 exp->expType->truth = 0x1;
13224 }
13225 else
13226 {
13227 exp->expType = type2;
13228 if(type2)
13229 type2->refCount++;
13230 }
13231 }
13232 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
13233 {
13234 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13235 {
13236 if(exp->op.exp2->destType)
13237 FreeType(exp->op.exp2->destType);
13238 exp->op.exp2->destType = type1->_class->registered->dataType;
13239 if(type1->_class->registered->dataType)
13240 type1->_class->registered->dataType->refCount++;
13241 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13242 }
13243 exp->expType = type1;
13244 if(type1)
13245 type1->refCount++;
13246 }
13247 }
13248 yylloc = exp->loc;
13249 if(exp->op.exp1 && !exp->op.exp1->expType)
13250 {
13251 char expString[10000];
13252
13253 expString[0] = '\0';
13254 if(inCompiler)
13255 {
13256 PrintExpression(exp->op.exp1, expString);
13257 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13258 }
13259 if(expString[0])
13260 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13261 }
13262 if(exp->op.exp2 && !exp->op.exp2->expType)
13263 {
13264 char expString[10240];
13265
13266 expString[0] = '\0';
13267 if(inCompiler)
13268 {
13269 PrintExpression(exp->op.exp2, expString);
13270 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13271 }
13272 if(expString[0])
13273 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13274 }
13275 if(boolResult)
13276 {
13277 FreeType(exp->expType);
13278 exp->expType = MkClassType("bool");
13279 exp->expType->truth = 0x1;
13280 }
13281 if(exp->op.op != SIZEOF)
13282 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
13283 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
13284 {
13285 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
13286 }
13287 yylloc = oldyylloc;
13288 FreeType(dummy);
13289 break;
13290 }
13291 case 5:
13292 case 34:
13293 {
13294 struct Expression * e;
13295
13296 exp->isConstant = 0x1;
13297 for(e = (*exp->list).first; e; e = e->next)
13298 {
13299 unsigned int inced = 0x0;
13300
13301 if(!e->next)
13302 {
13303 FreeType(e->destType);
13304 e->destType = exp->destType;
13305 if(e->destType)
13306 {
13307 exp->destType->refCount++;
13308 e->destType->count++;
13309 inced = 0x1;
13310 }
13311 }
13312 ProcessExpressionType(e);
13313 if(inced)
13314 exp->destType->count--;
13315 if(!exp->expType && !e->next)
13316 {
13317 exp->expType = e->expType;
13318 if(e->expType)
13319 e->expType->refCount++;
13320 }
13321 if(!e->isConstant)
13322 exp->isConstant = 0x0;
13323 }
13324 e = (*exp->list).first;
13325 if(!e->next && e->type == 8)
13326 {
13327 struct Expression * next = exp->next, * prev = exp->prev;
13328
13329 FreeType(exp->expType);
13330 FreeType(exp->destType);
13331 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
13332 *exp = *e;
13333 exp->prev = prev;
13334 exp->next = next;
13335 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
13336 ProcessExpressionType(exp);
13337 }
13338 break;
13339 }
13340 case 6:
13341 {
13342 struct Expression * e;
13343
13344 exp->isConstant = 0x1;
13345 ProcessExpressionType(exp->index.exp);
13346 if(!exp->index.exp->isConstant)
13347 exp->isConstant = 0x0;
13348 if(exp->index.exp->expType)
13349 {
13350 struct Type * source = exp->index.exp->expType;
13351
13352 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)
13353 {
13354 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
13355
13356 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
13357 if(exp->index.index && (*exp->index.index).last)
13358 {
13359 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
13360 }
13361 }
13362 }
13363 for(e = (*exp->index.index).first; e; e = e->next)
13364 {
13365 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
13366 {
13367 if(e->destType)
13368 FreeType(e->destType);
13369 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
13370 }
13371 ProcessExpressionType(e);
13372 if(!e->next)
13373 {
13374 }
13375 if(!e->isConstant)
13376 exp->isConstant = 0x0;
13377 }
13378 if(!exp->expType)
13379 exp->expType = Dereference(exp->index.exp->expType);
13380 if(exp->expType)
13381 DeclareType(exp->expType, 0x0, 0x0);
13382 break;
13383 }
13384 case 7:
13385 {
13386 struct Expression * e;
13387 struct Type * functionType;
13388 struct Type * methodType = (((void *)0));
13389 char name[1024];
13390
13391 name[0] = '\0';
13392 if(inCompiler)
13393 {
13394 PrintExpression(exp->call.exp, name);
13395 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
13396 {
13397 PrintExpression(exp->call.exp, name);
13398 }
13399 }
13400 if(exp->call.exp->type == 0)
13401 {
13402 struct Expression * idExp = exp->call.exp;
13403 struct Identifier * id = idExp->identifier;
13404
13405 if(!strcmp(id->string, "__builtin_frame_address"))
13406 {
13407 exp->expType = ProcessTypeString("void *", 0x1);
13408 if(exp->call.arguments && (*exp->call.arguments).first)
13409 ProcessExpressionType((*exp->call.arguments).first);
13410 break;
13411 }
13412 else if(!strcmp(id->string, "__ENDIAN_PAD"))
13413 {
13414 exp->expType = ProcessTypeString("int", 0x1);
13415 if(exp->call.arguments && (*exp->call.arguments).first)
13416 ProcessExpressionType((*exp->call.arguments).first);
13417 break;
13418 }
13419 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
13420 {
13421 struct Expression * a = (((void *)0));
13422 struct Expression * b = (((void *)0));
13423 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
13424
13425 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
13426 {
13427 a = (*exp->call.arguments).first;
13428 b = (*exp->call.arguments).last;
13429 tempExp1 = a;
13430 tempExp2 = b;
13431 }
13432 else if((*exp->call.arguments).count == 1)
13433 {
13434 a = (*exp->call.arguments).first;
13435 tempExp1 = a;
13436 }
13437 if(a)
13438 {
13439 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
13440 idExp->identifier = (((void *)0));
13441 FreeExpContents(exp);
13442 ProcessExpressionType(a);
13443 if(b)
13444 ProcessExpressionType(b);
13445 exp->type = 5;
13446 exp->list = MkList();
13447 if(a->expType && (!b || b->expType))
13448 {
13449 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
13450 {
13451 if(inCompiler)
13452 {
13453 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13454 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
13455 struct Declaration * decl;
13456 char temp1[1024], temp2[1024];
13457
13458 GetTypeSpecs(a->expType, specs);
13459 if(a && !a->isConstant && a->type != 0)
13460 {
13461 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
13462 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
13463 tempExp1 = QMkExpId(temp1);
13464 tempExp1->expType = a->expType;
13465 if(a->expType)
13466 a->expType->refCount++;
13467 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
13468 }
13469 if(b && !b->isConstant && b->type != 0)
13470 {
13471 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
13472 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
13473 tempExp2 = QMkExpId(temp2);
13474 tempExp2->expType = b->expType;
13475 if(b->expType)
13476 b->expType->refCount++;
13477 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
13478 }
13479 decl = MkDeclaration(specs, decls);
13480 if(!curCompound->compound.declarations)
13481 curCompound->compound.declarations = MkList();
13482 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
13483 }
13484 }
13485 }
13486 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13487 {
13488 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13489
13490 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13491 exp->expType = a->expType;
13492 if(a->expType)
13493 a->expType->refCount++;
13494 }
13495 else if(!strcmp(id->string, "Abs"))
13496 {
13497 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13498 exp->expType = a->expType;
13499 if(a->expType)
13500 a->expType->refCount++;
13501 }
13502 else if(!strcmp(id->string, "Sgn"))
13503 {
13504 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"))))));
13505 exp->expType = ProcessTypeString("int", 0x0);
13506 }
13507 FreeExpression(tempExp1);
13508 if(tempExp2)
13509 FreeExpression(tempExp2);
13510 FreeIdentifier(id);
13511 break;
13512 }
13513 }
13514 }
13515 {
13516 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
13517
13518 if(!exp->call.exp->destType)
13519 {
13520 exp->call.exp->destType = dummy;
13521 dummy->refCount++;
13522 }
13523 ProcessExpressionType(exp->call.exp);
13524 if(exp->call.exp->destType == dummy)
13525 {
13526 FreeType(dummy);
13527 exp->call.exp->destType = (((void *)0));
13528 }
13529 FreeType(dummy);
13530 }
13531 functionType = exp->call.exp->expType;
13532 if(functionType && functionType->kind == 16)
13533 {
13534 methodType = functionType;
13535 functionType = methodType->method->dataType;
13536 if(exp->call.exp->expType->usedClass)
13537 {
13538 char typeString[1024];
13539
13540 typeString[0] = '\0';
13541 PrintType(functionType, typeString, 0x1, 0x1);
13542 if(strstr(typeString, "thisclass"))
13543 {
13544 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13545 struct Declarator * decl;
13546
13547 {
13548 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13549
13550 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13551 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13552 thisClassParams = 0x0;
13553 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13554 {
13555 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13556
13557 thisClass = exp->call.exp->expType->usedClass;
13558 ProcessDeclarator(decl);
13559 thisClass = backupThisClass;
13560 }
13561 thisClassParams = 0x1;
13562 functionType = ProcessType(specs, decl);
13563 functionType->refCount = 0;
13564 FinishTemplatesContext(context);
13565 }
13566 FreeList(specs, FreeSpecifier);
13567 FreeDeclarator(decl);
13568 }
13569 }
13570 }
13571 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13572 {
13573 struct Type * type = functionType->type;
13574
13575 if(!functionType->refCount)
13576 {
13577 functionType->type = (((void *)0));
13578 FreeType(functionType);
13579 }
13580 functionType = type;
13581 }
13582 if(functionType && functionType->kind != 11)
13583 {
13584 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13585 }
13586 else if(functionType)
13587 {
13588 unsigned int emptyParams = 0x0, noParams = 0x0;
13589 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13590 struct Type * type = functionType->params.first;
13591 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13592 int extra = 0;
13593 struct Location oldyylloc = yylloc;
13594
13595 if(!type)
13596 emptyParams = 0x1;
13597 if(functionType->extraParam && e && functionType->thisClass)
13598 {
13599 e->destType = MkClassType(functionType->thisClass->string);
13600 e = e->next;
13601 }
13602 if(!functionType->staticMethod)
13603 {
13604 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13605 {
13606 type = MkClassType(memberExp->member.exp->expType->_class->string);
13607 if(e)
13608 {
13609 e->destType = type;
13610 e = e->next;
13611 type = functionType->params.first;
13612 }
13613 else
13614 type->refCount = 0;
13615 }
13616 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13617 {
13618 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13619 if(e)
13620 {
13621 e->destType = type;
13622 e = e->next;
13623 type = functionType->params.first;
13624 }
13625 else
13626 type->refCount = 0;
13627 }
13628 }
13629 if(type && type->kind == 0)
13630 {
13631 noParams = 0x1;
13632 if(!type->refCount)
13633 FreeType(type);
13634 type = (((void *)0));
13635 }
13636 for(; e; e = e->next)
13637 {
13638 if(!type && !emptyParams)
13639 {
13640 yylloc = e->loc;
13641 if(methodType && methodType->methodClass)
13642 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);
13643 else
13644 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);
13645 break;
13646 }
13647 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13648 {
13649 struct Type * templatedType = (((void *)0));
13650 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13651 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13652 int id = 0;
13653
13654 if(_class && _class->templateArgs)
13655 {
13656 struct __ecereNameSpace__ecere__com__Class * sClass;
13657
13658 for(sClass = _class; sClass; sClass = sClass->base)
13659 {
13660 if(sClass->templateClass)
13661 sClass = sClass->templateClass;
13662 id = 0;
13663 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13664 {
13665 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13666 {
13667 struct __ecereNameSpace__ecere__com__Class * nextClass;
13668
13669 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13670 {
13671 if(nextClass->templateClass)
13672 nextClass = nextClass->templateClass;
13673 id += nextClass->templateParams.count;
13674 }
13675 break;
13676 }
13677 id++;
13678 }
13679 if(curParam)
13680 break;
13681 }
13682 }
13683 if(curParam && _class->templateArgs[id].dataTypeString)
13684 {
13685 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13686
13687 {
13688 struct Context * context = SetupTemplatesContext(_class);
13689
13690 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13691 FinishTemplatesContext(context);
13692 }
13693 e->destType = templatedType;
13694 if(templatedType)
13695 {
13696 templatedType->passAsTemplate = 0x1;
13697 }
13698 }
13699 else
13700 {
13701 e->destType = type;
13702 if(type)
13703 type->refCount++;
13704 }
13705 }
13706 else
13707 {
13708 if(type && type->kind == 14 && type->prev && type->prev->kind == 8 && type->prev->classObjectType)
13709 {
13710 e->destType = type->prev;
13711 e->destType->refCount++;
13712 }
13713 else
13714 {
13715 e->destType = type;
13716 if(type)
13717 type->refCount++;
13718 }
13719 }
13720 if(type && type->kind != 14)
13721 {
13722 struct Type * next = type->next;
13723
13724 if(!type->refCount)
13725 FreeType(type);
13726 type = next;
13727 }
13728 }
13729 if(type && type->kind != 14)
13730 {
13731 if(methodType && methodType->methodClass)
13732 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);
13733 else
13734 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);
13735 }
13736 yylloc = oldyylloc;
13737 if(type && !type->refCount)
13738 FreeType(type);
13739 }
13740 else
13741 {
13742 functionType = __extension__ ({
13743 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13744
13745 __ecereInstance1->refCount = 0, __ecereInstance1->kind = 11, __ecereInstance1;
13746 });
13747 if(exp->call.exp->type == 0)
13748 {
13749 char * string = exp->call.exp->identifier->string;
13750
13751 if(inCompiler)
13752 {
13753 struct Symbol * symbol;
13754 struct Location oldyylloc = yylloc;
13755
13756 yylloc = exp->call.exp->identifier->loc;
13757 if(strstr(string, "__builtin_") == string)
13758 ;
13759 else
13760 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13761 symbol = __extension__ ({
13762 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
13763
13764 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString(string), __ecereInstance1->type = ProcessTypeString("int()", 0x1), __ecereInstance1;
13765 });
13766 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13767 if(strstr(symbol->string, "::"))
13768 globalContext->hasNameSpace = 0x1;
13769 yylloc = oldyylloc;
13770 }
13771 }
13772 else if(exp->call.exp->type == 8)
13773 {
13774 }
13775 else
13776 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13777 if(!functionType->returnType)
13778 {
13779 functionType->returnType = __extension__ ({
13780 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13781
13782 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
13783 });
13784 }
13785 }
13786 if(functionType && functionType->kind == 11)
13787 {
13788 exp->expType = functionType->returnType;
13789 if(functionType->returnType)
13790 functionType->returnType->refCount++;
13791 if(!functionType->refCount)
13792 FreeType(functionType);
13793 }
13794 if(exp->call.arguments)
13795 {
13796 for(e = (*exp->call.arguments).first; e; e = e->next)
13797 {
13798 struct Type * destType = e->destType;
13799
13800 ProcessExpressionType(e);
13801 }
13802 }
13803 break;
13804 }
13805 case 8:
13806 {
13807 struct Type * type;
13808 struct Location oldyylloc = yylloc;
13809 unsigned int thisPtr = (exp->member.exp && exp->member.exp->type == 0 && !strcmp(exp->member.exp->identifier->string, "this"));
13810
13811 exp->thisPtr = thisPtr;
13812 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13813 {
13814 exp->member.member->classSym = exp->member.member->_class->symbol;
13815 }
13816 ProcessExpressionType(exp->member.exp);
13817 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)
13818 {
13819 exp->isConstant = 0x0;
13820 }
13821 else
13822 exp->isConstant = exp->member.exp->isConstant;
13823 type = exp->member.exp->expType;
13824 yylloc = exp->loc;
13825 if(type && (type->kind == 20))
13826 {
13827 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13828 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13829
13830 if(_class)
13831 {
13832 for(param = _class->templateParams.first; param; param = param->next)
13833 {
13834 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
13835 break;
13836 }
13837 }
13838 if(param && param->defaultArg.member)
13839 {
13840 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
13841
13842 if(argExp)
13843 {
13844 struct Expression * expMember = exp->member.exp;
13845 struct Declarator * decl;
13846 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13847 char thisClassTypeString[1024];
13848
13849 FreeIdentifier(exp->member.member);
13850 ProcessExpressionType(argExp);
13851 {
13852 char * colon = strstr(param->defaultArg.memberString, "::");
13853
13854 if(colon)
13855 {
13856 char className[1024];
13857 struct __ecereNameSpace__ecere__com__Class * sClass;
13858
13859 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
13860 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
13861 }
13862 else
13863 strcpy(thisClassTypeString, _class->fullName);
13864 }
13865 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
13866 exp->expType = ProcessType(specs, decl);
13867 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
13868 {
13869 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13870 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13871 int c;
13872 int paramCount = 0;
13873 int lastParam = -1;
13874 char templateString[1024];
13875 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13876
13877 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13878 for(cClass = expClass; cClass; cClass = cClass->base)
13879 {
13880 int p = 0;
13881
13882 for(param = cClass->templateParams.first; param; param = param->next)
13883 {
13884 int id = p;
13885 struct __ecereNameSpace__ecere__com__Class * sClass;
13886 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13887
13888 for(sClass = cClass->base; sClass; sClass = sClass->base)
13889 id += sClass->templateParams.count;
13890 arg = expClass->templateArgs[id];
13891 for(sClass = _class; sClass; sClass = sClass->base)
13892 {
13893 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
13894 int p = 0;
13895 struct __ecereNameSpace__ecere__com__Class * nextClass;
13896
13897 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13898 p += nextClass->templateParams.count;
13899 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
13900 {
13901 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
13902 {
13903 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13904 {
13905 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
13906 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
13907 break;
13908 }
13909 }
13910 }
13911 }
13912 {
13913 char argument[256];
13914
13915 argument[0] = '\0';
13916 switch(param->type)
13917 {
13918 case 2:
13919 {
13920 char expString[1024];
13921 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13922 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13923 struct Expression * exp;
13924 char * string = PrintHexUInt64(arg.expression.ui64);
13925
13926 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13927 ProcessExpressionType(exp);
13928 ComputeExpression(exp);
13929 expString[0] = '\0';
13930 PrintExpression(exp, expString);
13931 strcat(argument, expString);
13932 FreeExpression(exp);
13933 break;
13934 }
13935 case 1:
13936 {
13937 strcat(argument, arg.member->name);
13938 break;
13939 }
13940 case 0:
13941 {
13942 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13943 {
13944 if(!strcmp(arg.dataTypeString, "thisclass"))
13945 strcat(argument, thisClassTypeString);
13946 else
13947 strcat(argument, arg.dataTypeString);
13948 }
13949 break;
13950 }
13951 }
13952 if(argument[0])
13953 {
13954 if(paramCount)
13955 strcat(templateString, ", ");
13956 if(lastParam != p - 1)
13957 {
13958 strcat(templateString, param->name);
13959 strcat(templateString, " = ");
13960 }
13961 strcat(templateString, argument);
13962 paramCount++;
13963 lastParam = p;
13964 }
13965 p++;
13966 }
13967 }
13968 }
13969 {
13970 int len = strlen(templateString);
13971
13972 if(templateString[len - 1] == '>')
13973 templateString[len++] = ' ';
13974 templateString[len++] = '>';
13975 templateString[len++] = '\0';
13976 }
13977 {
13978 struct Context * context = SetupTemplatesContext(_class);
13979
13980 FreeType(exp->expType);
13981 exp->expType = ProcessTypeString(templateString, 0x0);
13982 FinishTemplatesContext(context);
13983 }
13984 }
13985 exp->type = 5;
13986 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")))))))));
13987 }
13988 }
13989 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
13990 {
13991 type = ProcessTemplateParameterType(type->templateParameter);
13992 }
13993 }
13994 if(type && (type->kind == 20))
13995 ;
13996 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13997 {
13998 struct Identifier * id = exp->member.member;
13999 int typeKind = type->kind;
14000 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));
14001
14002 if(typeKind == 19 && exp->member.exp->type == 26)
14003 {
14004 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
14005 typeKind = 8;
14006 }
14007 if(id && (typeKind == 3 || typeKind == 15))
14008 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
14009 if(_class && id)
14010 {
14011 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
14012 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
14013 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
14014 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
14015 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
14016
14017 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
14018 exp->member.memberType = 1;
14019 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
14020 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
14021 if(typeKind != 19)
14022 {
14023 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
14024 {
14025 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
14026 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
14027 {
14028 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14029 if(prop)
14030 member = (((void *)0));
14031 }
14032 if(!member && !prop)
14033 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14034 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
14035 exp->member.thisPtr = 0x1;
14036 }
14037 else
14038 {
14039 if(!id->classSym)
14040 {
14041 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
14042 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
14043 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
14044 }
14045 if(!prop && !member)
14046 {
14047 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
14048 if(!method)
14049 {
14050 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14051 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
14052 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
14053 }
14054 }
14055 if(member && prop)
14056 {
14057 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
14058 prop = (((void *)0));
14059 else
14060 member = (((void *)0));
14061 }
14062 }
14063 }
14064 if(!prop && !member)
14065 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
14066 if(!prop && !member && !method)
14067 {
14068 if(typeKind == 19)
14069 {
14070 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
14071 if(classProp)
14072 {
14073 exp->member.memberType = 5;
14074 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
14075 }
14076 else
14077 {
14078 char structName[1024];
14079 struct Identifier * id = exp->member.member;
14080 struct Expression * classExp = exp->member.exp;
14081
14082 type->refCount++;
14083 FreeType(classExp->expType);
14084 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
14085 strcpy(structName, "__ecereClassData_");
14086 FullClassNameCat(structName, type->_class->string, 0x0);
14087 exp->type = 9;
14088 exp->member.member = id;
14089 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"))))))));
14090 FreeType(type);
14091 ProcessExpressionType(exp);
14092 return ;
14093 }
14094 }
14095 else
14096 {
14097 struct Symbol * classSym = FindClass(id->string);
14098
14099 if(classSym)
14100 {
14101 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
14102
14103 if(convertClass)
14104 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
14105 }
14106 }
14107 }
14108 if(prop)
14109 {
14110 exp->member.memberType = 1;
14111 if(!prop->dataType)
14112 ProcessPropertyType(prop);
14113 exp->expType = prop->dataType;
14114 if(prop->dataType)
14115 prop->dataType->refCount++;
14116 }
14117 else if(member)
14118 {
14119 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14120 {
14121 FreeExpContents(exp);
14122 exp->type = 0;
14123 exp->identifier = MkIdentifier("class");
14124 ProcessExpressionType(exp);
14125 return ;
14126 }
14127 exp->member.memberType = 3;
14128 DeclareStruct(_class->fullName, 0x0);
14129 if(!member->dataType)
14130 {
14131 struct Context * context = SetupTemplatesContext(_class);
14132
14133 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
14134 FinishTemplatesContext(context);
14135 }
14136 exp->expType = member->dataType;
14137 if(member->dataType)
14138 member->dataType->refCount++;
14139 }
14140 else if(revConvert)
14141 {
14142 exp->member.memberType = 4;
14143 exp->expType = MkClassType(revConvert->_class->fullName);
14144 }
14145 else if(method)
14146 {
14147 if(inCompiler)
14148 {
14149 exp->member.memberType = 2;
14150 }
14151 if(!method->dataType)
14152 ProcessMethodType(method);
14153 exp->expType = __extension__ ({
14154 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14155
14156 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1;
14157 });
14158 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
14159 exp->expType->usedClass = _class;
14160 }
14161 else if(!classProp)
14162 {
14163 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14164 {
14165 FreeExpContents(exp);
14166 exp->type = 0;
14167 exp->identifier = MkIdentifier("class");
14168 ProcessExpressionType(exp);
14169 return ;
14170 }
14171 yylloc = exp->member.member->loc;
14172 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
14173 if(inCompiler)
14174 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
14175 }
14176 if(_class && exp->expType)
14177 {
14178 struct __ecereNameSpace__ecere__com__Class * tClass;
14179
14180 tClass = _class;
14181 while(tClass && !tClass->templateClass)
14182 tClass = tClass->base;
14183 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
14184 {
14185 int id = 0;
14186 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14187 struct __ecereNameSpace__ecere__com__Class * sClass;
14188
14189 for(sClass = tClass; sClass; sClass = sClass->base)
14190 {
14191 id = 0;
14192 if(sClass->templateClass)
14193 sClass = sClass->templateClass;
14194 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14195 {
14196 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
14197 {
14198 for(sClass = sClass->base; sClass; sClass = sClass->base)
14199 id += sClass->templateParams.count;
14200 break;
14201 }
14202 id++;
14203 }
14204 if(curParam)
14205 break;
14206 }
14207 if(curParam && tClass->templateArgs[id].dataTypeString)
14208 {
14209 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14210 struct Context * context = SetupTemplatesContext(tClass);
14211
14212 FreeType(exp->expType);
14213 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
14214 if(exp->expType)
14215 {
14216 if(exp->expType->kind == 21)
14217 {
14218 FreeType(exp->expType);
14219 exp->expType = ReplaceThisClassType(_class);
14220 }
14221 if(tClass->templateClass)
14222 exp->expType->passAsTemplate = 0x1;
14223 if(!exp->destType)
14224 {
14225 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
14226 if(exp->destType->kind == 21)
14227 {
14228 FreeType(exp->destType);
14229 exp->destType = ReplaceThisClassType(_class);
14230 }
14231 }
14232 }
14233 FinishTemplatesContext(context);
14234 }
14235 }
14236 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
14237 {
14238 int id = 0;
14239 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14240 struct __ecereNameSpace__ecere__com__Class * sClass;
14241
14242 for(sClass = tClass; sClass; sClass = sClass->base)
14243 {
14244 id = 0;
14245 if(sClass->templateClass)
14246 sClass = sClass->templateClass;
14247 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14248 {
14249 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
14250 {
14251 for(sClass = sClass->base; sClass; sClass = sClass->base)
14252 id += sClass->templateParams.count;
14253 break;
14254 }
14255 id++;
14256 }
14257 if(curParam)
14258 break;
14259 }
14260 if(curParam)
14261 {
14262 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14263 struct Context * context = SetupTemplatesContext(tClass);
14264 struct Type * basicType;
14265
14266 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
14267 if(basicType)
14268 {
14269 if(basicType->kind == 21)
14270 {
14271 FreeType(basicType);
14272 basicType = ReplaceThisClassType(_class);
14273 }
14274 FreeType(exp->expType);
14275 exp->expType = __extension__ ({
14276 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14277
14278 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = basicType, __ecereInstance1;
14279 });
14280 if(!exp->destType)
14281 {
14282 exp->destType = exp->expType;
14283 exp->destType->refCount++;
14284 }
14285 {
14286 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14287 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14288 struct Declarator * decl;
14289
14290 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
14291 *newExp = *exp;
14292 if(exp->destType)
14293 exp->destType->refCount++;
14294 if(exp->expType)
14295 exp->expType->refCount++;
14296 exp->type = 11;
14297 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
14298 exp->cast.exp = newExp;
14299 }
14300 }
14301 FinishTemplatesContext(context);
14302 }
14303 }
14304 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
14305 {
14306 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
14307
14308 if(expClass)
14309 {
14310 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
14311 int c;
14312 int p = 0;
14313 int paramCount = 0;
14314 int lastParam = -1;
14315 char templateString[1024];
14316 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
14317
14318 sprintf(templateString, "%s<", expClass->templateClass->fullName);
14319 while(cClass != expClass)
14320 {
14321 struct __ecereNameSpace__ecere__com__Class * sClass;
14322
14323 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
14324 ;
14325 cClass = sClass;
14326 for(param = cClass->templateParams.first; param; param = param->next)
14327 {
14328 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
14329 int c;
14330 int cp = 0;
14331 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
14332 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
14333
14334 while(cClassCur != tClass && !paramCur)
14335 {
14336 struct __ecereNameSpace__ecere__com__Class * sClassCur;
14337
14338 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
14339 ;
14340 cClassCur = sClassCur;
14341 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
14342 {
14343 if(!strcmp(paramCur->name, param->name))
14344 {
14345 break;
14346 }
14347 cp++;
14348 }
14349 }
14350 if(paramCur && paramCur->type == 0)
14351 arg = tClass->templateArgs[cp];
14352 else
14353 arg = expClass->templateArgs[p];
14354 {
14355 char argument[256];
14356
14357 argument[0] = '\0';
14358 switch(param->type)
14359 {
14360 case 2:
14361 {
14362 char expString[1024];
14363 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14364 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14365 struct Expression * exp;
14366 char * string = PrintHexUInt64(arg.expression.ui64);
14367
14368 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14369 ProcessExpressionType(exp);
14370 ComputeExpression(exp);
14371 expString[0] = '\0';
14372 PrintExpression(exp, expString);
14373 strcat(argument, expString);
14374 FreeExpression(exp);
14375 break;
14376 }
14377 case 1:
14378 {
14379 strcat(argument, arg.member->name);
14380 break;
14381 }
14382 case 0:
14383 {
14384 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14385 strcat(argument, arg.dataTypeString);
14386 break;
14387 }
14388 }
14389 if(argument[0])
14390 {
14391 if(paramCount)
14392 strcat(templateString, ", ");
14393 if(lastParam != p - 1)
14394 {
14395 strcat(templateString, param->name);
14396 strcat(templateString, " = ");
14397 }
14398 strcat(templateString, argument);
14399 paramCount++;
14400 lastParam = p;
14401 }
14402 }
14403 p++;
14404 }
14405 }
14406 {
14407 int len = strlen(templateString);
14408
14409 if(templateString[len - 1] == '>')
14410 templateString[len++] = ' ';
14411 templateString[len++] = '>';
14412 templateString[len++] = '\0';
14413 }
14414 FreeType(exp->expType);
14415 {
14416 struct Context * context = SetupTemplatesContext(tClass);
14417
14418 exp->expType = ProcessTypeString(templateString, 0x0);
14419 FinishTemplatesContext(context);
14420 }
14421 }
14422 }
14423 }
14424 }
14425 else
14426 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)");
14427 }
14428 else if(type && (type->kind == 9 || type->kind == 10))
14429 {
14430 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
14431
14432 if(memberType)
14433 {
14434 exp->expType = memberType;
14435 if(memberType)
14436 memberType->refCount++;
14437 }
14438 }
14439 else
14440 {
14441 char expString[10240];
14442
14443 expString[0] = '\0';
14444 if(inCompiler)
14445 {
14446 PrintExpression(exp, expString);
14447 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14448 }
14449 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
14450 }
14451 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
14452 {
14453 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
14454 {
14455 struct Identifier * id = exp->member.member;
14456 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));
14457
14458 if(_class)
14459 {
14460 FreeType(exp->expType);
14461 exp->expType = ReplaceThisClassType(_class);
14462 }
14463 }
14464 }
14465 yylloc = oldyylloc;
14466 break;
14467 }
14468 case 9:
14469 {
14470 struct Type * destType = exp->destType;
14471
14472 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
14473 {
14474 exp->member.member->classSym = exp->member.member->_class->symbol;
14475 }
14476 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
14477 exp->type = 8;
14478 if(destType)
14479 destType->count++;
14480 ProcessExpressionType(exp);
14481 if(destType)
14482 destType->count--;
14483 break;
14484 }
14485 case 15:
14486 {
14487 struct Symbol * classSym = exp->_class->symbol;
14488
14489 if(classSym && classSym->registered)
14490 {
14491 if(classSym->registered->type == 5)
14492 {
14493 char name[1024];
14494
14495 name[0] = '\0';
14496 DeclareStruct(classSym->string, 0x0);
14497 FreeSpecifier(exp->_class);
14498 exp->type = 10;
14499 FullClassNameCat(name, classSym->string, 0x0);
14500 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
14501 }
14502 else
14503 {
14504 if(classSym->registered->fixed)
14505 {
14506 FreeSpecifier(exp->_class);
14507 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
14508 exp->type = 2;
14509 }
14510 else
14511 {
14512 char className[1024];
14513
14514 strcpy(className, "__ecereClass_");
14515 FullClassNameCat(className, classSym->string, 0x1);
14516 MangleClassName(className);
14517 DeclareClass(classSym, className);
14518 FreeExpContents(exp);
14519 exp->type = 9;
14520 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14521 exp->member.member = MkIdentifier("structSize");
14522 }
14523 }
14524 }
14525 exp->expType = __extension__ ({
14526 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14527
14528 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
14529 });
14530 break;
14531 }
14532 case 10:
14533 {
14534 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
14535
14536 exp->expType = __extension__ ({
14537 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14538
14539 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
14540 });
14541 exp->isConstant = 0x1;
14542 DeclareType(type, 0x0, 0x0);
14543 FreeType(type);
14544 break;
14545 }
14546 case 11:
14547 {
14548 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14549
14550 type->count = (unsigned int)1;
14551 FreeType(exp->cast.exp->destType);
14552 exp->cast.exp->destType = type;
14553 type->refCount++;
14554 ProcessExpressionType(exp->cast.exp);
14555 type->count = (unsigned int)0;
14556 exp->expType = type;
14557 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14558 {
14559 void * prev = exp->prev, * next = exp->next;
14560 struct Type * expType = exp->cast.exp->destType;
14561 struct Expression * castExp = exp->cast.exp;
14562 struct Type * destType = exp->destType;
14563
14564 if(expType)
14565 expType->refCount++;
14566 FreeType(exp->expType);
14567 FreeTypeName(exp->cast.typeName);
14568 *exp = *castExp;
14569 FreeType(exp->expType);
14570 FreeType(exp->destType);
14571 exp->expType = expType;
14572 exp->destType = destType;
14573 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14574 exp->prev = prev;
14575 exp->next = next;
14576 }
14577 else
14578 {
14579 exp->isConstant = exp->cast.exp->isConstant;
14580 }
14581 break;
14582 }
14583 case 35:
14584 {
14585 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14586
14587 type->refCount++;
14588 exp->expType = type;
14589 break;
14590 }
14591 case 36:
14592 {
14593 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14594
14595 ProcessExpressionType(exp->vaArg.exp);
14596 type->refCount++;
14597 exp->expType = type;
14598 break;
14599 }
14600 case 12:
14601 {
14602 struct Expression * e;
14603
14604 exp->isConstant = 0x1;
14605 FreeType(exp->cond.cond->destType);
14606 exp->cond.cond->destType = MkClassType("bool");
14607 exp->cond.cond->destType->truth = 0x1;
14608 ProcessExpressionType(exp->cond.cond);
14609 if(!exp->cond.cond->isConstant)
14610 exp->isConstant = 0x0;
14611 for(e = (*exp->cond.exp).first; e; e = e->next)
14612 {
14613 if(!e->next)
14614 {
14615 FreeType(e->destType);
14616 e->destType = exp->destType;
14617 if(e->destType)
14618 e->destType->refCount++;
14619 }
14620 ProcessExpressionType(e);
14621 if(!e->next)
14622 {
14623 exp->expType = e->expType;
14624 if(e->expType)
14625 e->expType->refCount++;
14626 }
14627 if(!e->isConstant)
14628 exp->isConstant = 0x0;
14629 }
14630 FreeType(exp->cond.elseExp->destType);
14631 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14632 if(exp->cond.elseExp->destType)
14633 exp->cond.elseExp->destType->refCount++;
14634 ProcessExpressionType(exp->cond.elseExp);
14635 if(!exp->cond.elseExp->isConstant)
14636 exp->isConstant = 0x0;
14637 break;
14638 }
14639 case 25:
14640 {
14641 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14642 {
14643 struct Statement * last = (*exp->compound->compound.statements).last;
14644
14645 if(last->type == 3 && last->expressions && (*last->expressions).last)
14646 {
14647 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14648 if(exp->destType)
14649 exp->destType->refCount++;
14650 }
14651 ProcessStatement(exp->compound);
14652 exp->expType = (last->expressions && (*last->expressions).last) ? ((struct Expression *)(*last->expressions).last)->expType : (((void *)0));
14653 if(exp->expType)
14654 exp->expType->refCount++;
14655 }
14656 break;
14657 }
14658 case 26:
14659 {
14660 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14661
14662 if(spec && spec->type == 1)
14663 {
14664 exp->expType = MkClassType(spec->name);
14665 exp->expType->kind = 19;
14666 exp->byReference = 0x1;
14667 }
14668 else
14669 {
14670 exp->expType = MkClassType("ecere::com::Class");
14671 exp->byReference = 0x1;
14672 }
14673 break;
14674 }
14675 case 27:
14676 {
14677 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14678
14679 if(_class)
14680 {
14681 struct Identifier * id = exp->classData.id;
14682 char structName[1024];
14683 struct Expression * classExp;
14684
14685 strcpy(structName, "__ecereClassData_");
14686 FullClassNameCat(structName, _class->fullName, 0x0);
14687 exp->type = 9;
14688 exp->member.member = id;
14689 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14690 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14691 else
14692 classExp = MkExpIdentifier(MkIdentifier("class"));
14693 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"))))))));
14694 ProcessExpressionType(exp);
14695 return ;
14696 }
14697 break;
14698 }
14699 case 37:
14700 {
14701 struct Type * type = (((void *)0));
14702 char * typeString = (((void *)0));
14703 char typeStringBuf[1024];
14704
14705 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))
14706 {
14707 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14708
14709 typeString = templateClass->templateArgs[2].dataTypeString;
14710 }
14711 else if(exp->list)
14712 {
14713 struct Expression * e;
14714
14715 for(e = (*exp->list).first; e; e = e->next)
14716 {
14717 ProcessExpressionType(e);
14718 if(e->expType)
14719 {
14720 if(!type)
14721 {
14722 type = e->expType;
14723 type->refCount++;
14724 }
14725 else
14726 {
14727 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14728 {
14729 FreeType(type);
14730 type = e->expType;
14731 e->expType = (((void *)0));
14732 e = (*exp->list).first;
14733 ProcessExpressionType(e);
14734 if(e->expType)
14735 {
14736 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14737 {
14738 FreeType(e->expType);
14739 e->expType = (((void *)0));
14740 FreeType(type);
14741 type = (((void *)0));
14742 break;
14743 }
14744 }
14745 }
14746 }
14747 if(e->expType)
14748 {
14749 FreeType(e->expType);
14750 e->expType = (((void *)0));
14751 }
14752 }
14753 }
14754 if(type)
14755 {
14756 typeStringBuf[0] = '\0';
14757 PrintType(type, typeStringBuf, 0x0, 0x1);
14758 typeString = typeStringBuf;
14759 FreeType(type);
14760 type = (((void *)0));
14761 }
14762 }
14763 if(typeString)
14764 {
14765 char templateString[1024];
14766 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14767 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14768 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14769 struct Expression * expExt;
14770 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14771
14772 sprintf(templateString, "Container<%s>", typeString);
14773 if(exp->list)
14774 {
14775 struct Expression * e;
14776
14777 type = ProcessTypeString(typeString, 0x0);
14778 while(e = (*exp->list).first)
14779 {
14780 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14781 e->destType = type;
14782 type->refCount++;
14783 ProcessExpressionType(e);
14784 ListAdd(initializers, MkInitializerAssignment(e));
14785 }
14786 FreeType(type);
14787 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14788 }
14789 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
14790 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
14791 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14792 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
14793 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14794 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
14795 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14796 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
14797 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14798 ListAdd(structInitializers, MkInitializerAssignment(__extension__ ({
14799 struct Expression * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14800
14801 __ecereInstance1->type = 2, __ecereInstance1->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, (void *)0), __ecereInstance1;
14802 })));
14803 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14804 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
14805 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14806 exp->expType = ProcessTypeString(templateString, 0x0);
14807 exp->type = 5;
14808 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
14809 ProcessExpressionType(expExt);
14810 }
14811 else
14812 {
14813 exp->expType = ProcessTypeString("Container", 0x0);
14814 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
14815 }
14816 break;
14817 }
14818 }
14819 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
14820 {
14821 FreeType(exp->expType);
14822 exp->expType = ReplaceThisClassType(thisClass);
14823 }
14824 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
14825 {
14826 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
14827
14828 if(symbol)
14829 {
14830 if(exp->expType->kind != 15)
14831 {
14832 struct Type * member;
14833 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
14834
14835 FreeType(exp->expType);
14836 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14837 exp->expType->kind = symbol->type->kind;
14838 exp->expType->refCount++;
14839 exp->expType->enumName = enumName;
14840 exp->expType->members = symbol->type->members;
14841 for(member = symbol->type->members.first; member; member = member->next)
14842 member->refCount++;
14843 }
14844 else
14845 {
14846 struct __ecereNameSpace__ecere__sys__NamedLink * member;
14847
14848 for(member = symbol->type->members.first; member; member = member->next)
14849 {
14850 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(structSize_NamedLink), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
14851
14852 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
14853 }
14854 }
14855 }
14856 }
14857 yylloc = exp->loc;
14858 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
14859 ;
14860 else if(exp->destType && !exp->destType->keepCast)
14861 {
14862 if(!CheckExpressionType(exp, exp->destType, 0x0))
14863 {
14864 if(!exp->destType->count || unresolved)
14865 {
14866 if(!exp->expType)
14867 {
14868 yylloc = exp->loc;
14869 if(exp->destType->kind != 14)
14870 {
14871 char type2[1024];
14872
14873 type2[0] = '\0';
14874 if(inCompiler)
14875 {
14876 char expString[10240];
14877
14878 expString[0] = '\0';
14879 PrintType(exp->destType, type2, 0x0, 0x1);
14880 if(inCompiler)
14881 {
14882 PrintExpression(exp, expString);
14883 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14884 }
14885 if(unresolved)
14886 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
14887 else if(exp->type != 16)
14888 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
14889 }
14890 }
14891 else
14892 {
14893 char expString[10240];
14894
14895 expString[0] = '\0';
14896 if(inCompiler)
14897 {
14898 PrintExpression(exp, expString);
14899 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14900 }
14901 if(unresolved)
14902 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
14903 else if(exp->type != 16)
14904 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14905 }
14906 }
14907 else
14908 {
14909 char type1[1024];
14910 char type2[1024];
14911
14912 type1[0] = '\0';
14913 type2[0] = '\0';
14914 if(inCompiler)
14915 {
14916 PrintType(exp->expType, type1, 0x0, 0x1);
14917 PrintType(exp->destType, type2, 0x0, 0x1);
14918 }
14919 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)))
14920 ;
14921 else
14922 {
14923 char expString[10240];
14924
14925 expString[0] = '\0';
14926 if(inCompiler)
14927 {
14928 PrintExpression(exp, expString);
14929 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14930 }
14931 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
14932 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
14933 FreeType(exp->expType);
14934 exp->destType->refCount++;
14935 exp->expType = exp->destType;
14936 }
14937 }
14938 }
14939 }
14940 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
14941 {
14942 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14943 char typeString[1024];
14944 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14945 struct Declarator * decl;
14946
14947 typeString[0] = '\0';
14948 *newExp = *exp;
14949 if(exp->expType)
14950 exp->expType->refCount++;
14951 if(exp->expType)
14952 exp->expType->refCount++;
14953 exp->type = 11;
14954 newExp->destType = exp->expType;
14955 PrintType(exp->expType, typeString, 0x0, 0x0);
14956 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14957 exp->cast.typeName = MkTypeName(specs, decl);
14958 exp->cast.exp = newExp;
14959 }
14960 }
14961 else if(unresolved)
14962 {
14963 if(exp->identifier->_class && exp->identifier->_class->name)
14964 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
14965 else if(exp->identifier->string && exp->identifier->string[0])
14966 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
14967 }
14968 else if(!exp->expType && exp->type != 16)
14969 {
14970 char expString[10240];
14971
14972 expString[0] = '\0';
14973 if(inCompiler)
14974 {
14975 PrintExpression(exp, expString);
14976 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14977 }
14978 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14979 }
14980 ApplyAnyObjectLogic(exp);
14981 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5)
14982 {
14983 exp->byReference = 0x1;
14984 }
14985 yylloc = oldyylloc;
14986 }
14987
14988 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)
14989 {
14990 if(*curMember)
14991 {
14992 *curMember = (*curMember)->next;
14993 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
14994 {
14995 *curMember = subMemberStack[--(*subMemberStackPos)];
14996 *curMember = (*curMember)->next;
14997 }
14998 while((*curMember) && (*curMember)->isProperty)
14999 *curMember = (*curMember)->next;
15000 if(subMemberStackPos)
15001 {
15002 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
15003 {
15004 subMemberStack[(*subMemberStackPos)++] = *curMember;
15005 *curMember = (*curMember)->members.first;
15006 while(*curMember && (*curMember)->isProperty)
15007 *curMember = (*curMember)->next;
15008 }
15009 }
15010 }
15011 while(!*curMember)
15012 {
15013 if(!*curMember)
15014 {
15015 if(subMemberStackPos && *subMemberStackPos)
15016 {
15017 *curMember = subMemberStack[--(*subMemberStackPos)];
15018 *curMember = (*curMember)->next;
15019 }
15020 else
15021 {
15022 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
15023
15024 if(*curClass == _class)
15025 break;
15026 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
15027 ;
15028 *curMember = (*curClass)->membersAndProperties.first;
15029 }
15030 while((*curMember) && (*curMember)->isProperty)
15031 *curMember = (*curMember)->next;
15032 if(subMemberStackPos)
15033 {
15034 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
15035 {
15036 subMemberStack[(*subMemberStackPos)++] = *curMember;
15037 *curMember = (*curMember)->members.first;
15038 while(*curMember && (*curMember)->isProperty)
15039 *curMember = (*curMember)->next;
15040 }
15041 }
15042 }
15043 }
15044 }
15045
15046 static void ProcessInitializer(struct Initializer * init, struct Type * type)
15047 {
15048 switch(init->type)
15049 {
15050 case 0:
15051 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
15052 {
15053 if(init->exp && !init->exp->destType)
15054 {
15055 FreeType(init->exp->destType);
15056 init->exp->destType = type;
15057 if(type)
15058 type->refCount++;
15059 }
15060 if(init->exp)
15061 {
15062 ProcessExpressionType(init->exp);
15063 init->isConstant = init->exp->isConstant;
15064 }
15065 break;
15066 }
15067 else
15068 {
15069 struct Expression * exp = init->exp;
15070 struct Instantiation * inst = exp->instance;
15071 struct MembersInit * members;
15072
15073 init->type = 1;
15074 init->list = MkList();
15075 if(inst->members)
15076 {
15077 for(members = (*inst->members).first; members; members = members->next)
15078 {
15079 if(members->type == 0)
15080 {
15081 struct MemberInit * member;
15082
15083 for(member = (*members->dataMembers).first; member; member = member->next)
15084 {
15085 ListAdd(init->list, member->initializer);
15086 member->initializer = (((void *)0));
15087 }
15088 }
15089 }
15090 }
15091 FreeExpression(exp);
15092 }
15093 case 1:
15094 {
15095 struct Initializer * i;
15096 struct Type * initializerType = (((void *)0));
15097 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
15098 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
15099 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
15100 int subMemberStackPos = 0;
15101
15102 if(type && type->kind == 12)
15103 initializerType = Dereference(type);
15104 else if(type && (type->kind == 9 || type->kind == 10))
15105 initializerType = type->members.first;
15106 for(i = (*init->list).first; i; i = i->next)
15107 {
15108 if(type && type->kind == 8 && type->_class && type->_class->registered)
15109 {
15110 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
15111 if(curMember)
15112 {
15113 if(!curMember->dataType)
15114 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
15115 initializerType = curMember->dataType;
15116 }
15117 }
15118 ProcessInitializer(i, initializerType);
15119 if(initializerType && type && (type->kind == 9 || type->kind == 10))
15120 initializerType = initializerType->next;
15121 if(!i->isConstant)
15122 init->isConstant = 0x0;
15123 }
15124 if(type && type->kind == 12)
15125 FreeType(initializerType);
15126 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
15127 {
15128 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
15129 }
15130 break;
15131 }
15132 }
15133 }
15134
15135 extern struct Symbol * FindType(struct Context * ctx, char *  name);
15136
15137 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
15138
15139 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
15140 {
15141 switch(spec->type)
15142 {
15143 case 0:
15144 {
15145 if(spec->specifier == THISCLASS)
15146 {
15147 if(thisClass)
15148 {
15149 spec->type = 1;
15150 spec->name = ReplaceThisClass(thisClass);
15151 spec->symbol = FindClass(spec->name);
15152 ProcessSpecifier(spec, declareStruct);
15153 }
15154 }
15155 break;
15156 }
15157 case 1:
15158 {
15159 struct Symbol * symbol = FindType(curContext, spec->name);
15160
15161 if(symbol)
15162 DeclareType(symbol->type, 0x1, 0x1);
15163 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
15164 DeclareStruct(spec->name, 0x0);
15165 break;
15166 }
15167 case 2:
15168 {
15169 struct Enumerator * e;
15170
15171 if(spec->list)
15172 {
15173 for(e = (*spec->list).first; e; e = e->next)
15174 {
15175 if(e->exp)
15176 ProcessExpressionType(e->exp);
15177 }
15178 }
15179 break;
15180 }
15181 case 3:
15182 case 4:
15183 {
15184 if(spec->definitions)
15185 {
15186 struct ClassDef * def;
15187 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
15188
15189 ProcessClass(spec->definitions, symbol);
15190 }
15191 break;
15192 }
15193 }
15194 }
15195
15196 static void ProcessDeclarator(struct Declarator * decl)
15197 {
15198 switch(decl->type)
15199 {
15200 case 1:
15201 if(decl->identifier->classSym)
15202 {
15203 FreeSpecifier(decl->identifier->_class);
15204 decl->identifier->_class = (((void *)0));
15205 }
15206 break;
15207 case 3:
15208 if(decl->array.exp)
15209 ProcessExpressionType(decl->array.exp);
15210 case 0:
15211 case 2:
15212 case 4:
15213 case 5:
15214 case 6:
15215 case 7:
15216 if(decl->declarator)
15217 ProcessDeclarator(decl->declarator);
15218 if(decl->type == 4)
15219 {
15220 struct Identifier * id = GetDeclId(decl);
15221
15222 if(id && id->_class)
15223 {
15224 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
15225
15226 if(!decl->function.parameters)
15227 decl->function.parameters = MkList();
15228 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
15229 id->_class = (((void *)0));
15230 }
15231 if(decl->function.parameters)
15232 {
15233 struct TypeName * param;
15234
15235 for(param = (*decl->function.parameters).first; param; param = param->next)
15236 {
15237 if(param->qualifiers && (*param->qualifiers).first)
15238 {
15239 struct Specifier * spec = (*param->qualifiers).first;
15240
15241 if(spec && spec->specifier == TYPED_OBJECT)
15242 {
15243 struct Declarator * d = param->declarator;
15244 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);
15245
15246 FreeList(param->qualifiers, FreeSpecifier);
15247 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
15248 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
15249 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
15250 param = newParam;
15251 }
15252 else if(spec && spec->specifier == ANY_OBJECT)
15253 {
15254 struct Declarator * d = param->declarator;
15255
15256 FreeList(param->qualifiers, FreeSpecifier);
15257 param->qualifiers = MkListOne(MkSpecifier(VOID));
15258 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
15259 }
15260 else if(spec->specifier == THISCLASS)
15261 {
15262 if(thisClass)
15263 {
15264 spec->type = 1;
15265 spec->name = ReplaceThisClass(thisClass);
15266 spec->symbol = FindClass(spec->name);
15267 ProcessSpecifier(spec, 0x0);
15268 }
15269 }
15270 }
15271 if(param->declarator)
15272 ProcessDeclarator(param->declarator);
15273 }
15274 }
15275 }
15276 break;
15277 }
15278 }
15279
15280 extern struct Identifier * CopyIdentifier(struct Identifier * id);
15281
15282 extern void FreeInitDeclarator(struct InitDeclarator * decl);
15283
15284 static void ProcessDeclaration(struct Declaration * decl)
15285 {
15286 yylloc = decl->loc;
15287 switch(decl->type)
15288 {
15289 case 1:
15290 {
15291 unsigned int declareStruct = 0x0;
15292
15293 if(decl->declarators)
15294 {
15295 struct InitDeclarator * d;
15296
15297 for(d = (*decl->declarators).first; d; d = d->next)
15298 {
15299 struct Type * type, * subType;
15300
15301 ProcessDeclarator(d->declarator);
15302 type = ProcessType(decl->specifiers, d->declarator);
15303 if(d->initializer)
15304 {
15305 ProcessInitializer(d->initializer, type);
15306 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
15307 {
15308 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
15309 {
15310 struct Instantiation * inst = d->initializer->exp->instance;
15311
15312 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
15313 d->initializer->exp->instance = (((void *)0));
15314 if(decl->specifiers)
15315 FreeList(decl->specifiers, FreeSpecifier);
15316 FreeList(decl->declarators, FreeInitDeclarator);
15317 d = (((void *)0));
15318 decl->type = 2;
15319 decl->inst = inst;
15320 }
15321 }
15322 }
15323 for(subType = type; subType; )
15324 {
15325 if(subType->kind == 8)
15326 {
15327 declareStruct = 0x1;
15328 break;
15329 }
15330 else if(subType->kind == 13)
15331 break;
15332 else if(subType->kind == 12)
15333 subType = subType->arrayType;
15334 else
15335 break;
15336 }
15337 FreeType(type);
15338 if(!d)
15339 break;
15340 }
15341 }
15342 if(decl->specifiers)
15343 {
15344 struct Specifier * s;
15345
15346 for(s = (*decl->specifiers).first; s; s = s->next)
15347 {
15348 ProcessSpecifier(s, declareStruct);
15349 }
15350 }
15351 break;
15352 }
15353 case 2:
15354 {
15355 ProcessInstantiationType(decl->inst);
15356 break;
15357 }
15358 case 0:
15359 {
15360 struct Specifier * spec;
15361 struct Declarator * d;
15362 unsigned int declareStruct = 0x0;
15363
15364 if(decl->declarators)
15365 {
15366 for(d = (*decl->declarators).first; d; d = d->next)
15367 {
15368 struct Type * type = ProcessType(decl->specifiers, d->declarator);
15369 struct Type * subType;
15370
15371 ProcessDeclarator(d);
15372 for(subType = type; subType; )
15373 {
15374 if(subType->kind == 8)
15375 {
15376 declareStruct = 0x1;
15377 break;
15378 }
15379 else if(subType->kind == 13)
15380 break;
15381 else if(subType->kind == 12)
15382 subType = subType->arrayType;
15383 else
15384 break;
15385 }
15386 FreeType(type);
15387 }
15388 }
15389 if(decl->specifiers)
15390 {
15391 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
15392 ProcessSpecifier(spec, declareStruct);
15393 }
15394 break;
15395 }
15396 }
15397 }
15398
15399 static struct FunctionDefinition * curFunction;
15400
15401 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
15402 {
15403 char propName[1024], propNameM[1024];
15404 char getName[1024], setName[1024];
15405 struct __ecereNameSpace__ecere__sys__OldList * args;
15406
15407 DeclareProperty(prop, setName, getName);
15408 strcpy(propName, "__ecereProp_");
15409 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15410 strcat(propName, "_");
15411 FullClassNameCat(propName, prop->name, 0x1);
15412 MangleClassName(propName);
15413 strcpy(propNameM, "__ecerePropM_");
15414 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
15415 strcat(propNameM, "_");
15416 FullClassNameCat(propNameM, prop->name, 0x1);
15417 MangleClassName(propNameM);
15418 if(prop->isWatchable)
15419 {
15420 args = MkList();
15421 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15422 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15423 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15424 args = MkList();
15425 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15426 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15427 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15428 }
15429 {
15430 args = MkList();
15431 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15432 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15433 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15434 args = MkList();
15435 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15436 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15437 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15438 }
15439 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15440 curFunction->propSet->fireWatchersDone = 0x1;
15441 }
15442
15443 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
15444
15445 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
15446
15447 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
15448
15449 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
15450
15451 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
15452
15453 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
15454
15455 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
15456
15457 extern void FreePropertyWatch(struct PropertyWatch * watcher);
15458
15459 static void ProcessStatement(struct Statement * stmt)
15460 {
15461 yylloc = stmt->loc;
15462 switch(stmt->type)
15463 {
15464 case 0:
15465 ProcessStatement(stmt->labeled.stmt);
15466 break;
15467 case 1:
15468 if(stmt->caseStmt.exp)
15469 {
15470 FreeType(stmt->caseStmt.exp->destType);
15471 stmt->caseStmt.exp->destType = curSwitchType;
15472 if(curSwitchType)
15473 curSwitchType->refCount++;
15474 ProcessExpressionType(stmt->caseStmt.exp);
15475 ComputeExpression(stmt->caseStmt.exp);
15476 }
15477 if(stmt->caseStmt.stmt)
15478 ProcessStatement(stmt->caseStmt.stmt);
15479 break;
15480 case 2:
15481 {
15482 if(stmt->compound.context)
15483 {
15484 struct Declaration * decl;
15485 struct Statement * s;
15486 struct Statement * prevCompound = curCompound;
15487 struct Context * prevContext = curContext;
15488
15489 if(!stmt->compound.isSwitch)
15490 {
15491 curCompound = stmt;
15492 curContext = stmt->compound.context;
15493 }
15494 if(stmt->compound.declarations)
15495 {
15496 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
15497 ProcessDeclaration(decl);
15498 }
15499 if(stmt->compound.statements)
15500 {
15501 for(s = (*stmt->compound.statements).first; s; s = s->next)
15502 ProcessStatement(s);
15503 }
15504 curContext = prevContext;
15505 curCompound = prevCompound;
15506 }
15507 break;
15508 }
15509 case 3:
15510 {
15511 struct Expression * exp;
15512
15513 if(stmt->expressions)
15514 {
15515 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15516 ProcessExpressionType(exp);
15517 }
15518 break;
15519 }
15520 case 4:
15521 {
15522 struct Expression * exp;
15523
15524 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15525 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15526 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15527 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15528 {
15529 ProcessExpressionType(exp);
15530 }
15531 if(stmt->ifStmt.stmt)
15532 ProcessStatement(stmt->ifStmt.stmt);
15533 if(stmt->ifStmt.elseStmt)
15534 ProcessStatement(stmt->ifStmt.elseStmt);
15535 break;
15536 }
15537 case 5:
15538 {
15539 struct Type * oldSwitchType = curSwitchType;
15540
15541 if(stmt->switchStmt.exp)
15542 {
15543 struct Expression * exp;
15544
15545 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15546 {
15547 if(!exp->next)
15548 {
15549 ProcessExpressionType(exp);
15550 }
15551 if(!exp->next)
15552 curSwitchType = exp->expType;
15553 }
15554 }
15555 ProcessStatement(stmt->switchStmt.stmt);
15556 curSwitchType = oldSwitchType;
15557 break;
15558 }
15559 case 6:
15560 {
15561 if(stmt->whileStmt.exp)
15562 {
15563 struct Expression * exp;
15564
15565 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15566 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15567 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15568 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15569 {
15570 ProcessExpressionType(exp);
15571 }
15572 }
15573 if(stmt->whileStmt.stmt)
15574 ProcessStatement(stmt->whileStmt.stmt);
15575 break;
15576 }
15577 case 7:
15578 {
15579 if(stmt->doWhile.exp)
15580 {
15581 struct Expression * exp;
15582
15583 if((*stmt->doWhile.exp).last)
15584 {
15585 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15586 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15587 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15588 }
15589 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15590 {
15591 ProcessExpressionType(exp);
15592 }
15593 }
15594 if(stmt->doWhile.stmt)
15595 ProcessStatement(stmt->doWhile.stmt);
15596 break;
15597 }
15598 case 8:
15599 {
15600 struct Expression * exp;
15601
15602 if(stmt->forStmt.init)
15603 ProcessStatement(stmt->forStmt.init);
15604 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15605 {
15606 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15607 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15608 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15609 }
15610 if(stmt->forStmt.check)
15611 ProcessStatement(stmt->forStmt.check);
15612 if(stmt->forStmt.increment)
15613 {
15614 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15615 ProcessExpressionType(exp);
15616 }
15617 if(stmt->forStmt.stmt)
15618 ProcessStatement(stmt->forStmt.stmt);
15619 break;
15620 }
15621 case 18:
15622 {
15623 struct Identifier * id = stmt->forEachStmt.id;
15624 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15625 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15626 struct Statement * block = stmt->forEachStmt.stmt;
15627 char iteratorType[1024];
15628 struct Type * source;
15629 struct Expression * e;
15630 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));
15631 struct Expression * arrayExp;
15632 char * typeString = (((void *)0));
15633 int builtinCount = 0;
15634
15635 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15636 {
15637 if(!e->next)
15638 {
15639 FreeType(e->destType);
15640 e->destType = ProcessTypeString("Container", 0x0);
15641 }
15642 if(!isBuiltin || e->next)
15643 ProcessExpressionType(e);
15644 }
15645 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15646 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15647 {
15648 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15649 struct Symbol * symbol;
15650 struct Expression * expIt = (((void *)0));
15651 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15652 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15653 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15654 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15655
15656 stmt->type = 2;
15657 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15658 stmt->compound.context->parent = curContext;
15659 curContext = stmt->compound.context;
15660 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15661 {
15662 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15663 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15664
15665 isCustomAVLTree = 0x1;
15666 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15667 isAVLTree = 0x1;
15668 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15669 isMap = 0x1;
15670 }
15671 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15672 isArray = 0x1;
15673 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15674 {
15675 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15676
15677 isLinkList = 0x1;
15678 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15679 }
15680 if(isArray)
15681 {
15682 struct Declarator * decl;
15683 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15684
15685 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15686 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15687 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15688 }
15689 else if(isBuiltin)
15690 {
15691 struct Type * type = (((void *)0));
15692 char typeStringBuf[1024];
15693
15694 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15695 if(((struct Expression *)(*exp).last)->type == 11)
15696 {
15697 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15698
15699 if(typeName)
15700 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15701 }
15702 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)
15703 {
15704 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15705
15706 typeString = templateClass->templateArgs[2].dataTypeString;
15707 }
15708 else if(arrayExp->list)
15709 {
15710 struct Expression * e;
15711
15712 for(e = (*arrayExp->list).first; e; e = e->next)
15713 {
15714 ProcessExpressionType(e);
15715 if(e->expType)
15716 {
15717 if(!type)
15718 {
15719 type = e->expType;
15720 type->refCount++;
15721 }
15722 else
15723 {
15724 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15725 {
15726 FreeType(type);
15727 type = e->expType;
15728 e->expType = (((void *)0));
15729 e = (*arrayExp->list).first;
15730 ProcessExpressionType(e);
15731 if(e->expType)
15732 {
15733 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15734 {
15735 FreeType(e->expType);
15736 e->expType = (((void *)0));
15737 FreeType(type);
15738 type = (((void *)0));
15739 break;
15740 }
15741 }
15742 }
15743 }
15744 if(e->expType)
15745 {
15746 FreeType(e->expType);
15747 e->expType = (((void *)0));
15748 }
15749 }
15750 }
15751 if(type)
15752 {
15753 typeStringBuf[0] = '\0';
15754 PrintType(type, typeStringBuf, 0x0, 0x1);
15755 typeString = typeStringBuf;
15756 FreeType(type);
15757 }
15758 }
15759 if(typeString)
15760 {
15761 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15762 struct Declarator * decl;
15763 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15764
15765 if(arrayExp->list)
15766 {
15767 struct Expression * e;
15768
15769 builtinCount = (*arrayExp->list).count;
15770 type = ProcessTypeString(typeString, 0x0);
15771 while(e = (*arrayExp->list).first)
15772 {
15773 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15774 e->destType = type;
15775 type->refCount++;
15776 ProcessExpressionType(e);
15777 ListAdd(initializers, MkInitializerAssignment(e));
15778 }
15779 FreeType(type);
15780 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15781 }
15782 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15783 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15784 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorArray(PlugDeclarator(decl, MkDeclaratorIdentifier(MkIdentifier("__internalArray"))), (((void *)0))), MkInitializerList(initializers)))));
15785 FreeList(exp, FreeExpression);
15786 }
15787 else
15788 {
15789 arrayExp->expType = ProcessTypeString("Container", 0x0);
15790 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15791 }
15792 }
15793 else if(isLinkList && !isList)
15794 {
15795 struct Declarator * decl;
15796 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15797
15798 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15799 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15800 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15801 }
15802 else if(_class->templateArgs)
15803 {
15804 if(isMap)
15805 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15806 else
15807 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
15808 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
15809 }
15810 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
15811 if(block && block->type == 2 && block->compound.context)
15812 {
15813 block->compound.context->parent = stmt->compound.context;
15814 }
15815 if(filter)
15816 {
15817 block = MkIfStmt(filter, block, (((void *)0)));
15818 }
15819 if(isArray)
15820 {
15821 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));
15822 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15823 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15824 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15825 }
15826 else if(isBuiltin)
15827 {
15828 char count[128];
15829
15830 sprintf(count, "%d", builtinCount);
15831 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));
15832 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15833 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15834 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15835 }
15836 else if(isLinkList && !isList)
15837 {
15838 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
15839 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
15840
15841 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
15842 {
15843 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));
15844 }
15845 else
15846 {
15847 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15848 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
15849
15850 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));
15851 }
15852 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15853 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15854 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15855 }
15856 else
15857 {
15858 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
15859 }
15860 ProcessExpressionType(expIt);
15861 if((*stmt->compound.declarations).first)
15862 ProcessDeclaration((*stmt->compound.declarations).first);
15863 if(symbol)
15864 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
15865 ProcessStatement(stmt);
15866 curContext = stmt->compound.context->parent;
15867 break;
15868 }
15869 else
15870 {
15871 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
15872 }
15873 break;
15874 }
15875 case 9:
15876 break;
15877 case 10:
15878 break;
15879 case 11:
15880 break;
15881 case 12:
15882 {
15883 struct Expression * exp;
15884
15885 if(stmt->expressions)
15886 {
15887 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15888 {
15889 if(!exp->next)
15890 {
15891 if(curFunction && !curFunction->type)
15892 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
15893 FreeType(exp->destType);
15894 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
15895 if(exp->destType)
15896 exp->destType->refCount++;
15897 }
15898 ProcessExpressionType(exp);
15899 }
15900 }
15901 break;
15902 }
15903 case 14:
15904 {
15905 ProcessDeclaration(stmt->decl);
15906 break;
15907 }
15908 case 13:
15909 {
15910 struct AsmField * field;
15911
15912 if(stmt->asmStmt.inputFields)
15913 {
15914 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
15915 if(field->expression)
15916 ProcessExpressionType(field->expression);
15917 }
15918 if(stmt->asmStmt.outputFields)
15919 {
15920 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
15921 if(field->expression)
15922 ProcessExpressionType(field->expression);
15923 }
15924 if(stmt->asmStmt.clobberedFields)
15925 {
15926 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
15927 {
15928 if(field->expression)
15929 ProcessExpressionType(field->expression);
15930 }
15931 }
15932 break;
15933 }
15934 case 17:
15935 {
15936 struct PropertyWatch * propWatch;
15937 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15938 struct Expression * object = stmt->_watch.object;
15939 struct Expression * watcher = stmt->_watch.watcher;
15940
15941 if(watcher)
15942 ProcessExpressionType(watcher);
15943 if(object)
15944 ProcessExpressionType(object);
15945 if(inCompiler)
15946 {
15947 if(watcher || thisClass)
15948 {
15949 struct External * external = curExternal;
15950 struct Context * context = curContext;
15951
15952 stmt->type = 3;
15953 stmt->expressions = MkList();
15954 curExternal = external->prev;
15955 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15956 {
15957 struct ClassFunction * func;
15958 char watcherName[1024];
15959 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
15960 struct External * createdExternal;
15961 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
15962
15963 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
15964 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
15965 if(propWatch->deleteWatch)
15966 strcat(watcherName, "_delete");
15967 else
15968 {
15969 struct Identifier * propID;
15970
15971 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15972 {
15973 strcat(watcherName, "_");
15974 strcat(watcherName, propID->string);
15975 }
15976 }
15977 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
15978 {
15979 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
15980 ProcessClassFunctionBody(func, propWatch->compound);
15981 propWatch->compound = (((void *)0));
15982 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
15983 createdExternal->symbol->idCode = external->symbol->idCode;
15984 curExternal = createdExternal;
15985 ProcessFunction(createdExternal->function);
15986 {
15987 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
15988
15989 externalDecl->declaration = decl;
15990 if(decl->symbol && !decl->symbol->pointerExternal)
15991 decl->symbol->pointerExternal = externalDecl;
15992 }
15993 if(propWatch->deleteWatch)
15994 {
15995 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15996
15997 ListAdd(args, CopyExpression(object));
15998 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15999 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
16000 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
16001 }
16002 else
16003 {
16004 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
16005 struct Identifier * propID;
16006
16007 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
16008 {
16009 char propName[1024];
16010 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16011
16012 if(prop)
16013 {
16014 char getName[1024], setName[1024];
16015 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16016
16017 DeclareProperty(prop, setName, getName);
16018 strcpy(propName, "__ecereProp_");
16019 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16020 strcat(propName, "_");
16021 FullClassNameCat(propName, prop->name, 0x1);
16022 ListAdd(args, CopyExpression(object));
16023 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16024 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16025 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
16026 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
16027 }
16028 else
16029 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16030 }
16031 }
16032 }
16033 else
16034 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
16035 }
16036 curExternal = external;
16037 curContext = context;
16038 if(watcher)
16039 FreeExpression(watcher);
16040 if(object)
16041 FreeExpression(object);
16042 FreeList(watches, FreePropertyWatch);
16043 }
16044 else
16045 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
16046 }
16047 else
16048 {
16049 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
16050 {
16051 ProcessStatement(propWatch->compound);
16052 }
16053 }
16054 break;
16055 }
16056 case 15:
16057 {
16058 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16059 struct Expression * object = stmt->_watch.object;
16060 struct __ecereNameSpace__ecere__com__Class * _class;
16061
16062 if(object)
16063 ProcessExpressionType(object);
16064 if(inCompiler)
16065 {
16066 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
16067 if(_class)
16068 {
16069 struct Identifier * propID;
16070
16071 stmt->type = 3;
16072 stmt->expressions = MkList();
16073 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
16074 {
16075 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
16076 }
16077 else if(!watches)
16078 {
16079 }
16080 if(watches)
16081 {
16082 for(propID = (*watches).first; propID; propID = propID->next)
16083 {
16084 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16085
16086 if(prop)
16087 {
16088 CreateFireWatcher(prop, object, stmt);
16089 }
16090 else
16091 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
16092 }
16093 }
16094 else
16095 {
16096 struct __ecereNameSpace__ecere__com__Property * prop;
16097 struct __ecereNameSpace__ecere__com__Class * base;
16098
16099 for(base = _class; base; base = base->base)
16100 {
16101 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
16102 {
16103 if(prop->isProperty && prop->isWatchable)
16104 {
16105 CreateFireWatcher(prop, object, stmt);
16106 }
16107 }
16108 }
16109 }
16110 if(object)
16111 FreeExpression(object);
16112 FreeList(watches, FreeIdentifier);
16113 }
16114 else
16115 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16116 }
16117 break;
16118 }
16119 case 16:
16120 {
16121 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16122 struct Expression * object = stmt->_watch.object;
16123 struct Expression * watcher = stmt->_watch.watcher;
16124 struct __ecereNameSpace__ecere__com__Class * _class;
16125
16126 if(object)
16127 ProcessExpressionType(object);
16128 if(watcher)
16129 ProcessExpressionType(watcher);
16130 if(inCompiler)
16131 {
16132 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
16133 if(watcher || thisClass)
16134 {
16135 if(_class)
16136 {
16137 struct Identifier * propID;
16138
16139 stmt->type = 3;
16140 stmt->expressions = MkList();
16141 if(!watches)
16142 {
16143 struct __ecereNameSpace__ecere__sys__OldList * args;
16144
16145 args = MkList();
16146 ListAdd(args, CopyExpression(object));
16147 ListAdd(args, MkExpConstant("0"));
16148 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16149 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16150 }
16151 else
16152 {
16153 for(propID = (*watches).first; propID; propID = propID->next)
16154 {
16155 char propName[1024];
16156 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16157
16158 if(prop)
16159 {
16160 char getName[1024], setName[1024];
16161 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16162
16163 DeclareProperty(prop, setName, getName);
16164 strcpy(propName, "__ecereProp_");
16165 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16166 strcat(propName, "_");
16167 FullClassNameCat(propName, prop->name, 0x1);
16168 MangleClassName(propName);
16169 ListAdd(args, CopyExpression(object));
16170 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16171 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16172 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16173 }
16174 else
16175 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16176 }
16177 }
16178 if(object)
16179 FreeExpression(object);
16180 if(watcher)
16181 FreeExpression(watcher);
16182 FreeList(watches, FreeIdentifier);
16183 }
16184 else
16185 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16186 }
16187 else
16188 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
16189 }
16190 break;
16191 }
16192 }
16193 }
16194
16195 extern struct Expression * QBrackets(struct Expression * exp);
16196
16197 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
16198
16199 extern struct Declarator * QMkPtrDecl(char *  id);
16200
16201 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
16202
16203 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
16204
16205 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
16206
16207 static void ProcessFunction(struct FunctionDefinition * function)
16208 {
16209 struct Identifier * id = GetDeclId(function->declarator);
16210 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
16211 struct Type * type = symbol ? symbol->type : (((void *)0));
16212 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
16213 struct Context * oldTopContext = topContext;
16214
16215 yylloc = function->loc;
16216 if(type && type->thisClass)
16217 {
16218 struct Symbol * classSym = type->thisClass;
16219 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
16220 char className[1024];
16221 char structName[1024];
16222 struct Declarator * funcDecl;
16223 struct Symbol * thisSymbol;
16224 unsigned int typedObject = 0x0;
16225
16226 if(_class && !_class->base)
16227 {
16228 _class = currentClass;
16229 if(_class && !_class->symbol)
16230 _class->symbol = FindClass(_class->fullName);
16231 classSym = _class ? _class->symbol : (((void *)0));
16232 typedObject = 0x1;
16233 }
16234 thisClass = _class;
16235 if(inCompiler && _class)
16236 {
16237 if(type->kind == 11)
16238 {
16239 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
16240 {
16241 struct Type * param = symbol->type->params.first;
16242
16243 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
16244 FreeType(param);
16245 }
16246 if(type->classObjectType != 1)
16247 {
16248 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
16249 symbol->type->staticMethod = 0x1;
16250 symbol->type->thisClass = (((void *)0));
16251 symbol->type->extraParam = 0x0;
16252 }
16253 }
16254 strcpy(className, "__ecereClass_");
16255 FullClassNameCat(className, _class->fullName, 0x1);
16256 MangleClassName(className);
16257 structName[0] = (char)0;
16258 FullClassNameCat(structName, _class->fullName, 0x0);
16259 funcDecl = GetFuncDecl(function->declarator);
16260 if(funcDecl)
16261 {
16262 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16263 {
16264 struct TypeName * param = (*funcDecl->function.parameters).first;
16265
16266 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16267 {
16268 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16269 FreeTypeName(param);
16270 }
16271 }
16272 if(!function->propertyNoThis)
16273 {
16274 struct TypeName * thisParam;
16275
16276 if(type->classObjectType != 1)
16277 {
16278 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16279 if(!funcDecl->function.parameters)
16280 funcDecl->function.parameters = MkList();
16281 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16282 }
16283 if(typedObject)
16284 {
16285 if(type->classObjectType != 1)
16286 {
16287 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
16288 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
16289 }
16290 thisParam = __extension__ ({
16291 struct TypeName * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName);
16292
16293 __ecereInstance1->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), __ecereInstance1->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), __ecereInstance1;
16294 });
16295 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16296 }
16297 }
16298 }
16299 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16300 {
16301 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16302
16303 funcDecl = GetFuncDecl(initDecl->declarator);
16304 if(funcDecl)
16305 {
16306 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16307 {
16308 struct TypeName * param = (*funcDecl->function.parameters).first;
16309
16310 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16311 {
16312 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16313 FreeTypeName(param);
16314 }
16315 }
16316 if(type->classObjectType != 1)
16317 {
16318 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
16319 {
16320 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16321
16322 if(!funcDecl->function.parameters)
16323 funcDecl->function.parameters = MkList();
16324 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16325 }
16326 }
16327 }
16328 }
16329 }
16330 if(function->body)
16331 {
16332 if(type->classObjectType != 1)
16333 {
16334 thisSymbol = __extension__ ({
16335 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
16336
16337 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("this"), __ecereInstance1->type = classSym ? MkClassType(classSym->string) : (((void *)0)), __ecereInstance1;
16338 });
16339 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16340 if(typedObject && thisSymbol->type)
16341 {
16342 thisSymbol->type->classObjectType = 2;
16343 thisSymbol->type->byReference = type->byReference;
16344 }
16345 }
16346 }
16347 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
16348 {
16349 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
16350
16351 {
16352 struct __ecereNameSpace__ecere__com__Class * base;
16353
16354 for(base = _class; base && base->type != 1000; base = base->next)
16355 {
16356 for(member = base->membersAndProperties.first; member; member = member->next)
16357 if(!member->isProperty)
16358 break;
16359 if(member)
16360 break;
16361 }
16362 }
16363 for(member = _class->membersAndProperties.first; member; member = member->next)
16364 if(!member->isProperty)
16365 break;
16366 if(member)
16367 {
16368 char pointerName[1024];
16369 struct Declaration * decl;
16370 struct Initializer * initializer;
16371 struct Expression * exp, * bytePtr;
16372
16373 strcpy(pointerName, "__ecerePointer_");
16374 FullClassNameCat(pointerName, _class->fullName, 0x0);
16375 {
16376 char className[1024];
16377
16378 strcpy(className, "__ecereClass_");
16379 FullClassNameCat(className, classSym->string, 0x1);
16380 MangleClassName(className);
16381 DeclareClass(classSym, className);
16382 }
16383 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
16384 if(_class->fixed)
16385 {
16386 char string[256];
16387
16388 sprintf(string, "%d", _class->offset);
16389 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
16390 }
16391 else
16392 {
16393 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
16394 }
16395 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
16396 exp->expType = __extension__ ({
16397 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16398
16399 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
16400 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16401
16402 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 0, __ecereInstance1;
16403 }), __ecereInstance2;
16404 });
16405 if(function->body)
16406 {
16407 yylloc = function->body->loc;
16408 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
16409 {
16410 struct Context * prevContext = curContext;
16411
16412 curContext = function->body->compound.context;
16413 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
16414 curContext = prevContext;
16415 }
16416 decl->symbol = (((void *)0));
16417 if(!function->body->compound.declarations)
16418 function->body->compound.declarations = MkList();
16419 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
16420 }
16421 }
16422 }
16423 }
16424 else
16425 thisClass = (((void *)0));
16426 if(id)
16427 {
16428 FreeSpecifier(id->_class);
16429 id->_class = (((void *)0));
16430 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16431 {
16432 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16433
16434 id = GetDeclId(initDecl->declarator);
16435 FreeSpecifier(id->_class);
16436 id->_class = (((void *)0));
16437 }
16438 }
16439 if(function->body)
16440 topContext = function->body->compound.context;
16441 {
16442 struct FunctionDefinition * oldFunction = curFunction;
16443
16444 curFunction = function;
16445 if(function->body)
16446 ProcessStatement(function->body);
16447 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
16448 {
16449 struct Statement * prevCompound = curCompound;
16450 struct Context * prevContext = curContext;
16451 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
16452
16453 if(!function->body->compound.statements)
16454 function->body->compound.statements = MkList();
16455 ListAdd(function->body->compound.statements, fireWatchers);
16456 curCompound = function->body;
16457 curContext = function->body->compound.context;
16458 ProcessStatement(fireWatchers);
16459 curContext = prevContext;
16460 curCompound = prevCompound;
16461 }
16462 curFunction = oldFunction;
16463 }
16464 if(function->declarator)
16465 {
16466 ProcessDeclarator(function->declarator);
16467 }
16468 topContext = oldTopContext;
16469 thisClass = oldThisClass;
16470 }
16471
16472 extern void FreeSymbol(struct Symbol * symbol);
16473
16474 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
16475
16476 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
16477 {
16478 struct ClassDef * def;
16479 struct External * external = curExternal;
16480 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
16481
16482 for(def = definitions->first; def; def = def->next)
16483 {
16484 if(def->type == 0)
16485 {
16486 if(def->function->declarator)
16487 curExternal = def->function->declarator->symbol->pointerExternal;
16488 else
16489 curExternal = external;
16490 ProcessFunction((struct FunctionDefinition *)def->function);
16491 }
16492 else if(def->type == 2)
16493 {
16494 if(def->decl->type == 2)
16495 {
16496 thisClass = regClass;
16497 ProcessInstantiationType(def->decl->inst);
16498 thisClass = (((void *)0));
16499 }
16500 else
16501 {
16502 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
16503
16504 if(regClass)
16505 thisClass = regClass;
16506 ProcessDeclaration(def->decl);
16507 thisClass = backThisClass;
16508 }
16509 }
16510 else if(def->type == 1 && def->defProperties)
16511 {
16512 struct MemberInit * defProperty;
16513 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);
16514
16515 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16516 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
16517 {
16518 thisClass = regClass;
16519 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
16520 thisClass = (((void *)0));
16521 }
16522 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16523 FreeSymbol(thisSymbol);
16524 }
16525 else if(def->type == 3 && def->propertyDef)
16526 {
16527 struct PropertyDef * prop = def->propertyDef;
16528
16529 thisClass = regClass;
16530 if(prop->setStmt)
16531 {
16532 if(regClass)
16533 {
16534 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16535
16536 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16537 }
16538 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16539 ProcessStatement(prop->setStmt);
16540 }
16541 if(prop->getStmt)
16542 {
16543 if(regClass)
16544 {
16545 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16546
16547 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16548 }
16549 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16550 ProcessStatement(prop->getStmt);
16551 }
16552 if(prop->issetStmt)
16553 {
16554 if(regClass)
16555 {
16556 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16557
16558 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16559 }
16560 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16561 ProcessStatement(prop->issetStmt);
16562 }
16563 thisClass = (((void *)0));
16564 }
16565 else if(def->type == 4 && def->propertyWatch)
16566 {
16567 struct PropertyWatch * propertyWatch = def->propertyWatch;
16568
16569 thisClass = regClass;
16570 if(propertyWatch->compound)
16571 {
16572 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);
16573
16574 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16575 curExternal = (((void *)0));
16576 ProcessStatement(propertyWatch->compound);
16577 }
16578 thisClass = (((void *)0));
16579 }
16580 }
16581 }
16582
16583 void DeclareFunctionUtil(char * s)
16584 {
16585 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
16586
16587 if(function)
16588 {
16589 char name[1024];
16590
16591 name[0] = (char)0;
16592 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
16593 strcpy(name, "__ecereFunction_");
16594 FullClassNameCat(name, s, 0x0);
16595 DeclareFunction(function, name);
16596 }
16597 }
16598
16599 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16600
16601 void ComputeDataTypes()
16602 {
16603 struct External * external;
16604 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16605 struct External * after = (((void *)0));
16606
16607 currentClass = (((void *)0));
16608 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16609 for(external = (*ast).first; external; external = external->next)
16610 {
16611 if(external->type == 1)
16612 {
16613 struct Declaration * decl = external->declaration;
16614
16615 if(decl)
16616 {
16617 struct __ecereNameSpace__ecere__sys__OldList * decls = decl->declarators;
16618
16619 if(decls)
16620 {
16621 struct InitDeclarator * initDecl = (*decls).first;
16622
16623 if(initDecl)
16624 {
16625 struct Declarator * declarator = initDecl->declarator;
16626
16627 if(declarator && declarator->type == 1)
16628 {
16629 struct Identifier * id = declarator->identifier;
16630
16631 if(id && id->string)
16632 {
16633 if(!strcmp(id->string, "uintptr_t") || !strcmp(id->string, "intptr_t") || !strcmp(id->string, "size_t") || !strcmp(id->string, "ssize_t"))
16634 {
16635 external->symbol->id = -1001, external->symbol->idCode = -1001;
16636 after = external;
16637 }
16638 }
16639 }
16640 }
16641 }
16642 }
16643 }
16644 }
16645 temp->symbol = __extension__ ({
16646 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
16647
16648 __ecereInstance1->id = -1000, __ecereInstance1->idCode = -1000, __ecereInstance1;
16649 });
16650 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), after, temp);
16651 curExternal = temp;
16652 DeclareFunctionUtil("eSystem_New");
16653 DeclareFunctionUtil("eSystem_New0");
16654 DeclareFunctionUtil("eSystem_Renew");
16655 DeclareFunctionUtil("eSystem_Renew0");
16656 DeclareFunctionUtil("eClass_GetProperty");
16657 DeclareStruct("ecere::com::Class", 0x0);
16658 DeclareStruct("ecere::com::Instance", 0x0);
16659 DeclareStruct("ecere::com::Property", 0x0);
16660 DeclareStruct("ecere::com::DataMember", 0x0);
16661 DeclareStruct("ecere::com::Method", 0x0);
16662 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16663 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16664 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16665 for(external = (*ast).first; external; external = external->next)
16666 {
16667 afterExternal = curExternal = external;
16668 if(external->type == 0)
16669 {
16670 currentClass = external->function->_class;
16671 ProcessFunction(external->function);
16672 }
16673 else if(external->type == 1)
16674 {
16675 currentClass = (((void *)0));
16676 ProcessDeclaration(external->declaration);
16677 }
16678 else if(external->type == 2)
16679 {
16680 struct ClassDefinition * _class = external->_class;
16681
16682 currentClass = external->symbol->registered;
16683 if(_class->definitions)
16684 {
16685 ProcessClass(_class->definitions, _class->symbol);
16686 }
16687 if(inCompiler)
16688 {
16689 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16690 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16691 }
16692 }
16693 else if(external->type == 4)
16694 {
16695 thisNameSpace = external->id->string;
16696 }
16697 }
16698 currentClass = (((void *)0));
16699 thisNameSpace = (((void *)0));
16700 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16701 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16702 }
16703
16704 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);
16705
16706 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);
16707
16708 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16709 {
16710 struct __ecereNameSpace__ecere__com__Class * class;
16711
16712 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16713 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16714 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16715 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16716 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16717 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16718 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16719 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16720 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16721 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16722 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16723 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16724 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16725 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16726 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16727 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16728 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16729 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16730 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16731 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16732 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16733 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16734 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
16735 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
16736 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntSize", "bool GetIntSize(Expression exp, intsize * value2)", GetIntSize, module, 1);
16737 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntSize", "bool GetUIntSize(Expression exp, uintsize * value2)", GetUIntSize, module, 1);
16738 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16739 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16740 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16741 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16742 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16743 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16744 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16745 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16746 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16747 __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);
16748 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16749 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16750 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16751 __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);
16752 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16753 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16754 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16755 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16756 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16757 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16758 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16759 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16760 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16761 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16762 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16763 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16764 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16765 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
16766 __ecereClass_Conversion = class;
16767 __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);
16768 __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);
16769 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16770 __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);
16771 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16772 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16773 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16774 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16775 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16776 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16777 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16778 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16779 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16780 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16781 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16782 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16783 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16784 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16785 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16786 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
16787 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16788 }
16789
16790 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16791 {
16792
16793 }
16794