ide(compiler/libec): Fixed watch crash on any_object
[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 int kind;
785 unsigned int size;
786 char *  name;
787 char *  typeName;
788 int classObjectType;
789 int alignment;
790 unsigned int offset;
791 int bitFieldCount;
792 int count;
793 unsigned int isSigned : 1;
794 unsigned int constant : 1;
795 unsigned int truth : 1;
796 unsigned int byReference : 1;
797 unsigned int extraParam : 1;
798 unsigned int directClassAccess : 1;
799 unsigned int computing : 1;
800 unsigned int keepCast : 1;
801 unsigned int passAsTemplate : 1;
802 unsigned int dllExport : 1;
803 unsigned int attrStdcall : 1;
804 } __attribute__ ((gcc_struct));
805
806 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
807
808 struct __ecereNameSpace__ecere__com__Class
809 {
810 struct __ecereNameSpace__ecere__com__Class * prev;
811 struct __ecereNameSpace__ecere__com__Class * next;
812 char *  name;
813 int offset;
814 int structSize;
815 int (* *  _vTbl)();
816 int vTblSize;
817 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
818 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
819 int offsetClass;
820 int sizeClass;
821 struct __ecereNameSpace__ecere__com__Class * base;
822 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
823 struct __ecereNameSpace__ecere__sys__BinaryTree members;
824 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
825 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
826 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
827 struct __ecereNameSpace__ecere__sys__OldList derivatives;
828 int memberID;
829 int startMemberID;
830 int type;
831 struct __ecereNameSpace__ecere__com__Instance * module;
832 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
833 char *  dataTypeString;
834 struct Type * dataType;
835 int typeSize;
836 int defaultAlignment;
837 void (*  Initialize)();
838 int memberOffset;
839 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
840 char *  designerClass;
841 unsigned int noExpansion;
842 char *  defaultProperty;
843 unsigned int comRedefinition;
844 int count;
845 unsigned int isRemote;
846 unsigned int internalDecl;
847 void *  data;
848 unsigned int computeSize;
849 int structAlignment;
850 int destructionWatchOffset;
851 unsigned int fixed;
852 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
853 int inheritanceAccess;
854 char *  fullName;
855 void *  symbol;
856 struct __ecereNameSpace__ecere__sys__OldList conversions;
857 struct __ecereNameSpace__ecere__sys__OldList templateParams;
858 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
859 struct __ecereNameSpace__ecere__com__Class * templateClass;
860 struct __ecereNameSpace__ecere__sys__OldList templatized;
861 int numParams;
862 } __attribute__ ((gcc_struct));
863
864 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
865
866 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
867
868 struct __ecereNameSpace__ecere__com__Instance
869 {
870 int (* *  _vTbl)();
871 struct __ecereNameSpace__ecere__com__Class * _class;
872 int _refCount;
873 } __attribute__ ((gcc_struct));
874
875 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
876
877 struct __ecereNameSpace__ecere__com__DataMember
878 {
879 struct __ecereNameSpace__ecere__com__DataMember * prev;
880 struct __ecereNameSpace__ecere__com__DataMember * next;
881 char *  name;
882 unsigned int isProperty;
883 int memberAccess;
884 int id;
885 struct __ecereNameSpace__ecere__com__Class * _class;
886 char *  dataTypeString;
887 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
888 struct Type * dataType;
889 int type;
890 int offset;
891 int memberID;
892 struct __ecereNameSpace__ecere__sys__OldList members;
893 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
894 int memberOffset;
895 int structAlignment;
896 } __attribute__ ((gcc_struct));
897
898 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
899
900 struct __ecereNameSpace__ecere__com__SerialBuffer
901 {
902 unsigned char *  _buffer;
903 unsigned int count;
904 unsigned int _size;
905 unsigned int pos;
906 } __attribute__ ((gcc_struct));
907
908 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
909
910 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
911 {
912 union
913 {
914 struct
915 {
916 char *  dataTypeString;
917 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
918 } __attribute__ ((gcc_struct));
919 struct __ecereNameSpace__ecere__com__DataValue expression;
920 struct
921 {
922 char *  memberString;
923 union
924 {
925 struct __ecereNameSpace__ecere__com__DataMember * member;
926 struct __ecereNameSpace__ecere__com__Property * prop;
927 struct __ecereNameSpace__ecere__com__Method * method;
928 } __attribute__ ((gcc_struct));
929 } __attribute__ ((gcc_struct));
930 } __attribute__ ((gcc_struct));
931 } __attribute__ ((gcc_struct));
932
933 void exit(int status);
934
935 void * calloc(size_t nmemb, size_t size);
936
937 void free(void * ptr);
938
939 void * malloc(size_t size);
940
941 void * realloc(void * ptr, size_t size);
942
943 long int strtol(const char * nptr, char ** endptr, int base);
944
945 long long int strtoll(const char * nptr, char ** endptr, int base);
946
947 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
948
949 enum yytokentype
950 {
951 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
952 };
953
954 typedef union YYSTYPE
955 {
956 int specifierType;
957 int i;
958 int declMode;
959 struct Identifier * id;
960 struct Expression * exp;
961 struct Specifier * specifier;
962 struct __ecereNameSpace__ecere__sys__OldList * list;
963 struct Enumerator * enumerator;
964 struct Declarator * declarator;
965 struct Pointer * pointer;
966 struct Initializer * initializer;
967 struct InitDeclarator * initDeclarator;
968 struct TypeName * typeName;
969 struct Declaration * declaration;
970 struct Statement * stmt;
971 struct FunctionDefinition * function;
972 struct External * external;
973 struct Context * context;
974 struct AsmField * asmField;
975 struct Attrib * attrib;
976 struct ExtDecl * extDecl;
977 struct Attribute * attribute;
978 struct Instantiation * instance;
979 struct MembersInit * membersInit;
980 struct MemberInit * memberInit;
981 struct ClassFunction * classFunction;
982 struct ClassDefinition * _class;
983 struct ClassDef * classDef;
984 struct PropertyDef * prop;
985 char * string;
986 struct Symbol * symbol;
987 struct PropertyWatch * propertyWatch;
988 struct TemplateParameter * templateParameter;
989 struct TemplateArgument * templateArgument;
990 struct TemplateDatatype * templateDatatype;
991 struct DBTableEntry * dbtableEntry;
992 struct DBIndexItem * dbindexItem;
993 struct DBTableDef * dbtableDef;
994 } __attribute__ ((gcc_struct)) YYSTYPE;
995
996 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
997
998 struct Enumerator
999 {
1000 struct Enumerator * prev;
1001 struct Enumerator * next;
1002 struct Location loc;
1003 struct Identifier * id;
1004 struct Expression * exp;
1005 } __attribute__ ((gcc_struct));
1006
1007 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
1008
1009 struct InitDeclarator
1010 {
1011 struct InitDeclarator * prev;
1012 struct InitDeclarator * next;
1013 struct Location loc;
1014 struct Declarator * declarator;
1015 struct Initializer * initializer;
1016 } __attribute__ ((gcc_struct));
1017
1018 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
1019
1020 struct AsmField
1021 {
1022 struct AsmField * prev;
1023 struct AsmField * next;
1024 struct Location loc;
1025 char *  command;
1026 struct Expression * expression;
1027 } __attribute__ ((gcc_struct));
1028
1029 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
1030
1031 struct Attribute;
1032
1033 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
1034
1035 struct ClassFunction
1036 {
1037 struct ClassFunction * prev;
1038 struct ClassFunction * next;
1039 struct Location loc;
1040 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1041 struct Declarator * declarator;
1042 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1043 struct Statement * body;
1044 struct __ecereNameSpace__ecere__com__Class * _class;
1045 struct __ecereNameSpace__ecere__sys__OldList attached;
1046 int declMode;
1047 struct Type * type;
1048 struct Symbol * propSet;
1049 unsigned int isVirtual;
1050 unsigned int isConstructor;
1051 unsigned int isDestructor;
1052 unsigned int dontMangle;
1053 int id;
1054 int idCode;
1055 } __attribute__ ((gcc_struct));
1056
1057 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1058
1059 struct MembersInit
1060 {
1061 struct MembersInit * prev;
1062 struct MembersInit * next;
1063 struct Location loc;
1064 int type;
1065 union
1066 {
1067 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1068 struct ClassFunction * function;
1069 } __attribute__ ((gcc_struct));
1070 } __attribute__ ((gcc_struct));
1071
1072 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1073
1074 struct MemberInit
1075 {
1076 struct MemberInit * prev;
1077 struct MemberInit * next;
1078 struct Location loc;
1079 struct Location realLoc;
1080 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1081 struct Initializer * initializer;
1082 unsigned int used;
1083 unsigned int variable;
1084 unsigned int takeOutExp;
1085 } __attribute__ ((gcc_struct));
1086
1087 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1088
1089 struct PropertyDef
1090 {
1091 struct PropertyDef * prev;
1092 struct PropertyDef * next;
1093 struct Location loc;
1094 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1095 struct Declarator * declarator;
1096 struct Identifier * id;
1097 struct Statement * getStmt;
1098 struct Statement * setStmt;
1099 struct Statement * issetStmt;
1100 struct Symbol * symbol;
1101 unsigned int conversion;
1102 unsigned int isWatchable;
1103 struct Expression * category;
1104 } __attribute__ ((gcc_struct));
1105
1106 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1107
1108 struct PropertyWatch
1109 {
1110 struct PropertyWatch * prev;
1111 struct PropertyWatch * next;
1112 struct Location loc;
1113 struct Statement * compound;
1114 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1115 unsigned int deleteWatch;
1116 } __attribute__ ((gcc_struct));
1117
1118 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1119
1120 struct ClassDef
1121 {
1122 struct ClassDef * prev;
1123 struct ClassDef * next;
1124 struct Location loc;
1125 int type;
1126 union
1127 {
1128 struct Declaration * decl;
1129 struct ClassFunction * function;
1130 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1131 struct PropertyDef * propertyDef;
1132 struct PropertyWatch * propertyWatch;
1133 char *  designer;
1134 struct Identifier * defaultProperty;
1135 struct
1136 {
1137 struct Identifier * id;
1138 struct Initializer * initializer;
1139 } __attribute__ ((gcc_struct));
1140 } __attribute__ ((gcc_struct));
1141 int memberAccess;
1142 void *  object;
1143 } __attribute__ ((gcc_struct));
1144
1145 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1146
1147 struct DBTableEntry;
1148
1149 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1150
1151 struct DBIndexItem;
1152
1153 extern YYSTYPE yylval;
1154
1155 extern struct Location yylloc;
1156
1157 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1158
1159 extern int returnCode;
1160
1161 extern struct Expression * parsedExpression;
1162
1163 extern unsigned int yydebug;
1164
1165 void SetYydebug(unsigned int b)
1166 {
1167 yydebug = b;
1168 }
1169
1170 extern unsigned int echoOn;
1171
1172 void resetScanner();
1173
1174 int propWatcherID;
1175
1176 int expression_yyparse();
1177
1178 static struct Statement * curCompound;
1179
1180 struct External * curExternal, * afterExternal;
1181
1182 static struct Type * curSwitchType;
1183
1184 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1185
1186 struct __ecereNameSpace__ecere__com__Class * thisClass;
1187
1188 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1189 {
1190 thisClass = c;
1191 }
1192
1193 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1194 {
1195 return thisClass;
1196 }
1197
1198 static char * thisNameSpace;
1199
1200 struct __ecereNameSpace__ecere__com__Class * containerClass;
1201
1202 unsigned int thisClassParams = 0x1;
1203
1204 unsigned int internalValueCounter;
1205
1206 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1207
1208 extern size_t strlen(const char * );
1209
1210 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1211
1212 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1213
1214 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1215
1216 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1217
1218 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1219
1220 void PrintExpression(struct Expression * exp, char * string)
1221 {
1222 {
1223 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1224 int count;
1225
1226 if(exp)
1227 OutputExpression(exp, f);
1228 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1229 count = strlen(string);
1230 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);
1231 string[count] = '\0';
1232 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1233 }
1234 }
1235
1236 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1237
1238 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1239
1240 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1241 {
1242 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1243 {
1244 if(!param->baseType)
1245 {
1246 if(param->dataTypeString)
1247 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1248 else
1249 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1250 }
1251 return param->baseType;
1252 }
1253 return (((void *)0));
1254 }
1255
1256 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1257 {
1258 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1259 return 0x1;
1260 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1261 {
1262 return 0x0;
1263 }
1264 if(type1->kind == type2->kind)
1265 {
1266 switch(type1->kind)
1267 {
1268 case 1:
1269 case 2:
1270 case 3:
1271 case 4:
1272 case 22:
1273 case 23:
1274 if(type1->passAsTemplate && !type2->passAsTemplate)
1275 return 0x1;
1276 return type1->isSigned != type2->isSigned;
1277 case 8:
1278 return type1->_class != type2->_class;
1279 case 13:
1280 return NeedCast(type1->type, type2->type);
1281 default:
1282 return 0x1;
1283 }
1284 }
1285 return 0x1;
1286 }
1287
1288 extern int strcmp(const char * , const char * );
1289
1290 extern struct Context * curContext;
1291
1292 extern struct Context * topContext;
1293
1294 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1295
1296 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);
1297
1298 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1299
1300 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);
1301
1302 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);
1303
1304 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1305
1306 struct __ecereNameSpace__ecere__com__ClassProperty
1307 {
1308 char *  name;
1309 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1310 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1311 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1312 int depth;
1313 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, long long);
1314 long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1315 char *  dataTypeString;
1316 struct Type * dataType;
1317 unsigned int constant;
1318 } __attribute__ ((gcc_struct));
1319
1320 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1321
1322 extern struct Expression * QMkExpId(char *  id);
1323
1324 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1325
1326 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1327 {
1328 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1329 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1330 char *  name;
1331 int type;
1332 union
1333 {
1334 char *  dataTypeString;
1335 int memberType;
1336 } __attribute__ ((gcc_struct));
1337 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1338 void *  param;
1339 } __attribute__ ((gcc_struct));
1340
1341 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1342
1343 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1344
1345 extern void FreeIdentifier(struct Identifier * id);
1346
1347 void ProcessExpressionType(struct Expression * exp);
1348
1349 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1350
1351 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1352
1353 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1354
1355 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1356
1357 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1358
1359 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1360
1361 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1362
1363 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1364
1365 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1366 {
1367 if(exp->type == 0 && exp->identifier)
1368 {
1369 struct Identifier * id = exp->identifier;
1370 struct Context * ctx;
1371 struct Symbol * symbol = (((void *)0));
1372
1373 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1374 {
1375 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1376 {
1377 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1378 if(symbol)
1379 break;
1380 }
1381 }
1382 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1383 {
1384 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1385 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1386 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1387 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
1388
1389 if(!prop)
1390 {
1391 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1392 }
1393 if(!prop && !method)
1394 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1395 if(!prop && !method && !member)
1396 {
1397 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1398 }
1399 if(prop || method || member || classProp)
1400 {
1401 exp->type = 8;
1402 exp->member.member = id;
1403 exp->member.memberType = 0;
1404 exp->member.exp = QMkExpId("this");
1405 exp->addedThis = 0x1;
1406 }
1407 else if(_class && _class->templateParams.first)
1408 {
1409 struct __ecereNameSpace__ecere__com__Class * sClass;
1410
1411 for(sClass = _class; sClass; sClass = sClass->base)
1412 {
1413 if(sClass->templateParams.first)
1414 {
1415 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1416
1417 for(param = sClass->templateParams.first; param; param = param->next)
1418 {
1419 if(param->type == 2 && !strcmp(param->name, id->string))
1420 {
1421 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1422
1423 if(argExp)
1424 {
1425 struct Declarator * decl;
1426 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1427
1428 FreeIdentifier(exp->member.member);
1429 ProcessExpressionType(argExp);
1430 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1431 exp->expType = ProcessType(specs, decl);
1432 exp->type = 5;
1433 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1434 }
1435 }
1436 }
1437 }
1438 }
1439 }
1440 }
1441 }
1442 }
1443
1444 extern int sprintf(char * , char * , ...);
1445
1446 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1447
1448 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1449
1450 char * PrintInt(long long result)
1451 {
1452 char temp[100];
1453
1454 if(result > (((long long)0x7fffffffffffffffLL)))
1455 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1456 else
1457 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1458 return __ecereNameSpace__ecere__sys__CopyString(temp);
1459 }
1460
1461 char * PrintUInt(uint64 result)
1462 {
1463 char temp[100];
1464
1465 if(result > (0xffffffff))
1466 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1467 else if(result > (((int)0x7fffffff)))
1468 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1469 else
1470 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1471 return __ecereNameSpace__ecere__sys__CopyString(temp);
1472 }
1473
1474 char * PrintInt64(long long result)
1475 {
1476 char temp[100];
1477
1478 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1479 return __ecereNameSpace__ecere__sys__CopyString(temp);
1480 }
1481
1482 char * PrintUInt64(uint64 result)
1483 {
1484 char temp[100];
1485
1486 if(result > (((long long)0x7fffffffffffffffLL)))
1487 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1488 else
1489 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1490 return __ecereNameSpace__ecere__sys__CopyString(temp);
1491 }
1492
1493 char * PrintHexUInt(uint64 result)
1494 {
1495 char temp[100];
1496
1497 if(result > (0xffffffff))
1498 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1499 else
1500 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1501 return __ecereNameSpace__ecere__sys__CopyString(temp);
1502 }
1503
1504 char * PrintHexUInt64(uint64 result)
1505 {
1506 char temp[100];
1507
1508 if(result > (0xffffffff))
1509 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1510 else
1511 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1512 return __ecereNameSpace__ecere__sys__CopyString(temp);
1513 }
1514
1515 char * PrintShort(short result)
1516 {
1517 char temp[100];
1518
1519 sprintf(temp, "%d", (unsigned short)result);
1520 return __ecereNameSpace__ecere__sys__CopyString(temp);
1521 }
1522
1523 char * PrintUShort(unsigned short result)
1524 {
1525 char temp[100];
1526
1527 if(result > (unsigned short)32767)
1528 sprintf(temp, "0x%X", (int)result);
1529 else
1530 sprintf(temp, "%d", (int)result);
1531 return __ecereNameSpace__ecere__sys__CopyString(temp);
1532 }
1533
1534 extern int isprint(int c);
1535
1536 char * PrintChar(char result)
1537 {
1538 char temp[100];
1539
1540 if(result > (char)0 && isprint(result))
1541 sprintf(temp, "'%c'", result);
1542 else if(result < (char)0)
1543 sprintf(temp, "%d", (int)result);
1544 else
1545 sprintf(temp, "0x%X", (unsigned char)result);
1546 return __ecereNameSpace__ecere__sys__CopyString(temp);
1547 }
1548
1549 char * PrintUChar(unsigned char result)
1550 {
1551 char temp[100];
1552
1553 sprintf(temp, "0x%X", result);
1554 return __ecereNameSpace__ecere__sys__CopyString(temp);
1555 }
1556
1557 char * PrintFloat(float result)
1558 {
1559 char temp[350];
1560
1561 sprintf(temp, "%.16ff", result);
1562 return __ecereNameSpace__ecere__sys__CopyString(temp);
1563 }
1564
1565 char * PrintDouble(double result)
1566 {
1567 char temp[350];
1568
1569 sprintf(temp, "%.16f", result);
1570 return __ecereNameSpace__ecere__sys__CopyString(temp);
1571 }
1572
1573 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1574
1575 struct OpTable
1576 {
1577 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1578 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1579 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1580 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1581 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1582 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1583 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1584 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1585 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1586 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1587 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1588 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1589 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1590 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1591 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1592 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1593 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1594 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1595 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1596 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1597 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1598 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1599 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1600 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1601 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1602 unsigned int (*  Not)(struct Expression *, struct Operand *);
1603 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1604 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1605 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1606 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1607 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1608 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1609 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1610 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1611 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1612 } __attribute__ ((gcc_struct));
1613
1614 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1615
1616 struct Operand
1617 {
1618 int kind;
1619 struct Type * type;
1620 unsigned int ptrSize;
1621 union
1622 {
1623 char c;
1624 unsigned char uc;
1625 short s;
1626 unsigned short us;
1627 int i;
1628 unsigned int ui;
1629 float f;
1630 double d;
1631 long long i64;
1632 uint64 ui64;
1633 } __attribute__ ((gcc_struct));
1634 struct OpTable ops;
1635 } __attribute__ ((gcc_struct));
1636
1637 struct Operand GetOperand(struct Expression * exp);
1638
1639 unsigned int GetInt(struct Expression * exp, int * value2)
1640 {
1641 struct Operand op2 = GetOperand(exp);
1642
1643 if(op2.kind == 3 && op2.type->isSigned)
1644 *value2 = op2.i;
1645 else if(op2.kind == 3)
1646 *value2 = (int)op2.ui;
1647 else if(op2.kind == 4 && op2.type->isSigned)
1648 *value2 = (int)op2.i64;
1649 else if(op2.kind == 4)
1650 *value2 = (int)op2.ui64;
1651 else if(op2.kind == 23 && op2.type->isSigned)
1652 *value2 = (int)op2.i64;
1653 else if(op2.kind == 23)
1654 *value2 = (int)op2.ui64;
1655 else if(op2.kind == 22 && op2.type->isSigned)
1656 *value2 = (int)op2.i64;
1657 else if(op2.kind == 22)
1658 *value2 = (int)op2.ui64;
1659 else if(op2.kind == 2 && op2.type->isSigned)
1660 *value2 = (int)op2.s;
1661 else if(op2.kind == 2)
1662 *value2 = (int)op2.us;
1663 else if(op2.kind == 1 && op2.type->isSigned)
1664 *value2 = (int)op2.c;
1665 else if(op2.kind == 1)
1666 *value2 = (int)op2.uc;
1667 else if(op2.kind == 6)
1668 *value2 = (int)op2.f;
1669 else if(op2.kind == 7)
1670 *value2 = (int)op2.d;
1671 else if(op2.kind == 13)
1672 *value2 = (int)op2.ui64;
1673 else
1674 return 0x0;
1675 return 0x1;
1676 }
1677
1678 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1679 {
1680 struct Operand op2 = GetOperand(exp);
1681
1682 if(op2.kind == 3 && op2.type->isSigned)
1683 *value2 = (unsigned int)op2.i;
1684 else if(op2.kind == 3)
1685 *value2 = op2.ui;
1686 else if(op2.kind == 4 && op2.type->isSigned)
1687 *value2 = (unsigned int)op2.i64;
1688 else if(op2.kind == 4)
1689 *value2 = (unsigned int)op2.ui64;
1690 else if(op2.kind == 23 && op2.type->isSigned)
1691 *value2 = (unsigned int)op2.i64;
1692 else if(op2.kind == 23)
1693 *value2 = (unsigned int)op2.ui64;
1694 else if(op2.kind == 22 && op2.type->isSigned)
1695 *value2 = (unsigned int)op2.i64;
1696 else if(op2.kind == 22)
1697 *value2 = (unsigned int)op2.ui64;
1698 else if(op2.kind == 2 && op2.type->isSigned)
1699 *value2 = (unsigned int)op2.s;
1700 else if(op2.kind == 2)
1701 *value2 = (unsigned int)op2.us;
1702 else if(op2.kind == 1 && op2.type->isSigned)
1703 *value2 = (unsigned int)op2.c;
1704 else if(op2.kind == 1)
1705 *value2 = (unsigned int)op2.uc;
1706 else if(op2.kind == 6)
1707 *value2 = (unsigned int)op2.f;
1708 else if(op2.kind == 7)
1709 *value2 = (unsigned int)op2.d;
1710 else if(op2.kind == 13)
1711 *value2 = (unsigned int)op2.ui64;
1712 else
1713 return 0x0;
1714 return 0x1;
1715 }
1716
1717 unsigned int GetInt64(struct Expression * exp, long long * value2)
1718 {
1719 struct Operand op2 = GetOperand(exp);
1720
1721 if(op2.kind == 3 && op2.type->isSigned)
1722 *value2 = (long long)op2.i;
1723 else if(op2.kind == 3)
1724 *value2 = (long long)op2.ui;
1725 else if(op2.kind == 4 && op2.type->isSigned)
1726 *value2 = op2.i64;
1727 else if(op2.kind == 4)
1728 *value2 = (long long)op2.ui64;
1729 else if(op2.kind == 23 && op2.type->isSigned)
1730 *value2 = op2.i64;
1731 else if(op2.kind == 23)
1732 *value2 = (long long)op2.ui64;
1733 else if(op2.kind == 22 && op2.type->isSigned)
1734 *value2 = op2.i64;
1735 else if(op2.kind == 22)
1736 *value2 = (long long)op2.ui64;
1737 else if(op2.kind == 2 && op2.type->isSigned)
1738 *value2 = (long long)op2.s;
1739 else if(op2.kind == 2)
1740 *value2 = (long long)op2.us;
1741 else if(op2.kind == 1 && op2.type->isSigned)
1742 *value2 = (long long)op2.c;
1743 else if(op2.kind == 1)
1744 *value2 = (long long)op2.uc;
1745 else if(op2.kind == 6)
1746 *value2 = (long long)op2.f;
1747 else if(op2.kind == 7)
1748 *value2 = (long long)op2.d;
1749 else if(op2.kind == 13)
1750 *value2 = (long long)op2.ui64;
1751 else
1752 return 0x0;
1753 return 0x1;
1754 }
1755
1756 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1757 {
1758 struct Operand op2 = GetOperand(exp);
1759
1760 if(op2.kind == 3 && op2.type->isSigned)
1761 *value2 = (uint64)op2.i;
1762 else if(op2.kind == 3)
1763 *value2 = (uint64)op2.ui;
1764 else if(op2.kind == 4 && op2.type->isSigned)
1765 *value2 = (uint64)op2.i64;
1766 else if(op2.kind == 4)
1767 *value2 = op2.ui64;
1768 else if(op2.kind == 23 && op2.type->isSigned)
1769 *value2 = (uint64)op2.i64;
1770 else if(op2.kind == 23)
1771 *value2 = op2.ui64;
1772 else if(op2.kind == 22 && op2.type->isSigned)
1773 *value2 = (uint64)op2.i64;
1774 else if(op2.kind == 22)
1775 *value2 = op2.ui64;
1776 else if(op2.kind == 2 && op2.type->isSigned)
1777 *value2 = (uint64)op2.s;
1778 else if(op2.kind == 2)
1779 *value2 = (uint64)op2.us;
1780 else if(op2.kind == 1 && op2.type->isSigned)
1781 *value2 = (uint64)op2.c;
1782 else if(op2.kind == 1)
1783 *value2 = (uint64)op2.uc;
1784 else if(op2.kind == 6)
1785 *value2 = (uint64)op2.f;
1786 else if(op2.kind == 7)
1787 *value2 = (uint64)op2.d;
1788 else if(op2.kind == 13)
1789 *value2 = op2.ui64;
1790 else
1791 return 0x0;
1792 return 0x1;
1793 }
1794
1795 unsigned int GetIntPtr(struct Expression * exp, intptr_t * value2)
1796 {
1797 struct Operand op2 = GetOperand(exp);
1798
1799 if(op2.kind == 3 && op2.type->isSigned)
1800 *value2 = (intptr_t)op2.i;
1801 else if(op2.kind == 3)
1802 *value2 = (intptr_t)op2.ui;
1803 else if(op2.kind == 4 && op2.type->isSigned)
1804 *value2 = (intptr_t)op2.i64;
1805 else if(op2.kind == 4)
1806 *value2 = (intptr_t)op2.ui64;
1807 else if(op2.kind == 23 && op2.type->isSigned)
1808 *value2 = (intptr_t)op2.i64;
1809 else if(op2.kind == 23)
1810 *value2 = (intptr_t)op2.ui64;
1811 else if(op2.kind == 22 && op2.type->isSigned)
1812 *value2 = (intptr_t)op2.i64;
1813 else if(op2.kind == 22)
1814 *value2 = (intptr_t)op2.ui64;
1815 else if(op2.kind == 2 && op2.type->isSigned)
1816 *value2 = (intptr_t)op2.s;
1817 else if(op2.kind == 2)
1818 *value2 = (intptr_t)op2.us;
1819 else if(op2.kind == 1 && op2.type->isSigned)
1820 *value2 = (intptr_t)op2.c;
1821 else if(op2.kind == 1)
1822 *value2 = (intptr_t)op2.uc;
1823 else if(op2.kind == 6)
1824 *value2 = (intptr_t)op2.f;
1825 else if(op2.kind == 7)
1826 *value2 = (intptr_t)op2.d;
1827 else if(op2.kind == 13)
1828 *value2 = (intptr_t)op2.ui64;
1829 else
1830 return 0x0;
1831 return 0x1;
1832 }
1833
1834 unsigned int GetUIntPtr(struct Expression * exp, uintptr_t * value2)
1835 {
1836 struct Operand op2 = GetOperand(exp);
1837
1838 if(op2.kind == 3 && op2.type->isSigned)
1839 *value2 = (uintptr_t)op2.i;
1840 else if(op2.kind == 3)
1841 *value2 = (uintptr_t)op2.ui;
1842 else if(op2.kind == 4 && op2.type->isSigned)
1843 *value2 = (uintptr_t)op2.i64;
1844 else if(op2.kind == 4)
1845 *value2 = (uintptr_t)op2.ui64;
1846 else if(op2.kind == 23 && op2.type->isSigned)
1847 *value2 = (uintptr_t)op2.i64;
1848 else if(op2.kind == 23)
1849 *value2 = (uintptr_t)op2.ui64;
1850 else if(op2.kind == 22 && op2.type->isSigned)
1851 *value2 = (uintptr_t)op2.i64;
1852 else if(op2.kind == 22)
1853 *value2 = (uintptr_t)op2.ui64;
1854 else if(op2.kind == 2 && op2.type->isSigned)
1855 *value2 = (uintptr_t)op2.s;
1856 else if(op2.kind == 2)
1857 *value2 = (uintptr_t)op2.us;
1858 else if(op2.kind == 1 && op2.type->isSigned)
1859 *value2 = (uintptr_t)op2.c;
1860 else if(op2.kind == 1)
1861 *value2 = (uintptr_t)op2.uc;
1862 else if(op2.kind == 6)
1863 *value2 = (uintptr_t)op2.f;
1864 else if(op2.kind == 7)
1865 *value2 = (uintptr_t)op2.d;
1866 else if(op2.kind == 13)
1867 *value2 = (uintptr_t)op2.ui64;
1868 else
1869 return 0x0;
1870 return 0x1;
1871 }
1872
1873 unsigned int GetIntSize(struct Expression * exp, ssize_t * value2)
1874 {
1875 struct Operand op2 = GetOperand(exp);
1876
1877 if(op2.kind == 3 && op2.type->isSigned)
1878 *value2 = (ssize_t)op2.i;
1879 else if(op2.kind == 3)
1880 *value2 = (ssize_t)op2.ui;
1881 else if(op2.kind == 4 && op2.type->isSigned)
1882 *value2 = (ssize_t)op2.i64;
1883 else if(op2.kind == 4)
1884 *value2 = (ssize_t)op2.ui64;
1885 else if(op2.kind == 23 && op2.type->isSigned)
1886 *value2 = (ssize_t)op2.i64;
1887 else if(op2.kind == 23)
1888 *value2 = (ssize_t)op2.ui64;
1889 else if(op2.kind == 22 && op2.type->isSigned)
1890 *value2 = (ssize_t)op2.i64;
1891 else if(op2.kind == 22)
1892 *value2 = (ssize_t)op2.ui64;
1893 else if(op2.kind == 2 && op2.type->isSigned)
1894 *value2 = (ssize_t)op2.s;
1895 else if(op2.kind == 2)
1896 *value2 = (ssize_t)op2.us;
1897 else if(op2.kind == 1 && op2.type->isSigned)
1898 *value2 = (ssize_t)op2.c;
1899 else if(op2.kind == 1)
1900 *value2 = (ssize_t)op2.uc;
1901 else if(op2.kind == 6)
1902 *value2 = (ssize_t)op2.f;
1903 else if(op2.kind == 7)
1904 *value2 = (ssize_t)op2.d;
1905 else if(op2.kind == 13)
1906 *value2 = (ssize_t)op2.ui64;
1907 else
1908 return 0x0;
1909 return 0x1;
1910 }
1911
1912 unsigned int GetUIntSize(struct Expression * exp, size_t * value2)
1913 {
1914 struct Operand op2 = GetOperand(exp);
1915
1916 if(op2.kind == 3 && op2.type->isSigned)
1917 *value2 = (size_t)op2.i;
1918 else if(op2.kind == 3)
1919 *value2 = (size_t)op2.ui;
1920 else if(op2.kind == 4 && op2.type->isSigned)
1921 *value2 = (size_t)op2.i64;
1922 else if(op2.kind == 4)
1923 *value2 = (size_t)op2.ui64;
1924 else if(op2.kind == 23 && op2.type->isSigned)
1925 *value2 = (size_t)op2.i64;
1926 else if(op2.kind == 23)
1927 *value2 = (size_t)op2.ui64;
1928 else if(op2.kind == 22 && op2.type->isSigned)
1929 *value2 = (size_t)op2.i64;
1930 else if(op2.kind == 22)
1931 *value2 = (size_t)op2.ui64;
1932 else if(op2.kind == 2 && op2.type->isSigned)
1933 *value2 = (size_t)op2.s;
1934 else if(op2.kind == 2)
1935 *value2 = (size_t)op2.us;
1936 else if(op2.kind == 1 && op2.type->isSigned)
1937 *value2 = (size_t)op2.c;
1938 else if(op2.kind == 1)
1939 *value2 = (size_t)op2.uc;
1940 else if(op2.kind == 6)
1941 *value2 = (size_t)op2.f;
1942 else if(op2.kind == 7)
1943 *value2 = (size_t)op2.d;
1944 else if(op2.kind == 13)
1945 *value2 = (size_t)op2.ui64;
1946 else
1947 return 0x0;
1948 return 0x1;
1949 }
1950
1951 unsigned int GetShort(struct Expression * exp, short * value2)
1952 {
1953 struct Operand op2 = GetOperand(exp);
1954
1955 if(op2.kind == 3 && op2.type->isSigned)
1956 *value2 = (short)op2.i;
1957 else if(op2.kind == 3)
1958 *value2 = (short)op2.ui;
1959 else if(op2.kind == 4 && op2.type->isSigned)
1960 *value2 = (short)op2.i64;
1961 else if(op2.kind == 4)
1962 *value2 = (short)op2.ui64;
1963 else if(op2.kind == 23 && op2.type->isSigned)
1964 *value2 = (short)op2.i64;
1965 else if(op2.kind == 23)
1966 *value2 = (short)op2.ui64;
1967 else if(op2.kind == 22 && op2.type->isSigned)
1968 *value2 = (short)op2.i64;
1969 else if(op2.kind == 22)
1970 *value2 = (short)op2.ui64;
1971 else if(op2.kind == 2 && op2.type->isSigned)
1972 *value2 = op2.s;
1973 else if(op2.kind == 2)
1974 *value2 = (short)op2.us;
1975 else if(op2.kind == 1 && op2.type->isSigned)
1976 *value2 = (short)op2.c;
1977 else if(op2.kind == 1)
1978 *value2 = (short)op2.uc;
1979 else if(op2.kind == 6)
1980 *value2 = (short)op2.f;
1981 else if(op2.kind == 7)
1982 *value2 = (short)op2.d;
1983 else if(op2.kind == 13)
1984 *value2 = (short)op2.ui64;
1985 else
1986 return 0x0;
1987 return 0x1;
1988 }
1989
1990 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
1991 {
1992 struct Operand op2 = GetOperand(exp);
1993
1994 if(op2.kind == 3 && op2.type->isSigned)
1995 *value2 = (unsigned short)op2.i;
1996 else if(op2.kind == 3)
1997 *value2 = (unsigned short)op2.ui;
1998 else if(op2.kind == 4 && op2.type->isSigned)
1999 *value2 = (unsigned short)op2.i64;
2000 else if(op2.kind == 4)
2001 *value2 = (unsigned short)op2.ui64;
2002 else if(op2.kind == 23 && op2.type->isSigned)
2003 *value2 = (unsigned short)op2.i64;
2004 else if(op2.kind == 23)
2005 *value2 = (unsigned short)op2.ui64;
2006 else if(op2.kind == 22 && op2.type->isSigned)
2007 *value2 = (unsigned short)op2.i64;
2008 else if(op2.kind == 22)
2009 *value2 = (unsigned short)op2.ui64;
2010 else if(op2.kind == 2 && op2.type->isSigned)
2011 *value2 = (unsigned short)op2.s;
2012 else if(op2.kind == 2)
2013 *value2 = op2.us;
2014 else if(op2.kind == 1 && op2.type->isSigned)
2015 *value2 = (unsigned short)op2.c;
2016 else if(op2.kind == 1)
2017 *value2 = (unsigned short)op2.uc;
2018 else if(op2.kind == 6)
2019 *value2 = (unsigned short)op2.f;
2020 else if(op2.kind == 7)
2021 *value2 = (unsigned short)op2.d;
2022 else if(op2.kind == 13)
2023 *value2 = (unsigned short)op2.ui64;
2024 else
2025 return 0x0;
2026 return 0x1;
2027 }
2028
2029 unsigned int GetChar(struct Expression * exp, char * value2)
2030 {
2031 struct Operand op2 = GetOperand(exp);
2032
2033 if(op2.kind == 3 && op2.type->isSigned)
2034 *value2 = (char)op2.i;
2035 else if(op2.kind == 3)
2036 *value2 = (char)op2.ui;
2037 else if(op2.kind == 4 && op2.type->isSigned)
2038 *value2 = (char)op2.i64;
2039 else if(op2.kind == 4)
2040 *value2 = (char)op2.ui64;
2041 else if(op2.kind == 23 && op2.type->isSigned)
2042 *value2 = (char)op2.i64;
2043 else if(op2.kind == 23)
2044 *value2 = (char)op2.ui64;
2045 else if(op2.kind == 22 && op2.type->isSigned)
2046 *value2 = (char)op2.i64;
2047 else if(op2.kind == 22)
2048 *value2 = (char)op2.ui64;
2049 else if(op2.kind == 2 && op2.type->isSigned)
2050 *value2 = (char)op2.s;
2051 else if(op2.kind == 2)
2052 *value2 = (char)op2.us;
2053 else if(op2.kind == 1 && op2.type->isSigned)
2054 *value2 = op2.c;
2055 else if(op2.kind == 1)
2056 *value2 = (char)op2.uc;
2057 else if(op2.kind == 6)
2058 *value2 = (char)op2.f;
2059 else if(op2.kind == 7)
2060 *value2 = (char)op2.d;
2061 else if(op2.kind == 13)
2062 *value2 = (char)op2.ui64;
2063 else
2064 return 0x0;
2065 return 0x1;
2066 }
2067
2068 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
2069 {
2070 struct Operand op2 = GetOperand(exp);
2071
2072 if(op2.kind == 3 && op2.type->isSigned)
2073 *value2 = (unsigned char)op2.i;
2074 else if(op2.kind == 3)
2075 *value2 = (unsigned char)op2.ui;
2076 else if(op2.kind == 4 && op2.type->isSigned)
2077 *value2 = (unsigned char)op2.i64;
2078 else if(op2.kind == 4)
2079 *value2 = (unsigned char)op2.ui64;
2080 else if(op2.kind == 23 && op2.type->isSigned)
2081 *value2 = (unsigned char)op2.i64;
2082 else if(op2.kind == 23)
2083 *value2 = (unsigned char)op2.ui64;
2084 else if(op2.kind == 22 && op2.type->isSigned)
2085 *value2 = (unsigned char)op2.i64;
2086 else if(op2.kind == 22)
2087 *value2 = (unsigned char)op2.ui64;
2088 else if(op2.kind == 2 && op2.type->isSigned)
2089 *value2 = (unsigned char)op2.s;
2090 else if(op2.kind == 2)
2091 *value2 = (unsigned char)op2.us;
2092 else if(op2.kind == 1 && op2.type->isSigned)
2093 *value2 = (unsigned char)op2.c;
2094 else if(op2.kind == 1)
2095 *value2 = op2.uc;
2096 else if(op2.kind == 6)
2097 *value2 = (unsigned char)op2.f;
2098 else if(op2.kind == 7)
2099 *value2 = (unsigned char)op2.d;
2100 else if(op2.kind == 13)
2101 *value2 = (unsigned char)op2.ui64;
2102 else
2103 return 0x0;
2104 return 0x1;
2105 }
2106
2107 unsigned int GetFloat(struct Expression * exp, float * value2)
2108 {
2109 struct Operand op2 = GetOperand(exp);
2110
2111 if(op2.kind == 3 && op2.type->isSigned)
2112 *value2 = (float)(float)op2.i;
2113 else if(op2.kind == 3)
2114 *value2 = (float)(float)op2.ui;
2115 else if(op2.kind == 4 && op2.type->isSigned)
2116 *value2 = (float)(float)op2.i64;
2117 else if(op2.kind == 4)
2118 *value2 = (float)(float)op2.ui64;
2119 else if(op2.kind == 23 && op2.type->isSigned)
2120 *value2 = (float)(float)op2.i64;
2121 else if(op2.kind == 23)
2122 *value2 = (float)(float)op2.ui64;
2123 else if(op2.kind == 22 && op2.type->isSigned)
2124 *value2 = (float)(float)op2.i64;
2125 else if(op2.kind == 22)
2126 *value2 = (float)(float)op2.ui64;
2127 else if(op2.kind == 2 && op2.type->isSigned)
2128 *value2 = (float)(float)op2.s;
2129 else if(op2.kind == 2)
2130 *value2 = (float)(float)op2.us;
2131 else if(op2.kind == 1 && op2.type->isSigned)
2132 *value2 = (float)(float)op2.c;
2133 else if(op2.kind == 1)
2134 *value2 = (float)(float)op2.uc;
2135 else if(op2.kind == 6)
2136 *value2 = (float)op2.f;
2137 else if(op2.kind == 7)
2138 *value2 = (float)op2.d;
2139 else if(op2.kind == 13)
2140 *value2 = (float)(float)op2.ui64;
2141 else
2142 return 0x0;
2143 return 0x1;
2144 }
2145
2146 unsigned int GetDouble(struct Expression * exp, double * value2)
2147 {
2148 struct Operand op2 = GetOperand(exp);
2149
2150 if(op2.kind == 3 && op2.type->isSigned)
2151 *value2 = (double)(double)op2.i;
2152 else if(op2.kind == 3)
2153 *value2 = (double)(double)op2.ui;
2154 else if(op2.kind == 4 && op2.type->isSigned)
2155 *value2 = (double)(double)op2.i64;
2156 else if(op2.kind == 4)
2157 *value2 = (double)(double)op2.ui64;
2158 else if(op2.kind == 23 && op2.type->isSigned)
2159 *value2 = (double)(double)op2.i64;
2160 else if(op2.kind == 23)
2161 *value2 = (double)(double)op2.ui64;
2162 else if(op2.kind == 22 && op2.type->isSigned)
2163 *value2 = (double)(double)op2.i64;
2164 else if(op2.kind == 22)
2165 *value2 = (double)(double)op2.ui64;
2166 else if(op2.kind == 2 && op2.type->isSigned)
2167 *value2 = (double)(double)op2.s;
2168 else if(op2.kind == 2)
2169 *value2 = (double)(double)op2.us;
2170 else if(op2.kind == 1 && op2.type->isSigned)
2171 *value2 = (double)(double)op2.c;
2172 else if(op2.kind == 1)
2173 *value2 = (double)(double)op2.uc;
2174 else if(op2.kind == 6)
2175 *value2 = (double)op2.f;
2176 else if(op2.kind == 7)
2177 *value2 = (double)op2.d;
2178 else if(op2.kind == 13)
2179 *value2 = (double)(double)op2.ui64;
2180 else
2181 return 0x0;
2182 return 0x1;
2183 }
2184
2185 void ComputeExpression(struct Expression * exp);
2186
2187 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2188
2189 extern int targetBits;
2190
2191 int ComputeTypeSize(struct Type * type);
2192
2193 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2194
2195 struct __ecereNameSpace__ecere__com__BitMember
2196 {
2197 struct __ecereNameSpace__ecere__com__BitMember * prev;
2198 struct __ecereNameSpace__ecere__com__BitMember * next;
2199 char *  name;
2200 unsigned int isProperty;
2201 int memberAccess;
2202 int id;
2203 struct __ecereNameSpace__ecere__com__Class * _class;
2204 char *  dataTypeString;
2205 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2206 struct Type * dataType;
2207 int type;
2208 int size;
2209 int pos;
2210 uint64 mask;
2211 } __attribute__ ((gcc_struct));
2212
2213 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2214
2215 struct __ecereNameSpace__ecere__sys__OldLink
2216 {
2217 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2218 struct __ecereNameSpace__ecere__sys__OldLink * next;
2219 void *  data;
2220 } __attribute__ ((gcc_struct));
2221
2222 void FinishTemplatesContext(struct Context * context);
2223
2224 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2225 {
2226 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2227 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2228
2229 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))
2230 {
2231 int c;
2232 int unionMemberOffset = 0;
2233 int bitFields = 0;
2234
2235 if(member)
2236 {
2237 member->memberOffset = 0;
2238 if(targetBits < sizeof(void *) * 8)
2239 member->structAlignment = 0;
2240 }
2241 else if(targetBits < sizeof(void *) * 8)
2242 _class->structAlignment = 0;
2243 if(!member && ((_class->type == 0 || _class->type == 5) || (_class->type == 1 && _class->memberOffset && _class->memberOffset > _class->base->structSize)))
2244 _class->memberOffset = (_class->base && _class->type == 1) ? _class->base->structSize : 0;
2245 if(!member && _class->destructionWatchOffset)
2246 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2247 {
2248 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2249
2250 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2251 {
2252 if(!dataMember->isProperty)
2253 {
2254 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2255 {
2256 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2257 }
2258 }
2259 }
2260 }
2261 {
2262 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2263
2264 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2265 {
2266 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2267 {
2268 if(!isMember && _class->type == 2 && dataMember->dataType)
2269 {
2270 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2271 uint64 mask = 0;
2272 int d;
2273
2274 ComputeTypeSize(dataMember->dataType);
2275 if(bitMember->pos == -1)
2276 bitMember->pos = _class->memberOffset;
2277 if(!bitMember->size)
2278 bitMember->size = dataMember->dataType->size * 8;
2279 _class->memberOffset = bitMember->pos + bitMember->size;
2280 for(d = 0; d < bitMember->size; d++)
2281 {
2282 if(d)
2283 mask <<= 1;
2284 mask |= 1;
2285 }
2286 bitMember->mask = mask << bitMember->pos;
2287 }
2288 else if(dataMember->type == 0 && dataMember->dataType)
2289 {
2290 int size;
2291 int alignment = 0;
2292
2293 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2294 ComputeTypeSize(dataMember->dataType);
2295 if(dataMember->dataType->bitFieldCount)
2296 {
2297 bitFields += dataMember->dataType->bitFieldCount;
2298 size = 0;
2299 }
2300 else
2301 {
2302 if(bitFields)
2303 {
2304 int size = (bitFields + 7) / 8;
2305
2306 if(isMember)
2307 {
2308 int __simpleStruct0;
2309
2310 if(alignment)
2311 {
2312 int __simpleStruct0;
2313
2314 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2315 if(member->memberOffset % alignment)
2316 member->memberOffset += alignment - (member->memberOffset % alignment);
2317 }
2318 dataMember->offset = member->memberOffset;
2319 if(member->type == 1)
2320 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2321 else
2322 {
2323 member->memberOffset += size;
2324 }
2325 }
2326 else
2327 {
2328 if(alignment)
2329 {
2330 int __simpleStruct0;
2331
2332 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2333 if(_class->memberOffset % alignment)
2334 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2335 }
2336 dataMember->offset = _class->memberOffset;
2337 _class->memberOffset += size;
2338 }
2339 bitFields = 0;
2340 }
2341 size = dataMember->dataType->size;
2342 alignment = dataMember->dataType->alignment;
2343 }
2344 if(isMember)
2345 {
2346 int __simpleStruct0;
2347
2348 if(alignment)
2349 {
2350 int __simpleStruct0;
2351
2352 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2353 if(member->memberOffset % alignment)
2354 member->memberOffset += alignment - (member->memberOffset % alignment);
2355 }
2356 dataMember->offset = member->memberOffset;
2357 if(member->type == 1)
2358 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2359 else
2360 {
2361 member->memberOffset += size;
2362 }
2363 }
2364 else
2365 {
2366 if(alignment)
2367 {
2368 int __simpleStruct0;
2369
2370 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2371 if(_class->memberOffset % alignment)
2372 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2373 }
2374 dataMember->offset = _class->memberOffset;
2375 _class->memberOffset += size;
2376 }
2377 }
2378 else
2379 {
2380 int alignment;
2381
2382 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2383 alignment = dataMember->structAlignment;
2384 if(isMember)
2385 {
2386 int __simpleStruct0;
2387
2388 if(alignment)
2389 {
2390 int __simpleStruct0;
2391
2392 if(member->memberOffset % alignment)
2393 member->memberOffset += alignment - (member->memberOffset % alignment);
2394 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2395 }
2396 dataMember->offset = member->memberOffset;
2397 if(member->type == 1)
2398 unionMemberOffset = (__simpleStruct0 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2399 else
2400 member->memberOffset += dataMember->memberOffset;
2401 }
2402 else
2403 {
2404 if(alignment)
2405 {
2406 int __simpleStruct0;
2407
2408 if(_class->memberOffset % alignment)
2409 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2410 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2411 }
2412 dataMember->offset = _class->memberOffset;
2413 _class->memberOffset += dataMember->memberOffset;
2414 }
2415 }
2416 }
2417 }
2418 if(bitFields)
2419 {
2420 int alignment = 0;
2421 int size = (bitFields + 7) / 8;
2422
2423 if(isMember)
2424 {
2425 int __simpleStruct0;
2426
2427 if(alignment)
2428 {
2429 int __simpleStruct0;
2430
2431 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2432 if(member->memberOffset % alignment)
2433 member->memberOffset += alignment - (member->memberOffset % alignment);
2434 }
2435 if(member->type == 1)
2436 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2437 else
2438 {
2439 member->memberOffset += size;
2440 }
2441 }
2442 else
2443 {
2444 if(alignment)
2445 {
2446 int __simpleStruct0;
2447
2448 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2449 if(_class->memberOffset % alignment)
2450 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2451 }
2452 _class->memberOffset += size;
2453 }
2454 bitFields = 0;
2455 }
2456 }
2457 if(member && member->type == 1)
2458 {
2459 member->memberOffset = unionMemberOffset;
2460 }
2461 if(!isMember)
2462 {
2463 if(_class->type != 2)
2464 {
2465 int extra = 0;
2466
2467 if(_class->structAlignment)
2468 {
2469 if(_class->memberOffset % _class->structAlignment)
2470 extra += _class->structAlignment - (_class->memberOffset % _class->structAlignment);
2471 }
2472 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset + extra;
2473 if(!member)
2474 {
2475 struct __ecereNameSpace__ecere__com__Property * prop;
2476
2477 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2478 {
2479 if(prop->isProperty && prop->isWatchable)
2480 {
2481 prop->watcherOffset = _class->structSize;
2482 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2483 }
2484 }
2485 }
2486 {
2487 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2488
2489 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2490 {
2491 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2492
2493 if(deriv->computeSize)
2494 {
2495 deriv->offset = _class->structSize;
2496 deriv->memberOffset = 0;
2497 deriv->structSize = deriv->offset;
2498 ComputeClassMembers(deriv, 0x0);
2499 }
2500 }
2501 }
2502 }
2503 }
2504 }
2505 if(context)
2506 FinishTemplatesContext(context);
2507 }
2508
2509 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2510
2511 struct __ecereNameSpace__ecere__com__NameSpace
2512 {
2513 char *  name;
2514 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2515 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2516 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2517 int depth;
2518 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2519 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2520 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2521 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2522 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2523 } __attribute__ ((gcc_struct));
2524
2525 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2526
2527 struct __ecereNameSpace__ecere__com__Module
2528 {
2529 struct __ecereNameSpace__ecere__com__Instance * application;
2530 struct __ecereNameSpace__ecere__sys__OldList classes;
2531 struct __ecereNameSpace__ecere__sys__OldList defines;
2532 struct __ecereNameSpace__ecere__sys__OldList functions;
2533 struct __ecereNameSpace__ecere__sys__OldList modules;
2534 struct __ecereNameSpace__ecere__com__Instance * prev;
2535 struct __ecereNameSpace__ecere__com__Instance * next;
2536 char *  name;
2537 void *  library;
2538 void *  Unload;
2539 int importType;
2540 int origImportType;
2541 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2542 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2543 } __attribute__ ((gcc_struct));
2544
2545 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2546 {
2547 struct __ecereNameSpace__ecere__com__Class * _class;
2548 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2549
2550 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
2551 ComputeModuleClasses(subModule->data);
2552 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->classes.first; _class; _class = _class->next)
2553 ComputeClassMembers(_class, 0x0);
2554 }
2555
2556 extern unsigned int inCompiler;
2557
2558 extern void Compiler_Error(char *  format, ...);
2559
2560 extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
2561
2562 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
2563
2564 int ComputeTypeSize(struct Type * type)
2565 {
2566 unsigned int size = type ? type->size : 0;
2567
2568 if(!size && type && !type->computing)
2569 {
2570 type->computing = 0x1;
2571 switch(type->kind)
2572 {
2573 case 1:
2574 type->alignment = size = sizeof(char);
2575 break;
2576 case 3:
2577 type->alignment = size = sizeof(int);
2578 break;
2579 case 4:
2580 type->alignment = size = sizeof(long long);
2581 break;
2582 case 22:
2583 type->alignment = size = targetBits / 8;
2584 break;
2585 case 23:
2586 type->alignment = size = targetBits / 8;
2587 break;
2588 case 5:
2589 type->alignment = size = sizeof(long);
2590 break;
2591 case 2:
2592 type->alignment = size = sizeof(short);
2593 break;
2594 case 6:
2595 type->alignment = size = sizeof(float);
2596 break;
2597 case 7:
2598 type->alignment = size = sizeof(double);
2599 break;
2600 case 8:
2601 {
2602 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2603
2604 if(_class && _class->type == 1)
2605 {
2606 ComputeClassMembers(_class, 0x0);
2607 type->alignment = _class->structAlignment;
2608 size = _class->structSize;
2609 if(type->alignment && size % type->alignment)
2610 size += type->alignment - (size % type->alignment);
2611 }
2612 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2613 {
2614 if(!_class->dataType)
2615 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2616 size = type->alignment = ComputeTypeSize(_class->dataType);
2617 }
2618 else
2619 size = type->alignment = targetBits / 8;
2620 break;
2621 }
2622 case 13:
2623 case 19:
2624 size = type->alignment = targetBits / 8;
2625 break;
2626 case 12:
2627 if(type->arraySizeExp)
2628 {
2629 ProcessExpressionType(type->arraySizeExp);
2630 ComputeExpression(type->arraySizeExp);
2631 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)))
2632 {
2633 struct Location oldLoc = yylloc;
2634 char expression[10240];
2635
2636 expression[0] = '\0';
2637 type->arraySizeExp->expType = (((void *)0));
2638 yylloc = type->arraySizeExp->loc;
2639 if(inCompiler)
2640 PrintExpression(type->arraySizeExp, expression);
2641 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Array size not constant int (%s)\n", (((void *)0))), expression);
2642 yylloc = oldLoc;
2643 }
2644 GetInt(type->arraySizeExp, &type->arraySize);
2645 }
2646 else if(type->enumClass)
2647 {
2648 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2649 {
2650 type->arraySize = (int)__ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2651 }
2652 else
2653 type->arraySize = 0;
2654 }
2655 else
2656 {
2657 type->arraySize = 0;
2658 }
2659 size = ComputeTypeSize(type->type) * type->arraySize;
2660 if(type->type)
2661 type->alignment = type->type->alignment;
2662 break;
2663 case 9:
2664 {
2665 struct Type * member;
2666
2667 for(member = type->members.first; member; member = member->next)
2668 {
2669 int __simpleStruct0, __simpleStruct1;
2670 unsigned int addSize = ComputeTypeSize(member);
2671
2672 member->offset = size;
2673 if(member->alignment && size % member->alignment)
2674 member->offset += member->alignment - (size % member->alignment);
2675 size = member->offset;
2676 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2677 size += addSize;
2678 }
2679 if(type->alignment && size % type->alignment)
2680 size += type->alignment - (size % type->alignment);
2681 break;
2682 }
2683 case 10:
2684 {
2685 struct Type * member;
2686
2687 for(member = type->members.first; member; member = member->next)
2688 {
2689 int __simpleStruct0, __simpleStruct1;
2690 unsigned int addSize = ComputeTypeSize(member);
2691
2692 member->offset = size;
2693 if(member->alignment && size % member->alignment)
2694 member->offset += member->alignment - (size % member->alignment);
2695 size = member->offset;
2696 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2697 size = ((size > addSize) ? size : addSize);
2698 }
2699 if(type->alignment && size % type->alignment)
2700 size += type->alignment - (size % type->alignment);
2701 break;
2702 }
2703 case 20:
2704 {
2705 struct TemplateParameter * param = type->templateParameter;
2706 struct Type * baseType = ProcessTemplateParameterType(param);
2707
2708 if(baseType)
2709 {
2710 size = ComputeTypeSize(baseType);
2711 type->alignment = baseType->alignment;
2712 }
2713 else
2714 type->alignment = size = sizeof(uint64);
2715 break;
2716 }
2717 case 15:
2718 {
2719 type->alignment = size = sizeof(enum
2720 {
2721 test
2722 });
2723 break;
2724 }
2725 case 21:
2726 {
2727 type->alignment = size = targetBits / 8;
2728 break;
2729 }
2730 }
2731 type->size = size;
2732 type->computing = 0x0;
2733 }
2734 return size;
2735 }
2736
2737 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2738
2739 extern struct Identifier * MkIdentifier(char *  string);
2740
2741 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2742
2743 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2744
2745 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2746
2747 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2748
2749 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2750
2751 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2752
2753 extern void FreeType(struct Type * type);
2754
2755 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2756
2757 extern struct Specifier * MkSpecifier(int specifier);
2758
2759 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2760
2761 extern struct Expression * MkExpConstant(char *  string);
2762
2763 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)
2764 {
2765 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2766 unsigned int totalSize = 0;
2767 unsigned int maxSize = 0;
2768 int alignment, size;
2769 struct __ecereNameSpace__ecere__com__DataMember * member;
2770 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2771
2772 if(addedPadding)
2773 *addedPadding = 0x0;
2774 if(!isMember && _class->base)
2775 {
2776 maxSize = _class->structSize;
2777 {
2778 if(_class->type == 1 || _class->type == 5)
2779 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass, (((void *)0)));
2780 else
2781 {
2782 unsigned int baseSize = _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2783
2784 if(maxSize > baseSize)
2785 maxSize -= baseSize;
2786 else
2787 maxSize = 0;
2788 }
2789 }
2790 }
2791 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2792 {
2793 if(!member->isProperty)
2794 {
2795 switch(member->type)
2796 {
2797 case 0:
2798 {
2799 if(member->dataTypeString)
2800 {
2801 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2802 struct Declarator * decl;
2803
2804 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2805 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2806 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2807 if(!member->dataType)
2808 member->dataType = ProcessType(specs, decl);
2809 ReplaceThisClassSpecifiers(specs, topClass);
2810 {
2811 struct Type * type = ProcessType(specs, decl);
2812
2813 DeclareType(member->dataType, 0x0, 0x0);
2814 FreeType(type);
2815 }
2816 ComputeTypeSize(member->dataType);
2817 size = member->dataType->size;
2818 alignment = member->dataType->alignment;
2819 if(alignment)
2820 {
2821 if(totalSize % alignment)
2822 totalSize += alignment - (totalSize % alignment);
2823 }
2824 totalSize += size;
2825 }
2826 break;
2827 }
2828 case 1:
2829 case 2:
2830 {
2831 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2832
2833 size = 0;
2834 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass, (((void *)0)));
2835 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
2836 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
2837 alignment = member->structAlignment;
2838 if(alignment)
2839 {
2840 if(totalSize % alignment)
2841 totalSize += alignment - (totalSize % alignment);
2842 }
2843 totalSize += size;
2844 break;
2845 }
2846 }
2847 }
2848 }
2849 if(retSize)
2850 {
2851 unsigned int __simpleStruct0;
2852
2853 if(topMember && topMember->type == 1)
2854 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
2855 else
2856 *retSize += totalSize;
2857 }
2858 else if(totalSize < maxSize && _class->type != 1000)
2859 {
2860 int autoPadding = 0;
2861
2862 if(!isMember && _class->structAlignment && totalSize % _class->structAlignment)
2863 autoPadding = _class->structAlignment - (totalSize % _class->structAlignment);
2864 if(totalSize + autoPadding < maxSize)
2865 {
2866 char sizeString[50];
2867
2868 sprintf(sizeString, "%d", maxSize - totalSize);
2869 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
2870 if(addedPadding)
2871 *addedPadding = 0x1;
2872 }
2873 }
2874 if(context)
2875 FinishTemplatesContext(context);
2876 return topMember ? topMember->memberID : _class->memberID;
2877 }
2878
2879 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2880 {
2881 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2882 unsigned int totalSize = 0;
2883 struct __ecereNameSpace__ecere__com__DataMember * member;
2884 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2885
2886 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
2887 DeclareMembers(_class->base, 0x0);
2888 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2889 {
2890 if(!member->isProperty)
2891 {
2892 switch(member->type)
2893 {
2894 case 0:
2895 {
2896 if(!member->dataType && member->dataTypeString)
2897 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
2898 if(member->dataType)
2899 DeclareType(member->dataType, 0x0, 0x0);
2900 break;
2901 }
2902 case 1:
2903 case 2:
2904 {
2905 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
2906 break;
2907 }
2908 }
2909 }
2910 }
2911 if(context)
2912 FinishTemplatesContext(context);
2913 return topMember ? topMember->memberID : _class->memberID;
2914 }
2915
2916 extern struct Symbol * FindClass(char *  name);
2917
2918 extern char *  strchr(const char * , int);
2919
2920 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
2921
2922 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (*  FreeFunction)(void * ));
2923
2924 extern void FreeClassDef(struct ClassDef * def);
2925
2926 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
2927
2928 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
2929
2930 extern char *  strcpy(char * , const char * );
2931
2932 extern void MangleClassName(char *  className);
2933
2934 extern void DeclareClass(struct Symbol * classSym, char *  className);
2935
2936 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
2937
2938 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
2939
2940 void DeclareStruct(char * name, unsigned int skipNoHead)
2941 {
2942 struct External * external = (((void *)0));
2943 struct Symbol * classSym = FindClass(name);
2944
2945 if(!inCompiler || !classSym)
2946 return ;
2947 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
2948 return ;
2949 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
2950 {
2951 struct Declaration * decl;
2952 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2953 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
2954 char structName[1024];
2955
2956 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
2957 classSym->declaring++;
2958 if(strchr(classSym->string, '<'))
2959 {
2960 if(classSym->registered->templateClass)
2961 {
2962 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
2963 classSym->declaring--;
2964 }
2965 return ;
2966 }
2967 DeclareMembers(classSym->registered, 0x0);
2968 structName[0] = (char)0;
2969 FullClassNameCat(structName, name, 0x0);
2970 if(!skipNoHead)
2971 {
2972 unsigned int addedPadding = 0x0;
2973
2974 classSym->declaredStructSym = 0x1;
2975 declarations = MkList();
2976 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered, &addedPadding);
2977 if(!(*declarations).count || ((*declarations).count == 1 && addedPadding))
2978 {
2979 FreeList(declarations, FreeClassDef);
2980 declarations = (((void *)0));
2981 }
2982 }
2983 if(skipNoHead || declarations)
2984 {
2985 if(external && external->declaration)
2986 {
2987 ((struct Specifier *)(*external->declaration->specifiers).first)->definitions = declarations;
2988 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2989 {
2990 if(classSym->structExternal)
2991 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2992 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2993 classSym->id = curExternal->symbol->idCode;
2994 classSym->idCode = curExternal->symbol->idCode;
2995 }
2996 }
2997 else
2998 {
2999 if(!external)
3000 external = MkExternalDeclaration((((void *)0)));
3001 specifiers = MkList();
3002 declarators = MkList();
3003 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
3004 external->declaration = decl = MkDeclaration(specifiers, declarators);
3005 if(decl->symbol && !decl->symbol->pointerExternal)
3006 decl->symbol->pointerExternal = external;
3007 if(classSym->registered && classSym->registered->type == 1)
3008 {
3009 char className[1024];
3010
3011 strcpy(className, "__ecereClass_");
3012 FullClassNameCat(className, classSym->string, 0x1);
3013 MangleClassName(className);
3014 DeclareClass(classSym, className);
3015 external->symbol = classSym;
3016 classSym->pointerExternal = external;
3017 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3018 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3019 }
3020 else
3021 {
3022 char className[1024];
3023
3024 strcpy(className, "__ecereClass_");
3025 FullClassNameCat(className, classSym->string, 0x1);
3026 MangleClassName(className);
3027 classSym->structExternal = external;
3028 DeclareClass(classSym, className);
3029 external->symbol = classSym;
3030 }
3031 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
3032 }
3033 }
3034 classSym->declaring--;
3035 }
3036 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3037 {
3038 classSym->declaring++;
3039 {
3040 if(classSym->registered)
3041 DeclareMembers(classSym->registered, 0x0);
3042 }
3043 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
3044 {
3045 if(classSym->structExternal)
3046 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3047 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3048 classSym->id = curExternal->symbol->idCode;
3049 classSym->idCode = curExternal->symbol->idCode;
3050 }
3051 classSym->declaring--;
3052 }
3053 }
3054
3055 extern char *  strcat(char * , const char * );
3056
3057 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
3058
3059 extern struct ModuleImport * mainModule;
3060
3061 extern struct Specifier * MkSpecifierName(char *  name);
3062
3063 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
3064
3065 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
3066
3067 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
3068
3069 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
3070
3071 extern void FreeDeclarator(struct Declarator * decl);
3072
3073 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
3074
3075 struct PropertyImport
3076 {
3077 struct PropertyImport * prev;
3078 struct PropertyImport * next;
3079 char *  name;
3080 unsigned int isVirtual;
3081 unsigned int hasSet;
3082 unsigned int hasGet;
3083 } __attribute__ ((gcc_struct));
3084
3085 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3086
3087 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
3088 {
3089 struct Symbol * symbol = prop->symbol;
3090 char propName[1024];
3091
3092 strcpy(setName, "__ecereProp_");
3093 FullClassNameCat(setName, prop->_class->fullName, 0x0);
3094 strcat(setName, "_Set_");
3095 FullClassNameCat(setName, prop->name, 0x1);
3096 strcpy(getName, "__ecereProp_");
3097 FullClassNameCat(getName, prop->_class->fullName, 0x0);
3098 strcat(getName, "_Get_");
3099 FullClassNameCat(getName, prop->name, 0x1);
3100 strcpy(propName, "__ecereProp_");
3101 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3102 strcat(propName, "_");
3103 FullClassNameCat(propName, prop->name, 0x1);
3104 MangleClassName(getName);
3105 MangleClassName(setName);
3106 MangleClassName(propName);
3107 if(prop->_class->type == 1)
3108 DeclareStruct(prop->_class->fullName, 0x0);
3109 if(!symbol || curExternal->symbol->idCode < symbol->id)
3110 {
3111 unsigned int imported = 0x0;
3112 unsigned int dllImport = 0x0;
3113
3114 if(!symbol || symbol->_import)
3115 {
3116 if(!symbol)
3117 {
3118 struct Symbol * classSym;
3119
3120 if(!prop->_class->symbol)
3121 prop->_class->symbol = FindClass(prop->_class->fullName);
3122 classSym = prop->_class->symbol;
3123 if(classSym && !classSym->_import)
3124 {
3125 struct ModuleImport * module;
3126
3127 if(prop->_class->module)
3128 module = FindModule(prop->_class->module);
3129 else
3130 module = mainModule;
3131 classSym->_import = __extension__ ({
3132 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
3133
3134 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), __ecereInstance1->isRemote = prop->_class->isRemote, __ecereInstance1;
3135 });
3136 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3137 }
3138 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3139 symbol->_import = (struct ClassImport *)__extension__ ({
3140 struct PropertyImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport);
3141
3142 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), __ecereInstance1->isVirtual = 0x0, __ecereInstance1->hasSet = prop->Set ? 0x1 : 0x0, __ecereInstance1->hasGet = prop->Get ? 0x1 : 0x0, __ecereInstance1;
3143 });
3144 if(classSym)
3145 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
3146 }
3147 imported = 0x1;
3148 if(prop->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + structSize_Instance)))->importType != 1)
3149 dllImport = 0x1;
3150 }
3151 if(!symbol->type)
3152 {
3153 struct Context * context = SetupTemplatesContext(prop->_class);
3154
3155 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
3156 FinishTemplatesContext(context);
3157 }
3158 if(prop->Get)
3159 {
3160 if(!symbol->externalGet || symbol->externalGet->type == 0)
3161 {
3162 struct Declaration * decl;
3163 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3164 struct Declarator * d;
3165 struct __ecereNameSpace__ecere__sys__OldList * params;
3166 struct Specifier * spec;
3167 struct External * external;
3168 struct Declarator * typeDecl;
3169 unsigned int simple = 0x0;
3170
3171 specifiers = MkList();
3172 declarators = MkList();
3173 params = MkList();
3174 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3175 d = MkDeclaratorIdentifier(MkIdentifier(getName));
3176 if(dllImport)
3177 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3178 {
3179 struct Context * context = SetupTemplatesContext(prop->_class);
3180
3181 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
3182 FinishTemplatesContext(context);
3183 }
3184 for(spec = (*specifiers).first; spec; spec = spec->next)
3185 {
3186 if(spec->type == 1)
3187 {
3188 if((!typeDecl || typeDecl->type == 1))
3189 {
3190 struct Symbol * classSym = spec->symbol;
3191
3192 symbol->_class = classSym->registered;
3193 if(classSym->registered && classSym->registered->type == 1)
3194 {
3195 DeclareStruct(spec->name, 0x0);
3196 simple = 0x1;
3197 }
3198 }
3199 }
3200 }
3201 if(!simple)
3202 d = PlugDeclarator(typeDecl, d);
3203 else
3204 {
3205 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3206 specifiers = MkList();
3207 }
3208 d = MkDeclaratorFunction(d, params);
3209 if(dllImport)
3210 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3211 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3212 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3213 if(simple)
3214 ListAdd(specifiers, MkSpecifier(VOID));
3215 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3216 decl = MkDeclaration(specifiers, declarators);
3217 external = MkExternalDeclaration(decl);
3218 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3219 external->symbol = symbol;
3220 symbol->externalGet = external;
3221 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3222 if(typeDecl)
3223 FreeDeclarator(typeDecl);
3224 }
3225 else
3226 {
3227 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3228 }
3229 }
3230 if(prop->Set)
3231 {
3232 if(!symbol->externalSet || symbol->externalSet->type == 0)
3233 {
3234 struct Declaration * decl;
3235 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3236 struct Declarator * d;
3237 struct __ecereNameSpace__ecere__sys__OldList * params;
3238 struct Specifier * spec;
3239 struct External * external;
3240 struct Declarator * typeDecl;
3241
3242 declarators = MkList();
3243 params = MkList();
3244 if(!prop->conversion || prop->_class->type == 1)
3245 {
3246 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3247 }
3248 specifiers = MkList();
3249 {
3250 struct Context * context = SetupTemplatesContext(prop->_class);
3251
3252 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3253 FinishTemplatesContext(context);
3254 }
3255 ListAdd(params, MkTypeName(specifiers, d));
3256 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3257 if(dllImport)
3258 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3259 d = MkDeclaratorFunction(d, params);
3260 for(spec = (*specifiers).first; spec; spec = spec->next)
3261 {
3262 if(spec->type == 1)
3263 {
3264 if((!typeDecl || typeDecl->type == 1))
3265 {
3266 struct Symbol * classSym = spec->symbol;
3267
3268 symbol->_class = classSym->registered;
3269 if(classSym->registered && classSym->registered->type == 1)
3270 DeclareStruct(spec->name, 0x0);
3271 }
3272 }
3273 }
3274 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3275 specifiers = MkList();
3276 if(dllImport)
3277 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3278 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3279 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3280 if(!prop->conversion || prop->_class->type == 1)
3281 ListAdd(specifiers, MkSpecifier(VOID));
3282 else
3283 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3284 decl = MkDeclaration(specifiers, declarators);
3285 external = MkExternalDeclaration(decl);
3286 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3287 external->symbol = symbol;
3288 symbol->externalSet = external;
3289 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3290 }
3291 else
3292 {
3293 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3294 }
3295 }
3296 if(!symbol->externalPtr)
3297 {
3298 struct Declaration * decl;
3299 struct External * external;
3300 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3301
3302 if(imported)
3303 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3304 else
3305 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3306 ListAdd(specifiers, MkSpecifierName("Property"));
3307 {
3308 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3309
3310 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3311 if(!imported)
3312 {
3313 strcpy(propName, "__ecerePropM_");
3314 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3315 strcat(propName, "_");
3316 FullClassNameCat(propName, prop->name, 0x1);
3317 MangleClassName(propName);
3318 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3319 }
3320 decl = MkDeclaration(specifiers, list);
3321 }
3322 external = MkExternalDeclaration(decl);
3323 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3324 external->symbol = symbol;
3325 symbol->externalPtr = external;
3326 }
3327 else
3328 {
3329 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3330 }
3331 symbol->id = curExternal->symbol->idCode;
3332 }
3333 }
3334
3335 struct Type * Dereference(struct Type * source)
3336 {
3337 struct Type * type = (((void *)0));
3338
3339 if(source)
3340 {
3341 if(source->kind == 13 || source->kind == 12)
3342 {
3343 type = source->type;
3344 source->type->refCount++;
3345 }
3346 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3347 {
3348 type = __extension__ ({
3349 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3350
3351 __ecereInstance1->kind = 1, __ecereInstance1->refCount = 1, __ecereInstance1;
3352 });
3353 }
3354 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3355 {
3356 type = source;
3357 source->refCount++;
3358 }
3359 else
3360 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot dereference type\n", (((void *)0))));
3361 }
3362 return type;
3363 }
3364
3365 static struct Type * Reference(struct Type * source)
3366 {
3367 struct Type * type = (((void *)0));
3368
3369 if(source)
3370 {
3371 type = __extension__ ({
3372 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3373
3374 __ecereInstance1->kind = 13, __ecereInstance1->type = source, __ecereInstance1->refCount = 1, __ecereInstance1;
3375 });
3376 source->refCount++;
3377 }
3378 return type;
3379 }
3380
3381 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);
3382
3383 extern void *  memcpy(void * , const void * , size_t size);
3384
3385 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3386
3387 extern void FreeExpression(struct Expression * exp);
3388
3389 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3390
3391 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);
3392
3393 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3394
3395 extern struct Type * MkClassType(char *  name);
3396
3397 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);
3398
3399 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)
3400 {
3401 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3402 unsigned int found = 0x0;
3403 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3404 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3405 unsigned int freeType = 0x0;
3406
3407 yylloc = member->loc;
3408 if(!ident)
3409 {
3410 if(curMember)
3411 {
3412 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3413 if(*curMember)
3414 {
3415 found = 0x1;
3416 dataMember = *curMember;
3417 }
3418 }
3419 }
3420 else
3421 {
3422 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3423 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3424 int _subMemberStackPos = 0;
3425
3426 if(!thisMember)
3427 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3428 if(thisMember)
3429 {
3430 dataMember = thisMember;
3431 if(curMember && thisMember->memberAccess == 1)
3432 {
3433 *curMember = thisMember;
3434 *curClass = thisMember->_class;
3435 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
3436 *subMemberStackPos = _subMemberStackPos;
3437 }
3438 found = 0x1;
3439 }
3440 else
3441 {
3442 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3443 if(method && method->type == 1)
3444 found = 0x1;
3445 else
3446 method = (((void *)0));
3447 }
3448 }
3449 if(found)
3450 {
3451 struct Type * type = (((void *)0));
3452
3453 if(dataMember)
3454 {
3455 if(!dataMember->dataType && dataMember->dataTypeString)
3456 {
3457 struct Context * context = SetupTemplatesContext(_class);
3458
3459 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3460 FinishTemplatesContext(context);
3461 }
3462 type = dataMember->dataType;
3463 }
3464 else if(method)
3465 {
3466 if(!method->dataType)
3467 ProcessMethodType(method);
3468 type = method->dataType;
3469 }
3470 if(ident && ident->next)
3471 {
3472 for(ident = ident->next; ident && type; ident = ident->next)
3473 {
3474 if(type->kind == 8)
3475 {
3476 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3477 if(!dataMember)
3478 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3479 if(dataMember)
3480 type = dataMember->dataType;
3481 }
3482 else if(type->kind == 9 || type->kind == 10)
3483 {
3484 struct Type * memberType;
3485
3486 for(memberType = type->members.first; memberType; memberType = memberType->next)
3487 {
3488 if(!strcmp(memberType->name, ident->string))
3489 {
3490 type = memberType;
3491 break;
3492 }
3493 }
3494 }
3495 }
3496 }
3497 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3498 {
3499 int id = 0;
3500 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3501 struct __ecereNameSpace__ecere__com__Class * sClass;
3502
3503 for(sClass = _class; sClass; sClass = sClass->base)
3504 {
3505 id = 0;
3506 if(sClass->templateClass)
3507 sClass = sClass->templateClass;
3508 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3509 {
3510 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3511 {
3512 for(sClass = sClass->base; sClass; sClass = sClass->base)
3513 {
3514 if(sClass->templateClass)
3515 sClass = sClass->templateClass;
3516 id += sClass->templateParams.count;
3517 }
3518 break;
3519 }
3520 id++;
3521 }
3522 if(curParam)
3523 break;
3524 }
3525 if(curParam)
3526 {
3527 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3528
3529 if(arg.dataTypeString)
3530 {
3531 type = ProcessTypeString(arg.dataTypeString, 0x0);
3532 freeType = 0x1;
3533 if(type && _class->templateClass)
3534 type->passAsTemplate = 0x1;
3535 if(type)
3536 {
3537 }
3538 }
3539 }
3540 }
3541 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3542 {
3543 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3544 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3545 int c;
3546 int paramCount = 0;
3547 int lastParam = -1;
3548 char templateString[1024];
3549 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3550
3551 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3552 for(cClass = expClass; cClass; cClass = cClass->base)
3553 {
3554 int p = 0;
3555
3556 if(cClass->templateClass)
3557 cClass = cClass->templateClass;
3558 for(param = cClass->templateParams.first; param; param = param->next)
3559 {
3560 int id = p;
3561 struct __ecereNameSpace__ecere__com__Class * sClass;
3562 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3563
3564 for(sClass = cClass->base; sClass; sClass = sClass->base)
3565 {
3566 if(sClass->templateClass)
3567 sClass = sClass->templateClass;
3568 id += sClass->templateParams.count;
3569 }
3570 arg = expClass->templateArgs[id];
3571 for(sClass = _class; sClass; sClass = sClass->base)
3572 {
3573 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3574 int p = 0;
3575 struct __ecereNameSpace__ecere__com__Class * nextClass;
3576
3577 if(sClass->templateClass)
3578 sClass = sClass->templateClass;
3579 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3580 {
3581 if(nextClass->templateClass)
3582 nextClass = nextClass->templateClass;
3583 p += nextClass->templateParams.count;
3584 }
3585 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3586 {
3587 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3588 {
3589 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3590 {
3591 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3592 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3593 break;
3594 }
3595 }
3596 }
3597 }
3598 {
3599 char argument[256];
3600
3601 argument[0] = '\0';
3602 switch(param->type)
3603 {
3604 case 2:
3605 {
3606 char expString[1024];
3607 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3608 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3609 struct Expression * exp;
3610 char * string = PrintHexUInt64(arg.expression.ui64);
3611
3612 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3613 ProcessExpressionType(exp);
3614 ComputeExpression(exp);
3615 expString[0] = '\0';
3616 PrintExpression(exp, expString);
3617 strcat(argument, expString);
3618 FreeExpression(exp);
3619 break;
3620 }
3621 case 1:
3622 {
3623 strcat(argument, arg.member->name);
3624 break;
3625 }
3626 case 0:
3627 {
3628 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3629 strcat(argument, arg.dataTypeString);
3630 break;
3631 }
3632 }
3633 if(argument[0])
3634 {
3635 if(paramCount)
3636 strcat(templateString, ", ");
3637 if(lastParam != p - 1)
3638 {
3639 strcat(templateString, param->name);
3640 strcat(templateString, " = ");
3641 }
3642 strcat(templateString, argument);
3643 paramCount++;
3644 lastParam = p;
3645 }
3646 p++;
3647 }
3648 }
3649 }
3650 {
3651 int len = strlen(templateString);
3652
3653 if(templateString[len - 1] == '<')
3654 len--;
3655 else
3656 {
3657 if(templateString[len - 1] == '>')
3658 templateString[len++] = ' ';
3659 templateString[len++] = '>';
3660 }
3661 templateString[len++] = '\0';
3662 }
3663 {
3664 struct Context * context = SetupTemplatesContext(_class);
3665
3666 if(freeType)
3667 FreeType(type);
3668 type = ProcessTypeString(templateString, 0x0);
3669 freeType = 0x1;
3670 FinishTemplatesContext(context);
3671 }
3672 }
3673 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3674 {
3675 ProcessExpressionType(member->initializer->exp);
3676 if(!member->initializer->exp->expType)
3677 {
3678 if(inCompiler)
3679 {
3680 char expString[10240];
3681
3682 expString[0] = '\0';
3683 PrintExpression(member->initializer->exp, expString);
3684 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3685 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3686 }
3687 }
3688 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3689 {
3690 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible instance method %s\n", (((void *)0))), ident->string);
3691 }
3692 }
3693 else if(member->initializer)
3694 {
3695 ProcessInitializer(member->initializer, type);
3696 }
3697 if(freeType)
3698 FreeType(type);
3699 }
3700 else
3701 {
3702 if(_class && _class->type == 3)
3703 {
3704 if(member->initializer)
3705 {
3706 struct Type * type = MkClassType(_class->fullName);
3707
3708 ProcessInitializer(member->initializer, type);
3709 FreeType(type);
3710 }
3711 }
3712 else
3713 {
3714 if(member->initializer)
3715 {
3716 ProcessInitializer(member->initializer, (((void *)0)));
3717 }
3718 if(ident)
3719 {
3720 if(method)
3721 {
3722 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3723 }
3724 else if(_class)
3725 {
3726 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3727 if(inCompiler)
3728 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3729 }
3730 }
3731 else if(_class)
3732 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3733 }
3734 }
3735 }
3736
3737 extern struct Identifier * GetDeclId(struct Declarator * decl);
3738
3739 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);
3740
3741 extern void FreeSpecifier(struct Specifier * spec);
3742
3743 static void ProcessFunction(struct FunctionDefinition * function);
3744
3745 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (*  CopyFunction)(void * ));
3746
3747 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3748
3749 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3750
3751 extern void FreeClassFunction(struct ClassFunction * func);
3752
3753 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3754
3755 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3756
3757 void ProcessInstantiationType(struct Instantiation * inst)
3758 {
3759 yylloc = inst->loc;
3760 if(inst->_class)
3761 {
3762 struct MembersInit * members;
3763 struct Symbol * classSym;
3764 struct __ecereNameSpace__ecere__com__Class * _class;
3765
3766 classSym = inst->_class->symbol;
3767 _class = classSym ? classSym->registered : (((void *)0));
3768 if(!_class || _class->type != 5)
3769 DeclareStruct(inst->_class->name, 0x0);
3770 afterExternal = afterExternal ? afterExternal : curExternal;
3771 if(inst->exp)
3772 ProcessExpressionType(inst->exp);
3773 inst->isConstant = 0x1;
3774 if(inst->members)
3775 {
3776 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3777 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3778 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3779 int subMemberStackPos = 0;
3780
3781 for(members = (*inst->members).first; members; members = members->next)
3782 {
3783 switch(members->type)
3784 {
3785 case 1:
3786 {
3787 char name[1024];
3788 static unsigned int instMethodID = 0;
3789 struct External * external = curExternal;
3790 struct Context * context = curContext;
3791 struct Declarator * declarator = members->function->declarator;
3792 struct Identifier * nameID = GetDeclId(declarator);
3793 char * unmangled = nameID ? nameID->string : (((void *)0));
3794 struct Expression * exp;
3795 struct External * createdExternal = (((void *)0));
3796
3797 if(inCompiler)
3798 {
3799 char number[16];
3800
3801 strcpy(name, "__ecereInstMeth_");
3802 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3803 strcat(name, "_");
3804 strcat(name, nameID->string);
3805 strcat(name, "_");
3806 sprintf(number, "_%08d", instMethodID++);
3807 strcat(name, number);
3808 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3809 }
3810 if(declarator)
3811 {
3812 struct Symbol * symbol = declarator->symbol;
3813 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3814
3815 if(method && method->type == 1)
3816 {
3817 symbol->method = method;
3818 ProcessMethodType(method);
3819 if(!symbol->type->thisClass)
3820 {
3821 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3822 {
3823 if(!currentClass->symbol)
3824 currentClass->symbol = FindClass(currentClass->fullName);
3825 symbol->type->thisClass = currentClass->symbol;
3826 }
3827 else
3828 {
3829 if(!_class->symbol)
3830 _class->symbol = FindClass(_class->fullName);
3831 symbol->type->thisClass = _class->symbol;
3832 }
3833 }
3834 DeclareType(symbol->type, 0x1, 0x1);
3835 }
3836 else if(classSym)
3837 {
3838 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
3839 }
3840 }
3841 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
3842 if(nameID)
3843 {
3844 FreeSpecifier(nameID->_class);
3845 nameID->_class = (((void *)0));
3846 }
3847 if(inCompiler)
3848 {
3849 struct Type * type = declarator->symbol->type;
3850 struct External * oldExternal = curExternal;
3851
3852 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
3853 {
3854 struct External * externalDecl;
3855
3856 externalDecl = MkExternalDeclaration((((void *)0)));
3857 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
3858 if(createdExternal->function)
3859 {
3860 ProcessFunction(createdExternal->function);
3861 {
3862 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
3863
3864 externalDecl->declaration = decl;
3865 if(decl->symbol && !decl->symbol->pointerExternal)
3866 decl->symbol->pointerExternal = externalDecl;
3867 declarator->symbol->pointerExternal = externalDecl;
3868 }
3869 }
3870 }
3871 }
3872 else if(declarator)
3873 {
3874 curExternal = declarator->symbol->pointerExternal;
3875 ProcessFunction((struct FunctionDefinition *)members->function);
3876 }
3877 curExternal = external;
3878 curContext = context;
3879 if(inCompiler)
3880 {
3881 FreeClassFunction(members->function);
3882 exp = QMkExpId(name);
3883 members->type = 0;
3884 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
3885 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
3886 }
3887 break;
3888 }
3889 case 0:
3890 {
3891 if(members->dataMembers && classSym)
3892 {
3893 struct MemberInit * member;
3894 struct Location oldyyloc = yylloc;
3895
3896 for(member = (*members->dataMembers).first; member; member = member->next)
3897 {
3898 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
3899 if(member->initializer && !member->initializer->isConstant)
3900 inst->isConstant = 0x0;
3901 }
3902 yylloc = oldyyloc;
3903 }
3904 break;
3905 }
3906 }
3907 }
3908 }
3909 }
3910 }
3911
3912 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
3913 {
3914 if(inCompiler)
3915 {
3916 if(type->kind == 11)
3917 {
3918 struct Type * param;
3919
3920 if(declareParams)
3921 {
3922 for(param = type->params.first; param; param = param->next)
3923 DeclareType(param, declarePointers, 0x1);
3924 }
3925 DeclareType(type->returnType, declarePointers, 0x1);
3926 }
3927 else if(type->kind == 13 && declarePointers)
3928 DeclareType(type->type, declarePointers, 0x0);
3929 else if(type->kind == 8)
3930 {
3931 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
3932 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
3933 }
3934 else if(type->kind == 9 || type->kind == 10)
3935 {
3936 struct Type * member;
3937
3938 for(member = type->members.first; member; member = member->next)
3939 DeclareType(member, 0x0, 0x0);
3940 }
3941 else if(type->kind == 12)
3942 DeclareType(type->arrayType, declarePointers, 0x0);
3943 }
3944 }
3945
3946 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
3947
3948 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
3949 {
3950 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
3951 int id = 0;
3952 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3953 struct __ecereNameSpace__ecere__com__Class * sClass;
3954
3955 for(sClass = _class; sClass; sClass = sClass->base)
3956 {
3957 id = 0;
3958 if(sClass->templateClass)
3959 sClass = sClass->templateClass;
3960 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3961 {
3962 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
3963 {
3964 for(sClass = sClass->base; sClass; sClass = sClass->base)
3965 {
3966 if(sClass->templateClass)
3967 sClass = sClass->templateClass;
3968 id += sClass->templateParams.count;
3969 }
3970 break;
3971 }
3972 id++;
3973 }
3974 if(curParam)
3975 break;
3976 }
3977 if(curParam)
3978 {
3979 arg = &_class->templateArgs[id];
3980 if(arg && param->type == 0)
3981 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
3982 }
3983 return arg;
3984 }
3985
3986 extern struct Context * PushContext(void);
3987
3988 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
3989
3990 struct TemplatedType
3991 {
3992 uintptr_t key;
3993 struct __ecereNameSpace__ecere__sys__BTNode * parent;
3994 struct __ecereNameSpace__ecere__sys__BTNode * left;
3995 struct __ecereNameSpace__ecere__sys__BTNode * right;
3996 int depth;
3997 struct TemplateParameter * param;
3998 } __attribute__ ((gcc_struct));
3999
4000 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
4001
4002 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
4003 {
4004 struct Context * context = PushContext();
4005
4006 context->templateTypesOnly = 0x1;
4007 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
4008 {
4009 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
4010
4011 for(; param; param = param->next)
4012 {
4013 if(param->type == 0 && param->identifier)
4014 {
4015 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (uintptr_t)param->identifier->string, type->param = param, type);
4016
4017 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4018 }
4019 }
4020 }
4021 else if(_class)
4022 {
4023 struct __ecereNameSpace__ecere__com__Class * sClass;
4024
4025 for(sClass = _class; sClass; sClass = sClass->base)
4026 {
4027 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
4028
4029 for(p = sClass->templateParams.first; p; p = p->next)
4030 {
4031 if(p->type == 0)
4032 {
4033 struct TemplateParameter * param = p->param;
4034 struct TemplatedType * type;
4035
4036 if(!param)
4037 {
4038 p->param = param = __extension__ ({
4039 struct TemplateParameter * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter);
4040
4041 __ecereInstance1->identifier = MkIdentifier(p->name), __ecereInstance1->type = p->type, __ecereInstance1->dataTypeString = p->dataTypeString, __ecereInstance1;
4042 });
4043 }
4044 type = __extension__ ({
4045 struct TemplatedType * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType);
4046
4047 __ecereInstance1->key = (uintptr_t)p->name, __ecereInstance1->param = param, __ecereInstance1;
4048 });
4049 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4050 }
4051 }
4052 }
4053 }
4054 return context;
4055 }
4056
4057 extern void PopContext(struct Context * ctx);
4058
4059 extern void FreeContext(struct Context * context);
4060
4061 void FinishTemplatesContext(struct Context * context)
4062 {
4063 PopContext(context);
4064 FreeContext(context);
4065 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
4066 }
4067
4068 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
4069 {
4070 if(!method->dataType)
4071 {
4072 struct Context * context = SetupTemplatesContext(method->_class);
4073
4074 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4075 FinishTemplatesContext(context);
4076 if(method->type != 1 && method->dataType)
4077 {
4078 if(!method->dataType->thisClass && !method->dataType->staticMethod)
4079 {
4080 if(!method->_class->symbol)
4081 method->_class->symbol = FindClass(method->_class->fullName);
4082 method->dataType->thisClass = method->_class->symbol;
4083 }
4084 }
4085 }
4086 }
4087
4088 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
4089 {
4090 if(!prop->dataType)
4091 {
4092 struct Context * context = SetupTemplatesContext(prop->_class);
4093
4094 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
4095 FinishTemplatesContext(context);
4096 }
4097 }
4098
4099 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
4100
4101 extern void FreeTypeName(struct TypeName * typeName);
4102
4103 static void ProcessDeclarator(struct Declarator * decl);
4104
4105 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
4106
4107 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
4108
4109 struct MethodImport
4110 {
4111 struct MethodImport * prev;
4112 struct MethodImport * next;
4113 char *  name;
4114 unsigned int isVirtual;
4115 } __attribute__ ((gcc_struct));
4116
4117 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
4118
4119 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
4120 {
4121 struct Symbol * symbol = method->symbol;
4122
4123 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
4124 {
4125 unsigned int imported = 0x0;
4126 unsigned int dllImport = 0x0;
4127
4128 if(!method->dataType)
4129 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4130 if(!symbol || symbol->_import || method->type == 1)
4131 {
4132 if(!symbol || method->type == 1)
4133 {
4134 struct Symbol * classSym;
4135
4136 if(!method->_class->symbol)
4137 method->_class->symbol = FindClass(method->_class->fullName);
4138 classSym = method->_class->symbol;
4139 if(!classSym->_import)
4140 {
4141 struct ModuleImport * module;
4142
4143 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->name)
4144 module = FindModule(method->_class->module);
4145 else
4146 module = mainModule;
4147 classSym->_import = __extension__ ({
4148 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
4149
4150 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), __ecereInstance1->isRemote = method->_class->isRemote, __ecereInstance1;
4151 });
4152 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
4153 }
4154 if(!symbol)
4155 {
4156 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4157 }
4158 if(!symbol->_import)
4159 {
4160 symbol->_import = (struct ClassImport *)__extension__ ({
4161 struct MethodImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport);
4162
4163 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->name), __ecereInstance1->isVirtual = method->type == 1, __ecereInstance1;
4164 });
4165 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
4166 }
4167 if(!symbol)
4168 {
4169 symbol->type = method->dataType;
4170 if(symbol->type)
4171 symbol->type->refCount++;
4172 }
4173 }
4174 if(!method->dataType->dllExport)
4175 {
4176 imported = 0x1;
4177 if(method->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->importType != 1)
4178 dllImport = 0x1;
4179 }
4180 }
4181 if(method->type != 1 && method->dataType)
4182 DeclareType(method->dataType, 0x1, 0x1);
4183 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4184 {
4185 struct Declaration * decl;
4186 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4187 struct Declarator * d;
4188 struct Declarator * funcDecl;
4189 struct External * external;
4190
4191 specifiers = MkList();
4192 declarators = MkList();
4193 if(dllImport)
4194 ListAdd(specifiers, MkSpecifier(EXTERN));
4195 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
4196 ListAdd(specifiers, MkSpecifier(STATIC));
4197 if(method->type == 1)
4198 {
4199 ListAdd(specifiers, MkSpecifier(INT));
4200 d = MkDeclaratorIdentifier(MkIdentifier(name));
4201 }
4202 else
4203 {
4204 d = MkDeclaratorIdentifier(MkIdentifier(name));
4205 if(dllImport)
4206 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4207 {
4208 struct Context * context = SetupTemplatesContext(method->_class);
4209
4210 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
4211 FinishTemplatesContext(context);
4212 }
4213 funcDecl = GetFuncDecl(d);
4214 if(dllImport)
4215 {
4216 struct Specifier * spec, * next;
4217
4218 for(spec = (*specifiers).first; spec; spec = next)
4219 {
4220 next = spec->next;
4221 if(spec->type == 5)
4222 {
4223 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4224 FreeSpecifier(spec);
4225 }
4226 }
4227 }
4228 if(method->dataType && !method->dataType->staticMethod)
4229 {
4230 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4231 {
4232 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4233 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")));
4234 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4235 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4236
4237 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4238 {
4239 struct TypeName * param = (*funcDecl->function.parameters).first;
4240
4241 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4242 FreeTypeName(param);
4243 }
4244 if(!funcDecl->function.parameters)
4245 funcDecl->function.parameters = MkList();
4246 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4247 }
4248 }
4249 }
4250 ProcessDeclarator(d);
4251 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4252 decl = MkDeclaration(specifiers, declarators);
4253 ReplaceThisClassSpecifiers(specifiers, method->_class);
4254 if(symbol->pointerExternal)
4255 {
4256 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4257
4258 {
4259 *functionSymbol = *symbol;
4260 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4261 if(functionSymbol->type)
4262 functionSymbol->type->refCount++;
4263 }
4264 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4265 symbol->pointerExternal->symbol = functionSymbol;
4266 }
4267 external = MkExternalDeclaration(decl);
4268 if(curExternal)
4269 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4270 external->symbol = symbol;
4271 symbol->pointerExternal = external;
4272 }
4273 else if(ast)
4274 {
4275 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4276 }
4277 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4278 }
4279 }
4280
4281 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4282 {
4283 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4284 {
4285 unsigned int first = 0x1;
4286 int p = 0;
4287 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4288 int lastParam = -1;
4289 char className[1024];
4290
4291 strcpy(className, _class->fullName);
4292 for(param = _class->templateParams.first; param; param = param->next)
4293 {
4294 {
4295 if(first)
4296 strcat(className, "<");
4297 if(!first)
4298 strcat(className, ", ");
4299 if(lastParam + 1 != p)
4300 {
4301 strcat(className, param->name);
4302 strcat(className, " = ");
4303 }
4304 strcat(className, param->name);
4305 first = 0x0;
4306 lastParam = p;
4307 }
4308 p++;
4309 }
4310 if(!first)
4311 {
4312 int len = strlen(className);
4313
4314 if(className[len - 1] == '>')
4315 className[len++] = ' ';
4316 className[len++] = '>';
4317 className[len++] = '\0';
4318 }
4319 return __ecereNameSpace__ecere__sys__CopyString(className);
4320 }
4321 else
4322 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4323 }
4324
4325 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4326 {
4327 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4328 {
4329 unsigned int first = 0x1;
4330 int p = 0;
4331 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4332 int lastParam = -1;
4333 char className[1024];
4334
4335 strcpy(className, _class->fullName);
4336 for(param = _class->templateParams.first; param; param = param->next)
4337 {
4338 {
4339 if(first)
4340 strcat(className, "<");
4341 if(!first)
4342 strcat(className, ", ");
4343 if(lastParam + 1 != p)
4344 {
4345 strcat(className, param->name);
4346 strcat(className, " = ");
4347 }
4348 strcat(className, param->name);
4349 first = 0x0;
4350 lastParam = p;
4351 }
4352 p++;
4353 }
4354 if(!first)
4355 {
4356 int len = strlen(className);
4357
4358 if(className[len - 1] == '>')
4359 className[len++] = ' ';
4360 className[len++] = '>';
4361 className[len++] = '\0';
4362 }
4363 return MkClassType(className);
4364 }
4365 else
4366 {
4367 return MkClassType(_class->fullName);
4368 }
4369 }
4370
4371 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4372 {
4373 if(specs != (((void *)0)) && _class)
4374 {
4375 struct Specifier * spec;
4376
4377 for(spec = specs->first; spec; spec = spec->next)
4378 {
4379 if(spec->type == 0 && spec->specifier == THISCLASS)
4380 {
4381 spec->type = 1;
4382 spec->name = ReplaceThisClass(_class);
4383 spec->symbol = FindClass(spec->name);
4384 }
4385 }
4386 }
4387 }
4388
4389 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4390
4391 struct __ecereNameSpace__ecere__com__GlobalFunction
4392 {
4393 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4394 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4395 char *  name;
4396 int (*  function)();
4397 struct __ecereNameSpace__ecere__com__Instance * module;
4398 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4399 char *  dataTypeString;
4400 struct Type * dataType;
4401 void *  symbol;
4402 } __attribute__ ((gcc_struct));
4403
4404 extern struct Context * globalContext;
4405
4406 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4407
4408 struct FunctionImport
4409 {
4410 struct FunctionImport * prev;
4411 struct FunctionImport * next;
4412 char *  name;
4413 } __attribute__ ((gcc_struct));
4414
4415 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4416 {
4417 struct Symbol * symbol = function->symbol;
4418
4419 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4420 {
4421 unsigned int imported = 0x0;
4422 unsigned int dllImport = 0x0;
4423
4424 if(!function->dataType)
4425 {
4426 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4427 if(!function->dataType->thisClass)
4428 function->dataType->staticMethod = 0x1;
4429 }
4430 if(inCompiler)
4431 {
4432 if(!symbol)
4433 {
4434 struct ModuleImport * module = FindModule(function->module);
4435
4436 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4437 if(module->name)
4438 {
4439 if(!function->dataType->dllExport)
4440 {
4441 symbol->_import = (struct ClassImport *)__extension__ ({
4442 struct FunctionImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport);
4443
4444 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(function->name), __ecereInstance1;
4445 });
4446 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4447 }
4448 }
4449 {
4450 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4451 if(!symbol->type->thisClass)
4452 symbol->type->staticMethod = 0x1;
4453 }
4454 }
4455 imported = symbol->_import ? 0x1 : 0x0;
4456 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1)
4457 dllImport = 0x1;
4458 }
4459 DeclareType(function->dataType, 0x1, 0x1);
4460 if(inCompiler)
4461 {
4462 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4463 {
4464 struct Declaration * decl;
4465 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4466 struct Declarator * d;
4467 struct Declarator * funcDecl;
4468 struct External * external;
4469
4470 specifiers = MkList();
4471 declarators = MkList();
4472 ListAdd(specifiers, MkSpecifier(EXTERN));
4473 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4474 if(dllImport)
4475 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4476 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4477 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType == 1)
4478 {
4479 struct Specifier * spec;
4480
4481 for(spec = (*specifiers).first; spec; spec = spec->next)
4482 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4483 {
4484 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4485 FreeSpecifier(spec);
4486 break;
4487 }
4488 }
4489 funcDecl = GetFuncDecl(d);
4490 if(funcDecl && !funcDecl->function.parameters)
4491 {
4492 funcDecl->function.parameters = MkList();
4493 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4494 }
4495 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4496 {
4497 struct Context * oldCtx = curContext;
4498
4499 curContext = globalContext;
4500 decl = MkDeclaration(specifiers, declarators);
4501 curContext = oldCtx;
4502 }
4503 if(symbol->pointerExternal)
4504 {
4505 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4506
4507 {
4508 *functionSymbol = *symbol;
4509 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4510 if(functionSymbol->type)
4511 functionSymbol->type->refCount++;
4512 }
4513 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4514 symbol->pointerExternal->symbol = functionSymbol;
4515 }
4516 external = MkExternalDeclaration(decl);
4517 if(curExternal)
4518 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4519 external->symbol = symbol;
4520 symbol->pointerExternal = external;
4521 }
4522 else
4523 {
4524 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4525 }
4526 if(curExternal)
4527 symbol->id = curExternal->symbol->idCode;
4528 }
4529 }
4530 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1) ? 0x1 : 0x0;
4531 }
4532
4533 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4534
4535 struct GlobalData
4536 {
4537 uintptr_t key;
4538 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4539 struct __ecereNameSpace__ecere__sys__BTNode * left;
4540 struct __ecereNameSpace__ecere__sys__BTNode * right;
4541 int depth;
4542 struct __ecereNameSpace__ecere__com__Instance * module;
4543 char *  dataTypeString;
4544 struct Type * dataType;
4545 void *  symbol;
4546 char *  fullName;
4547 } __attribute__ ((gcc_struct));
4548
4549 void DeclareGlobalData(struct GlobalData * data)
4550 {
4551 struct Symbol * symbol = data->symbol;
4552
4553 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4554 {
4555 if(inCompiler)
4556 {
4557 if(!symbol)
4558 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4559 }
4560 if(!data->dataType)
4561 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4562 DeclareType(data->dataType, 0x1, 0x1);
4563 if(inCompiler)
4564 {
4565 if(!symbol->pointerExternal)
4566 {
4567 struct Declaration * decl;
4568 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4569 struct Declarator * d;
4570 struct External * external;
4571
4572 specifiers = MkList();
4573 declarators = MkList();
4574 ListAdd(specifiers, MkSpecifier(EXTERN));
4575 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4576 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4577 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4578 decl = MkDeclaration(specifiers, declarators);
4579 external = MkExternalDeclaration(decl);
4580 if(curExternal)
4581 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4582 external->symbol = symbol;
4583 symbol->pointerExternal = external;
4584 }
4585 else
4586 {
4587 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4588 }
4589 if(curExternal)
4590 symbol->id = curExternal->symbol->idCode;
4591 }
4592 }
4593 }
4594
4595 struct Conversion
4596 {
4597 struct Conversion * prev, * next;
4598 struct __ecereNameSpace__ecere__com__Property * convert;
4599 unsigned int isGet;
4600 struct Type * resultType;
4601 } __attribute__ ((gcc_struct));
4602
4603 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4604
4605 extern void Compiler_Warning(char *  format, ...);
4606
4607 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4608
4609 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)
4610 {
4611 if(source && dest)
4612 {
4613 if(source->kind == 20 && dest->kind != 20)
4614 {
4615 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4616
4617 if(type)
4618 source = type;
4619 }
4620 if(dest->kind == 20 && source->kind != 20)
4621 {
4622 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4623
4624 if(type)
4625 dest = type;
4626 }
4627 if(dest->classObjectType == 2)
4628 {
4629 if(source->classObjectType != 3)
4630 return 0x1;
4631 else
4632 {
4633 if((dest->_class && strcmp(dest->_class->string, "class")) || (source->_class && strcmp(source->_class->string, "class")))
4634 {
4635 return 0x1;
4636 }
4637 }
4638 }
4639 else
4640 {
4641 if(source->classObjectType == 3)
4642 return 0x1;
4643 if(dest->classObjectType == 3 && source->classObjectType != 2)
4644 return 0x1;
4645 }
4646 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4647 {
4648 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4649 return 0x1;
4650 }
4651 if(dest->kind == 14 && source->kind != 0)
4652 return 0x1;
4653 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))
4654 return 0x1;
4655 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))
4656 return 0x1;
4657 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4658 {
4659 if(source->_class->registered && source->_class->registered->type == 3)
4660 {
4661 if(conversions != (((void *)0)))
4662 {
4663 if(source->_class->registered == dest->_class->registered)
4664 return 0x1;
4665 }
4666 else
4667 {
4668 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4669
4670 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4671 ;
4672 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4673 ;
4674 if(sourceBase == destBase)
4675 return 0x1;
4676 }
4677 }
4678 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))
4679 return 0x1;
4680 else
4681 {
4682 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4 && source->_class && source->_class->registered && source->_class->registered->type != 4)
4683 {
4684 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4685 {
4686 return 0x1;
4687 }
4688 }
4689 }
4690 }
4691 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4692 return 0x1;
4693 if(doConversion)
4694 {
4695 if(source->kind == 8)
4696 {
4697 struct __ecereNameSpace__ecere__com__Class * _class;
4698
4699 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4700 {
4701 struct __ecereNameSpace__ecere__com__Property * convert;
4702
4703 for(convert = _class->conversions.first; convert; convert = convert->next)
4704 {
4705 if(convert->memberAccess == 1 || _class->module == privateModule)
4706 {
4707 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4708
4709 if(!convert->dataType)
4710 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4711 if(MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x0, 0x1, 0x0, 0x1))
4712 {
4713 if(!conversions && !convert->Get)
4714 return 0x1;
4715 else if(conversions != (((void *)0)))
4716 {
4717 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))
4718 return 0x1;
4719 else
4720 {
4721 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4722
4723 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4724 return 0x1;
4725 }
4726 }
4727 }
4728 }
4729 }
4730 }
4731 }
4732 if(dest->kind == 8)
4733 {
4734 struct __ecereNameSpace__ecere__com__Class * _class;
4735
4736 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4737 {
4738 struct __ecereNameSpace__ecere__com__Property * convert;
4739
4740 for(convert = _class->conversions.first; convert; convert = convert->next)
4741 {
4742 if(convert->memberAccess == 1 || _class->module == privateModule)
4743 {
4744 if(!convert->dataType)
4745 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4746 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4747 {
4748 if(!conversions && !convert->Set)
4749 return 0x1;
4750 else if(conversions != (((void *)0)))
4751 {
4752 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))
4753 return 0x1;
4754 else
4755 {
4756 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4757
4758 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4759 return 0x1;
4760 }
4761 }
4762 }
4763 }
4764 }
4765 }
4766 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4767 {
4768 if(!dest->_class->registered->dataType)
4769 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4770 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4771 {
4772 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4773 {
4774 return 0x1;
4775 }
4776 }
4777 }
4778 }
4779 if(source->kind == 8)
4780 {
4781 struct __ecereNameSpace__ecere__com__Class * _class;
4782
4783 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4784 {
4785 struct __ecereNameSpace__ecere__com__Property * convert;
4786
4787 for(convert = _class->conversions.first; convert; convert = convert->next)
4788 {
4789 if(convert->memberAccess == 1 || _class->module == privateModule)
4790 {
4791 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4792
4793 if(!convert->dataType)
4794 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4795 if(convert->dataType != source && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x1))
4796 {
4797 if(!conversions && !convert->Get)
4798 return 0x1;
4799 else if(conversions != (((void *)0)))
4800 {
4801 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))
4802 return 0x1;
4803 else
4804 {
4805 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4806
4807 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4808 return 0x1;
4809 }
4810 }
4811 }
4812 }
4813 }
4814 }
4815 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4816 {
4817 if(!source->_class->registered->dataType)
4818 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4819 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4820 {
4821 return 0x1;
4822 }
4823 }
4824 }
4825 }
4826 if(source->kind == 8 || source->kind == 19)
4827 ;
4828 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
4829 return 0x1;
4830 else if(dest->kind == 7 && source->kind == 6)
4831 return 0x1;
4832 else if(dest->kind == 2 && source->kind == 1)
4833 return 0x1;
4834 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1 || source->kind == 23))
4835 return 0x1;
4836 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 22 || source->kind == 23))
4837 return 0x1;
4838 else if(dest->kind == 22 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 23 || source->kind == 4))
4839 return 0x1;
4840 else if(dest->kind == 23 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4 || source->kind == 22))
4841 return 0x1;
4842 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))
4843 return 0x1;
4844 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))
4845 return 0x1;
4846 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)))
4847 {
4848 struct Type * paramSource, * paramDest;
4849
4850 if(dest->kind == 16)
4851 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
4852 if(source->kind == 16)
4853 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
4854 if(dest->kind == 13 && dest->type->kind == 11)
4855 dest = dest->type;
4856 if(source->kind == 13 && source->type->kind == 11)
4857 source = source->type;
4858 if(dest->kind == 16)
4859 dest = dest->method->dataType;
4860 if(source->kind == 16)
4861 source = source->method->dataType;
4862 paramSource = source->params.first;
4863 if(paramSource && paramSource->kind == 0)
4864 paramSource = (((void *)0));
4865 paramDest = dest->params.first;
4866 if(paramDest && paramDest->kind == 0)
4867 paramDest = (((void *)0));
4868 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
4869 {
4870 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))))
4871 {
4872 if(paramDest && paramDest->kind == 8)
4873 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
4874 else
4875 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class should not take an object\n", (((void *)0))));
4876 return 0x0;
4877 }
4878 paramDest = paramDest->next;
4879 }
4880 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
4881 {
4882 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
4883 {
4884 if(dest->thisClass)
4885 {
4886 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
4887 {
4888 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4889 return 0x0;
4890 }
4891 }
4892 else
4893 {
4894 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
4895 {
4896 if(owningClassDest)
4897 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
4898 else
4899 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "overriding class expected to be derived from method class\n", (((void *)0))));
4900 return 0x0;
4901 }
4902 }
4903 paramSource = paramSource->next;
4904 }
4905 else
4906 {
4907 if(dest->thisClass)
4908 {
4909 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
4910 {
4911 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4912 return 0x0;
4913 }
4914 }
4915 else
4916 {
4917 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
4918 {
4919 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
4920 return 0x0;
4921 }
4922 }
4923 }
4924 }
4925 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4926 {
4927 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible return type for function\n", (((void *)0))));
4928 return 0x0;
4929 }
4930 for(; paramDest; paramDest = paramDest->next)
4931 {
4932 if(!paramSource)
4933 {
4934 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough parameters\n", (((void *)0))));
4935 return 0x0;
4936 }
4937 {
4938 struct Type * paramDestType = paramDest;
4939 struct Type * paramSourceType = paramSource;
4940 struct Type * type = paramDestType;
4941
4942 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
4943 {
4944 int id = 0;
4945 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4946 struct __ecereNameSpace__ecere__com__Class * sClass;
4947
4948 for(sClass = owningClassSource; sClass; sClass = sClass->base)
4949 {
4950 id = 0;
4951 if(sClass->templateClass)
4952 sClass = sClass->templateClass;
4953 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4954 {
4955 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
4956 {
4957 for(sClass = sClass->base; sClass; sClass = sClass->base)
4958 {
4959 if(sClass->templateClass)
4960 sClass = sClass->templateClass;
4961 id += sClass->templateParams.count;
4962 }
4963 break;
4964 }
4965 id++;
4966 }
4967 if(curParam)
4968 break;
4969 }
4970 if(curParam)
4971 {
4972 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
4973
4974 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
4975 }
4976 }
4977 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)))
4978 {
4979 char type[1024];
4980
4981 type[0] = (char)0;
4982 PrintType(paramDest, type, 0x0, 0x1);
4983 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
4984 if(paramDestType != paramDest)
4985 FreeType(paramDestType);
4986 return 0x0;
4987 }
4988 if(paramDestType != paramDest)
4989 FreeType(paramDestType);
4990 }
4991 paramSource = paramSource->next;
4992 }
4993 if(paramSource)
4994 {
4995 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many parameters\n", (((void *)0))));
4996 return 0x0;
4997 }
4998 return 0x1;
4999 }
5000 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
5001 {
5002 return 0x1;
5003 }
5004 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
5005 {
5006 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5007 return 0x1;
5008 }
5009 }
5010 return 0x0;
5011 }
5012
5013 static void FreeConvert(struct Conversion * convert)
5014 {
5015 if(convert->resultType)
5016 FreeType(convert->resultType);
5017 }
5018
5019 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
5020
5021 struct __ecereNameSpace__ecere__com__BTNamedLink
5022 {
5023 char *  name;
5024 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
5025 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
5026 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
5027 int depth;
5028 void *  data;
5029 } __attribute__ ((gcc_struct));
5030
5031 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
5032
5033 struct __ecereNameSpace__ecere__com__EnumClassData
5034 {
5035 struct __ecereNameSpace__ecere__sys__OldList values;
5036 int largest;
5037 } __attribute__ ((gcc_struct));
5038
5039 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
5040
5041 struct __ecereNameSpace__ecere__sys__NamedLink
5042 {
5043 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
5044 struct __ecereNameSpace__ecere__sys__NamedLink * next;
5045 char *  name;
5046 void *  data;
5047 } __attribute__ ((gcc_struct));
5048
5049 extern void FreeExpContents(struct Expression * exp);
5050
5051 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
5052
5053 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
5054
5055 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
5056
5057 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
5058
5059 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
5060
5061 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5062 {
5063 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
5064
5065 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)))
5066 {
5067 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
5068
5069 if(_class->type == 4)
5070 {
5071 struct __ecereNameSpace__ecere__sys__OldList converts = 
5072 {
5073 0, 0, 0, 0, 0
5074 };
5075 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5076
5077 type->kind = 8;
5078 if(!_class->symbol)
5079 _class->symbol = FindClass(_class->fullName);
5080 type->_class = _class->symbol;
5081 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
5082 {
5083 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5084 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5085
5086 if(enumClass)
5087 {
5088 struct __ecereNameSpace__ecere__com__Class * baseClass;
5089
5090 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
5091 {
5092 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
5093
5094 for(value = e->values.first; value; value = value->next)
5095 {
5096 if(!strcmp(value->name, string))
5097 break;
5098 }
5099 if(value)
5100 {
5101 FreeExpContents(sourceExp);
5102 FreeType(sourceExp->expType);
5103 sourceExp->isConstant = 0x1;
5104 sourceExp->expType = MkClassType(baseClass->fullName);
5105 {
5106 char constant[256];
5107
5108 sourceExp->type = 2;
5109 if(!strcmp(baseClass->dataTypeString, "int"))
5110 sprintf(constant, "%d", (int)value->data);
5111 else
5112 sprintf(constant, "0x%X", (int)value->data);
5113 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5114 }
5115 while(converts.first)
5116 {
5117 struct Conversion * convert = converts.first;
5118
5119 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
5120 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
5121 }
5122 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5123 return 0x1;
5124 }
5125 }
5126 }
5127 }
5128 if(converts.first)
5129 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
5130 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5131 }
5132 }
5133 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)))
5134 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
5135 return 0x1;
5136 return 0x0;
5137 }
5138
5139 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
5140
5141 struct __ecereNameSpace__ecere__com__SubModule
5142 {
5143 struct __ecereNameSpace__ecere__com__SubModule * prev;
5144 struct __ecereNameSpace__ecere__com__SubModule * next;
5145 struct __ecereNameSpace__ecere__com__Instance * module;
5146 int importMode;
5147 } __attribute__ ((gcc_struct));
5148
5149 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
5150 {
5151 struct __ecereNameSpace__ecere__com__SubModule * subModule;
5152
5153 if(searchFor == searchIn)
5154 return 0x1;
5155 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
5156 {
5157 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->application)
5158 {
5159 if(ModuleVisibility(subModule->module, searchFor))
5160 return 0x1;
5161 }
5162 }
5163 return 0x0;
5164 }
5165
5166 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
5167
5168 struct __ecereNameSpace__ecere__com__Application
5169 {
5170 int argc;
5171 char * *  argv;
5172 int exitCode;
5173 unsigned int isGUIApp;
5174 struct __ecereNameSpace__ecere__sys__OldList allModules;
5175 char *  parsedCommand;
5176 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
5177 } __attribute__ ((gcc_struct));
5178
5179 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5180 {
5181 struct __ecereNameSpace__ecere__com__Instance * module;
5182
5183 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))
5184 return 0x1;
5185 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))
5186 return 0x1;
5187 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))
5188 return 0x1;
5189 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)
5190 {
5191 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5192 return 0x1;
5193 }
5194 return 0x0;
5195 }
5196
5197 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
5198
5199 void ReadString(char *  output, char *  string);
5200
5201 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
5202
5203 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
5204
5205 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
5206
5207 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
5208 {
5209 struct Type * source = sourceExp->expType;
5210 struct Type * realDest = dest;
5211 struct Type * backupSourceExpType = (((void *)0));
5212
5213 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5214 return 0x1;
5215 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5216 {
5217 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5218 {
5219 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5220
5221 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5222 ;
5223 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5224 ;
5225 if(sourceBase == destBase)
5226 return 0x1;
5227 }
5228 }
5229 if(source)
5230 {
5231 struct __ecereNameSpace__ecere__sys__OldList * specs;
5232 unsigned int flag = 0x0;
5233 long long value = (((int)0x7fffffff));
5234
5235 source->refCount++;
5236 dest->refCount++;
5237 if(sourceExp->type == 2)
5238 {
5239 if(source->isSigned)
5240 value = strtoll(sourceExp->constant, (((void *)0)), 0);
5241 else
5242 value = strtoull(sourceExp->constant, (((void *)0)), 0);
5243 }
5244 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
5245 {
5246 if(source->isSigned)
5247 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
5248 else
5249 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
5250 }
5251 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5252 {
5253 FreeType(source);
5254 source = __extension__ ({
5255 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5256
5257 __ecereInstance1->kind = 3, __ecereInstance1->isSigned = 0x0, __ecereInstance1->refCount = 1, __ecereInstance1;
5258 });
5259 }
5260 if(dest->kind == 8)
5261 {
5262 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5263
5264 if(_class && _class->type == 3)
5265 {
5266 if(source->kind != 8)
5267 {
5268 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5269 struct Type * tempDest, * tempSource;
5270
5271 for(; _class->base->type != 1000; _class = _class->base)
5272 ;
5273 tempSource = dest;
5274 tempDest = tempType;
5275 tempType->kind = 8;
5276 if(!_class->symbol)
5277 _class->symbol = FindClass(_class->fullName);
5278 tempType->_class = _class->symbol;
5279 tempType->truth = dest->truth;
5280 if(tempType->_class)
5281 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5282 backupSourceExpType = sourceExp->expType;
5283 sourceExp->expType = dest;
5284 dest->refCount++;
5285 flag = 0x1;
5286 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5287 }
5288 }
5289 if(_class && _class->type == 2 && source->kind != 8)
5290 {
5291 if(!dest->_class->registered->dataType)
5292 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5293 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5294 {
5295 FreeType(source);
5296 FreeType(sourceExp->expType);
5297 source = sourceExp->expType = MkClassType(dest->_class->string);
5298 source->refCount++;
5299 }
5300 }
5301 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5302 {
5303 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5304 struct Declarator * decl;
5305 char string[1024];
5306
5307 ReadString(string, sourceExp->string);
5308 decl = SpecDeclFromString(string, specs, (((void *)0)));
5309 FreeExpContents(sourceExp);
5310 FreeType(sourceExp->expType);
5311 sourceExp->type = 26;
5312 sourceExp->_classExp.specifiers = specs;
5313 sourceExp->_classExp.decl = decl;
5314 sourceExp->expType = dest;
5315 dest->refCount++;
5316 FreeType(source);
5317 FreeType(dest);
5318 if(backupSourceExpType)
5319 FreeType(backupSourceExpType);
5320 return 0x1;
5321 }
5322 }
5323 else if(source->kind == 8)
5324 {
5325 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5326
5327 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5328 {
5329 if(dest->kind != 8)
5330 {
5331 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5332 struct Type * tempDest, * tempSource;
5333
5334 if(!source->_class->registered->dataType)
5335 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5336 for(; _class->base->type != 1000; _class = _class->base)
5337 ;
5338 tempDest = source;
5339 tempSource = tempType;
5340 tempType->kind = 8;
5341 tempType->_class = FindClass(_class->fullName);
5342 tempType->truth = source->truth;
5343 tempType->classObjectType = source->classObjectType;
5344 if(tempType->_class)
5345 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5346 if(conversions->last)
5347 {
5348 ((struct Conversion *)conversions->last)->resultType = dest;
5349 dest->refCount++;
5350 }
5351 FreeType(sourceExp->expType);
5352 sourceExp->expType = MkClassType(_class->fullName);
5353 sourceExp->expType->truth = source->truth;
5354 sourceExp->expType->classObjectType = source->classObjectType;
5355 if(!sourceExp->destType)
5356 {
5357 FreeType(sourceExp->destType);
5358 sourceExp->destType = sourceExp->expType;
5359 if(sourceExp->expType)
5360 sourceExp->expType->refCount++;
5361 }
5362 if(!_class->dataType)
5363 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5364 FreeType(dest);
5365 dest = MkClassType(source->_class->string);
5366 dest->truth = source->truth;
5367 dest->classObjectType = source->classObjectType;
5368 FreeType(source);
5369 source = _class->dataType;
5370 source->refCount++;
5371 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5372 }
5373 }
5374 }
5375 if(!flag)
5376 {
5377 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5378 {
5379 FreeType(source);
5380 FreeType(dest);
5381 return 0x1;
5382 }
5383 }
5384 if(dest->kind == 8)
5385 {
5386 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5387
5388 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5389 {
5390 if(_class->type == 0 || _class->type == 5)
5391 {
5392 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5393
5394 *newExp = *sourceExp;
5395 if(sourceExp->destType)
5396 sourceExp->destType->refCount++;
5397 if(sourceExp->expType)
5398 sourceExp->expType->refCount++;
5399 sourceExp->type = 11;
5400 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5401 sourceExp->cast.exp = newExp;
5402 FreeType(sourceExp->expType);
5403 sourceExp->expType = (((void *)0));
5404 ProcessExpressionType(sourceExp);
5405 if(!inCompiler)
5406 {
5407 FreeType(sourceExp->expType);
5408 sourceExp->expType = dest;
5409 }
5410 FreeType(source);
5411 if(inCompiler)
5412 FreeType(dest);
5413 if(backupSourceExpType)
5414 FreeType(backupSourceExpType);
5415 return 0x1;
5416 }
5417 if(!_class->dataType)
5418 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5419 FreeType(dest);
5420 dest = _class->dataType;
5421 dest->refCount++;
5422 }
5423 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5424 {
5425 specs = MkListOne(MkSpecifier(DOUBLE));
5426 }
5427 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 7))
5428 {
5429 specs = MkListOne(MkSpecifier(FLOAT));
5430 }
5431 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5432 {
5433 specs = MkList();
5434 if(!dest->isSigned)
5435 ListAdd(specs, MkSpecifier(UNSIGNED));
5436 ListAdd(specs, MkSpecifier(INT64));
5437 }
5438 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5439 {
5440 specs = MkList();
5441 if(!dest->isSigned)
5442 ListAdd(specs, MkSpecifier(UNSIGNED));
5443 ListAdd(specs, MkSpecifier(INT));
5444 }
5445 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5446 {
5447 specs = MkList();
5448 if(!dest->isSigned)
5449 ListAdd(specs, MkSpecifier(UNSIGNED));
5450 ListAdd(specs, MkSpecifier(SHORT));
5451 }
5452 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5453 {
5454 specs = MkList();
5455 if(!dest->isSigned)
5456 ListAdd(specs, MkSpecifier(UNSIGNED));
5457 ListAdd(specs, MkSpecifier(CHAR));
5458 }
5459 else
5460 {
5461 FreeType(source);
5462 FreeType(dest);
5463 if(backupSourceExpType)
5464 {
5465 if(sourceExp->expType)
5466 FreeType(sourceExp->expType);
5467 sourceExp->expType = backupSourceExpType;
5468 }
5469 return 0x0;
5470 }
5471 }
5472 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))
5473 {
5474 specs = MkListOne(MkSpecifier(DOUBLE));
5475 }
5476 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5477 {
5478 specs = MkListOne(MkSpecifier(FLOAT));
5479 }
5480 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)))
5481 {
5482 specs = MkList();
5483 if(!dest->isSigned)
5484 ListAdd(specs, MkSpecifier(UNSIGNED));
5485 ListAdd(specs, MkSpecifier(CHAR));
5486 }
5487 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)))))
5488 {
5489 specs = MkList();
5490 if(!dest->isSigned)
5491 ListAdd(specs, MkSpecifier(UNSIGNED));
5492 ListAdd(specs, MkSpecifier(SHORT));
5493 }
5494 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3))
5495 {
5496 specs = MkList();
5497 if(!dest->isSigned)
5498 ListAdd(specs, MkSpecifier(UNSIGNED));
5499 ListAdd(specs, MkSpecifier(INT));
5500 }
5501 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5502 {
5503 specs = MkList();
5504 if(!dest->isSigned)
5505 ListAdd(specs, MkSpecifier(UNSIGNED));
5506 ListAdd(specs, MkSpecifier(INT64));
5507 }
5508 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5509 {
5510 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5511 }
5512 else
5513 {
5514 FreeType(source);
5515 FreeType(dest);
5516 if(backupSourceExpType)
5517 {
5518 if(sourceExp->expType)
5519 FreeType(sourceExp->expType);
5520 sourceExp->expType = backupSourceExpType;
5521 }
5522 return 0x0;
5523 }
5524 if(!flag)
5525 {
5526 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5527
5528 *newExp = *sourceExp;
5529 newExp->prev = (((void *)0));
5530 newExp->next = (((void *)0));
5531 if(sourceExp->destType)
5532 sourceExp->destType->refCount++;
5533 if(sourceExp->expType)
5534 sourceExp->expType->refCount++;
5535 sourceExp->type = 11;
5536 if(realDest->kind == 8)
5537 {
5538 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5539 FreeList(specs, FreeSpecifier);
5540 }
5541 else
5542 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5543 if(newExp->type == 4)
5544 {
5545 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5546 }
5547 else
5548 sourceExp->cast.exp = newExp;
5549 FreeType(sourceExp->expType);
5550 sourceExp->expType = (((void *)0));
5551 ProcessExpressionType(sourceExp);
5552 }
5553 else
5554 FreeList(specs, FreeSpecifier);
5555 FreeType(dest);
5556 FreeType(source);
5557 if(backupSourceExpType)
5558 FreeType(backupSourceExpType);
5559 return 0x1;
5560 }
5561 else
5562 {
5563 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5564 sourceExp = (*sourceExp->list).last;
5565 if(sourceExp->type == 0)
5566 {
5567 struct Identifier * id = sourceExp->identifier;
5568
5569 if(dest->kind == 8)
5570 {
5571 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5572 {
5573 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5574 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5575
5576 if(enumClass)
5577 {
5578 for(; _class && _class->type == 4; _class = _class->base)
5579 {
5580 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5581 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5582
5583 for(value = e->values.first; value; value = value->next)
5584 {
5585 if(!strcmp(value->name, id->string))
5586 break;
5587 }
5588 if(value)
5589 {
5590 FreeExpContents(sourceExp);
5591 FreeType(sourceExp->expType);
5592 sourceExp->isConstant = 0x1;
5593 sourceExp->expType = MkClassType(_class->fullName);
5594 {
5595 char constant[256];
5596
5597 sourceExp->type = 2;
5598 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5599 sprintf(constant, "%d", (int)value->data);
5600 else
5601 sprintf(constant, "0x%X", (int)value->data);
5602 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5603 }
5604 return 0x1;
5605 }
5606 }
5607 }
5608 }
5609 }
5610 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5611 return 0x1;
5612 }
5613 }
5614 return 0x0;
5615 }
5616
5617 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5618 {
5619 int value2 = op2->i;
5620
5621 exp->type = 2;
5622 exp->string = PrintInt(op1->i + value2);
5623 if(!exp->expType)
5624 {
5625 exp->expType = op1->type;
5626 if(op1->type)
5627 op1->type->refCount++;
5628 }
5629 return 0x1;
5630 }
5631
5632 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5633 {
5634 unsigned int value2 = op2->ui;
5635
5636 exp->type = 2;
5637 exp->string = PrintUInt(op1->ui + value2);
5638 if(!exp->expType)
5639 {
5640 exp->expType = op1->type;
5641 if(op1->type)
5642 op1->type->refCount++;
5643 }
5644 return 0x1;
5645 }
5646
5647 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5648 {
5649 short value2 = op2->s;
5650
5651 exp->type = 2;
5652 exp->string = PrintShort(op1->s + value2);
5653 if(!exp->expType)
5654 {
5655 exp->expType = op1->type;
5656 if(op1->type)
5657 op1->type->refCount++;
5658 }
5659 return 0x1;
5660 }
5661
5662 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5663 {
5664 unsigned short value2 = op2->us;
5665
5666 exp->type = 2;
5667 exp->string = PrintUShort(op1->us + value2);
5668 if(!exp->expType)
5669 {
5670 exp->expType = op1->type;
5671 if(op1->type)
5672 op1->type->refCount++;
5673 }
5674 return 0x1;
5675 }
5676
5677 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5678 {
5679 char value2 = op2->c;
5680
5681 exp->type = 2;
5682 exp->string = PrintChar(op1->c + value2);
5683 if(!exp->expType)
5684 {
5685 exp->expType = op1->type;
5686 if(op1->type)
5687 op1->type->refCount++;
5688 }
5689 return 0x1;
5690 }
5691
5692 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5693 {
5694 unsigned char value2 = op2->uc;
5695
5696 exp->type = 2;
5697 exp->string = PrintUChar(op1->uc + value2);
5698 if(!exp->expType)
5699 {
5700 exp->expType = op1->type;
5701 if(op1->type)
5702 op1->type->refCount++;
5703 }
5704 return 0x1;
5705 }
5706
5707 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5708 {
5709 float value2 = op2->f;
5710
5711 exp->type = 2;
5712 exp->string = PrintFloat(op1->f + value2);
5713 if(!exp->expType)
5714 {
5715 exp->expType = op1->type;
5716 if(op1->type)
5717 op1->type->refCount++;
5718 }
5719 return 0x1;
5720 }
5721
5722 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5723 {
5724 double value2 = op2->d;
5725
5726 exp->type = 2;
5727 exp->string = PrintDouble(op1->d + value2);
5728 if(!exp->expType)
5729 {
5730 exp->expType = op1->type;
5731 if(op1->type)
5732 op1->type->refCount++;
5733 }
5734 return 0x1;
5735 }
5736
5737 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5738 {
5739 int value2 = op2->i;
5740
5741 exp->type = 2;
5742 exp->string = PrintInt(op1->i - value2);
5743 if(!exp->expType)
5744 {
5745 exp->expType = op1->type;
5746 if(op1->type)
5747 op1->type->refCount++;
5748 }
5749 return 0x1;
5750 }
5751
5752 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5753 {
5754 unsigned int value2 = op2->ui;
5755
5756 exp->type = 2;
5757 exp->string = PrintUInt(op1->ui - value2);
5758 if(!exp->expType)
5759 {
5760 exp->expType = op1->type;
5761 if(op1->type)
5762 op1->type->refCount++;
5763 }
5764 return 0x1;
5765 }
5766
5767 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5768 {
5769 short value2 = op2->s;
5770
5771 exp->type = 2;
5772 exp->string = PrintShort(op1->s - value2);
5773 if(!exp->expType)
5774 {
5775 exp->expType = op1->type;
5776 if(op1->type)
5777 op1->type->refCount++;
5778 }
5779 return 0x1;
5780 }
5781
5782 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5783 {
5784 unsigned short value2 = op2->us;
5785
5786 exp->type = 2;
5787 exp->string = PrintUShort(op1->us - value2);
5788 if(!exp->expType)
5789 {
5790 exp->expType = op1->type;
5791 if(op1->type)
5792 op1->type->refCount++;
5793 }
5794 return 0x1;
5795 }
5796
5797 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5798 {
5799 char value2 = op2->c;
5800
5801 exp->type = 2;
5802 exp->string = PrintChar(op1->c - value2);
5803 if(!exp->expType)
5804 {
5805 exp->expType = op1->type;
5806 if(op1->type)
5807 op1->type->refCount++;
5808 }
5809 return 0x1;
5810 }
5811
5812 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5813 {
5814 unsigned char value2 = op2->uc;
5815
5816 exp->type = 2;
5817 exp->string = PrintUChar(op1->uc - value2);
5818 if(!exp->expType)
5819 {
5820 exp->expType = op1->type;
5821 if(op1->type)
5822 op1->type->refCount++;
5823 }
5824 return 0x1;
5825 }
5826
5827 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5828 {
5829 float value2 = op2->f;
5830
5831 exp->type = 2;
5832 exp->string = PrintFloat(op1->f - value2);
5833 if(!exp->expType)
5834 {
5835 exp->expType = op1->type;
5836 if(op1->type)
5837 op1->type->refCount++;
5838 }
5839 return 0x1;
5840 }
5841
5842 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5843 {
5844 double value2 = op2->d;
5845
5846 exp->type = 2;
5847 exp->string = PrintDouble(op1->d - value2);
5848 if(!exp->expType)
5849 {
5850 exp->expType = op1->type;
5851 if(op1->type)
5852 op1->type->refCount++;
5853 }
5854 return 0x1;
5855 }
5856
5857 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5858 {
5859 int value2 = op2->i;
5860
5861 exp->type = 2;
5862 exp->string = PrintInt(op1->i * value2);
5863 if(!exp->expType)
5864 {
5865 exp->expType = op1->type;
5866 if(op1->type)
5867 op1->type->refCount++;
5868 }
5869 return 0x1;
5870 }
5871
5872 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5873 {
5874 unsigned int value2 = op2->ui;
5875
5876 exp->type = 2;
5877 exp->string = PrintUInt(op1->ui * value2);
5878 if(!exp->expType)
5879 {
5880 exp->expType = op1->type;
5881 if(op1->type)
5882 op1->type->refCount++;
5883 }
5884 return 0x1;
5885 }
5886
5887 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5888 {
5889 short value2 = op2->s;
5890
5891 exp->type = 2;
5892 exp->string = PrintShort(op1->s * value2);
5893 if(!exp->expType)
5894 {
5895 exp->expType = op1->type;
5896 if(op1->type)
5897 op1->type->refCount++;
5898 }
5899 return 0x1;
5900 }
5901
5902 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5903 {
5904 unsigned short value2 = op2->us;
5905
5906 exp->type = 2;
5907 exp->string = PrintUShort(op1->us * value2);
5908 if(!exp->expType)
5909 {
5910 exp->expType = op1->type;
5911 if(op1->type)
5912 op1->type->refCount++;
5913 }
5914 return 0x1;
5915 }
5916
5917 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5918 {
5919 char value2 = op2->c;
5920
5921 exp->type = 2;
5922 exp->string = PrintChar(op1->c * value2);
5923 if(!exp->expType)
5924 {
5925 exp->expType = op1->type;
5926 if(op1->type)
5927 op1->type->refCount++;
5928 }
5929 return 0x1;
5930 }
5931
5932 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5933 {
5934 unsigned char value2 = op2->uc;
5935
5936 exp->type = 2;
5937 exp->string = PrintUChar(op1->uc * value2);
5938 if(!exp->expType)
5939 {
5940 exp->expType = op1->type;
5941 if(op1->type)
5942 op1->type->refCount++;
5943 }
5944 return 0x1;
5945 }
5946
5947 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5948 {
5949 float value2 = op2->f;
5950
5951 exp->type = 2;
5952 exp->string = PrintFloat(op1->f * value2);
5953 if(!exp->expType)
5954 {
5955 exp->expType = op1->type;
5956 if(op1->type)
5957 op1->type->refCount++;
5958 }
5959 return 0x1;
5960 }
5961
5962 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5963 {
5964 double value2 = op2->d;
5965
5966 exp->type = 2;
5967 exp->string = PrintDouble(op1->d * value2);
5968 if(!exp->expType)
5969 {
5970 exp->expType = op1->type;
5971 if(op1->type)
5972 op1->type->refCount++;
5973 }
5974 return 0x1;
5975 }
5976
5977 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5978 {
5979 int value2 = op2->i;
5980
5981 exp->type = 2;
5982 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
5983 if(!exp->expType)
5984 {
5985 exp->expType = op1->type;
5986 if(op1->type)
5987 op1->type->refCount++;
5988 }
5989 return 0x1;
5990 }
5991
5992 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5993 {
5994 unsigned int value2 = op2->ui;
5995
5996 exp->type = 2;
5997 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
5998 if(!exp->expType)
5999 {
6000 exp->expType = op1->type;
6001 if(op1->type)
6002 op1->type->refCount++;
6003 }
6004 return 0x1;
6005 }
6006
6007 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6008 {
6009 short value2 = op2->s;
6010
6011 exp->type = 2;
6012 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
6013 if(!exp->expType)
6014 {
6015 exp->expType = op1->type;
6016 if(op1->type)
6017 op1->type->refCount++;
6018 }
6019 return 0x1;
6020 }
6021
6022 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6023 {
6024 unsigned short value2 = op2->us;
6025
6026 exp->type = 2;
6027 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
6028 if(!exp->expType)
6029 {
6030 exp->expType = op1->type;
6031 if(op1->type)
6032 op1->type->refCount++;
6033 }
6034 return 0x1;
6035 }
6036
6037 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6038 {
6039 char value2 = op2->c;
6040
6041 exp->type = 2;
6042 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
6043 if(!exp->expType)
6044 {
6045 exp->expType = op1->type;
6046 if(op1->type)
6047 op1->type->refCount++;
6048 }
6049 return 0x1;
6050 }
6051
6052 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6053 {
6054 unsigned char value2 = op2->uc;
6055
6056 exp->type = 2;
6057 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
6058 if(!exp->expType)
6059 {
6060 exp->expType = op1->type;
6061 if(op1->type)
6062 op1->type->refCount++;
6063 }
6064 return 0x1;
6065 }
6066
6067 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6068 {
6069 float value2 = op2->f;
6070
6071 exp->type = 2;
6072 exp->string = PrintFloat(value2 ? (op1->f / value2) : (float)0);
6073 if(!exp->expType)
6074 {
6075 exp->expType = op1->type;
6076 if(op1->type)
6077 op1->type->refCount++;
6078 }
6079 return 0x1;
6080 }
6081
6082 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6083 {
6084 double value2 = op2->d;
6085
6086 exp->type = 2;
6087 exp->string = PrintDouble(value2 ? (op1->d / value2) : (double)0);
6088 if(!exp->expType)
6089 {
6090 exp->expType = op1->type;
6091 if(op1->type)
6092 op1->type->refCount++;
6093 }
6094 return 0x1;
6095 }
6096
6097 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6098 {
6099 int value2 = op2->i;
6100
6101 exp->type = 2;
6102 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
6103 if(!exp->expType)
6104 {
6105 exp->expType = op1->type;
6106 if(op1->type)
6107 op1->type->refCount++;
6108 }
6109 return 0x1;
6110 }
6111
6112 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6113 {
6114 unsigned int value2 = op2->ui;
6115
6116 exp->type = 2;
6117 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
6118 if(!exp->expType)
6119 {
6120 exp->expType = op1->type;
6121 if(op1->type)
6122 op1->type->refCount++;
6123 }
6124 return 0x1;
6125 }
6126
6127 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6128 {
6129 short value2 = op2->s;
6130
6131 exp->type = 2;
6132 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
6133 if(!exp->expType)
6134 {
6135 exp->expType = op1->type;
6136 if(op1->type)
6137 op1->type->refCount++;
6138 }
6139 return 0x1;
6140 }
6141
6142 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6143 {
6144 unsigned short value2 = op2->us;
6145
6146 exp->type = 2;
6147 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
6148 if(!exp->expType)
6149 {
6150 exp->expType = op1->type;
6151 if(op1->type)
6152 op1->type->refCount++;
6153 }
6154 return 0x1;
6155 }
6156
6157 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6158 {
6159 char value2 = op2->c;
6160
6161 exp->type = 2;
6162 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
6163 if(!exp->expType)
6164 {
6165 exp->expType = op1->type;
6166 if(op1->type)
6167 op1->type->refCount++;
6168 }
6169 return 0x1;
6170 }
6171
6172 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6173 {
6174 unsigned char value2 = op2->uc;
6175
6176 exp->type = 2;
6177 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
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 IntNeg(struct Expression * exp, struct Operand * op1)
6188 {
6189 exp->type = 2;
6190 exp->string = PrintInt(-op1->i);
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 UIntNeg(struct Expression * exp, struct Operand * op1)
6201 {
6202 exp->type = 2;
6203 exp->string = PrintUInt(-op1->ui);
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 ShortNeg(struct Expression * exp, struct Operand * op1)
6214 {
6215 exp->type = 2;
6216 exp->string = PrintShort(-op1->s);
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 UShortNeg(struct Expression * exp, struct Operand * op1)
6227 {
6228 exp->type = 2;
6229 exp->string = PrintUShort(-op1->us);
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 CharNeg(struct Expression * exp, struct Operand * op1)
6240 {
6241 exp->type = 2;
6242 exp->string = PrintChar(-op1->c);
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 UCharNeg(struct Expression * exp, struct Operand * op1)
6253 {
6254 exp->type = 2;
6255 exp->string = PrintUChar(-op1->uc);
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 FloatNeg(struct Expression * exp, struct Operand * op1)
6266 {
6267 exp->type = 2;
6268 exp->string = PrintFloat(-op1->f);
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 DoubleNeg(struct Expression * exp, struct Operand * op1)
6279 {
6280 exp->type = 2;
6281 exp->string = PrintDouble(-op1->d);
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 IntInc(struct Expression * exp, struct Operand * op1)
6292 {
6293 exp->type = 2;
6294 exp->string = PrintInt(++op1->i);
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 UIntInc(struct Expression * exp, struct Operand * op1)
6305 {
6306 exp->type = 2;
6307 exp->string = PrintUInt(++op1->ui);
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 ShortInc(struct Expression * exp, struct Operand * op1)
6318 {
6319 exp->type = 2;
6320 exp->string = PrintShort(++op1->s);
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 UShortInc(struct Expression * exp, struct Operand * op1)
6331 {
6332 exp->type = 2;
6333 exp->string = PrintUShort(++op1->us);
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 CharInc(struct Expression * exp, struct Operand * op1)
6344 {
6345 exp->type = 2;
6346 exp->string = PrintChar(++op1->c);
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 UCharInc(struct Expression * exp, struct Operand * op1)
6357 {
6358 exp->type = 2;
6359 exp->string = PrintUChar(++op1->uc);
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 FloatInc(struct Expression * exp, struct Operand * op1)
6370 {
6371 exp->type = 2;
6372 exp->string = PrintFloat(++op1->f);
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 DoubleInc(struct Expression * exp, struct Operand * op1)
6383 {
6384 exp->type = 2;
6385 exp->string = PrintDouble(++op1->d);
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 IntDec(struct Expression * exp, struct Operand * op1)
6396 {
6397 exp->type = 2;
6398 exp->string = PrintInt(--op1->i);
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 UIntDec(struct Expression * exp, struct Operand * op1)
6409 {
6410 exp->type = 2;
6411 exp->string = PrintUInt(--op1->ui);
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 ShortDec(struct Expression * exp, struct Operand * op1)
6422 {
6423 exp->type = 2;
6424 exp->string = PrintShort(--op1->s);
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 UShortDec(struct Expression * exp, struct Operand * op1)
6435 {
6436 exp->type = 2;
6437 exp->string = PrintUShort(--op1->us);
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 CharDec(struct Expression * exp, struct Operand * op1)
6448 {
6449 exp->type = 2;
6450 exp->string = PrintChar(--op1->c);
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 UCharDec(struct Expression * exp, struct Operand * op1)
6461 {
6462 exp->type = 2;
6463 exp->string = PrintUChar(--op1->uc);
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 FloatDec(struct Expression * exp, struct Operand * op1)
6474 {
6475 exp->type = 2;
6476 exp->string = PrintFloat(--op1->f);
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 DoubleDec(struct Expression * exp, struct Operand * op1)
6487 {
6488 exp->type = 2;
6489 exp->string = PrintDouble(--op1->d);
6490 if(!exp->expType)
6491 {
6492 exp->expType = op1->type;
6493 if(op1->type)
6494 op1->type->refCount++;
6495 }
6496 return 0x1;
6497 }
6498
6499 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6500 {
6501 int value2 = op2->i;
6502
6503 exp->type = 2;
6504 exp->string = PrintInt(op1->i = value2);
6505 if(!exp->expType)
6506 {
6507 exp->expType = op1->type;
6508 if(op1->type)
6509 op1->type->refCount++;
6510 }
6511 return 0x1;
6512 }
6513
6514 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6515 {
6516 unsigned int value2 = op2->ui;
6517
6518 exp->type = 2;
6519 exp->string = PrintUInt(op1->ui = value2);
6520 if(!exp->expType)
6521 {
6522 exp->expType = op1->type;
6523 if(op1->type)
6524 op1->type->refCount++;
6525 }
6526 return 0x1;
6527 }
6528
6529 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6530 {
6531 short value2 = op2->s;
6532
6533 exp->type = 2;
6534 exp->string = PrintShort(op1->s = value2);
6535 if(!exp->expType)
6536 {
6537 exp->expType = op1->type;
6538 if(op1->type)
6539 op1->type->refCount++;
6540 }
6541 return 0x1;
6542 }
6543
6544 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6545 {
6546 unsigned short value2 = op2->us;
6547
6548 exp->type = 2;
6549 exp->string = PrintUShort(op1->us = value2);
6550 if(!exp->expType)
6551 {
6552 exp->expType = op1->type;
6553 if(op1->type)
6554 op1->type->refCount++;
6555 }
6556 return 0x1;
6557 }
6558
6559 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6560 {
6561 char value2 = op2->c;
6562
6563 exp->type = 2;
6564 exp->string = PrintChar(op1->c = value2);
6565 if(!exp->expType)
6566 {
6567 exp->expType = op1->type;
6568 if(op1->type)
6569 op1->type->refCount++;
6570 }
6571 return 0x1;
6572 }
6573
6574 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6575 {
6576 unsigned char value2 = op2->uc;
6577
6578 exp->type = 2;
6579 exp->string = PrintUChar(op1->uc = value2);
6580 if(!exp->expType)
6581 {
6582 exp->expType = op1->type;
6583 if(op1->type)
6584 op1->type->refCount++;
6585 }
6586 return 0x1;
6587 }
6588
6589 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6590 {
6591 float value2 = op2->f;
6592
6593 exp->type = 2;
6594 exp->string = PrintFloat(op1->f = value2);
6595 if(!exp->expType)
6596 {
6597 exp->expType = op1->type;
6598 if(op1->type)
6599 op1->type->refCount++;
6600 }
6601 return 0x1;
6602 }
6603
6604 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6605 {
6606 double value2 = op2->d;
6607
6608 exp->type = 2;
6609 exp->string = PrintDouble(op1->d = value2);
6610 if(!exp->expType)
6611 {
6612 exp->expType = op1->type;
6613 if(op1->type)
6614 op1->type->refCount++;
6615 }
6616 return 0x1;
6617 }
6618
6619 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6620 {
6621 int value2 = op2->i;
6622
6623 exp->type = 2;
6624 exp->string = PrintInt(op1->i += value2);
6625 if(!exp->expType)
6626 {
6627 exp->expType = op1->type;
6628 if(op1->type)
6629 op1->type->refCount++;
6630 }
6631 return 0x1;
6632 }
6633
6634 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6635 {
6636 unsigned int value2 = op2->ui;
6637
6638 exp->type = 2;
6639 exp->string = PrintUInt(op1->ui += value2);
6640 if(!exp->expType)
6641 {
6642 exp->expType = op1->type;
6643 if(op1->type)
6644 op1->type->refCount++;
6645 }
6646 return 0x1;
6647 }
6648
6649 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6650 {
6651 short value2 = op2->s;
6652
6653 exp->type = 2;
6654 exp->string = PrintShort(op1->s += value2);
6655 if(!exp->expType)
6656 {
6657 exp->expType = op1->type;
6658 if(op1->type)
6659 op1->type->refCount++;
6660 }
6661 return 0x1;
6662 }
6663
6664 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6665 {
6666 unsigned short value2 = op2->us;
6667
6668 exp->type = 2;
6669 exp->string = PrintUShort(op1->us += value2);
6670 if(!exp->expType)
6671 {
6672 exp->expType = op1->type;
6673 if(op1->type)
6674 op1->type->refCount++;
6675 }
6676 return 0x1;
6677 }
6678
6679 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6680 {
6681 char value2 = op2->c;
6682
6683 exp->type = 2;
6684 exp->string = PrintChar(op1->c += value2);
6685 if(!exp->expType)
6686 {
6687 exp->expType = op1->type;
6688 if(op1->type)
6689 op1->type->refCount++;
6690 }
6691 return 0x1;
6692 }
6693
6694 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6695 {
6696 unsigned char value2 = op2->uc;
6697
6698 exp->type = 2;
6699 exp->string = PrintUChar(op1->uc += value2);
6700 if(!exp->expType)
6701 {
6702 exp->expType = op1->type;
6703 if(op1->type)
6704 op1->type->refCount++;
6705 }
6706 return 0x1;
6707 }
6708
6709 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6710 {
6711 float value2 = op2->f;
6712
6713 exp->type = 2;
6714 exp->string = PrintFloat(op1->f += value2);
6715 if(!exp->expType)
6716 {
6717 exp->expType = op1->type;
6718 if(op1->type)
6719 op1->type->refCount++;
6720 }
6721 return 0x1;
6722 }
6723
6724 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6725 {
6726 double value2 = op2->d;
6727
6728 exp->type = 2;
6729 exp->string = PrintDouble(op1->d += value2);
6730 if(!exp->expType)
6731 {
6732 exp->expType = op1->type;
6733 if(op1->type)
6734 op1->type->refCount++;
6735 }
6736 return 0x1;
6737 }
6738
6739 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6740 {
6741 int value2 = op2->i;
6742
6743 exp->type = 2;
6744 exp->string = PrintInt(op1->i -= value2);
6745 if(!exp->expType)
6746 {
6747 exp->expType = op1->type;
6748 if(op1->type)
6749 op1->type->refCount++;
6750 }
6751 return 0x1;
6752 }
6753
6754 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6755 {
6756 unsigned int value2 = op2->ui;
6757
6758 exp->type = 2;
6759 exp->string = PrintUInt(op1->ui -= value2);
6760 if(!exp->expType)
6761 {
6762 exp->expType = op1->type;
6763 if(op1->type)
6764 op1->type->refCount++;
6765 }
6766 return 0x1;
6767 }
6768
6769 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6770 {
6771 short value2 = op2->s;
6772
6773 exp->type = 2;
6774 exp->string = PrintShort(op1->s -= value2);
6775 if(!exp->expType)
6776 {
6777 exp->expType = op1->type;
6778 if(op1->type)
6779 op1->type->refCount++;
6780 }
6781 return 0x1;
6782 }
6783
6784 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6785 {
6786 unsigned short value2 = op2->us;
6787
6788 exp->type = 2;
6789 exp->string = PrintUShort(op1->us -= value2);
6790 if(!exp->expType)
6791 {
6792 exp->expType = op1->type;
6793 if(op1->type)
6794 op1->type->refCount++;
6795 }
6796 return 0x1;
6797 }
6798
6799 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6800 {
6801 char value2 = op2->c;
6802
6803 exp->type = 2;
6804 exp->string = PrintChar(op1->c -= value2);
6805 if(!exp->expType)
6806 {
6807 exp->expType = op1->type;
6808 if(op1->type)
6809 op1->type->refCount++;
6810 }
6811 return 0x1;
6812 }
6813
6814 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6815 {
6816 unsigned char value2 = op2->uc;
6817
6818 exp->type = 2;
6819 exp->string = PrintUChar(op1->uc -= value2);
6820 if(!exp->expType)
6821 {
6822 exp->expType = op1->type;
6823 if(op1->type)
6824 op1->type->refCount++;
6825 }
6826 return 0x1;
6827 }
6828
6829 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6830 {
6831 float value2 = op2->f;
6832
6833 exp->type = 2;
6834 exp->string = PrintFloat(op1->f -= value2);
6835 if(!exp->expType)
6836 {
6837 exp->expType = op1->type;
6838 if(op1->type)
6839 op1->type->refCount++;
6840 }
6841 return 0x1;
6842 }
6843
6844 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6845 {
6846 double value2 = op2->d;
6847
6848 exp->type = 2;
6849 exp->string = PrintDouble(op1->d -= value2);
6850 if(!exp->expType)
6851 {
6852 exp->expType = op1->type;
6853 if(op1->type)
6854 op1->type->refCount++;
6855 }
6856 return 0x1;
6857 }
6858
6859 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6860 {
6861 int value2 = op2->i;
6862
6863 exp->type = 2;
6864 exp->string = PrintInt(op1->i *= value2);
6865 if(!exp->expType)
6866 {
6867 exp->expType = op1->type;
6868 if(op1->type)
6869 op1->type->refCount++;
6870 }
6871 return 0x1;
6872 }
6873
6874 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6875 {
6876 unsigned int value2 = op2->ui;
6877
6878 exp->type = 2;
6879 exp->string = PrintUInt(op1->ui *= value2);
6880 if(!exp->expType)
6881 {
6882 exp->expType = op1->type;
6883 if(op1->type)
6884 op1->type->refCount++;
6885 }
6886 return 0x1;
6887 }
6888
6889 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6890 {
6891 short value2 = op2->s;
6892
6893 exp->type = 2;
6894 exp->string = PrintShort(op1->s *= value2);
6895 if(!exp->expType)
6896 {
6897 exp->expType = op1->type;
6898 if(op1->type)
6899 op1->type->refCount++;
6900 }
6901 return 0x1;
6902 }
6903
6904 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6905 {
6906 unsigned short value2 = op2->us;
6907
6908 exp->type = 2;
6909 exp->string = PrintUShort(op1->us *= value2);
6910 if(!exp->expType)
6911 {
6912 exp->expType = op1->type;
6913 if(op1->type)
6914 op1->type->refCount++;
6915 }
6916 return 0x1;
6917 }
6918
6919 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6920 {
6921 char value2 = op2->c;
6922
6923 exp->type = 2;
6924 exp->string = PrintChar(op1->c *= value2);
6925 if(!exp->expType)
6926 {
6927 exp->expType = op1->type;
6928 if(op1->type)
6929 op1->type->refCount++;
6930 }
6931 return 0x1;
6932 }
6933
6934 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6935 {
6936 unsigned char value2 = op2->uc;
6937
6938 exp->type = 2;
6939 exp->string = PrintUChar(op1->uc *= value2);
6940 if(!exp->expType)
6941 {
6942 exp->expType = op1->type;
6943 if(op1->type)
6944 op1->type->refCount++;
6945 }
6946 return 0x1;
6947 }
6948
6949 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6950 {
6951 float value2 = op2->f;
6952
6953 exp->type = 2;
6954 exp->string = PrintFloat(op1->f *= value2);
6955 if(!exp->expType)
6956 {
6957 exp->expType = op1->type;
6958 if(op1->type)
6959 op1->type->refCount++;
6960 }
6961 return 0x1;
6962 }
6963
6964 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6965 {
6966 double value2 = op2->d;
6967
6968 exp->type = 2;
6969 exp->string = PrintDouble(op1->d *= value2);
6970 if(!exp->expType)
6971 {
6972 exp->expType = op1->type;
6973 if(op1->type)
6974 op1->type->refCount++;
6975 }
6976 return 0x1;
6977 }
6978
6979 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6980 {
6981 int value2 = op2->i;
6982
6983 exp->type = 2;
6984 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
6985 if(!exp->expType)
6986 {
6987 exp->expType = op1->type;
6988 if(op1->type)
6989 op1->type->refCount++;
6990 }
6991 return 0x1;
6992 }
6993
6994 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6995 {
6996 unsigned int value2 = op2->ui;
6997
6998 exp->type = 2;
6999 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
7000 if(!exp->expType)
7001 {
7002 exp->expType = op1->type;
7003 if(op1->type)
7004 op1->type->refCount++;
7005 }
7006 return 0x1;
7007 }
7008
7009 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7010 {
7011 short value2 = op2->s;
7012
7013 exp->type = 2;
7014 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
7015 if(!exp->expType)
7016 {
7017 exp->expType = op1->type;
7018 if(op1->type)
7019 op1->type->refCount++;
7020 }
7021 return 0x1;
7022 }
7023
7024 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7025 {
7026 unsigned short value2 = op2->us;
7027
7028 exp->type = 2;
7029 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
7030 if(!exp->expType)
7031 {
7032 exp->expType = op1->type;
7033 if(op1->type)
7034 op1->type->refCount++;
7035 }
7036 return 0x1;
7037 }
7038
7039 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7040 {
7041 char value2 = op2->c;
7042
7043 exp->type = 2;
7044 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
7045 if(!exp->expType)
7046 {
7047 exp->expType = op1->type;
7048 if(op1->type)
7049 op1->type->refCount++;
7050 }
7051 return 0x1;
7052 }
7053
7054 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7055 {
7056 unsigned char value2 = op2->uc;
7057
7058 exp->type = 2;
7059 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
7060 if(!exp->expType)
7061 {
7062 exp->expType = op1->type;
7063 if(op1->type)
7064 op1->type->refCount++;
7065 }
7066 return 0x1;
7067 }
7068
7069 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7070 {
7071 float value2 = op2->f;
7072
7073 exp->type = 2;
7074 exp->string = PrintFloat(value2 ? (op1->f /= value2) : (float)0);
7075 if(!exp->expType)
7076 {
7077 exp->expType = op1->type;
7078 if(op1->type)
7079 op1->type->refCount++;
7080 }
7081 return 0x1;
7082 }
7083
7084 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7085 {
7086 double value2 = op2->d;
7087
7088 exp->type = 2;
7089 exp->string = PrintDouble(value2 ? (op1->d /= value2) : (double)0);
7090 if(!exp->expType)
7091 {
7092 exp->expType = op1->type;
7093 if(op1->type)
7094 op1->type->refCount++;
7095 }
7096 return 0x1;
7097 }
7098
7099 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7100 {
7101 int value2 = op2->i;
7102
7103 exp->type = 2;
7104 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
7105 if(!exp->expType)
7106 {
7107 exp->expType = op1->type;
7108 if(op1->type)
7109 op1->type->refCount++;
7110 }
7111 return 0x1;
7112 }
7113
7114 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7115 {
7116 unsigned int value2 = op2->ui;
7117
7118 exp->type = 2;
7119 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
7120 if(!exp->expType)
7121 {
7122 exp->expType = op1->type;
7123 if(op1->type)
7124 op1->type->refCount++;
7125 }
7126 return 0x1;
7127 }
7128
7129 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7130 {
7131 short value2 = op2->s;
7132
7133 exp->type = 2;
7134 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
7135 if(!exp->expType)
7136 {
7137 exp->expType = op1->type;
7138 if(op1->type)
7139 op1->type->refCount++;
7140 }
7141 return 0x1;
7142 }
7143
7144 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7145 {
7146 unsigned short value2 = op2->us;
7147
7148 exp->type = 2;
7149 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
7150 if(!exp->expType)
7151 {
7152 exp->expType = op1->type;
7153 if(op1->type)
7154 op1->type->refCount++;
7155 }
7156 return 0x1;
7157 }
7158
7159 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7160 {
7161 char value2 = op2->c;
7162
7163 exp->type = 2;
7164 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
7165 if(!exp->expType)
7166 {
7167 exp->expType = op1->type;
7168 if(op1->type)
7169 op1->type->refCount++;
7170 }
7171 return 0x1;
7172 }
7173
7174 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7175 {
7176 unsigned char value2 = op2->uc;
7177
7178 exp->type = 2;
7179 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
7180 if(!exp->expType)
7181 {
7182 exp->expType = op1->type;
7183 if(op1->type)
7184 op1->type->refCount++;
7185 }
7186 return 0x1;
7187 }
7188
7189 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7190 {
7191 int value2 = op2->i;
7192
7193 exp->type = 2;
7194 exp->string = PrintInt(op1->i & value2);
7195 if(!exp->expType)
7196 {
7197 exp->expType = op1->type;
7198 if(op1->type)
7199 op1->type->refCount++;
7200 }
7201 return 0x1;
7202 }
7203
7204 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7205 {
7206 unsigned int value2 = op2->ui;
7207
7208 exp->type = 2;
7209 exp->string = PrintUInt(op1->ui & value2);
7210 if(!exp->expType)
7211 {
7212 exp->expType = op1->type;
7213 if(op1->type)
7214 op1->type->refCount++;
7215 }
7216 return 0x1;
7217 }
7218
7219 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7220 {
7221 short value2 = op2->s;
7222
7223 exp->type = 2;
7224 exp->string = PrintShort(op1->s & value2);
7225 if(!exp->expType)
7226 {
7227 exp->expType = op1->type;
7228 if(op1->type)
7229 op1->type->refCount++;
7230 }
7231 return 0x1;
7232 }
7233
7234 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7235 {
7236 unsigned short value2 = op2->us;
7237
7238 exp->type = 2;
7239 exp->string = PrintUShort(op1->us & value2);
7240 if(!exp->expType)
7241 {
7242 exp->expType = op1->type;
7243 if(op1->type)
7244 op1->type->refCount++;
7245 }
7246 return 0x1;
7247 }
7248
7249 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7250 {
7251 char value2 = op2->c;
7252
7253 exp->type = 2;
7254 exp->string = PrintChar(op1->c & value2);
7255 if(!exp->expType)
7256 {
7257 exp->expType = op1->type;
7258 if(op1->type)
7259 op1->type->refCount++;
7260 }
7261 return 0x1;
7262 }
7263
7264 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7265 {
7266 unsigned char value2 = op2->uc;
7267
7268 exp->type = 2;
7269 exp->string = PrintUChar(op1->uc & value2);
7270 if(!exp->expType)
7271 {
7272 exp->expType = op1->type;
7273 if(op1->type)
7274 op1->type->refCount++;
7275 }
7276 return 0x1;
7277 }
7278
7279 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7280 {
7281 int value2 = op2->i;
7282
7283 exp->type = 2;
7284 exp->string = PrintInt(op1->i | value2);
7285 if(!exp->expType)
7286 {
7287 exp->expType = op1->type;
7288 if(op1->type)
7289 op1->type->refCount++;
7290 }
7291 return 0x1;
7292 }
7293
7294 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7295 {
7296 unsigned int value2 = op2->ui;
7297
7298 exp->type = 2;
7299 exp->string = PrintUInt(op1->ui | value2);
7300 if(!exp->expType)
7301 {
7302 exp->expType = op1->type;
7303 if(op1->type)
7304 op1->type->refCount++;
7305 }
7306 return 0x1;
7307 }
7308
7309 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7310 {
7311 short value2 = op2->s;
7312
7313 exp->type = 2;
7314 exp->string = PrintShort(op1->s | value2);
7315 if(!exp->expType)
7316 {
7317 exp->expType = op1->type;
7318 if(op1->type)
7319 op1->type->refCount++;
7320 }
7321 return 0x1;
7322 }
7323
7324 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7325 {
7326 unsigned short value2 = op2->us;
7327
7328 exp->type = 2;
7329 exp->string = PrintUShort(op1->us | value2);
7330 if(!exp->expType)
7331 {
7332 exp->expType = op1->type;
7333 if(op1->type)
7334 op1->type->refCount++;
7335 }
7336 return 0x1;
7337 }
7338
7339 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7340 {
7341 char value2 = op2->c;
7342
7343 exp->type = 2;
7344 exp->string = PrintChar(op1->c | value2);
7345 if(!exp->expType)
7346 {
7347 exp->expType = op1->type;
7348 if(op1->type)
7349 op1->type->refCount++;
7350 }
7351 return 0x1;
7352 }
7353
7354 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7355 {
7356 unsigned char value2 = op2->uc;
7357
7358 exp->type = 2;
7359 exp->string = PrintUChar(op1->uc | value2);
7360 if(!exp->expType)
7361 {
7362 exp->expType = op1->type;
7363 if(op1->type)
7364 op1->type->refCount++;
7365 }
7366 return 0x1;
7367 }
7368
7369 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7370 {
7371 int value2 = op2->i;
7372
7373 exp->type = 2;
7374 exp->string = PrintInt(op1->i ^ value2);
7375 if(!exp->expType)
7376 {
7377 exp->expType = op1->type;
7378 if(op1->type)
7379 op1->type->refCount++;
7380 }
7381 return 0x1;
7382 }
7383
7384 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7385 {
7386 unsigned int value2 = op2->ui;
7387
7388 exp->type = 2;
7389 exp->string = PrintUInt(op1->ui ^ value2);
7390 if(!exp->expType)
7391 {
7392 exp->expType = op1->type;
7393 if(op1->type)
7394 op1->type->refCount++;
7395 }
7396 return 0x1;
7397 }
7398
7399 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7400 {
7401 short value2 = op2->s;
7402
7403 exp->type = 2;
7404 exp->string = PrintShort(op1->s ^ value2);
7405 if(!exp->expType)
7406 {
7407 exp->expType = op1->type;
7408 if(op1->type)
7409 op1->type->refCount++;
7410 }
7411 return 0x1;
7412 }
7413
7414 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7415 {
7416 unsigned short value2 = op2->us;
7417
7418 exp->type = 2;
7419 exp->string = PrintUShort(op1->us ^ value2);
7420 if(!exp->expType)
7421 {
7422 exp->expType = op1->type;
7423 if(op1->type)
7424 op1->type->refCount++;
7425 }
7426 return 0x1;
7427 }
7428
7429 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7430 {
7431 char value2 = op2->c;
7432
7433 exp->type = 2;
7434 exp->string = PrintChar(op1->c ^ value2);
7435 if(!exp->expType)
7436 {
7437 exp->expType = op1->type;
7438 if(op1->type)
7439 op1->type->refCount++;
7440 }
7441 return 0x1;
7442 }
7443
7444 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7445 {
7446 unsigned char value2 = op2->uc;
7447
7448 exp->type = 2;
7449 exp->string = PrintUChar(op1->uc ^ value2);
7450 if(!exp->expType)
7451 {
7452 exp->expType = op1->type;
7453 if(op1->type)
7454 op1->type->refCount++;
7455 }
7456 return 0x1;
7457 }
7458
7459 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7460 {
7461 int value2 = op2->i;
7462
7463 exp->type = 2;
7464 exp->string = PrintInt(op1->i << value2);
7465 if(!exp->expType)
7466 {
7467 exp->expType = op1->type;
7468 if(op1->type)
7469 op1->type->refCount++;
7470 }
7471 return 0x1;
7472 }
7473
7474 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7475 {
7476 unsigned int value2 = op2->ui;
7477
7478 exp->type = 2;
7479 exp->string = PrintUInt(op1->ui << value2);
7480 if(!exp->expType)
7481 {
7482 exp->expType = op1->type;
7483 if(op1->type)
7484 op1->type->refCount++;
7485 }
7486 return 0x1;
7487 }
7488
7489 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7490 {
7491 short value2 = op2->s;
7492
7493 exp->type = 2;
7494 exp->string = PrintShort(op1->s << value2);
7495 if(!exp->expType)
7496 {
7497 exp->expType = op1->type;
7498 if(op1->type)
7499 op1->type->refCount++;
7500 }
7501 return 0x1;
7502 }
7503
7504 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7505 {
7506 unsigned short value2 = op2->us;
7507
7508 exp->type = 2;
7509 exp->string = PrintUShort(op1->us << value2);
7510 if(!exp->expType)
7511 {
7512 exp->expType = op1->type;
7513 if(op1->type)
7514 op1->type->refCount++;
7515 }
7516 return 0x1;
7517 }
7518
7519 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7520 {
7521 char value2 = op2->c;
7522
7523 exp->type = 2;
7524 exp->string = PrintChar(op1->c << value2);
7525 if(!exp->expType)
7526 {
7527 exp->expType = op1->type;
7528 if(op1->type)
7529 op1->type->refCount++;
7530 }
7531 return 0x1;
7532 }
7533
7534 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7535 {
7536 unsigned char value2 = op2->uc;
7537
7538 exp->type = 2;
7539 exp->string = PrintUChar(op1->uc << value2);
7540 if(!exp->expType)
7541 {
7542 exp->expType = op1->type;
7543 if(op1->type)
7544 op1->type->refCount++;
7545 }
7546 return 0x1;
7547 }
7548
7549 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7550 {
7551 int value2 = op2->i;
7552
7553 exp->type = 2;
7554 exp->string = PrintInt(op1->i >> value2);
7555 if(!exp->expType)
7556 {
7557 exp->expType = op1->type;
7558 if(op1->type)
7559 op1->type->refCount++;
7560 }
7561 return 0x1;
7562 }
7563
7564 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7565 {
7566 unsigned int value2 = op2->ui;
7567
7568 exp->type = 2;
7569 exp->string = PrintUInt(op1->ui >> value2);
7570 if(!exp->expType)
7571 {
7572 exp->expType = op1->type;
7573 if(op1->type)
7574 op1->type->refCount++;
7575 }
7576 return 0x1;
7577 }
7578
7579 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7580 {
7581 short value2 = op2->s;
7582
7583 exp->type = 2;
7584 exp->string = PrintShort(op1->s >> value2);
7585 if(!exp->expType)
7586 {
7587 exp->expType = op1->type;
7588 if(op1->type)
7589 op1->type->refCount++;
7590 }
7591 return 0x1;
7592 }
7593
7594 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7595 {
7596 unsigned short value2 = op2->us;
7597
7598 exp->type = 2;
7599 exp->string = PrintUShort(op1->us >> value2);
7600 if(!exp->expType)
7601 {
7602 exp->expType = op1->type;
7603 if(op1->type)
7604 op1->type->refCount++;
7605 }
7606 return 0x1;
7607 }
7608
7609 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7610 {
7611 char value2 = op2->c;
7612
7613 exp->type = 2;
7614 exp->string = PrintChar(op1->c >> value2);
7615 if(!exp->expType)
7616 {
7617 exp->expType = op1->type;
7618 if(op1->type)
7619 op1->type->refCount++;
7620 }
7621 return 0x1;
7622 }
7623
7624 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7625 {
7626 unsigned char value2 = op2->uc;
7627
7628 exp->type = 2;
7629 exp->string = PrintUChar(op1->uc >> value2);
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 IntBitNot(struct Expression * exp, struct Operand * op1)
7640 {
7641 exp->type = 2;
7642 exp->string = PrintInt(~op1->i);
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 UIntBitNot(struct Expression * exp, struct Operand * op1)
7653 {
7654 exp->type = 2;
7655 exp->string = PrintUInt(~op1->ui);
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 ShortBitNot(struct Expression * exp, struct Operand * op1)
7666 {
7667 exp->type = 2;
7668 exp->string = PrintShort(~op1->s);
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 UShortBitNot(struct Expression * exp, struct Operand * op1)
7679 {
7680 exp->type = 2;
7681 exp->string = PrintUShort(~op1->us);
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 CharBitNot(struct Expression * exp, struct Operand * op1)
7692 {
7693 exp->type = 2;
7694 exp->string = PrintChar(~op1->c);
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 UCharBitNot(struct Expression * exp, struct Operand * op1)
7705 {
7706 exp->type = 2;
7707 exp->string = PrintUChar(~op1->uc);
7708 if(!exp->expType)
7709 {
7710 exp->expType = op1->type;
7711 if(op1->type)
7712 op1->type->refCount++;
7713 }
7714 return 0x1;
7715 }
7716
7717 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7718 {
7719 int value2 = op2->i;
7720
7721 exp->type = 2;
7722 exp->string = PrintInt(op1->i &= value2);
7723 if(!exp->expType)
7724 {
7725 exp->expType = op1->type;
7726 if(op1->type)
7727 op1->type->refCount++;
7728 }
7729 return 0x1;
7730 }
7731
7732 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7733 {
7734 unsigned int value2 = op2->ui;
7735
7736 exp->type = 2;
7737 exp->string = PrintUInt(op1->ui &= value2);
7738 if(!exp->expType)
7739 {
7740 exp->expType = op1->type;
7741 if(op1->type)
7742 op1->type->refCount++;
7743 }
7744 return 0x1;
7745 }
7746
7747 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7748 {
7749 short value2 = op2->s;
7750
7751 exp->type = 2;
7752 exp->string = PrintShort(op1->s &= value2);
7753 if(!exp->expType)
7754 {
7755 exp->expType = op1->type;
7756 if(op1->type)
7757 op1->type->refCount++;
7758 }
7759 return 0x1;
7760 }
7761
7762 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7763 {
7764 unsigned short value2 = op2->us;
7765
7766 exp->type = 2;
7767 exp->string = PrintUShort(op1->us &= value2);
7768 if(!exp->expType)
7769 {
7770 exp->expType = op1->type;
7771 if(op1->type)
7772 op1->type->refCount++;
7773 }
7774 return 0x1;
7775 }
7776
7777 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7778 {
7779 char value2 = op2->c;
7780
7781 exp->type = 2;
7782 exp->string = PrintChar(op1->c &= value2);
7783 if(!exp->expType)
7784 {
7785 exp->expType = op1->type;
7786 if(op1->type)
7787 op1->type->refCount++;
7788 }
7789 return 0x1;
7790 }
7791
7792 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7793 {
7794 unsigned char value2 = op2->uc;
7795
7796 exp->type = 2;
7797 exp->string = PrintUChar(op1->uc &= value2);
7798 if(!exp->expType)
7799 {
7800 exp->expType = op1->type;
7801 if(op1->type)
7802 op1->type->refCount++;
7803 }
7804 return 0x1;
7805 }
7806
7807 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7808 {
7809 int value2 = op2->i;
7810
7811 exp->type = 2;
7812 exp->string = PrintInt(op1->i |= value2);
7813 if(!exp->expType)
7814 {
7815 exp->expType = op1->type;
7816 if(op1->type)
7817 op1->type->refCount++;
7818 }
7819 return 0x1;
7820 }
7821
7822 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7823 {
7824 unsigned int value2 = op2->ui;
7825
7826 exp->type = 2;
7827 exp->string = PrintUInt(op1->ui |= value2);
7828 if(!exp->expType)
7829 {
7830 exp->expType = op1->type;
7831 if(op1->type)
7832 op1->type->refCount++;
7833 }
7834 return 0x1;
7835 }
7836
7837 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7838 {
7839 short value2 = op2->s;
7840
7841 exp->type = 2;
7842 exp->string = PrintShort(op1->s |= value2);
7843 if(!exp->expType)
7844 {
7845 exp->expType = op1->type;
7846 if(op1->type)
7847 op1->type->refCount++;
7848 }
7849 return 0x1;
7850 }
7851
7852 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7853 {
7854 unsigned short value2 = op2->us;
7855
7856 exp->type = 2;
7857 exp->string = PrintUShort(op1->us |= value2);
7858 if(!exp->expType)
7859 {
7860 exp->expType = op1->type;
7861 if(op1->type)
7862 op1->type->refCount++;
7863 }
7864 return 0x1;
7865 }
7866
7867 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7868 {
7869 char value2 = op2->c;
7870
7871 exp->type = 2;
7872 exp->string = PrintChar(op1->c |= value2);
7873 if(!exp->expType)
7874 {
7875 exp->expType = op1->type;
7876 if(op1->type)
7877 op1->type->refCount++;
7878 }
7879 return 0x1;
7880 }
7881
7882 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7883 {
7884 unsigned char value2 = op2->uc;
7885
7886 exp->type = 2;
7887 exp->string = PrintUChar(op1->uc |= value2);
7888 if(!exp->expType)
7889 {
7890 exp->expType = op1->type;
7891 if(op1->type)
7892 op1->type->refCount++;
7893 }
7894 return 0x1;
7895 }
7896
7897 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7898 {
7899 int value2 = op2->i;
7900
7901 exp->type = 2;
7902 exp->string = PrintInt(op1->i ^= value2);
7903 if(!exp->expType)
7904 {
7905 exp->expType = op1->type;
7906 if(op1->type)
7907 op1->type->refCount++;
7908 }
7909 return 0x1;
7910 }
7911
7912 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7913 {
7914 unsigned int value2 = op2->ui;
7915
7916 exp->type = 2;
7917 exp->string = PrintUInt(op1->ui ^= value2);
7918 if(!exp->expType)
7919 {
7920 exp->expType = op1->type;
7921 if(op1->type)
7922 op1->type->refCount++;
7923 }
7924 return 0x1;
7925 }
7926
7927 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7928 {
7929 short value2 = op2->s;
7930
7931 exp->type = 2;
7932 exp->string = PrintShort(op1->s ^= value2);
7933 if(!exp->expType)
7934 {
7935 exp->expType = op1->type;
7936 if(op1->type)
7937 op1->type->refCount++;
7938 }
7939 return 0x1;
7940 }
7941
7942 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7943 {
7944 unsigned short value2 = op2->us;
7945
7946 exp->type = 2;
7947 exp->string = PrintUShort(op1->us ^= value2);
7948 if(!exp->expType)
7949 {
7950 exp->expType = op1->type;
7951 if(op1->type)
7952 op1->type->refCount++;
7953 }
7954 return 0x1;
7955 }
7956
7957 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7958 {
7959 char value2 = op2->c;
7960
7961 exp->type = 2;
7962 exp->string = PrintChar(op1->c ^= value2);
7963 if(!exp->expType)
7964 {
7965 exp->expType = op1->type;
7966 if(op1->type)
7967 op1->type->refCount++;
7968 }
7969 return 0x1;
7970 }
7971
7972 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7973 {
7974 unsigned char value2 = op2->uc;
7975
7976 exp->type = 2;
7977 exp->string = PrintUChar(op1->uc ^= value2);
7978 if(!exp->expType)
7979 {
7980 exp->expType = op1->type;
7981 if(op1->type)
7982 op1->type->refCount++;
7983 }
7984 return 0x1;
7985 }
7986
7987 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7988 {
7989 int value2 = op2->i;
7990
7991 exp->type = 2;
7992 exp->string = PrintInt(op1->i <<= value2);
7993 if(!exp->expType)
7994 {
7995 exp->expType = op1->type;
7996 if(op1->type)
7997 op1->type->refCount++;
7998 }
7999 return 0x1;
8000 }
8001
8002 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8003 {
8004 unsigned int value2 = op2->ui;
8005
8006 exp->type = 2;
8007 exp->string = PrintUInt(op1->ui <<= value2);
8008 if(!exp->expType)
8009 {
8010 exp->expType = op1->type;
8011 if(op1->type)
8012 op1->type->refCount++;
8013 }
8014 return 0x1;
8015 }
8016
8017 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8018 {
8019 short value2 = op2->s;
8020
8021 exp->type = 2;
8022 exp->string = PrintShort(op1->s <<= value2);
8023 if(!exp->expType)
8024 {
8025 exp->expType = op1->type;
8026 if(op1->type)
8027 op1->type->refCount++;
8028 }
8029 return 0x1;
8030 }
8031
8032 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8033 {
8034 unsigned short value2 = op2->us;
8035
8036 exp->type = 2;
8037 exp->string = PrintUShort(op1->us <<= value2);
8038 if(!exp->expType)
8039 {
8040 exp->expType = op1->type;
8041 if(op1->type)
8042 op1->type->refCount++;
8043 }
8044 return 0x1;
8045 }
8046
8047 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8048 {
8049 char value2 = op2->c;
8050
8051 exp->type = 2;
8052 exp->string = PrintChar(op1->c <<= value2);
8053 if(!exp->expType)
8054 {
8055 exp->expType = op1->type;
8056 if(op1->type)
8057 op1->type->refCount++;
8058 }
8059 return 0x1;
8060 }
8061
8062 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8063 {
8064 unsigned char value2 = op2->uc;
8065
8066 exp->type = 2;
8067 exp->string = PrintUChar(op1->uc <<= value2);
8068 if(!exp->expType)
8069 {
8070 exp->expType = op1->type;
8071 if(op1->type)
8072 op1->type->refCount++;
8073 }
8074 return 0x1;
8075 }
8076
8077 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8078 {
8079 int value2 = op2->i;
8080
8081 exp->type = 2;
8082 exp->string = PrintInt(op1->i >>= value2);
8083 if(!exp->expType)
8084 {
8085 exp->expType = op1->type;
8086 if(op1->type)
8087 op1->type->refCount++;
8088 }
8089 return 0x1;
8090 }
8091
8092 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8093 {
8094 unsigned int value2 = op2->ui;
8095
8096 exp->type = 2;
8097 exp->string = PrintUInt(op1->ui >>= value2);
8098 if(!exp->expType)
8099 {
8100 exp->expType = op1->type;
8101 if(op1->type)
8102 op1->type->refCount++;
8103 }
8104 return 0x1;
8105 }
8106
8107 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8108 {
8109 short value2 = op2->s;
8110
8111 exp->type = 2;
8112 exp->string = PrintShort(op1->s >>= value2);
8113 if(!exp->expType)
8114 {
8115 exp->expType = op1->type;
8116 if(op1->type)
8117 op1->type->refCount++;
8118 }
8119 return 0x1;
8120 }
8121
8122 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8123 {
8124 unsigned short value2 = op2->us;
8125
8126 exp->type = 2;
8127 exp->string = PrintUShort(op1->us >>= value2);
8128 if(!exp->expType)
8129 {
8130 exp->expType = op1->type;
8131 if(op1->type)
8132 op1->type->refCount++;
8133 }
8134 return 0x1;
8135 }
8136
8137 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8138 {
8139 char value2 = op2->c;
8140
8141 exp->type = 2;
8142 exp->string = PrintChar(op1->c >>= value2);
8143 if(!exp->expType)
8144 {
8145 exp->expType = op1->type;
8146 if(op1->type)
8147 op1->type->refCount++;
8148 }
8149 return 0x1;
8150 }
8151
8152 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8153 {
8154 unsigned char value2 = op2->uc;
8155
8156 exp->type = 2;
8157 exp->string = PrintUChar(op1->uc >>= value2);
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 IntNot(struct Expression * exp, struct Operand * op1)
8168 {
8169 exp->type = 2;
8170 exp->string = PrintInt(!op1->i);
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 UIntNot(struct Expression * exp, struct Operand * op1)
8181 {
8182 exp->type = 2;
8183 exp->string = PrintUInt(!op1->ui);
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 ShortNot(struct Expression * exp, struct Operand * op1)
8194 {
8195 exp->type = 2;
8196 exp->string = PrintShort(!op1->s);
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 UShortNot(struct Expression * exp, struct Operand * op1)
8207 {
8208 exp->type = 2;
8209 exp->string = PrintUShort(!op1->us);
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 CharNot(struct Expression * exp, struct Operand * op1)
8220 {
8221 exp->type = 2;
8222 exp->string = PrintChar(!op1->c);
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 UCharNot(struct Expression * exp, struct Operand * op1)
8233 {
8234 exp->type = 2;
8235 exp->string = PrintUChar(!op1->uc);
8236 if(!exp->expType)
8237 {
8238 exp->expType = op1->type;
8239 if(op1->type)
8240 op1->type->refCount++;
8241 }
8242 return 0x1;
8243 }
8244
8245 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8246 {
8247 int value2 = op2->i;
8248
8249 exp->type = 2;
8250 exp->string = PrintInt(op1->i == value2);
8251 if(!exp->expType)
8252 {
8253 exp->expType = op1->type;
8254 if(op1->type)
8255 op1->type->refCount++;
8256 }
8257 return 0x1;
8258 }
8259
8260 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8261 {
8262 unsigned int value2 = op2->ui;
8263
8264 exp->type = 2;
8265 exp->string = PrintUInt(op1->ui == value2);
8266 if(!exp->expType)
8267 {
8268 exp->expType = op1->type;
8269 if(op1->type)
8270 op1->type->refCount++;
8271 }
8272 return 0x1;
8273 }
8274
8275 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8276 {
8277 short value2 = op2->s;
8278
8279 exp->type = 2;
8280 exp->string = PrintShort(op1->s == value2);
8281 if(!exp->expType)
8282 {
8283 exp->expType = op1->type;
8284 if(op1->type)
8285 op1->type->refCount++;
8286 }
8287 return 0x1;
8288 }
8289
8290 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8291 {
8292 unsigned short value2 = op2->us;
8293
8294 exp->type = 2;
8295 exp->string = PrintUShort(op1->us == value2);
8296 if(!exp->expType)
8297 {
8298 exp->expType = op1->type;
8299 if(op1->type)
8300 op1->type->refCount++;
8301 }
8302 return 0x1;
8303 }
8304
8305 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8306 {
8307 char value2 = op2->c;
8308
8309 exp->type = 2;
8310 exp->string = PrintChar(op1->c == value2);
8311 if(!exp->expType)
8312 {
8313 exp->expType = op1->type;
8314 if(op1->type)
8315 op1->type->refCount++;
8316 }
8317 return 0x1;
8318 }
8319
8320 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8321 {
8322 unsigned char value2 = op2->uc;
8323
8324 exp->type = 2;
8325 exp->string = PrintUChar(op1->uc == value2);
8326 if(!exp->expType)
8327 {
8328 exp->expType = op1->type;
8329 if(op1->type)
8330 op1->type->refCount++;
8331 }
8332 return 0x1;
8333 }
8334
8335 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8336 {
8337 float value2 = op2->f;
8338
8339 exp->type = 2;
8340 exp->string = PrintFloat(op1->f == value2);
8341 if(!exp->expType)
8342 {
8343 exp->expType = op1->type;
8344 if(op1->type)
8345 op1->type->refCount++;
8346 }
8347 return 0x1;
8348 }
8349
8350 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8351 {
8352 double value2 = op2->d;
8353
8354 exp->type = 2;
8355 exp->string = PrintDouble(op1->d == value2);
8356 if(!exp->expType)
8357 {
8358 exp->expType = op1->type;
8359 if(op1->type)
8360 op1->type->refCount++;
8361 }
8362 return 0x1;
8363 }
8364
8365 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8366 {
8367 int value2 = op2->i;
8368
8369 exp->type = 2;
8370 exp->string = PrintInt(op1->i != value2);
8371 if(!exp->expType)
8372 {
8373 exp->expType = op1->type;
8374 if(op1->type)
8375 op1->type->refCount++;
8376 }
8377 return 0x1;
8378 }
8379
8380 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8381 {
8382 unsigned int value2 = op2->ui;
8383
8384 exp->type = 2;
8385 exp->string = PrintUInt(op1->ui != value2);
8386 if(!exp->expType)
8387 {
8388 exp->expType = op1->type;
8389 if(op1->type)
8390 op1->type->refCount++;
8391 }
8392 return 0x1;
8393 }
8394
8395 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8396 {
8397 short value2 = op2->s;
8398
8399 exp->type = 2;
8400 exp->string = PrintShort(op1->s != value2);
8401 if(!exp->expType)
8402 {
8403 exp->expType = op1->type;
8404 if(op1->type)
8405 op1->type->refCount++;
8406 }
8407 return 0x1;
8408 }
8409
8410 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8411 {
8412 unsigned short value2 = op2->us;
8413
8414 exp->type = 2;
8415 exp->string = PrintUShort(op1->us != value2);
8416 if(!exp->expType)
8417 {
8418 exp->expType = op1->type;
8419 if(op1->type)
8420 op1->type->refCount++;
8421 }
8422 return 0x1;
8423 }
8424
8425 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8426 {
8427 char value2 = op2->c;
8428
8429 exp->type = 2;
8430 exp->string = PrintChar(op1->c != value2);
8431 if(!exp->expType)
8432 {
8433 exp->expType = op1->type;
8434 if(op1->type)
8435 op1->type->refCount++;
8436 }
8437 return 0x1;
8438 }
8439
8440 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8441 {
8442 unsigned char value2 = op2->uc;
8443
8444 exp->type = 2;
8445 exp->string = PrintUChar(op1->uc != value2);
8446 if(!exp->expType)
8447 {
8448 exp->expType = op1->type;
8449 if(op1->type)
8450 op1->type->refCount++;
8451 }
8452 return 0x1;
8453 }
8454
8455 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8456 {
8457 float value2 = op2->f;
8458
8459 exp->type = 2;
8460 exp->string = PrintFloat(op1->f != value2);
8461 if(!exp->expType)
8462 {
8463 exp->expType = op1->type;
8464 if(op1->type)
8465 op1->type->refCount++;
8466 }
8467 return 0x1;
8468 }
8469
8470 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8471 {
8472 double value2 = op2->d;
8473
8474 exp->type = 2;
8475 exp->string = PrintDouble(op1->d != value2);
8476 if(!exp->expType)
8477 {
8478 exp->expType = op1->type;
8479 if(op1->type)
8480 op1->type->refCount++;
8481 }
8482 return 0x1;
8483 }
8484
8485 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8486 {
8487 int value2 = op2->i;
8488
8489 exp->type = 2;
8490 exp->string = PrintInt(op1->i && value2);
8491 if(!exp->expType)
8492 {
8493 exp->expType = op1->type;
8494 if(op1->type)
8495 op1->type->refCount++;
8496 }
8497 return 0x1;
8498 }
8499
8500 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8501 {
8502 unsigned int value2 = op2->ui;
8503
8504 exp->type = 2;
8505 exp->string = PrintUInt(op1->ui && value2);
8506 if(!exp->expType)
8507 {
8508 exp->expType = op1->type;
8509 if(op1->type)
8510 op1->type->refCount++;
8511 }
8512 return 0x1;
8513 }
8514
8515 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8516 {
8517 short value2 = op2->s;
8518
8519 exp->type = 2;
8520 exp->string = PrintShort(op1->s && value2);
8521 if(!exp->expType)
8522 {
8523 exp->expType = op1->type;
8524 if(op1->type)
8525 op1->type->refCount++;
8526 }
8527 return 0x1;
8528 }
8529
8530 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8531 {
8532 unsigned short value2 = op2->us;
8533
8534 exp->type = 2;
8535 exp->string = PrintUShort(op1->us && value2);
8536 if(!exp->expType)
8537 {
8538 exp->expType = op1->type;
8539 if(op1->type)
8540 op1->type->refCount++;
8541 }
8542 return 0x1;
8543 }
8544
8545 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8546 {
8547 char value2 = op2->c;
8548
8549 exp->type = 2;
8550 exp->string = PrintChar(op1->c && value2);
8551 if(!exp->expType)
8552 {
8553 exp->expType = op1->type;
8554 if(op1->type)
8555 op1->type->refCount++;
8556 }
8557 return 0x1;
8558 }
8559
8560 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8561 {
8562 unsigned char value2 = op2->uc;
8563
8564 exp->type = 2;
8565 exp->string = PrintUChar(op1->uc && value2);
8566 if(!exp->expType)
8567 {
8568 exp->expType = op1->type;
8569 if(op1->type)
8570 op1->type->refCount++;
8571 }
8572 return 0x1;
8573 }
8574
8575 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8576 {
8577 float value2 = op2->f;
8578
8579 exp->type = 2;
8580 exp->string = PrintFloat(op1->f && value2);
8581 if(!exp->expType)
8582 {
8583 exp->expType = op1->type;
8584 if(op1->type)
8585 op1->type->refCount++;
8586 }
8587 return 0x1;
8588 }
8589
8590 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8591 {
8592 double value2 = op2->d;
8593
8594 exp->type = 2;
8595 exp->string = PrintDouble(op1->d && value2);
8596 if(!exp->expType)
8597 {
8598 exp->expType = op1->type;
8599 if(op1->type)
8600 op1->type->refCount++;
8601 }
8602 return 0x1;
8603 }
8604
8605 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8606 {
8607 int value2 = op2->i;
8608
8609 exp->type = 2;
8610 exp->string = PrintInt(op1->i || value2);
8611 if(!exp->expType)
8612 {
8613 exp->expType = op1->type;
8614 if(op1->type)
8615 op1->type->refCount++;
8616 }
8617 return 0x1;
8618 }
8619
8620 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8621 {
8622 unsigned int value2 = op2->ui;
8623
8624 exp->type = 2;
8625 exp->string = PrintUInt(op1->ui || value2);
8626 if(!exp->expType)
8627 {
8628 exp->expType = op1->type;
8629 if(op1->type)
8630 op1->type->refCount++;
8631 }
8632 return 0x1;
8633 }
8634
8635 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8636 {
8637 short value2 = op2->s;
8638
8639 exp->type = 2;
8640 exp->string = PrintShort(op1->s || value2);
8641 if(!exp->expType)
8642 {
8643 exp->expType = op1->type;
8644 if(op1->type)
8645 op1->type->refCount++;
8646 }
8647 return 0x1;
8648 }
8649
8650 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8651 {
8652 unsigned short value2 = op2->us;
8653
8654 exp->type = 2;
8655 exp->string = PrintUShort(op1->us || value2);
8656 if(!exp->expType)
8657 {
8658 exp->expType = op1->type;
8659 if(op1->type)
8660 op1->type->refCount++;
8661 }
8662 return 0x1;
8663 }
8664
8665 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8666 {
8667 char value2 = op2->c;
8668
8669 exp->type = 2;
8670 exp->string = PrintChar(op1->c || value2);
8671 if(!exp->expType)
8672 {
8673 exp->expType = op1->type;
8674 if(op1->type)
8675 op1->type->refCount++;
8676 }
8677 return 0x1;
8678 }
8679
8680 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8681 {
8682 unsigned char value2 = op2->uc;
8683
8684 exp->type = 2;
8685 exp->string = PrintUChar(op1->uc || value2);
8686 if(!exp->expType)
8687 {
8688 exp->expType = op1->type;
8689 if(op1->type)
8690 op1->type->refCount++;
8691 }
8692 return 0x1;
8693 }
8694
8695 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8696 {
8697 float value2 = op2->f;
8698
8699 exp->type = 2;
8700 exp->string = PrintFloat(op1->f || value2);
8701 if(!exp->expType)
8702 {
8703 exp->expType = op1->type;
8704 if(op1->type)
8705 op1->type->refCount++;
8706 }
8707 return 0x1;
8708 }
8709
8710 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8711 {
8712 double value2 = op2->d;
8713
8714 exp->type = 2;
8715 exp->string = PrintDouble(op1->d || value2);
8716 if(!exp->expType)
8717 {
8718 exp->expType = op1->type;
8719 if(op1->type)
8720 op1->type->refCount++;
8721 }
8722 return 0x1;
8723 }
8724
8725 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8726 {
8727 int value2 = op2->i;
8728
8729 exp->type = 2;
8730 exp->string = PrintInt(op1->i > value2);
8731 if(!exp->expType)
8732 {
8733 exp->expType = op1->type;
8734 if(op1->type)
8735 op1->type->refCount++;
8736 }
8737 return 0x1;
8738 }
8739
8740 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8741 {
8742 unsigned int value2 = op2->ui;
8743
8744 exp->type = 2;
8745 exp->string = PrintUInt(op1->ui > value2);
8746 if(!exp->expType)
8747 {
8748 exp->expType = op1->type;
8749 if(op1->type)
8750 op1->type->refCount++;
8751 }
8752 return 0x1;
8753 }
8754
8755 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8756 {
8757 short value2 = op2->s;
8758
8759 exp->type = 2;
8760 exp->string = PrintShort(op1->s > value2);
8761 if(!exp->expType)
8762 {
8763 exp->expType = op1->type;
8764 if(op1->type)
8765 op1->type->refCount++;
8766 }
8767 return 0x1;
8768 }
8769
8770 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8771 {
8772 unsigned short value2 = op2->us;
8773
8774 exp->type = 2;
8775 exp->string = PrintUShort(op1->us > value2);
8776 if(!exp->expType)
8777 {
8778 exp->expType = op1->type;
8779 if(op1->type)
8780 op1->type->refCount++;
8781 }
8782 return 0x1;
8783 }
8784
8785 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8786 {
8787 char value2 = op2->c;
8788
8789 exp->type = 2;
8790 exp->string = PrintChar(op1->c > value2);
8791 if(!exp->expType)
8792 {
8793 exp->expType = op1->type;
8794 if(op1->type)
8795 op1->type->refCount++;
8796 }
8797 return 0x1;
8798 }
8799
8800 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8801 {
8802 unsigned char value2 = op2->uc;
8803
8804 exp->type = 2;
8805 exp->string = PrintUChar(op1->uc > value2);
8806 if(!exp->expType)
8807 {
8808 exp->expType = op1->type;
8809 if(op1->type)
8810 op1->type->refCount++;
8811 }
8812 return 0x1;
8813 }
8814
8815 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8816 {
8817 float value2 = op2->f;
8818
8819 exp->type = 2;
8820 exp->string = PrintFloat(op1->f > value2);
8821 if(!exp->expType)
8822 {
8823 exp->expType = op1->type;
8824 if(op1->type)
8825 op1->type->refCount++;
8826 }
8827 return 0x1;
8828 }
8829
8830 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8831 {
8832 double value2 = op2->d;
8833
8834 exp->type = 2;
8835 exp->string = PrintDouble(op1->d > value2);
8836 if(!exp->expType)
8837 {
8838 exp->expType = op1->type;
8839 if(op1->type)
8840 op1->type->refCount++;
8841 }
8842 return 0x1;
8843 }
8844
8845 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8846 {
8847 int value2 = op2->i;
8848
8849 exp->type = 2;
8850 exp->string = PrintInt(op1->i < value2);
8851 if(!exp->expType)
8852 {
8853 exp->expType = op1->type;
8854 if(op1->type)
8855 op1->type->refCount++;
8856 }
8857 return 0x1;
8858 }
8859
8860 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8861 {
8862 unsigned int value2 = op2->ui;
8863
8864 exp->type = 2;
8865 exp->string = PrintUInt(op1->ui < value2);
8866 if(!exp->expType)
8867 {
8868 exp->expType = op1->type;
8869 if(op1->type)
8870 op1->type->refCount++;
8871 }
8872 return 0x1;
8873 }
8874
8875 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8876 {
8877 short value2 = op2->s;
8878
8879 exp->type = 2;
8880 exp->string = PrintShort(op1->s < value2);
8881 if(!exp->expType)
8882 {
8883 exp->expType = op1->type;
8884 if(op1->type)
8885 op1->type->refCount++;
8886 }
8887 return 0x1;
8888 }
8889
8890 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8891 {
8892 unsigned short value2 = op2->us;
8893
8894 exp->type = 2;
8895 exp->string = PrintUShort(op1->us < value2);
8896 if(!exp->expType)
8897 {
8898 exp->expType = op1->type;
8899 if(op1->type)
8900 op1->type->refCount++;
8901 }
8902 return 0x1;
8903 }
8904
8905 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8906 {
8907 char value2 = op2->c;
8908
8909 exp->type = 2;
8910 exp->string = PrintChar(op1->c < value2);
8911 if(!exp->expType)
8912 {
8913 exp->expType = op1->type;
8914 if(op1->type)
8915 op1->type->refCount++;
8916 }
8917 return 0x1;
8918 }
8919
8920 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8921 {
8922 unsigned char value2 = op2->uc;
8923
8924 exp->type = 2;
8925 exp->string = PrintUChar(op1->uc < value2);
8926 if(!exp->expType)
8927 {
8928 exp->expType = op1->type;
8929 if(op1->type)
8930 op1->type->refCount++;
8931 }
8932 return 0x1;
8933 }
8934
8935 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8936 {
8937 float value2 = op2->f;
8938
8939 exp->type = 2;
8940 exp->string = PrintFloat(op1->f < value2);
8941 if(!exp->expType)
8942 {
8943 exp->expType = op1->type;
8944 if(op1->type)
8945 op1->type->refCount++;
8946 }
8947 return 0x1;
8948 }
8949
8950 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8951 {
8952 double value2 = op2->d;
8953
8954 exp->type = 2;
8955 exp->string = PrintDouble(op1->d < value2);
8956 if(!exp->expType)
8957 {
8958 exp->expType = op1->type;
8959 if(op1->type)
8960 op1->type->refCount++;
8961 }
8962 return 0x1;
8963 }
8964
8965 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8966 {
8967 int value2 = op2->i;
8968
8969 exp->type = 2;
8970 exp->string = PrintInt(op1->i >= value2);
8971 if(!exp->expType)
8972 {
8973 exp->expType = op1->type;
8974 if(op1->type)
8975 op1->type->refCount++;
8976 }
8977 return 0x1;
8978 }
8979
8980 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8981 {
8982 unsigned int value2 = op2->ui;
8983
8984 exp->type = 2;
8985 exp->string = PrintUInt(op1->ui >= value2);
8986 if(!exp->expType)
8987 {
8988 exp->expType = op1->type;
8989 if(op1->type)
8990 op1->type->refCount++;
8991 }
8992 return 0x1;
8993 }
8994
8995 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8996 {
8997 short value2 = op2->s;
8998
8999 exp->type = 2;
9000 exp->string = PrintShort(op1->s >= value2);
9001 if(!exp->expType)
9002 {
9003 exp->expType = op1->type;
9004 if(op1->type)
9005 op1->type->refCount++;
9006 }
9007 return 0x1;
9008 }
9009
9010 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9011 {
9012 unsigned short value2 = op2->us;
9013
9014 exp->type = 2;
9015 exp->string = PrintUShort(op1->us >= value2);
9016 if(!exp->expType)
9017 {
9018 exp->expType = op1->type;
9019 if(op1->type)
9020 op1->type->refCount++;
9021 }
9022 return 0x1;
9023 }
9024
9025 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9026 {
9027 char value2 = op2->c;
9028
9029 exp->type = 2;
9030 exp->string = PrintChar(op1->c >= value2);
9031 if(!exp->expType)
9032 {
9033 exp->expType = op1->type;
9034 if(op1->type)
9035 op1->type->refCount++;
9036 }
9037 return 0x1;
9038 }
9039
9040 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9041 {
9042 unsigned char value2 = op2->uc;
9043
9044 exp->type = 2;
9045 exp->string = PrintUChar(op1->uc >= value2);
9046 if(!exp->expType)
9047 {
9048 exp->expType = op1->type;
9049 if(op1->type)
9050 op1->type->refCount++;
9051 }
9052 return 0x1;
9053 }
9054
9055 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9056 {
9057 float value2 = op2->f;
9058
9059 exp->type = 2;
9060 exp->string = PrintFloat(op1->f >= value2);
9061 if(!exp->expType)
9062 {
9063 exp->expType = op1->type;
9064 if(op1->type)
9065 op1->type->refCount++;
9066 }
9067 return 0x1;
9068 }
9069
9070 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9071 {
9072 double value2 = op2->d;
9073
9074 exp->type = 2;
9075 exp->string = PrintDouble(op1->d >= value2);
9076 if(!exp->expType)
9077 {
9078 exp->expType = op1->type;
9079 if(op1->type)
9080 op1->type->refCount++;
9081 }
9082 return 0x1;
9083 }
9084
9085 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9086 {
9087 int value2 = op2->i;
9088
9089 exp->type = 2;
9090 exp->string = PrintInt(op1->i <= value2);
9091 if(!exp->expType)
9092 {
9093 exp->expType = op1->type;
9094 if(op1->type)
9095 op1->type->refCount++;
9096 }
9097 return 0x1;
9098 }
9099
9100 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9101 {
9102 unsigned int value2 = op2->ui;
9103
9104 exp->type = 2;
9105 exp->string = PrintUInt(op1->ui <= value2);
9106 if(!exp->expType)
9107 {
9108 exp->expType = op1->type;
9109 if(op1->type)
9110 op1->type->refCount++;
9111 }
9112 return 0x1;
9113 }
9114
9115 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9116 {
9117 short value2 = op2->s;
9118
9119 exp->type = 2;
9120 exp->string = PrintShort(op1->s <= value2);
9121 if(!exp->expType)
9122 {
9123 exp->expType = op1->type;
9124 if(op1->type)
9125 op1->type->refCount++;
9126 }
9127 return 0x1;
9128 }
9129
9130 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9131 {
9132 unsigned short value2 = op2->us;
9133
9134 exp->type = 2;
9135 exp->string = PrintUShort(op1->us <= value2);
9136 if(!exp->expType)
9137 {
9138 exp->expType = op1->type;
9139 if(op1->type)
9140 op1->type->refCount++;
9141 }
9142 return 0x1;
9143 }
9144
9145 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9146 {
9147 char value2 = op2->c;
9148
9149 exp->type = 2;
9150 exp->string = PrintChar(op1->c <= value2);
9151 if(!exp->expType)
9152 {
9153 exp->expType = op1->type;
9154 if(op1->type)
9155 op1->type->refCount++;
9156 }
9157 return 0x1;
9158 }
9159
9160 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9161 {
9162 unsigned char value2 = op2->uc;
9163
9164 exp->type = 2;
9165 exp->string = PrintUChar(op1->uc <= value2);
9166 if(!exp->expType)
9167 {
9168 exp->expType = op1->type;
9169 if(op1->type)
9170 op1->type->refCount++;
9171 }
9172 return 0x1;
9173 }
9174
9175 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9176 {
9177 float value2 = op2->f;
9178
9179 exp->type = 2;
9180 exp->string = PrintFloat(op1->f <= value2);
9181 if(!exp->expType)
9182 {
9183 exp->expType = op1->type;
9184 if(op1->type)
9185 op1->type->refCount++;
9186 }
9187 return 0x1;
9188 }
9189
9190 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9191 {
9192 double value2 = op2->d;
9193
9194 exp->type = 2;
9195 exp->string = PrintDouble(op1->d <= value2);
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 IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9206 {
9207 exp->type = 2;
9208 exp->string = PrintInt(op1->i ? op2->i : op3->i);
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 UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9219 {
9220 exp->type = 2;
9221 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
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 ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9232 {
9233 exp->type = 2;
9234 exp->string = PrintShort(op1->s ? op2->s : op3->s);
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 UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9245 {
9246 exp->type = 2;
9247 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
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 CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9258 {
9259 exp->type = 2;
9260 exp->string = PrintChar(op1->c ? op2->c : op3->c);
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 UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9271 {
9272 exp->type = 2;
9273 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
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 FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9284 {
9285 exp->type = 2;
9286 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
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 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9297 {
9298 exp->type = 2;
9299 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
9300 if(!exp->expType)
9301 {
9302 exp->expType = op1->type;
9303 if(op1->type)
9304 op1->type->refCount++;
9305 }
9306 return 0x1;
9307 }
9308
9309 struct OpTable intOps = 
9310 {
9311 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
9312 };
9313
9314 struct OpTable uintOps = 
9315 {
9316 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
9317 };
9318
9319 struct OpTable shortOps = 
9320 {
9321 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
9322 };
9323
9324 struct OpTable ushortOps = 
9325 {
9326 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
9327 };
9328
9329 struct OpTable floatOps = 
9330 {
9331 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
9332 };
9333
9334 struct OpTable doubleOps = 
9335 {
9336 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
9337 };
9338
9339 struct OpTable charOps = 
9340 {
9341 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
9342 };
9343
9344 struct OpTable ucharOps = 
9345 {
9346 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
9347 };
9348
9349 void ReadString(char * output, char * string)
9350 {
9351 int len = strlen(string);
9352 int c, d = 0;
9353 unsigned int quoted = 0x0, escaped = 0x0;
9354
9355 for(c = 0; c < len; c++)
9356 {
9357 char ch = string[c];
9358
9359 if(escaped)
9360 {
9361 switch(ch)
9362 {
9363 case 'n':
9364 output[d] = '\n';
9365 break;
9366 case 't':
9367 output[d] = '\t';
9368 break;
9369 case 'a':
9370 output[d] = '\a';
9371 break;
9372 case 'b':
9373 output[d] = '\b';
9374 break;
9375 case 'f':
9376 output[d] = '\f';
9377 break;
9378 case 'r':
9379 output[d] = '\r';
9380 break;
9381 case 'v':
9382 output[d] = '\v';
9383 break;
9384 case '\\':
9385 output[d] = '\\';
9386 break;
9387 case '\"':
9388 output[d] = '\"';
9389 break;
9390 default:
9391 output[d++] = '\\';
9392 output[d] = ch;
9393 }
9394 d++;
9395 escaped = 0x0;
9396 }
9397 else
9398 {
9399 if(ch == '\"')
9400 quoted ^= 0x1;
9401 else if(quoted)
9402 {
9403 if(ch == '\\')
9404 escaped = 0x1;
9405 else
9406 output[d++] = ch;
9407 }
9408 }
9409 }
9410 output[d] = '\0';
9411 }
9412
9413 extern long long __ecereNameSpace__ecere__com___strtoi64(char *  string, char * *  endString, int base);
9414
9415 extern uint64 __ecereNameSpace__ecere__com___strtoui64(char *  string, char * *  endString, int base);
9416
9417 extern double strtod(char * , char * * );
9418
9419 struct Operand GetOperand(struct Expression * exp)
9420 {
9421 struct Operand op = 
9422 {
9423 0, 0, 0, 0, 
9424 {
9425 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
9426 }
9427 };
9428 struct Type * type = exp->expType;
9429
9430 if(type)
9431 {
9432 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9433 {
9434 if(!type->_class->registered->dataType)
9435 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9436 type = type->_class->registered->dataType;
9437 }
9438 op.kind = type->kind;
9439 op.type = exp->expType;
9440 if(exp->isConstant && exp->type == 2)
9441 {
9442 switch(op.kind)
9443 {
9444 case 1:
9445 {
9446 if(exp->constant[0] == '\'')
9447 op.c = exp->constant[1];
9448 else if(type->isSigned)
9449 {
9450 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9451 op.ops = charOps;
9452 }
9453 else
9454 {
9455 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9456 op.ops = ucharOps;
9457 }
9458 break;
9459 }
9460 case 2:
9461 if(type->isSigned)
9462 {
9463 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9464 op.ops = shortOps;
9465 }
9466 else
9467 {
9468 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9469 op.ops = ushortOps;
9470 }
9471 break;
9472 case 3:
9473 case 5:
9474 if(type->isSigned)
9475 {
9476 op.i = strtol(exp->constant, (((void *)0)), 0);
9477 op.ops = intOps;
9478 }
9479 else
9480 {
9481 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9482 op.ops = uintOps;
9483 }
9484 op.kind = 3;
9485 break;
9486 case 4:
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 22:
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 23:
9513 if(type->isSigned)
9514 {
9515 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9516 op.ops = intOps;
9517 }
9518 else
9519 {
9520 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9521 op.ops = uintOps;
9522 }
9523 op.kind = 3;
9524 break;
9525 case 6:
9526 op.f = (float)strtod(exp->constant, (((void *)0)));
9527 op.ops = floatOps;
9528 break;
9529 case 7:
9530 op.d = (double)strtod(exp->constant, (((void *)0)));
9531 op.ops = doubleOps;
9532 break;
9533 case 12:
9534 case 13:
9535 case 8:
9536 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9537 op.kind = 13;
9538 op.ops = uintOps;
9539 break;
9540 }
9541 }
9542 }
9543 return op;
9544 }
9545
9546 int __ecereVMethodID_class_OnGetString;
9547
9548 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9549
9550 static void UnusedFunction()
9551 {
9552 int a;
9553
9554 ((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);
9555 }
9556
9557 extern int __ecereVMethodID_class_OnGetString;
9558
9559 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9560 {
9561 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9562
9563 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9564 {
9565 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9566 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9567 else
9568 {
9569 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9570 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9571 struct Type * type;
9572 void * ptr = inst->data + dataMember->offset + offset;
9573 char * result = (((void *)0));
9574
9575 exp->loc = member->loc = inst->loc;
9576 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9577 if(!dataMember->dataType)
9578 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9579 type = dataMember->dataType;
9580 if(type->kind == 8)
9581 {
9582 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9583
9584 if(_class->type == 4)
9585 {
9586 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9587
9588 if(enumClass)
9589 {
9590 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9591 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9592
9593 for(item = e->values.first; item; item = item->next)
9594 {
9595 if((int)item->data == *(int *)ptr)
9596 {
9597 result = item->name;
9598 break;
9599 }
9600 }
9601 if(result)
9602 {
9603 exp->identifier = MkIdentifier(result);
9604 exp->type = 0;
9605 exp->destType = MkClassType(_class->fullName);
9606 ProcessExpressionType(exp);
9607 }
9608 }
9609 }
9610 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9611 {
9612 if(!_class->dataType)
9613 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9614 type = _class->dataType;
9615 }
9616 }
9617 if(!result)
9618 {
9619 switch(type->kind)
9620 {
9621 case 6:
9622 {
9623 FreeExpContents(exp);
9624 exp->constant = PrintFloat(*(float *)ptr);
9625 exp->type = 2;
9626 break;
9627 }
9628 case 7:
9629 {
9630 FreeExpContents(exp);
9631 exp->constant = PrintDouble(*(double *)ptr);
9632 exp->type = 2;
9633 break;
9634 }
9635 case 3:
9636 {
9637 FreeExpContents(exp);
9638 exp->constant = PrintInt(*(int *)ptr);
9639 exp->type = 2;
9640 break;
9641 }
9642 case 4:
9643 {
9644 FreeExpContents(exp);
9645 exp->constant = PrintInt64(*(long long *)ptr);
9646 exp->type = 2;
9647 break;
9648 }
9649 case 22:
9650 {
9651 FreeExpContents(exp);
9652 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9653 exp->type = 2;
9654 break;
9655 }
9656 case 23:
9657 {
9658 FreeExpContents(exp);
9659 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9660 exp->type = 2;
9661 break;
9662 }
9663 default:
9664 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9665 }
9666 }
9667 ListAdd(memberList, member);
9668 }
9669 if(parentDataMember->type == 1)
9670 break;
9671 }
9672 }
9673
9674 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9675
9676 void PopulateInstance(struct Instantiation * inst)
9677 {
9678 struct Symbol * classSym = inst->_class->symbol;
9679 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9680 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9681 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9682
9683 if(!inst->members)
9684 inst->members = MkListOne(MkMembersInitList(memberList));
9685 else
9686 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*inst->members), MkMembersInitList(memberList));
9687 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9688 {
9689 if(!dataMember->isProperty)
9690 {
9691 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9692 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9693 else
9694 {
9695 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9696 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9697 struct Type * type;
9698 void * ptr = inst->data + dataMember->offset;
9699 char * result = (((void *)0));
9700
9701 exp->loc = member->loc = inst->loc;
9702 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9703 if(!dataMember->dataType)
9704 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9705 type = dataMember->dataType;
9706 if(type->kind == 8)
9707 {
9708 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9709
9710 if(_class->type == 4)
9711 {
9712 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9713
9714 if(enumClass)
9715 {
9716 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9717 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9718
9719 for(item = e->values.first; item; item = item->next)
9720 {
9721 if((int)item->data == *(int *)ptr)
9722 {
9723 result = item->name;
9724 break;
9725 }
9726 }
9727 }
9728 if(result)
9729 {
9730 exp->identifier = MkIdentifier(result);
9731 exp->type = 0;
9732 exp->destType = MkClassType(_class->fullName);
9733 ProcessExpressionType(exp);
9734 }
9735 }
9736 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9737 {
9738 if(!_class->dataType)
9739 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9740 type = _class->dataType;
9741 }
9742 }
9743 if(!result)
9744 {
9745 switch(type->kind)
9746 {
9747 case 6:
9748 {
9749 exp->constant = PrintFloat(*(float *)ptr);
9750 exp->type = 2;
9751 break;
9752 }
9753 case 7:
9754 {
9755 exp->constant = PrintDouble(*(double *)ptr);
9756 exp->type = 2;
9757 break;
9758 }
9759 case 3:
9760 {
9761 exp->constant = PrintInt(*(int *)ptr);
9762 exp->type = 2;
9763 break;
9764 }
9765 case 4:
9766 {
9767 exp->constant = PrintInt64(*(long long *)ptr);
9768 exp->type = 2;
9769 break;
9770 }
9771 case 22:
9772 {
9773 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9774 exp->type = 2;
9775 break;
9776 }
9777 default:
9778 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9779 }
9780 }
9781 ListAdd(memberList, member);
9782 }
9783 }
9784 }
9785 }
9786
9787 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);
9788
9789 extern void FreeInstance(struct Instantiation * inst);
9790
9791 void ComputeInstantiation(struct Expression * exp)
9792 {
9793 struct Instantiation * inst = exp->instance;
9794 struct MembersInit * members;
9795 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9796 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9797 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9798 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9799 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9800 int subMemberStackPos = 0;
9801 uint64 bits = 0;
9802
9803 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9804 {
9805 if(inst->data)
9806 return ;
9807 if(_class->type == 0 || _class->type == 5)
9808 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9809 else
9810 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9811 }
9812 if(inst->members)
9813 {
9814 for(members = (*inst->members).first; members; members = members->next)
9815 {
9816 switch(members->type)
9817 {
9818 case 0:
9819 {
9820 if(members->dataMembers)
9821 {
9822 struct MemberInit * member;
9823
9824 for(member = (*members->dataMembers).first; member; member = member->next)
9825 {
9826 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9827 unsigned int found = 0x0;
9828 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9829 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9830 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9831 unsigned int dataMemberOffset;
9832
9833 if(!ident)
9834 {
9835 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9836 if(curMember)
9837 {
9838 if(curMember->isProperty)
9839 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9840 else
9841 {
9842 dataMember = curMember;
9843 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9844 }
9845 found = 0x1;
9846 }
9847 }
9848 else
9849 {
9850 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9851 if(prop)
9852 {
9853 found = 0x1;
9854 if(prop->memberAccess == 1)
9855 {
9856 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9857 curClass = prop->_class;
9858 }
9859 }
9860 else
9861 {
9862 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9863 int _subMemberStackPos = 0;
9864
9865 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9866 if(dataMember)
9867 {
9868 found = 0x1;
9869 if(dataMember->memberAccess == 1)
9870 {
9871 curMember = dataMember;
9872 curClass = dataMember->_class;
9873 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
9874 subMemberStackPos = _subMemberStackPos;
9875 }
9876 }
9877 }
9878 }
9879 if(found && member->initializer && member->initializer->type == 0)
9880 {
9881 struct Expression * value = member->initializer->exp;
9882 struct Type * type = (((void *)0));
9883 unsigned int deepMember = 0x0;
9884
9885 if(prop)
9886 {
9887 type = prop->dataType;
9888 }
9889 else if(dataMember)
9890 {
9891 if(!dataMember->dataType)
9892 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9893 type = dataMember->dataType;
9894 }
9895 if(ident && ident->next)
9896 {
9897 deepMember = 0x1;
9898 for(ident = ident->next; ident && type; ident = ident->next)
9899 {
9900 if(type->kind == 8)
9901 {
9902 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9903 if(prop)
9904 type = prop->dataType;
9905 else
9906 {
9907 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9908 if(dataMember)
9909 type = dataMember->dataType;
9910 }
9911 }
9912 else if(type->kind == 9 || type->kind == 10)
9913 {
9914 struct Type * memberType;
9915
9916 for(memberType = type->members.first; memberType; memberType = memberType->next)
9917 {
9918 if(!strcmp(memberType->name, ident->string))
9919 {
9920 type = memberType;
9921 break;
9922 }
9923 }
9924 }
9925 }
9926 }
9927 if(value)
9928 {
9929 FreeType(value->destType);
9930 value->destType = type;
9931 if(type)
9932 type->refCount++;
9933 ComputeExpression(value);
9934 }
9935 if(!deepMember && type && value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9936 {
9937 if(type->kind == 8)
9938 {
9939 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9940
9941 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9942 {
9943 if(!_class->dataType)
9944 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9945 type = _class->dataType;
9946 }
9947 }
9948 if(dataMember)
9949 {
9950 void * ptr = inst->data + dataMemberOffset;
9951
9952 if(value->type == 2)
9953 {
9954 switch(type->kind)
9955 {
9956 case 3:
9957 {
9958 GetInt(value, (int *)ptr);
9959 break;
9960 }
9961 case 4:
9962 {
9963 GetInt64(value, (long long *)ptr);
9964 break;
9965 }
9966 case 22:
9967 {
9968 GetIntPtr(value, (intptr_t *)ptr);
9969 break;
9970 }
9971 case 23:
9972 {
9973 GetIntSize(value, (ssize_t *)ptr);
9974 break;
9975 }
9976 case 6:
9977 {
9978 GetFloat(value, (float *)ptr);
9979 break;
9980 }
9981 case 7:
9982 {
9983 GetDouble(value, (double *)ptr);
9984 break;
9985 }
9986 }
9987 }
9988 else if(value->type == 1)
9989 {
9990 if(type->kind == 8)
9991 {
9992 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9993
9994 if(_class->type == 1)
9995 {
9996 ComputeTypeSize(type);
9997 if(value->instance->data)
9998 memcpy(ptr, value->instance->data, type->size);
9999 }
10000 }
10001 }
10002 }
10003 else if(prop)
10004 {
10005 if(value->type == 1 && value->instance->data)
10006 {
10007 if(type->kind == 8)
10008 {
10009 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10010
10011 if(_class && (_class->type != 0 || __ecereNameSpace__ecere__com__eClass_IsDerived(((struct __ecereNameSpace__ecere__com__Instance *)(char *)((struct __ecereNameSpace__ecere__com__Instance *)value->instance->data))->_class, _class)))
10012 {
10013 void (* Set)(void *, void *) = (void *)prop->Set;
10014
10015 Set(inst->data, value->instance->data);
10016 PopulateInstance(inst);
10017 }
10018 }
10019 }
10020 else if(value->type == 2)
10021 {
10022 switch(type->kind)
10023 {
10024 case 7:
10025 {
10026 void (* Set)(void *, double) = (void *)prop->Set;
10027
10028 Set(inst->data, strtod(value->constant, (((void *)0))));
10029 break;
10030 }
10031 case 6:
10032 {
10033 void (* Set)(void *, float) = (void *)prop->Set;
10034
10035 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
10036 break;
10037 }
10038 case 3:
10039 {
10040 void (* Set)(void *, int) = (void *)prop->Set;
10041
10042 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
10043 break;
10044 }
10045 case 4:
10046 {
10047 void (* Set)(void *, long long) = (void *)prop->Set;
10048
10049 Set(inst->data, __ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10050 break;
10051 }
10052 case 22:
10053 {
10054 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10055
10056 Set(inst->data, (intptr_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10057 break;
10058 }
10059 case 23:
10060 {
10061 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10062
10063 Set(inst->data, (ssize_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10064 break;
10065 }
10066 }
10067 }
10068 else if(value->type == 3)
10069 {
10070 char temp[1024];
10071
10072 ReadString(temp, value->string);
10073 ((void (*)(void *, void *))(void *)prop->Set)(inst->data, temp);
10074 }
10075 }
10076 }
10077 else if(!deepMember && type && _class->type == 3)
10078 {
10079 if(prop)
10080 {
10081 if(value->type == 2)
10082 {
10083 if(type->kind == 8)
10084 {
10085 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10086
10087 if(_class->type == 3)
10088 {
10089 if(!_class->dataType)
10090 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10091 type = _class->dataType;
10092 }
10093 }
10094 switch(type->kind)
10095 {
10096 case 6:
10097 {
10098 float fValue;
10099 float (* Set)(float) = (void *)prop->Set;
10100
10101 GetFloat(member->initializer->exp, &fValue);
10102 exp->constant = PrintFloat(Set(fValue));
10103 exp->type = 2;
10104 break;
10105 }
10106 case 7:
10107 {
10108 double dValue;
10109 double (* Set)(double) = (void *)prop->Set;
10110
10111 GetDouble(member->initializer->exp, &dValue);
10112 exp->constant = PrintDouble(Set(dValue));
10113 exp->type = 2;
10114 break;
10115 }
10116 }
10117 }
10118 }
10119 }
10120 else if(!deepMember && type && _class->type == 2)
10121 {
10122 if(prop)
10123 {
10124 if(value->type == 1 && value->instance->data)
10125 {
10126 unsigned int (* Set)(void *) = (void *)prop->Set;
10127
10128 bits = Set(value->instance->data);
10129 }
10130 else if(value->type == 2)
10131 {
10132 }
10133 }
10134 else if(dataMember)
10135 {
10136 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
10137 struct Type * type;
10138 int part = 0;
10139
10140 GetInt(value, &part);
10141 bits = (bits & ~bitMember->mask);
10142 if(!bitMember->dataType)
10143 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
10144 type = bitMember->dataType;
10145 if(type->kind == 8 && type->_class && type->_class->registered)
10146 {
10147 if(!type->_class->registered->dataType)
10148 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
10149 type = type->_class->registered->dataType;
10150 }
10151 switch(type->kind)
10152 {
10153 case 1:
10154 if(type->isSigned)
10155 bits |= ((char)part << bitMember->pos);
10156 else
10157 bits |= ((unsigned char)part << bitMember->pos);
10158 break;
10159 case 2:
10160 if(type->isSigned)
10161 bits |= ((short)part << bitMember->pos);
10162 else
10163 bits |= ((unsigned short)part << bitMember->pos);
10164 break;
10165 case 3:
10166 case 5:
10167 if(type->isSigned)
10168 bits |= (part << bitMember->pos);
10169 else
10170 bits |= ((unsigned int)part << bitMember->pos);
10171 break;
10172 case 4:
10173 if(type->isSigned)
10174 bits |= ((long long)part << bitMember->pos);
10175 else
10176 bits |= ((uint64)part << bitMember->pos);
10177 break;
10178 case 22:
10179 if(type->isSigned)
10180 {
10181 bits |= ((intptr_t)part << bitMember->pos);
10182 }
10183 else
10184 {
10185 bits |= ((uintptr_t)part << bitMember->pos);
10186 }
10187 break;
10188 case 23:
10189 if(type->isSigned)
10190 {
10191 bits |= ((ssize_t)part << bitMember->pos);
10192 }
10193 else
10194 {
10195 bits |= ((size_t)part << bitMember->pos);
10196 }
10197 break;
10198 }
10199 }
10200 }
10201 }
10202 else
10203 {
10204 if(_class && _class->type == 3)
10205 {
10206 ComputeExpression(member->initializer->exp);
10207 exp->constant = member->initializer->exp->constant;
10208 exp->type = 2;
10209 member->initializer->exp->constant = (((void *)0));
10210 }
10211 }
10212 }
10213 }
10214 break;
10215 }
10216 }
10217 }
10218 }
10219 if(_class && _class->type == 2)
10220 {
10221 exp->constant = PrintHexUInt(bits);
10222 exp->type = 2;
10223 }
10224 if(exp->type != 1)
10225 {
10226 FreeInstance(inst);
10227 }
10228 }
10229
10230 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
10231 {
10232 if(exp->op.op == SIZEOF)
10233 {
10234 FreeExpContents(exp);
10235 exp->type = 2;
10236 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
10237 }
10238 else
10239 {
10240 if(!exp->op.exp1)
10241 {
10242 switch(exp->op.op)
10243 {
10244 case '+':
10245 {
10246 struct Expression * exp2 = exp->op.exp2;
10247
10248 exp->op.exp2 = (((void *)0));
10249 FreeExpContents(exp);
10250 FreeType(exp->expType);
10251 FreeType(exp->destType);
10252 *exp = *exp2;
10253 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
10254 break;
10255 }
10256 case '-':
10257 if(op1->ops.Neg)
10258 {
10259 FreeExpContents(exp);
10260 op1->ops.Neg(exp, op1);
10261 }
10262 break;
10263 case '~':
10264 if(op1->ops.BitNot)
10265 {
10266 FreeExpContents(exp);
10267 op1->ops.BitNot(exp, op1);
10268 }
10269 break;
10270 case '!':
10271 if(op1->ops.Not)
10272 {
10273 FreeExpContents(exp);
10274 op1->ops.Not(exp, op1);
10275 }
10276 break;
10277 }
10278 }
10279 else
10280 {
10281 switch(exp->op.op)
10282 {
10283 case '+':
10284 if(op1->ops.Add)
10285 {
10286 FreeExpContents(exp);
10287 op1->ops.Add(exp, op1, op2);
10288 }
10289 break;
10290 case '-':
10291 if(op1->ops.Sub)
10292 {
10293 FreeExpContents(exp);
10294 op1->ops.Sub(exp, op1, op2);
10295 }
10296 break;
10297 case '*':
10298 if(op1->ops.Mul)
10299 {
10300 FreeExpContents(exp);
10301 op1->ops.Mul(exp, op1, op2);
10302 }
10303 break;
10304 case '/':
10305 if(op1->ops.Div)
10306 {
10307 FreeExpContents(exp);
10308 op1->ops.Div(exp, op1, op2);
10309 }
10310 break;
10311 case '%':
10312 if(op1->ops.Mod)
10313 {
10314 FreeExpContents(exp);
10315 op1->ops.Mod(exp, op1, op2);
10316 }
10317 break;
10318 case '&':
10319 if(exp->op.exp2)
10320 {
10321 if(op1->ops.BitAnd)
10322 {
10323 FreeExpContents(exp);
10324 op1->ops.BitAnd(exp, op1, op2);
10325 }
10326 }
10327 break;
10328 case '|':
10329 if(op1->ops.BitOr)
10330 {
10331 FreeExpContents(exp);
10332 op1->ops.BitOr(exp, op1, op2);
10333 }
10334 break;
10335 case '^':
10336 if(op1->ops.BitXor)
10337 {
10338 FreeExpContents(exp);
10339 op1->ops.BitXor(exp, op1, op2);
10340 }
10341 break;
10342 case LEFT_OP:
10343 if(op1->ops.LShift)
10344 {
10345 FreeExpContents(exp);
10346 op1->ops.LShift(exp, op1, op2);
10347 }
10348 break;
10349 case RIGHT_OP:
10350 if(op1->ops.RShift)
10351 {
10352 FreeExpContents(exp);
10353 op1->ops.RShift(exp, op1, op2);
10354 }
10355 break;
10356 case EQ_OP:
10357 if(op1->ops.Equ)
10358 {
10359 FreeExpContents(exp);
10360 op1->ops.Equ(exp, op1, op2);
10361 }
10362 break;
10363 case NE_OP:
10364 if(op1->ops.Nqu)
10365 {
10366 FreeExpContents(exp);
10367 op1->ops.Nqu(exp, op1, op2);
10368 }
10369 break;
10370 case AND_OP:
10371 if(op1->ops.And)
10372 {
10373 FreeExpContents(exp);
10374 op1->ops.And(exp, op1, op2);
10375 }
10376 break;
10377 case OR_OP:
10378 if(op1->ops.Or)
10379 {
10380 FreeExpContents(exp);
10381 op1->ops.Or(exp, op1, op2);
10382 }
10383 break;
10384 case '>':
10385 if(op1->ops.Grt)
10386 {
10387 FreeExpContents(exp);
10388 op1->ops.Grt(exp, op1, op2);
10389 }
10390 break;
10391 case '<':
10392 if(op1->ops.Sma)
10393 {
10394 FreeExpContents(exp);
10395 op1->ops.Sma(exp, op1, op2);
10396 }
10397 break;
10398 case GE_OP:
10399 if(op1->ops.GrtEqu)
10400 {
10401 FreeExpContents(exp);
10402 op1->ops.GrtEqu(exp, op1, op2);
10403 }
10404 break;
10405 case LE_OP:
10406 if(op1->ops.SmaEqu)
10407 {
10408 FreeExpContents(exp);
10409 op1->ops.SmaEqu(exp, op1, op2);
10410 }
10411 break;
10412 }
10413 }
10414 }
10415 }
10416
10417 void PrintTypeNoConst(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
10418
10419 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10420
10421 void ComputeExpression(struct Expression * exp)
10422 {
10423 char expString[10240];
10424
10425 expString[0] = '\0';
10426 switch(exp->type)
10427 {
10428 case 1:
10429 {
10430 ComputeInstantiation(exp);
10431 break;
10432 }
10433 case 4:
10434 {
10435 struct Expression * exp1, * exp2 = (((void *)0));
10436 struct Operand op1 = 
10437 {
10438 0, 0, 0, 0, 
10439 {
10440 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10441 }
10442 };
10443 struct Operand op2 = 
10444 {
10445 0, 0, 0, 0, 
10446 {
10447 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10448 }
10449 };
10450
10451 if(exp->op.exp2)
10452 ComputeExpression(exp->op.exp2);
10453 if(exp->op.exp1)
10454 {
10455 ComputeExpression(exp->op.exp1);
10456 exp1 = exp->op.exp1;
10457 exp2 = exp->op.exp2;
10458 op1 = GetOperand(exp1);
10459 if(op1.type)
10460 op1.type->refCount++;
10461 if(exp2)
10462 {
10463 op2 = GetOperand(exp2);
10464 if(op2.type)
10465 op2.type->refCount++;
10466 }
10467 }
10468 else
10469 {
10470 exp1 = exp->op.exp2;
10471 op1 = GetOperand(exp1);
10472 if(op1.type)
10473 op1.type->refCount++;
10474 }
10475 CallOperator(exp, exp1, exp2, &op1, &op2);
10476 if(op1.type)
10477 FreeType(op1.type);
10478 if(op2.type)
10479 FreeType(op2.type);
10480 break;
10481 }
10482 case 5:
10483 case 34:
10484 {
10485 struct Expression * e, * n;
10486
10487 for(e = (*exp->list).first; e; e = n)
10488 {
10489 n = e->next;
10490 if(!n)
10491 {
10492 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10493
10494 ComputeExpression(e);
10495 FreeType(exp->expType);
10496 FreeType(exp->destType);
10497 *exp = *e;
10498 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10499 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10500 }
10501 else
10502 {
10503 FreeExpression(e);
10504 }
10505 }
10506 break;
10507 }
10508 case 8:
10509 {
10510 struct Expression * memberExp = exp->member.exp;
10511 struct Identifier * memberID = exp->member.member;
10512 struct Type * type;
10513
10514 ComputeExpression(exp->member.exp);
10515 type = exp->member.exp->expType;
10516 if(type)
10517 {
10518 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)));
10519 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10520 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10521 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10522
10523 if(type->kind == 19 && exp->member.exp->type == 26)
10524 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10525 if(!_class)
10526 {
10527 char string[256];
10528 struct Symbol * classSym;
10529
10530 string[0] = '\0';
10531 PrintTypeNoConst(type, string, 0x0, 0x1);
10532 classSym = FindClass(string);
10533 _class = classSym ? classSym->registered : (((void *)0));
10534 }
10535 if(exp->member.member)
10536 {
10537 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10538 if(!prop)
10539 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10540 }
10541 if(!prop && !member && _class && exp->member.member)
10542 {
10543 struct Symbol * classSym = FindClass(exp->member.member->string);
10544
10545 convertTo = _class;
10546 _class = classSym ? classSym->registered : (((void *)0));
10547 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10548 }
10549 if(prop)
10550 {
10551 if(prop->compiled)
10552 {
10553 struct Type * type = prop->dataType;
10554
10555 if(_class->type == 3)
10556 {
10557 if(type->kind == 8)
10558 {
10559 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10560
10561 if(_class->type == 3)
10562 {
10563 if(!_class->dataType)
10564 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10565 type = _class->dataType;
10566 }
10567 }
10568 switch(type->kind)
10569 {
10570 case 6:
10571 {
10572 float value;
10573 float (* Get)(float) = (void *)prop->Get;
10574
10575 GetFloat(exp->member.exp, &value);
10576 exp->constant = PrintFloat(Get ? Get(value) : value);
10577 exp->type = 2;
10578 break;
10579 }
10580 case 7:
10581 {
10582 double value;
10583 double (* Get)(double);
10584
10585 GetDouble(exp->member.exp, &value);
10586 if(convertTo)
10587 Get = (void *)prop->Set;
10588 else
10589 Get = (void *)prop->Get;
10590 exp->constant = PrintDouble(Get ? Get(value) : value);
10591 exp->type = 2;
10592 break;
10593 }
10594 }
10595 }
10596 else
10597 {
10598 if(convertTo)
10599 {
10600 struct Expression * value = exp->member.exp;
10601 struct Type * type;
10602
10603 if(!prop->dataType)
10604 ProcessPropertyType(prop);
10605 type = prop->dataType;
10606 if(!type)
10607 {
10608 }
10609 else if(_class->type == 1)
10610 {
10611 switch(type->kind)
10612 {
10613 case 8:
10614 {
10615 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10616
10617 if(propertyClass->type == 1 && value->type == 1)
10618 {
10619 void (* Set)(void *, void *) = (void *)prop->Set;
10620
10621 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10622 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10623 exp->instance->_class = MkSpecifierName(_class->fullName);
10624 exp->instance->loc = exp->loc;
10625 exp->type = 1;
10626 Set(exp->instance->data, value->instance->data);
10627 PopulateInstance(exp->instance);
10628 }
10629 break;
10630 }
10631 case 3:
10632 {
10633 int intValue;
10634 void (* Set)(void *, int) = (void *)prop->Set;
10635
10636 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10637 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10638 exp->instance->_class = MkSpecifierName(_class->fullName);
10639 exp->instance->loc = exp->loc;
10640 exp->type = 1;
10641 GetInt(value, &intValue);
10642 Set(exp->instance->data, intValue);
10643 PopulateInstance(exp->instance);
10644 break;
10645 }
10646 case 4:
10647 {
10648 long long intValue;
10649 void (* Set)(void *, long long) = (void *)prop->Set;
10650
10651 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10652 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10653 exp->instance->_class = MkSpecifierName(_class->fullName);
10654 exp->instance->loc = exp->loc;
10655 exp->type = 1;
10656 GetInt64(value, &intValue);
10657 Set(exp->instance->data, intValue);
10658 PopulateInstance(exp->instance);
10659 break;
10660 }
10661 case 22:
10662 {
10663 intptr_t intValue;
10664 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10665
10666 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10667 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10668 exp->instance->_class = MkSpecifierName(_class->fullName);
10669 exp->instance->loc = exp->loc;
10670 exp->type = 1;
10671 GetIntPtr(value, &intValue);
10672 Set(exp->instance->data, intValue);
10673 PopulateInstance(exp->instance);
10674 break;
10675 }
10676 case 23:
10677 {
10678 ssize_t intValue;
10679 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10680
10681 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10682 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10683 exp->instance->_class = MkSpecifierName(_class->fullName);
10684 exp->instance->loc = exp->loc;
10685 exp->type = 1;
10686 GetIntSize(value, &intValue);
10687 Set(exp->instance->data, intValue);
10688 PopulateInstance(exp->instance);
10689 break;
10690 }
10691 case 7:
10692 {
10693 double doubleValue;
10694 void (* Set)(void *, double) = (void *)prop->Set;
10695
10696 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10697 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10698 exp->instance->_class = MkSpecifierName(_class->fullName);
10699 exp->instance->loc = exp->loc;
10700 exp->type = 1;
10701 GetDouble(value, &doubleValue);
10702 Set(exp->instance->data, doubleValue);
10703 PopulateInstance(exp->instance);
10704 break;
10705 }
10706 }
10707 }
10708 else if(_class->type == 2)
10709 {
10710 switch(type->kind)
10711 {
10712 case 8:
10713 {
10714 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10715
10716 if(propertyClass->type == 1 && value->instance->data)
10717 {
10718 unsigned int (* Set)(void *) = (void *)prop->Set;
10719 unsigned int bits = Set(value->instance->data);
10720
10721 exp->constant = PrintHexUInt(bits);
10722 exp->type = 2;
10723 break;
10724 }
10725 else if(_class->type == 2)
10726 {
10727 unsigned int value;
10728 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10729 unsigned int bits;
10730
10731 GetUInt(exp->member.exp, &value);
10732 bits = Set(value);
10733 exp->constant = PrintHexUInt(bits);
10734 exp->type = 2;
10735 }
10736 }
10737 }
10738 }
10739 }
10740 else
10741 {
10742 if(_class->type == 2)
10743 {
10744 unsigned int value;
10745
10746 GetUInt(exp->member.exp, &value);
10747 switch(type->kind)
10748 {
10749 case 8:
10750 {
10751 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10752
10753 if(_class->type == 1)
10754 {
10755 void (* Get)(unsigned int, void *) = (void *)prop->Get;
10756
10757 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10758 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10759 exp->instance->_class = MkSpecifierName(_class->fullName);
10760 exp->instance->loc = exp->loc;
10761 exp->type = 1;
10762 Get(value, exp->instance->data);
10763 PopulateInstance(exp->instance);
10764 }
10765 else if(_class->type == 2)
10766 {
10767 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10768 uint64 bits = Get(value);
10769
10770 exp->constant = PrintHexUInt64(bits);
10771 exp->type = 2;
10772 }
10773 break;
10774 }
10775 }
10776 }
10777 else if(_class->type == 1)
10778 {
10779 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10780
10781 switch(type->kind)
10782 {
10783 case 8:
10784 {
10785 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10786
10787 if(_class->type == 1 && value)
10788 {
10789 void (* Get)(void *, void *) = (void *)prop->Get;
10790
10791 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10792 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10793 exp->instance->_class = MkSpecifierName(_class->fullName);
10794 exp->instance->loc = exp->loc;
10795 exp->type = 1;
10796 Get(value, exp->instance->data);
10797 PopulateInstance(exp->instance);
10798 }
10799 break;
10800 }
10801 }
10802 }
10803 }
10804 }
10805 }
10806 else
10807 {
10808 exp->isConstant = 0x0;
10809 }
10810 }
10811 else if(member)
10812 {
10813 }
10814 }
10815 if(exp->type != 8)
10816 {
10817 FreeExpression(memberExp);
10818 FreeIdentifier(memberID);
10819 }
10820 break;
10821 }
10822 case 10:
10823 {
10824 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10825
10826 FreeExpContents(exp);
10827 exp->constant = PrintUInt(ComputeTypeSize(type));
10828 exp->type = 2;
10829 FreeType(type);
10830 break;
10831 }
10832 case 15:
10833 {
10834 struct Symbol * classSym = exp->_class->symbol;
10835
10836 if(classSym && classSym->registered)
10837 {
10838 if(classSym->registered->fixed)
10839 {
10840 FreeSpecifier(exp->_class);
10841 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10842 exp->type = 2;
10843 }
10844 else
10845 {
10846 char className[1024];
10847
10848 strcpy(className, "__ecereClass_");
10849 FullClassNameCat(className, classSym->string, 0x1);
10850 MangleClassName(className);
10851 FreeExpContents(exp);
10852 exp->type = 9;
10853 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10854 exp->member.member = MkIdentifier("structSize");
10855 }
10856 }
10857 break;
10858 }
10859 case 11:
10860 {
10861 struct Type * type;
10862 struct Expression * e = exp;
10863
10864 if(exp->type == 11)
10865 {
10866 if(exp->cast.exp)
10867 ComputeExpression(exp->cast.exp);
10868 e = exp->cast.exp;
10869 }
10870 if(e && exp->expType)
10871 {
10872 type = exp->expType;
10873 if(type->kind == 8)
10874 {
10875 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10876
10877 if(_class && (_class->type == 3 || _class->type == 2))
10878 {
10879 if(!_class->dataType)
10880 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10881 type = _class->dataType;
10882 }
10883 }
10884 switch(type->kind)
10885 {
10886 case 1:
10887 if(type->isSigned)
10888 {
10889 char value;
10890
10891 GetChar(e, &value);
10892 FreeExpContents(exp);
10893 exp->constant = PrintChar(value);
10894 exp->type = 2;
10895 }
10896 else
10897 {
10898 unsigned char value;
10899
10900 GetUChar(e, &value);
10901 FreeExpContents(exp);
10902 exp->constant = PrintUChar(value);
10903 exp->type = 2;
10904 }
10905 break;
10906 case 2:
10907 if(type->isSigned)
10908 {
10909 short value;
10910
10911 GetShort(e, &value);
10912 FreeExpContents(exp);
10913 exp->constant = PrintShort(value);
10914 exp->type = 2;
10915 }
10916 else
10917 {
10918 unsigned short value;
10919
10920 GetUShort(e, &value);
10921 FreeExpContents(exp);
10922 exp->constant = PrintUShort(value);
10923 exp->type = 2;
10924 }
10925 break;
10926 case 3:
10927 if(type->isSigned)
10928 {
10929 int value;
10930
10931 GetInt(e, &value);
10932 FreeExpContents(exp);
10933 exp->constant = PrintInt(value);
10934 exp->type = 2;
10935 }
10936 else
10937 {
10938 unsigned int value;
10939
10940 GetUInt(e, &value);
10941 FreeExpContents(exp);
10942 exp->constant = PrintUInt(value);
10943 exp->type = 2;
10944 }
10945 break;
10946 case 4:
10947 if(type->isSigned)
10948 {
10949 long long value;
10950
10951 GetInt64(e, &value);
10952 FreeExpContents(exp);
10953 exp->constant = PrintInt64(value);
10954 exp->type = 2;
10955 }
10956 else
10957 {
10958 uint64 value;
10959
10960 GetUInt64(e, &value);
10961 FreeExpContents(exp);
10962 exp->constant = PrintUInt64(value);
10963 exp->type = 2;
10964 }
10965 break;
10966 case 22:
10967 if(type->isSigned)
10968 {
10969 intptr_t value;
10970
10971 GetIntPtr(e, &value);
10972 FreeExpContents(exp);
10973 exp->constant = PrintInt64((long long)value);
10974 exp->type = 2;
10975 }
10976 else
10977 {
10978 uintptr_t value;
10979
10980 GetUIntPtr(e, &value);
10981 FreeExpContents(exp);
10982 exp->constant = PrintUInt64((uint64)value);
10983 exp->type = 2;
10984 }
10985 break;
10986 case 23:
10987 if(type->isSigned)
10988 {
10989 ssize_t value;
10990
10991 GetIntSize(e, &value);
10992 FreeExpContents(exp);
10993 exp->constant = PrintInt64((long long)value);
10994 exp->type = 2;
10995 }
10996 else
10997 {
10998 size_t value;
10999
11000 GetUIntSize(e, &value);
11001 FreeExpContents(exp);
11002 exp->constant = PrintUInt64((uint64)value);
11003 exp->type = 2;
11004 }
11005 break;
11006 case 6:
11007 {
11008 float value;
11009
11010 GetFloat(e, &value);
11011 FreeExpContents(exp);
11012 exp->constant = PrintFloat(value);
11013 exp->type = 2;
11014 break;
11015 }
11016 case 7:
11017 {
11018 double value;
11019
11020 GetDouble(e, &value);
11021 FreeExpContents(exp);
11022 exp->constant = PrintDouble(value);
11023 exp->type = 2;
11024 break;
11025 }
11026 }
11027 }
11028 break;
11029 }
11030 case 12:
11031 {
11032 struct Operand op1 = 
11033 {
11034 0, 0, 0, 0, 
11035 {
11036 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11037 }
11038 };
11039 struct Operand op2 = 
11040 {
11041 0, 0, 0, 0, 
11042 {
11043 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11044 }
11045 };
11046 struct Operand op3 = 
11047 {
11048 0, 0, 0, 0, 
11049 {
11050 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11051 }
11052 };
11053
11054 if(exp->cond.exp)
11055 ComputeExpression((*exp->cond.exp).last);
11056 if(exp->cond.elseExp)
11057 ComputeExpression(exp->cond.elseExp);
11058 if(exp->cond.cond)
11059 ComputeExpression(exp->cond.cond);
11060 op1 = GetOperand(exp->cond.cond);
11061 if(op1.type)
11062 op1.type->refCount++;
11063 op2 = GetOperand((*exp->cond.exp).last);
11064 if(op2.type)
11065 op2.type->refCount++;
11066 op3 = GetOperand(exp->cond.elseExp);
11067 if(op3.type)
11068 op3.type->refCount++;
11069 if(op1.ops.Cond)
11070 {
11071 FreeExpContents(exp);
11072 op1.ops.Cond(exp, &op1, &op2, &op3);
11073 }
11074 if(op1.type)
11075 FreeType(op1.type);
11076 if(op2.type)
11077 FreeType(op2.type);
11078 if(op3.type)
11079 FreeType(op3.type);
11080 break;
11081 }
11082 }
11083 }
11084
11085 void ApplyAnyObjectLogic(struct Expression * e);
11086
11087 extern void CopyTypeInto(struct Type * type, struct Type * src);
11088
11089 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
11090 {
11091 unsigned int result = 0x1;
11092
11093 if(destType)
11094 {
11095 struct __ecereNameSpace__ecere__sys__OldList converts = 
11096 {
11097 0, 0, 0, 0, 0
11098 };
11099 struct Conversion * convert;
11100
11101 if(destType->kind == 0)
11102 return 0x0;
11103 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
11104 result = 0x0;
11105 if(converts.count)
11106 {
11107 for(convert = converts.first; convert; convert = convert->next)
11108 {
11109 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
11110
11111 if(!empty)
11112 {
11113 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11114 int objectType = exp->expType ? exp->expType->classObjectType : 0;
11115
11116 *newExp = *exp;
11117 newExp->destType = (((void *)0));
11118 if(convert->isGet)
11119 {
11120 exp->type = 8;
11121 exp->addedThis = 0x1;
11122 exp->member.exp = newExp;
11123 FreeType(exp->member.exp->expType);
11124 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
11125 exp->member.exp->expType->classObjectType = objectType;
11126 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
11127 exp->member.memberType = 1;
11128 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11129 exp->needCast = 0x1;
11130 if(exp->expType)
11131 exp->expType->refCount++;
11132 ApplyAnyObjectLogic(exp->member.exp);
11133 }
11134 else
11135 {
11136 {
11137 exp->type = 8;
11138 exp->addedThis = 0x1;
11139 exp->member.exp = newExp;
11140 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
11141 {
11142 newExp->byReference = 0x1;
11143 }
11144 FreeType(exp->member.exp->expType);
11145 exp->member.exp->expType = (((void *)0));
11146 if(convert->convert->dataType)
11147 {
11148 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11149 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
11150 exp->member.exp->expType->refCount = 1;
11151 exp->member.exp->expType->classObjectType = objectType;
11152 ApplyAnyObjectLogic(exp->member.exp);
11153 }
11154 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
11155 exp->member.memberType = 4;
11156 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11157 exp->needCast = 0x1;
11158 if(convert->resultType)
11159 convert->resultType->refCount++;
11160 }
11161 }
11162 }
11163 else
11164 {
11165 FreeType(exp->expType);
11166 if(convert->isGet)
11167 {
11168 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11169 exp->needCast = 0x1;
11170 if(exp->expType)
11171 exp->expType->refCount++;
11172 }
11173 else
11174 {
11175 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11176 exp->needCast = 0x1;
11177 if(convert->resultType)
11178 convert->resultType->refCount++;
11179 }
11180 }
11181 }
11182 if(exp->isConstant && inCompiler)
11183 ComputeExpression(exp);
11184 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
11185 }
11186 if(!result && exp->expType && converts.count)
11187 {
11188 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
11189 }
11190 if(!result && exp->expType && exp->destType)
11191 {
11192 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))
11193 result = 0x1;
11194 }
11195 }
11196 return result;
11197 }
11198
11199 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
11200
11201 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
11202
11203 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
11204
11205 void CheckTemplateTypes(struct Expression * exp)
11206 {
11207 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
11208 {
11209 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11210 struct Statement * compound;
11211 struct Context * context;
11212
11213 *newExp = *exp;
11214 if(exp->destType)
11215 exp->destType->refCount++;
11216 if(exp->expType)
11217 exp->expType->refCount++;
11218 newExp->prev = (((void *)0));
11219 newExp->next = (((void *)0));
11220 switch(exp->expType->kind)
11221 {
11222 case 7:
11223 if(exp->destType->classObjectType)
11224 {
11225 if(exp->destType)
11226 exp->destType->refCount--;
11227 if(exp->expType)
11228 exp->expType->refCount--;
11229 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11230 }
11231 else
11232 {
11233 struct __ecereNameSpace__ecere__sys__OldList * specs;
11234 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11235 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11236
11237 context = PushContext();
11238 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11239 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11240 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11241 exp->type = 25;
11242 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11243 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
11244 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
11245 exp->compound->compound.context = context;
11246 PopContext(context);
11247 }
11248 break;
11249 default:
11250 exp->type = 11;
11251 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
11252 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11253 break;
11254 }
11255 }
11256 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
11257 {
11258 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11259 struct Statement * compound;
11260 struct Context * context;
11261
11262 *newExp = *exp;
11263 if(exp->destType)
11264 exp->destType->refCount++;
11265 if(exp->expType)
11266 exp->expType->refCount++;
11267 newExp->prev = (((void *)0));
11268 newExp->next = (((void *)0));
11269 switch(exp->expType->kind)
11270 {
11271 case 7:
11272 if(exp->destType->classObjectType)
11273 {
11274 if(exp->destType)
11275 exp->destType->refCount--;
11276 if(exp->expType)
11277 exp->expType->refCount--;
11278 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11279 }
11280 else
11281 {
11282 struct __ecereNameSpace__ecere__sys__OldList * specs;
11283 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11284 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11285
11286 context = PushContext();
11287 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11288 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11289 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11290 exp->type = 25;
11291 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11292 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
11293 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
11294 exp->compound->compound.context = context;
11295 PopContext(context);
11296 }
11297 break;
11298 case 8:
11299 {
11300 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
11301 {
11302 exp->type = 5;
11303 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
11304 ProcessExpressionType((*exp->list).first);
11305 break;
11306 }
11307 else
11308 {
11309 exp->type = 5;
11310 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
11311 newExp->needCast = 0x1;
11312 ProcessExpressionType((*exp->list).first);
11313 break;
11314 }
11315 }
11316 default:
11317 {
11318 if(exp->expType->kind == 20)
11319 {
11320 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
11321
11322 if(type)
11323 {
11324 FreeType(exp->destType);
11325 FreeType(exp->expType);
11326 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11327 break;
11328 }
11329 }
11330 if(newExp->type == 8 && newExp->member.memberType == 3)
11331 {
11332 exp->type = 4;
11333 exp->op.op = '*';
11334 exp->op.exp1 = (((void *)0));
11335 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
11336 }
11337 else
11338 {
11339 char typeString[1024];
11340 struct Declarator * decl;
11341 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11342
11343 typeString[0] = '\0';
11344 PrintType(exp->expType, typeString, 0x0, 0x0);
11345 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11346 exp->type = 11;
11347 exp->cast.typeName = MkTypeName(specs, decl);
11348 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11349 exp->cast.exp->needCast = 0x1;
11350 }
11351 break;
11352 }
11353 }
11354 }
11355 }
11356
11357 extern int strncmp(const char * , const char * , size_t n);
11358
11359 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
11360
11361 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
11362 {
11363 int nsLen = strlen(nameSpace);
11364 struct Symbol * symbol;
11365
11366 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)))
11367 {
11368 char * s = symbol->string;
11369
11370 if(!strncmp(s, nameSpace, nsLen))
11371 {
11372 int c;
11373 char * namePart;
11374
11375 for(c = strlen(s) - 1; c >= 0; c--)
11376 if(s[c] == ':')
11377 break;
11378 namePart = s + c + 1;
11379 if(!strcmp(namePart, name))
11380 {
11381 return symbol;
11382 }
11383 }
11384 else
11385 break;
11386 }
11387 return (((void *)0));
11388 }
11389
11390 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
11391 {
11392 int c;
11393 char nameSpace[1024];
11394 char * namePart;
11395 unsigned int gotColon = 0x0;
11396
11397 nameSpace[0] = '\0';
11398 for(c = strlen(name) - 1; c >= 0; c--)
11399 if(name[c] == ':')
11400 {
11401 gotColon = 0x1;
11402 break;
11403 }
11404 namePart = name + c + 1;
11405 while(c >= 0 && name[c] == ':')
11406 c--;
11407 if(c >= 0)
11408 {
11409 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
11410
11411 if(symbol)
11412 return symbol;
11413 memcpy(nameSpace, name, c + 1);
11414 nameSpace[c + 1] = (char)0;
11415 return ScanWithNameSpace(tree, nameSpace, namePart);
11416 }
11417 else if(gotColon)
11418 {
11419 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11420
11421 return symbol;
11422 }
11423 else
11424 {
11425 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11426
11427 if(symbol)
11428 return symbol;
11429 return ScanWithNameSpace(tree, "", namePart);
11430 }
11431 return (((void *)0));
11432 }
11433
11434 static void ProcessDeclaration(struct Declaration * decl);
11435
11436 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
11437 {
11438 struct Context * ctx;
11439 struct Symbol * symbol = (((void *)0));
11440
11441 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
11442 {
11443 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
11444 {
11445 symbol = (((void *)0));
11446 if(thisNameSpace)
11447 {
11448 char curName[1024];
11449
11450 strcpy(curName, thisNameSpace);
11451 strcat(curName, "::");
11452 strcat(curName, name);
11453 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
11454 }
11455 if(!symbol)
11456 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
11457 }
11458 else
11459 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
11460 if(symbol || ctx == endContext)
11461 break;
11462 }
11463 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
11464 {
11465 if(symbol->pointerExternal->type == 0)
11466 {
11467 struct FunctionDefinition * function = symbol->pointerExternal->function;
11468 struct Context * tmpContext = curContext;
11469
11470 curContext = (((void *)0));
11471 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
11472 curContext = tmpContext;
11473 symbol->pointerExternal->symbol = symbol;
11474 DeclareType(symbol->type, 0x1, 0x1);
11475 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
11476 symbol->id = curExternal->symbol->idCode;
11477 }
11478 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
11479 {
11480 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
11481 symbol->id = curExternal->symbol->idCode;
11482 }
11483 }
11484 return symbol;
11485 }
11486
11487 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
11488 {
11489 if(!type->isSigned && type->kind != 22 && type->kind != 23)
11490 ListAdd(specs, MkSpecifier(UNSIGNED));
11491 switch(type->kind)
11492 {
11493 case 8:
11494 {
11495 if(type->_class->registered)
11496 {
11497 if(!type->_class->registered->dataType)
11498 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11499 GetTypeSpecs(type->_class->registered->dataType, specs);
11500 }
11501 break;
11502 }
11503 case 7:
11504 ListAdd(specs, MkSpecifier(DOUBLE));
11505 break;
11506 case 6:
11507 ListAdd(specs, MkSpecifier(FLOAT));
11508 break;
11509 case 1:
11510 ListAdd(specs, MkSpecifier(CHAR));
11511 break;
11512 case 2:
11513 ListAdd(specs, MkSpecifier(SHORT));
11514 break;
11515 case 4:
11516 ListAdd(specs, MkSpecifier(INT64));
11517 break;
11518 case 22:
11519 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
11520 break;
11521 case 23:
11522 ListAdd(specs, MkSpecifierName(type->isSigned ? "intsize" : "uintsize"));
11523 break;
11524 case 3:
11525 default:
11526 ListAdd(specs, MkSpecifier(INT));
11527 break;
11528 }
11529 }
11530
11531 static void PrintArraySize(struct Type * arrayType, char * string)
11532 {
11533 char size[256];
11534
11535 size[0] = '\0';
11536 strcat(size, "[");
11537 if(arrayType->enumClass)
11538 strcat(size, arrayType->enumClass->string);
11539 else if(arrayType->arraySizeExp)
11540 PrintExpression(arrayType->arraySizeExp, size);
11541 strcat(size, "]");
11542 strcat(string, size);
11543 }
11544
11545 static void PrintTypeSpecs(struct Type * type, char * string, unsigned int fullName, unsigned int printConst)
11546 {
11547 if(type)
11548 {
11549 if(printConst && type->constant)
11550 strcat(string, "const ");
11551 switch(type->kind)
11552 {
11553 case 8:
11554 {
11555 struct Symbol * c = type->_class;
11556
11557 if(type->classObjectType == 2)
11558 strcat(string, "typed_object");
11559 else if(type->classObjectType == 3)
11560 strcat(string, "any_object");
11561 else
11562 {
11563 if(c && c->string)
11564 strcat(string, (fullName || !c->registered) ? c->string : c->registered->name);
11565 }
11566 if(type->byReference)
11567 strcat(string, " &");
11568 break;
11569 }
11570 case 0:
11571 strcat(string, "void");
11572 break;
11573 case 3:
11574 strcat(string, type->isSigned ? "int" : "uint");
11575 break;
11576 case 4:
11577 strcat(string, type->isSigned ? "int64" : "uint64");
11578 break;
11579 case 22:
11580 strcat(string, type->isSigned ? "intptr" : "uintptr");
11581 break;
11582 case 23:
11583 strcat(string, type->isSigned ? "intsize" : "uintsize");
11584 break;
11585 case 1:
11586 strcat(string, type->isSigned ? "char" : "byte");
11587 break;
11588 case 2:
11589 strcat(string, type->isSigned ? "short" : "uint16");
11590 break;
11591 case 6:
11592 strcat(string, "float");
11593 break;
11594 case 7:
11595 strcat(string, "double");
11596 break;
11597 case 9:
11598 if(type->enumName)
11599 {
11600 strcat(string, "struct ");
11601 strcat(string, type->enumName);
11602 }
11603 else if(type->typeName)
11604 strcat(string, type->typeName);
11605 else
11606 {
11607 struct Type * member;
11608
11609 strcat(string, "struct { ");
11610 for(member = type->members.first; member; member = member->next)
11611 {
11612 PrintType(member, string, 0x1, fullName);
11613 strcat(string, "; ");
11614 }
11615 strcat(string, "}");
11616 }
11617 break;
11618 case 10:
11619 if(type->enumName)
11620 {
11621 strcat(string, "union ");
11622 strcat(string, type->enumName);
11623 }
11624 else if(type->typeName)
11625 strcat(string, type->typeName);
11626 else
11627 {
11628 strcat(string, "union ");
11629 strcat(string, "(unnamed)");
11630 }
11631 break;
11632 case 15:
11633 if(type->enumName)
11634 {
11635 strcat(string, "enum ");
11636 strcat(string, type->enumName);
11637 }
11638 else if(type->typeName)
11639 strcat(string, type->typeName);
11640 else
11641 strcat(string, "int");
11642 break;
11643 case 14:
11644 strcat(string, "...");
11645 break;
11646 case 19:
11647 strcat(string, "subclass(");
11648 strcat(string, type->_class ? type->_class->string : "int");
11649 strcat(string, ")");
11650 break;
11651 case 20:
11652 strcat(string, type->templateParameter->identifier->string);
11653 break;
11654 case 21:
11655 strcat(string, "thisclass");
11656 break;
11657 case 17:
11658 strcat(string, "__builtin_va_list");
11659 break;
11660 }
11661 }
11662 }
11663
11664 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
11665
11666 static void PrintName(struct Type * type, char * string, unsigned int fullName)
11667 {
11668 if(type->name && type->name[0])
11669 {
11670 if(fullName)
11671 strcat(string, type->name);
11672 else
11673 {
11674 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11675
11676 if(name)
11677 name += 2;
11678 else
11679 name = type->name;
11680 strcat(string, name);
11681 }
11682 }
11683 }
11684
11685 static void PrintAttribs(struct Type * type, char * string)
11686 {
11687 if(type)
11688 {
11689 if(type->dllExport)
11690 strcat(string, "dllexport ");
11691 if(type->attrStdcall)
11692 strcat(string, "stdcall ");
11693 }
11694 }
11695
11696 static void PrePrintType(struct Type * type, char * string, unsigned int fullName, struct Type * parentType, unsigned int printConst)
11697 {
11698 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
11699 {
11700 struct Type * attrType = (((void *)0));
11701
11702 if((type->kind == 11 || type->kind == 16) && (!parentType || parentType->kind != 13))
11703 PrintAttribs(type, string);
11704 if(printConst && type->constant && (type->kind == 11 || type->kind == 16))
11705 strcat(string, " const");
11706 PrePrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName, type, printConst);
11707 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
11708 strcat(string, " (");
11709 if(type->kind == 13)
11710 {
11711 if(type->type->kind == 11 || type->type->kind == 16)
11712 PrintAttribs(type->type, string);
11713 }
11714 if(type->kind == 13)
11715 {
11716 if(type->type->kind == 11 || type->type->kind == 16 || type->type->kind == 12)
11717 strcat(string, "*");
11718 else
11719 strcat(string, " *");
11720 }
11721 if(printConst && type->constant && type->kind == 13)
11722 strcat(string, " const");
11723 }
11724 else
11725 PrintTypeSpecs(type, string, fullName, printConst);
11726 }
11727
11728 static void PostPrintType(struct Type * type, char * string, unsigned int fullName)
11729 {
11730 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
11731 strcat(string, ")");
11732 if(type->kind == 12)
11733 PrintArraySize(type, string);
11734 else if(type->kind == 11)
11735 {
11736 struct Type * param;
11737
11738 strcat(string, "(");
11739 for(param = type->params.first; param; param = param->next)
11740 {
11741 PrintType(param, string, 0x1, fullName);
11742 if(param->next)
11743 strcat(string, ", ");
11744 }
11745 strcat(string, ")");
11746 }
11747 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
11748 PostPrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName);
11749 }
11750
11751 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName, unsigned int printConst)
11752 {
11753 PrePrintType(type, string, fullName, (((void *)0)), printConst);
11754 if(type->thisClass || (printName && type->name && type->name[0]))
11755 strcat(string, " ");
11756 if((type->thisClass || type->staticMethod))
11757 {
11758 struct Symbol * _class = type->thisClass;
11759
11760 if((type->classObjectType == 2 || type->classObjectType == 1) || (_class && !strcmp(_class->string, "class")))
11761 {
11762 if(type->classObjectType == 1)
11763 strcat(string, "class");
11764 else
11765 strcat(string, type->byReference ? "typed_object&" : "typed_object");
11766 }
11767 else if(_class && _class->string)
11768 {
11769 char * s = _class->string;
11770
11771 if(fullName)
11772 strcat(string, s);
11773 else
11774 {
11775 char * name = __ecereNameSpace__ecere__sys__RSearchString(s, "::", strlen(s), 0x1, 0x0);
11776
11777 if(name)
11778 name += 2;
11779 else
11780 name = s;
11781 strcat(string, name);
11782 }
11783 }
11784 strcat(string, "::");
11785 }
11786 if(printName && type->name)
11787 PrintName(type, string, fullName);
11788 PostPrintType(type, string, fullName);
11789 if(type->bitFieldCount)
11790 {
11791 char count[100];
11792
11793 sprintf(count, ":%d", type->bitFieldCount);
11794 strcat(string, count);
11795 }
11796 }
11797
11798 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11799 {
11800 _PrintType(type, string, printName, fullName, 0x1);
11801 }
11802
11803 void PrintTypeNoConst(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11804 {
11805 _PrintType(type, string, printName, fullName, 0x0);
11806 }
11807
11808 static struct Type * FindMember(struct Type * type, char * string)
11809 {
11810 struct Type * memberType;
11811
11812 for(memberType = type->members.first; memberType; memberType = memberType->next)
11813 {
11814 if(!memberType->name)
11815 {
11816 struct Type * subType = FindMember(memberType, string);
11817
11818 if(subType)
11819 return subType;
11820 }
11821 else if(!strcmp(memberType->name, string))
11822 return memberType;
11823 }
11824 return (((void *)0));
11825 }
11826
11827 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11828 {
11829 struct Type * memberType;
11830
11831 for(memberType = type->members.first; memberType; memberType = memberType->next)
11832 {
11833 if(!memberType->name)
11834 {
11835 struct Type * subType = FindMember(memberType, string);
11836
11837 if(subType)
11838 {
11839 *offset += memberType->offset;
11840 return subType;
11841 }
11842 }
11843 else if(!strcmp(memberType->name, string))
11844 {
11845 *offset += memberType->offset;
11846 return memberType;
11847 }
11848 }
11849 return (((void *)0));
11850 }
11851
11852 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11853
11854 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11855
11856 struct Expression * ParseExpressionString(char * expression)
11857 {
11858 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11859 ((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));
11860 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11861 echoOn = 0x0;
11862 parsedExpression = (((void *)0));
11863 resetScanner();
11864 expression_yyparse();
11865 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11866 return parsedExpression;
11867 }
11868
11869 extern char *  QMkString(char *  source);
11870
11871 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11872 {
11873 struct Identifier * id = exp->identifier;
11874 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11875 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11876 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11877 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11878
11879 if(_class && _class->type == 4)
11880 {
11881 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11882 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11883
11884 if(enumClass)
11885 {
11886 struct __ecereNameSpace__ecere__com__Class * baseClass;
11887
11888 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11889 {
11890 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11891
11892 for(value = e->values.first; value; value = value->next)
11893 {
11894 if(!strcmp(value->name, id->string))
11895 break;
11896 }
11897 if(value)
11898 {
11899 char constant[256];
11900
11901 FreeExpContents(exp);
11902 exp->type = 2;
11903 exp->isConstant = 0x1;
11904 if(!strcmp(baseClass->dataTypeString, "int"))
11905 sprintf(constant, "%d", (int)value->data);
11906 else
11907 sprintf(constant, "0x%X", (int)value->data);
11908 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11909 exp->expType = MkClassType(baseClass->fullName);
11910 break;
11911 }
11912 }
11913 }
11914 if(value)
11915 return 0x1;
11916 }
11917 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11918 {
11919 ProcessMethodType(method);
11920 exp->expType = __extension__ ({
11921 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11922
11923 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), __ecereInstance1;
11924 });
11925 return 0x1;
11926 }
11927 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11928 {
11929 if(!prop->dataType)
11930 ProcessPropertyType(prop);
11931 exp->expType = prop->dataType;
11932 if(prop->dataType)
11933 prop->dataType->refCount++;
11934 return 0x1;
11935 }
11936 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11937 {
11938 if(!member->dataType)
11939 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11940 exp->expType = member->dataType;
11941 if(member->dataType)
11942 member->dataType->refCount++;
11943 return 0x1;
11944 }
11945 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11946 {
11947 if(!classProp->dataType)
11948 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11949 if(classProp->constant)
11950 {
11951 FreeExpContents(exp);
11952 exp->isConstant = 0x1;
11953 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
11954 {
11955 exp->type = 3;
11956 exp->constant = QMkString((char *)classProp->Get(_class));
11957 }
11958 else
11959 {
11960 char constant[256];
11961
11962 exp->type = 2;
11963 sprintf(constant, "%d", (int)classProp->Get(_class));
11964 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11965 }
11966 }
11967 else
11968 {
11969 }
11970 exp->expType = classProp->dataType;
11971 if(classProp->dataType)
11972 classProp->dataType->refCount++;
11973 return 0x1;
11974 }
11975 return 0x0;
11976 }
11977
11978 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
11979 {
11980 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
11981 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
11982 struct __ecereNameSpace__ecere__com__NameSpace * child;
11983
11984 if(!data)
11985 {
11986 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)))
11987 {
11988 data = ScanGlobalData(child, name);
11989 if(data)
11990 break;
11991 }
11992 }
11993 return data;
11994 }
11995
11996 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
11997
11998 extern char *  strncpy(char * , const char * , size_t n);
11999
12000 static struct GlobalData * FindGlobalData(char * name)
12001 {
12002 int start = 0, c;
12003 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
12004
12005 nameSpace = globalData;
12006 for(c = 0; name[c]; c++)
12007 {
12008 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
12009 {
12010 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
12011 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
12012
12013 strncpy(spaceName, name + start, c - start);
12014 spaceName[c - start] = '\0';
12015 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
12016 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
12017 if(!newSpace)
12018 return (((void *)0));
12019 nameSpace = newSpace;
12020 if(name[c] == ':')
12021 c++;
12022 start = c + 1;
12023 }
12024 }
12025 if(c - start)
12026 {
12027 return ScanGlobalData(nameSpace, name + start);
12028 }
12029 return (((void *)0));
12030 }
12031
12032 static int definedExpStackPos;
12033
12034 static void * definedExpStack[512];
12035
12036 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
12037 {
12038 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
12039
12040 FreeExpContents(checkedExp);
12041 FreeType(checkedExp->expType);
12042 FreeType(checkedExp->destType);
12043 *checkedExp = *newExp;
12044 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12045 checkedExp->prev = prev;
12046 checkedExp->next = next;
12047 }
12048
12049 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
12050
12051 extern int printf(char * , ...);
12052
12053 void __ecereMethod_Expression_Clear();
12054
12055 void ApplyAnyObjectLogic(struct Expression * e)
12056 {
12057 struct Type * destType = e->destType;
12058
12059 if(destType && (destType->classObjectType == 3))
12060 {
12061 if(e && e->expType)
12062 {
12063 struct Type * type = e->expType;
12064 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
12065
12066 if(type->kind == 8 && type->_class && type->_class->registered)
12067 {
12068 _class = type->_class->registered;
12069 }
12070 else if(type->kind == 19)
12071 {
12072 _class = FindClass("ecere::com::Class")->registered;
12073 }
12074 else
12075 {
12076 char string[1024] = "";
12077 struct Symbol * classSym;
12078
12079 PrintTypeNoConst(type, string, 0x0, 0x1);
12080 classSym = FindClass(string);
12081 if(classSym)
12082 _class = classSym->registered;
12083 }
12084 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)))
12085 {
12086 if(!_class || strcmp(_class->fullName, "char *"))
12087 {
12088 struct Expression * checkedExp = e, * newExp;
12089
12090 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12091 {
12092 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12093 {
12094 if(checkedExp->type == 25)
12095 {
12096 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12097 }
12098 else
12099 checkedExp = (*checkedExp->list).last;
12100 }
12101 else if(checkedExp->type == 11)
12102 checkedExp = checkedExp->cast.exp;
12103 }
12104 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
12105 {
12106 newExp = checkedExp->op.exp2;
12107 checkedExp->op.exp2 = (((void *)0));
12108 FreeExpContents(checkedExp);
12109 if(e->expType && e->expType->passAsTemplate)
12110 {
12111 char size[100];
12112
12113 ComputeTypeSize(e->expType);
12114 sprintf(size, "%d", e->expType->size);
12115 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))))));
12116 }
12117 ReplaceExpContents(checkedExp, newExp);
12118 e->byReference = 0x1;
12119 }
12120 else if(!e->byReference || (_class && _class->type == 5))
12121 {
12122 struct Expression * checkedExp, * newExp;
12123
12124 {
12125 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;
12126
12127 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
12128 {
12129 struct Context * context = PushContext();
12130 struct Declarator * decl;
12131 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12132 char typeString[1024];
12133 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12134
12135 typeString[0] = '\0';
12136 *newExp = *e;
12137 newExp->prev = (((void *)0));
12138 newExp->next = (((void *)0));
12139 newExp->expType = (((void *)0));
12140 PrintTypeNoConst(e->expType, typeString, 0x0, 0x1);
12141 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12142 newExp->destType = ProcessType(specs, decl);
12143 curContext = context;
12144 if(curCompound)
12145 {
12146 char name[100];
12147 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
12148
12149 e->type = 25;
12150 sprintf(name, "__internalValue%03X", internalValueCounter++);
12151 if(!curCompound->compound.declarations)
12152 curCompound->compound.declarations = MkList();
12153 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
12154 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
12155 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
12156 e->compound = MkCompoundStmt((((void *)0)), stmts);
12157 }
12158 else
12159 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
12160 {
12161 struct Type * type = e->destType;
12162
12163 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12164 CopyTypeInto(e->destType, type);
12165 e->destType->refCount = 1;
12166 e->destType->classObjectType = 0;
12167 FreeType(type);
12168 }
12169 e->compound->compound.context = context;
12170 PopContext(context);
12171 curContext = context->parent;
12172 }
12173 }
12174 checkedExp = e;
12175 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12176 {
12177 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12178 {
12179 if(checkedExp->type == 25)
12180 {
12181 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12182 }
12183 else
12184 checkedExp = (*checkedExp->list).last;
12185 }
12186 else if(checkedExp->type == 11)
12187 checkedExp = checkedExp->cast.exp;
12188 }
12189 {
12190 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12191
12192 *operand = *checkedExp;
12193 checkedExp->destType = (((void *)0));
12194 checkedExp->expType = (((void *)0));
12195 __ecereMethod_Expression_Clear(checkedExp);
12196 checkedExp->type = 4;
12197 checkedExp->op.op = '&';
12198 checkedExp->op.exp1 = (((void *)0));
12199 checkedExp->op.exp2 = operand;
12200 }
12201 }
12202 }
12203 }
12204 }
12205 }
12206 {
12207 }
12208 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))))
12209 {
12210 if(e->expType->classObjectType && destType && destType->classObjectType)
12211 {
12212 return ;
12213 }
12214 else
12215 {
12216 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12217
12218 *thisExp = *e;
12219 thisExp->prev = (((void *)0));
12220 thisExp->next = (((void *)0));
12221 __ecereMethod_Expression_Clear(e);
12222 e->type = 5;
12223 e->list = MkListOne(MkExpOp((((void *)0)), '*', thisExp->type == 0 ? thisExp : MkExpBrackets(MkListOne(thisExp))));
12224 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
12225 ((struct Expression *)(*e->list).first)->byReference = 0x1;
12226 {
12227 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12228 CopyTypeInto(e->expType, thisExp->expType);
12229 e->expType->byReference = 0x0;
12230 e->expType->refCount = 1;
12231 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))
12232 {
12233 e->expType->classObjectType = 0;
12234 }
12235 }
12236 }
12237 }
12238 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
12239 {
12240 if(destType->kind == 14)
12241 {
12242 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unspecified type\n", (((void *)0))));
12243 }
12244 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
12245 {
12246 unsigned int byReference = e->expType->byReference;
12247 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12248 struct Declarator * decl;
12249 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12250 char typeString[1024];
12251 struct Type * type;
12252 int backupClassObjectType;
12253 unsigned int backupByReference;
12254
12255 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
12256 type = e->expType;
12257 else
12258 type = destType;
12259 backupClassObjectType = type->classObjectType;
12260 backupByReference = type->byReference;
12261 type->classObjectType = 0;
12262 type->byReference = 0x0;
12263 typeString[0] = '\0';
12264 PrintType(type, typeString, 0x0, 0x1);
12265 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12266 type->classObjectType = backupClassObjectType;
12267 type->byReference = backupByReference;
12268 *thisExp = *e;
12269 thisExp->prev = (((void *)0));
12270 thisExp->next = (((void *)0));
12271 __ecereMethod_Expression_Clear(e);
12272 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)))
12273 {
12274 e->type = 4;
12275 e->op.op = '*';
12276 e->op.exp1 = (((void *)0));
12277 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
12278 }
12279 else
12280 {
12281 e->type = 11;
12282 e->cast.typeName = MkTypeName(specs, decl);
12283 e->cast.exp = thisExp;
12284 e->byReference = 0x1;
12285 }
12286 e->expType = type;
12287 e->destType = destType;
12288 type->refCount++;
12289 destType->refCount++;
12290 }
12291 }
12292 }
12293
12294 extern char *  strstr(const char * , const char * );
12295
12296 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
12297
12298 struct __ecereNameSpace__ecere__com__DefinedExpression
12299 {
12300 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
12301 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
12302 char *  name;
12303 char *  value;
12304 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
12305 } __attribute__ ((gcc_struct));
12306
12307 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12308
12309 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12310
12311 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
12312
12313 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
12314
12315 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
12316
12317 extern struct Expression * CopyExpression(struct Expression * exp);
12318
12319 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
12320
12321 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
12322
12323 static void ProcessStatement(struct Statement * stmt);
12324
12325 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
12326
12327 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
12328
12329 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
12330
12331 extern char *  sourceFile;
12332
12333 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
12334
12335 void ProcessExpressionType(struct Expression * exp)
12336 {
12337 unsigned int unresolved = 0x0;
12338 struct Location oldyylloc = yylloc;
12339 unsigned int notByReference = 0x0;
12340
12341 if(!exp || exp->expType)
12342 return ;
12343 yylloc = exp->loc;
12344 switch(exp->type)
12345 {
12346 case 0:
12347 {
12348 struct Identifier * id = exp->identifier;
12349
12350 if(!id)
12351 return ;
12352 if(id->_class && id->_class->name)
12353 {
12354 id->classSym = id->_class->symbol;
12355 }
12356 if(strstr(id->string, "__ecereClass") == id->string)
12357 {
12358 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
12359 break;
12360 }
12361 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
12362 {
12363 ReplaceClassMembers(exp, thisClass);
12364 if(exp->type != 0)
12365 {
12366 ProcessExpressionType(exp);
12367 break;
12368 }
12369 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
12370 break;
12371 }
12372 else
12373 {
12374 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12375
12376 if(!symbol)
12377 {
12378 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
12379 break;
12380 else
12381 {
12382 if(thisClass)
12383 {
12384 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
12385 if(exp->type != 0)
12386 {
12387 ProcessExpressionType(exp);
12388 break;
12389 }
12390 }
12391 else if(currentClass && !id->_class)
12392 {
12393 if(ResolveIdWithClass(exp, currentClass, 0x1))
12394 break;
12395 }
12396 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12397 }
12398 }
12399 if(symbol)
12400 {
12401 struct Type * type = symbol->type;
12402 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
12403
12404 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
12405 {
12406 struct Context * context = SetupTemplatesContext(_class);
12407
12408 type = ReplaceThisClassType(_class);
12409 FinishTemplatesContext(context);
12410 if(type)
12411 type->refCount = 0;
12412 }
12413 FreeSpecifier(id->_class);
12414 id->_class = (((void *)0));
12415 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12416 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
12417 id->classSym = (((void *)0));
12418 exp->expType = type;
12419 if(type)
12420 type->refCount++;
12421 if(type && (type->kind == 15 || (_class && _class->type == 4)))
12422 exp->isConstant = 0x1;
12423 if(symbol->isParam || !strcmp(id->string, "this"))
12424 {
12425 if(_class && _class->type == 1)
12426 exp->byReference = 0x1;
12427 }
12428 if(symbol->isIterator)
12429 {
12430 if(symbol->isIterator == 3)
12431 {
12432 exp->type = 5;
12433 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
12434 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
12435 exp->expType = (((void *)0));
12436 ProcessExpressionType(exp);
12437 }
12438 else if(symbol->isIterator != 4)
12439 {
12440 exp->type = 8;
12441 exp->member.exp = MkExpIdentifier(exp->identifier);
12442 exp->member.exp->expType = exp->expType;
12443 exp->member.member = MkIdentifier("data");
12444 exp->expType = (((void *)0));
12445 ProcessExpressionType(exp);
12446 }
12447 }
12448 break;
12449 }
12450 else
12451 {
12452 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
12453
12454 if(thisNameSpace && !(id->_class && !id->_class->name))
12455 {
12456 char name[1024];
12457
12458 strcpy(name, thisNameSpace);
12459 strcat(name, "::");
12460 strcat(name, id->string);
12461 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
12462 }
12463 if(!definedExp)
12464 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
12465 if(definedExp)
12466 {
12467 int c;
12468
12469 for(c = 0; c < definedExpStackPos; c++)
12470 if(definedExpStack[c] == definedExp)
12471 break;
12472 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
12473 {
12474 struct Location backupYylloc = yylloc;
12475
12476 definedExpStack[definedExpStackPos++] = definedExp;
12477 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
12478 ((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));
12479 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
12480 echoOn = 0x0;
12481 parsedExpression = (((void *)0));
12482 resetScanner();
12483 expression_yyparse();
12484 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
12485 yylloc = backupYylloc;
12486 if(parsedExpression)
12487 {
12488 FreeIdentifier(id);
12489 exp->type = 5;
12490 exp->list = MkListOne(parsedExpression);
12491 parsedExpression->loc = yylloc;
12492 ProcessExpressionType(exp);
12493 definedExpStackPos--;
12494 return ;
12495 }
12496 definedExpStackPos--;
12497 }
12498 else
12499 {
12500 if(inCompiler)
12501 {
12502 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
12503 }
12504 }
12505 }
12506 else
12507 {
12508 struct GlobalData * data = (((void *)0));
12509
12510 if(thisNameSpace && !(id->_class && !id->_class->name))
12511 {
12512 char name[1024];
12513
12514 strcpy(name, thisNameSpace);
12515 strcat(name, "::");
12516 strcat(name, id->string);
12517 data = FindGlobalData(name);
12518 }
12519 if(!data)
12520 data = FindGlobalData(id->string);
12521 if(data)
12522 {
12523 DeclareGlobalData(data);
12524 exp->expType = data->dataType;
12525 if(data->dataType)
12526 data->dataType->refCount++;
12527 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12528 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12529 FreeSpecifier(id->_class);
12530 id->_class = (((void *)0));
12531 break;
12532 }
12533 else
12534 {
12535 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
12536
12537 if(thisNameSpace && !(id->_class && !id->_class->name))
12538 {
12539 char name[1024];
12540
12541 strcpy(name, thisNameSpace);
12542 strcat(name, "::");
12543 strcat(name, id->string);
12544 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12545 }
12546 if(!function)
12547 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12548 if(function)
12549 {
12550 char name[1024];
12551
12552 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12553 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12554 name[0] = (char)0;
12555 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12556 strcpy(name, "__ecereFunction_");
12557 FullClassNameCat(name, id->string, 0x0);
12558 if(DeclareFunction(function, name))
12559 {
12560 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12561 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12562 }
12563 exp->expType = function->dataType;
12564 if(function->dataType)
12565 function->dataType->refCount++;
12566 FreeSpecifier(id->_class);
12567 id->_class = (((void *)0));
12568 break;
12569 }
12570 }
12571 }
12572 }
12573 }
12574 unresolved = 0x1;
12575 break;
12576 }
12577 case 1:
12578 {
12579 struct __ecereNameSpace__ecere__com__Class * _class;
12580
12581 if(!exp->instance->_class)
12582 {
12583 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12584 {
12585 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12586 }
12587 }
12588 ProcessInstantiationType(exp->instance);
12589 exp->isConstant = exp->instance->isConstant;
12590 if(exp->instance->_class)
12591 {
12592 exp->expType = MkClassType(exp->instance->_class->name);
12593 }
12594 break;
12595 }
12596 case 2:
12597 {
12598 if(!exp->expType)
12599 {
12600 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12601
12602 exp->expType = type;
12603 if(exp->constant[0] == '\'')
12604 {
12605 if((int)((unsigned char *)exp->constant)[1] > 127)
12606 {
12607 int nb;
12608 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12609
12610 if(nb < 2)
12611 ch = exp->constant[1];
12612 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12613 exp->constant = PrintUInt(ch);
12614 type->kind = 8;
12615 type->_class = FindClass("unichar");
12616 type->isSigned = 0x0;
12617 }
12618 else
12619 {
12620 type->kind = 1;
12621 type->isSigned = 0x1;
12622 }
12623 }
12624 else if(strchr(exp->constant, '.'))
12625 {
12626 char ch = exp->constant[strlen(exp->constant) - 1];
12627
12628 if(ch == 'f')
12629 type->kind = 6;
12630 else
12631 type->kind = 7;
12632 type->isSigned = 0x1;
12633 }
12634 else
12635 {
12636 if(exp->constant[0] == '0' && exp->constant[1])
12637 type->isSigned = 0x0;
12638 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12639 type->isSigned = 0x0;
12640 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12641 type->isSigned = 0x0;
12642 else
12643 type->isSigned = 0x1;
12644 type->kind = 3;
12645 }
12646 exp->isConstant = 0x1;
12647 }
12648 break;
12649 }
12650 case 3:
12651 {
12652 exp->isConstant = 0x1;
12653 exp->expType = __extension__ ({
12654 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12655
12656 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
12657 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12658
12659 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 1, __ecereInstance1->constant = 0x1, __ecereInstance1;
12660 }), __ecereInstance2;
12661 });
12662 break;
12663 }
12664 case 13:
12665 case 28:
12666 ProcessExpressionType(exp->_new.size);
12667 exp->expType = __extension__ ({
12668 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12669
12670 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_new.typeName->qualifiers, exp->_new.typeName->declarator), __ecereInstance1;
12671 });
12672 DeclareType(exp->expType->type, 0x0, 0x0);
12673 break;
12674 case 14:
12675 case 29:
12676 ProcessExpressionType(exp->_renew.size);
12677 ProcessExpressionType(exp->_renew.exp);
12678 exp->expType = __extension__ ({
12679 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12680
12681 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), __ecereInstance1;
12682 });
12683 DeclareType(exp->expType->type, 0x0, 0x0);
12684 break;
12685 case 4:
12686 {
12687 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12688 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12689 unsigned int useDestType = 0x0, useSideType = 0x0;
12690 struct Location oldyylloc = yylloc;
12691 unsigned int useSideUnit = 0x0;
12692 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
12693
12694 switch(exp->op.op)
12695 {
12696 case '=':
12697 case MUL_ASSIGN:
12698 case DIV_ASSIGN:
12699 case MOD_ASSIGN:
12700 case ADD_ASSIGN:
12701 case SUB_ASSIGN:
12702 case LEFT_ASSIGN:
12703 case RIGHT_ASSIGN:
12704 case AND_ASSIGN:
12705 case XOR_ASSIGN:
12706 case OR_ASSIGN:
12707 assign = 0x1;
12708 break;
12709 case '!':
12710 break;
12711 case AND_OP:
12712 case OR_OP:
12713 boolOps = 0x1;
12714 boolResult = 0x1;
12715 break;
12716 case EQ_OP:
12717 case '<':
12718 case '>':
12719 case LE_OP:
12720 case GE_OP:
12721 case NE_OP:
12722 boolResult = 0x1;
12723 useSideType = 0x1;
12724 break;
12725 case '+':
12726 case '-':
12727 useSideUnit = 0x1;
12728 case '|':
12729 case '&':
12730 case '^':
12731 case '/':
12732 case '%':
12733 case '*':
12734 if(exp->op.op != '*' || exp->op.exp1)
12735 {
12736 useSideType = 0x1;
12737 useDestType = 0x1;
12738 }
12739 break;
12740 }
12741 if(exp->op.op == '&')
12742 {
12743 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12744 {
12745 struct Identifier * id = exp->op.exp2->identifier;
12746 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12747
12748 if(symbol && symbol->isIterator == 2)
12749 {
12750 exp->type = 8;
12751 exp->member.exp = exp->op.exp2;
12752 exp->member.member = MkIdentifier("key");
12753 exp->expType = (((void *)0));
12754 exp->op.exp2->expType = symbol->type;
12755 symbol->type->refCount++;
12756 ProcessExpressionType(exp);
12757 FreeType(dummy);
12758 break;
12759 }
12760 }
12761 }
12762 if(exp->op.exp1)
12763 {
12764 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))
12765 {
12766 if(exp->op.exp1->destType)
12767 FreeType(exp->op.exp1->destType);
12768 exp->op.exp1->destType = exp->destType;
12769 if(exp->destType)
12770 exp->destType->refCount++;
12771 }
12772 else if(!assign)
12773 {
12774 if(exp->op.exp1->destType)
12775 FreeType(exp->op.exp1->destType);
12776 exp->op.exp1->destType = dummy;
12777 dummy->refCount++;
12778 }
12779 if(exp->op.exp1->destType && exp->op.op != '=')
12780 exp->op.exp1->destType->count++;
12781 ProcessExpressionType(exp->op.exp1);
12782 if(exp->op.exp1->destType && exp->op.op != '=')
12783 exp->op.exp1->destType->count--;
12784 if(exp->op.exp1->destType == dummy)
12785 {
12786 FreeType(dummy);
12787 exp->op.exp1->destType = (((void *)0));
12788 }
12789 type1 = exp->op.exp1->expType;
12790 }
12791 if(exp->op.exp2)
12792 {
12793 char expString[10240];
12794
12795 expString[0] = '\0';
12796 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12797 {
12798 if(exp->op.exp1)
12799 {
12800 exp->op.exp2->destType = exp->op.exp1->expType;
12801 if(exp->op.exp1->expType)
12802 exp->op.exp1->expType->refCount++;
12803 }
12804 else
12805 {
12806 exp->op.exp2->destType = exp->destType;
12807 if(exp->destType)
12808 exp->destType->refCount++;
12809 }
12810 if(type1)
12811 type1->refCount++;
12812 exp->expType = type1;
12813 }
12814 else if(assign)
12815 {
12816 if(inCompiler)
12817 PrintExpression(exp->op.exp2, expString);
12818 if(type1 && type1->kind == 13)
12819 {
12820 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)
12821 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12822 else if(exp->op.op == '=')
12823 {
12824 if(exp->op.exp2->destType)
12825 FreeType(exp->op.exp2->destType);
12826 exp->op.exp2->destType = type1;
12827 if(type1)
12828 type1->refCount++;
12829 }
12830 }
12831 else
12832 {
12833 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)
12834 ;
12835 else
12836 {
12837 if(exp->op.exp2->destType)
12838 FreeType(exp->op.exp2->destType);
12839 exp->op.exp2->destType = type1;
12840 if(type1)
12841 type1->refCount++;
12842 }
12843 }
12844 if(type1)
12845 type1->refCount++;
12846 exp->expType = type1;
12847 }
12848 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)))
12849 {
12850 if(exp->op.exp2->destType)
12851 FreeType(exp->op.exp2->destType);
12852 exp->op.exp2->destType = exp->destType;
12853 if(exp->destType)
12854 exp->destType->refCount++;
12855 }
12856 else
12857 {
12858 if(exp->op.exp2->destType)
12859 FreeType(exp->op.exp2->destType);
12860 exp->op.exp2->destType = dummy;
12861 dummy->refCount++;
12862 }
12863 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12864 {
12865 FreeType(exp->op.exp2->destType);
12866 exp->op.exp2->destType = type1;
12867 type1->refCount++;
12868 }
12869 if(exp->op.exp2->destType && exp->op.op != '=')
12870 exp->op.exp2->destType->count++;
12871 ProcessExpressionType(exp->op.exp2);
12872 if(exp->op.exp2->destType && exp->op.op != '=')
12873 exp->op.exp2->destType->count--;
12874 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12875 {
12876 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)
12877 {
12878 if(exp->op.op != '=' && type1->type->kind == 0)
12879 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12880 }
12881 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)))
12882 {
12883 if(exp->op.op == ADD_ASSIGN)
12884 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12885 }
12886 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))
12887 {
12888 if(exp->op.op == ADD_ASSIGN)
12889 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12890 }
12891 else if(inCompiler)
12892 {
12893 char type1String[1024];
12894 char type2String[1024];
12895
12896 type1String[0] = '\0';
12897 type2String[0] = '\0';
12898 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12899 PrintType(type1, type2String, 0x0, 0x1);
12900 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12901 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12902 }
12903 }
12904 if(exp->op.exp2->destType == dummy)
12905 {
12906 FreeType(dummy);
12907 exp->op.exp2->destType = (((void *)0));
12908 }
12909 type2 = exp->op.exp2->expType;
12910 }
12911 dummy->kind = 0;
12912 if(exp->op.op == SIZEOF)
12913 {
12914 exp->expType = __extension__ ({
12915 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12916
12917 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
12918 });
12919 exp->isConstant = 0x1;
12920 }
12921 else if(exp->op.op == '*' && !exp->op.exp1)
12922 {
12923 exp->expType = Dereference(type2);
12924 if(type2 && type2->kind == 8)
12925 notByReference = 0x1;
12926 }
12927 else if(exp->op.op == '&' && !exp->op.exp1)
12928 exp->expType = Reference(type2);
12929 else if(!assign)
12930 {
12931 if(boolOps)
12932 {
12933 if(exp->op.exp1)
12934 {
12935 if(exp->op.exp1->destType)
12936 FreeType(exp->op.exp1->destType);
12937 exp->op.exp1->destType = MkClassType("bool");
12938 exp->op.exp1->destType->truth = 0x1;
12939 if(!exp->op.exp1->expType)
12940 ProcessExpressionType(exp->op.exp1);
12941 else
12942 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12943 FreeType(exp->op.exp1->expType);
12944 exp->op.exp1->expType = MkClassType("bool");
12945 exp->op.exp1->expType->truth = 0x1;
12946 }
12947 if(exp->op.exp2)
12948 {
12949 if(exp->op.exp2->destType)
12950 FreeType(exp->op.exp2->destType);
12951 exp->op.exp2->destType = MkClassType("bool");
12952 exp->op.exp2->destType->truth = 0x1;
12953 if(!exp->op.exp2->expType)
12954 ProcessExpressionType(exp->op.exp2);
12955 else
12956 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12957 FreeType(exp->op.exp2->expType);
12958 exp->op.exp2->expType = MkClassType("bool");
12959 exp->op.exp2->expType->truth = 0x1;
12960 }
12961 }
12962 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")))))
12963 {
12964 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
12965 {
12966 if(exp->op.exp2->destType)
12967 FreeType(exp->op.exp2->destType);
12968 exp->op.exp2->destType = type1;
12969 type1->refCount++;
12970 if(exp->op.exp1->destType)
12971 FreeType(exp->op.exp1->destType);
12972 exp->op.exp1->destType = type2;
12973 type2->refCount++;
12974 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)
12975 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);
12976 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
12977 {
12978 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12979
12980 if(argExp)
12981 {
12982 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12983
12984 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
12985 ProcessExpressionType(exp->op.exp1);
12986 if(type2->kind != 13)
12987 {
12988 ProcessExpressionType(classExp);
12989 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"))))))));
12990 if(!exp->op.exp2->expType)
12991 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
12992 ProcessExpressionType(exp->op.exp2);
12993 }
12994 }
12995 }
12996 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)))
12997 {
12998 if(type1->kind != 8 && type1->type->kind == 0)
12999 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
13000 exp->expType = type1;
13001 if(type1)
13002 type1->refCount++;
13003 }
13004 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)))
13005 {
13006 if(type2->kind != 8 && type2->type->kind == 0)
13007 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
13008 exp->expType = type2;
13009 if(type2)
13010 type2->refCount++;
13011 }
13012 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))
13013 {
13014 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
13015 }
13016 else
13017 {
13018 unsigned int success = 0x0;
13019
13020 if(type1->kind == 13 && type2->kind == 13)
13021 {
13022 if(exp->op.op == '+')
13023 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
13024 else if(exp->op.op == '-')
13025 {
13026 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
13027 {
13028 exp->expType = __extension__ ({
13029 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13030
13031 __ecereInstance1->kind = 3, __ecereInstance1->refCount = 1, __ecereInstance1;
13032 });
13033 success = 0x1;
13034 if(type1->type->kind == 20)
13035 {
13036 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
13037
13038 if(argExp)
13039 {
13040 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
13041
13042 ProcessExpressionType(classExp);
13043 exp->type = 5;
13044 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")))))));
13045 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
13046 FreeType(dummy);
13047 return ;
13048 }
13049 }
13050 }
13051 }
13052 }
13053 if(!success && exp->op.exp1->type == 2)
13054 {
13055 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13056 {
13057 if(exp->expType)
13058 FreeType(exp->expType);
13059 exp->expType = exp->op.exp1->destType;
13060 if(exp->op.exp1->destType)
13061 exp->op.exp1->destType->refCount++;
13062 success = 0x1;
13063 }
13064 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13065 {
13066 if(exp->expType)
13067 FreeType(exp->expType);
13068 exp->expType = exp->op.exp2->destType;
13069 if(exp->op.exp2->destType)
13070 exp->op.exp2->destType->refCount++;
13071 success = 0x1;
13072 }
13073 }
13074 else if(!success)
13075 {
13076 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13077 {
13078 if(exp->expType)
13079 FreeType(exp->expType);
13080 exp->expType = exp->op.exp2->destType;
13081 if(exp->op.exp2->destType)
13082 exp->op.exp2->destType->refCount++;
13083 success = 0x1;
13084 }
13085 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13086 {
13087 if(exp->expType)
13088 FreeType(exp->expType);
13089 exp->expType = exp->op.exp1->destType;
13090 if(exp->op.exp1->destType)
13091 exp->op.exp1->destType->refCount++;
13092 success = 0x1;
13093 }
13094 }
13095 if(!success)
13096 {
13097 char expString1[10240];
13098 char expString2[10240];
13099 char type1[1024];
13100 char type2[1024];
13101
13102 expString1[0] = '\0';
13103 expString2[0] = '\0';
13104 type1[0] = '\0';
13105 type2[0] = '\0';
13106 if(inCompiler)
13107 {
13108 PrintExpression(exp->op.exp1, expString1);
13109 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13110 PrintExpression(exp->op.exp2, expString2);
13111 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13112 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
13113 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
13114 }
13115 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
13116 }
13117 }
13118 }
13119 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13120 {
13121 if(exp->op.exp1->destType)
13122 FreeType(exp->op.exp1->destType);
13123 exp->op.exp1->destType = type2->_class->registered->dataType;
13124 if(type2->_class->registered->dataType)
13125 type2->_class->registered->dataType->refCount++;
13126 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13127 exp->expType = type2;
13128 if(type2)
13129 type2->refCount++;
13130 }
13131 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13132 {
13133 if(exp->op.exp2->destType)
13134 FreeType(exp->op.exp2->destType);
13135 exp->op.exp2->destType = type1->_class->registered->dataType;
13136 if(type1->_class->registered->dataType)
13137 type1->_class->registered->dataType->refCount++;
13138 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13139 exp->expType = type1;
13140 if(type1)
13141 type1->refCount++;
13142 }
13143 else if(type1)
13144 {
13145 unsigned int valid = 0x0;
13146
13147 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
13148 {
13149 if(exp->op.exp2->destType)
13150 FreeType(exp->op.exp2->destType);
13151 if(!type1->_class->registered->dataType)
13152 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
13153 exp->op.exp2->destType = type1->_class->registered->dataType;
13154 exp->op.exp2->destType->refCount++;
13155 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13156 type2 = exp->op.exp2->destType;
13157 exp->expType = type2;
13158 type2->refCount++;
13159 }
13160 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
13161 {
13162 if(exp->op.exp1->destType)
13163 FreeType(exp->op.exp1->destType);
13164 if(!type2->_class->registered->dataType)
13165 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
13166 exp->op.exp1->destType = type2->_class->registered->dataType;
13167 exp->op.exp1->destType->refCount++;
13168 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13169 type1 = exp->op.exp1->destType;
13170 exp->expType = type1;
13171 type1->refCount++;
13172 }
13173 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
13174 {
13175 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
13176 {
13177 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
13178 {
13179 if(exp->expType)
13180 FreeType(exp->expType);
13181 exp->expType = exp->op.exp1->expType;
13182 if(exp->op.exp2->expType)
13183 exp->op.exp1->expType->refCount++;
13184 valid = 0x1;
13185 }
13186 }
13187 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
13188 {
13189 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
13190 {
13191 if(exp->expType)
13192 FreeType(exp->expType);
13193 exp->expType = exp->op.exp2->expType;
13194 if(exp->op.exp2->expType)
13195 exp->op.exp2->expType->refCount++;
13196 valid = 0x1;
13197 }
13198 }
13199 }
13200 if(!valid)
13201 {
13202 if(exp->op.exp2->destType)
13203 FreeType(exp->op.exp2->destType);
13204 exp->op.exp2->destType = type1;
13205 type1->refCount++;
13206 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13207 {
13208 if(exp->expType)
13209 FreeType(exp->expType);
13210 exp->expType = exp->op.exp2->destType;
13211 if(exp->op.exp2->destType)
13212 exp->op.exp2->destType->refCount++;
13213 }
13214 else if(type1 && type2)
13215 {
13216 char expString1[10240];
13217 char expString2[10240];
13218 char type1String[1024];
13219 char type2String[1024];
13220
13221 expString1[0] = '\0';
13222 expString2[0] = '\0';
13223 type1String[0] = '\0';
13224 type2String[0] = '\0';
13225 if(inCompiler)
13226 {
13227 PrintExpression(exp->op.exp1, expString1);
13228 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13229 PrintExpression(exp->op.exp2, expString2);
13230 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13231 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
13232 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
13233 }
13234 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
13235 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
13236 {
13237 exp->expType = exp->op.exp1->expType;
13238 if(exp->op.exp1->expType)
13239 exp->op.exp1->expType->refCount++;
13240 }
13241 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13242 {
13243 exp->expType = exp->op.exp2->expType;
13244 if(exp->op.exp2->expType)
13245 exp->op.exp2->expType->refCount++;
13246 }
13247 }
13248 }
13249 }
13250 else if(type2)
13251 {
13252 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13253 {
13254 struct Type * oldType = exp->op.exp1->expType;
13255
13256 exp->op.exp1->expType = (((void *)0));
13257 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13258 FreeType(oldType);
13259 else
13260 exp->op.exp1->expType = oldType;
13261 }
13262 if(exp->op.exp1->destType)
13263 FreeType(exp->op.exp1->destType);
13264 exp->op.exp1->destType = type2;
13265 type2->refCount++;
13266 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13267 {
13268 if(exp->expType)
13269 FreeType(exp->expType);
13270 exp->expType = exp->op.exp1->destType;
13271 if(exp->op.exp1->destType)
13272 exp->op.exp1->destType->refCount++;
13273 }
13274 }
13275 }
13276 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
13277 {
13278 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13279 {
13280 if(exp->op.exp1->destType)
13281 FreeType(exp->op.exp1->destType);
13282 exp->op.exp1->destType = type2->_class->registered->dataType;
13283 if(type2->_class->registered->dataType)
13284 type2->_class->registered->dataType->refCount++;
13285 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13286 }
13287 if(exp->op.op == '!')
13288 {
13289 exp->expType = MkClassType("bool");
13290 exp->expType->truth = 0x1;
13291 }
13292 else
13293 {
13294 exp->expType = type2;
13295 if(type2)
13296 type2->refCount++;
13297 }
13298 }
13299 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
13300 {
13301 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13302 {
13303 if(exp->op.exp2->destType)
13304 FreeType(exp->op.exp2->destType);
13305 exp->op.exp2->destType = type1->_class->registered->dataType;
13306 if(type1->_class->registered->dataType)
13307 type1->_class->registered->dataType->refCount++;
13308 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13309 }
13310 exp->expType = type1;
13311 if(type1)
13312 type1->refCount++;
13313 }
13314 }
13315 yylloc = exp->loc;
13316 if(exp->op.exp1 && !exp->op.exp1->expType)
13317 {
13318 char expString[10000];
13319
13320 expString[0] = '\0';
13321 if(inCompiler)
13322 {
13323 PrintExpression(exp->op.exp1, expString);
13324 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13325 }
13326 if(expString[0])
13327 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13328 }
13329 if(exp->op.exp2 && !exp->op.exp2->expType)
13330 {
13331 char expString[10240];
13332
13333 expString[0] = '\0';
13334 if(inCompiler)
13335 {
13336 PrintExpression(exp->op.exp2, expString);
13337 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13338 }
13339 if(expString[0])
13340 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13341 }
13342 if(boolResult)
13343 {
13344 FreeType(exp->expType);
13345 exp->expType = MkClassType("bool");
13346 exp->expType->truth = 0x1;
13347 }
13348 if(exp->op.op != SIZEOF)
13349 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
13350 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
13351 {
13352 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
13353 }
13354 yylloc = oldyylloc;
13355 FreeType(dummy);
13356 break;
13357 }
13358 case 5:
13359 case 34:
13360 {
13361 struct Expression * e;
13362
13363 exp->isConstant = 0x1;
13364 for(e = (*exp->list).first; e; e = e->next)
13365 {
13366 unsigned int inced = 0x0;
13367
13368 if(!e->next)
13369 {
13370 FreeType(e->destType);
13371 e->destType = exp->destType;
13372 if(e->destType)
13373 {
13374 exp->destType->refCount++;
13375 e->destType->count++;
13376 inced = 0x1;
13377 }
13378 }
13379 ProcessExpressionType(e);
13380 if(inced)
13381 exp->destType->count--;
13382 if(!exp->expType && !e->next)
13383 {
13384 exp->expType = e->expType;
13385 if(e->expType)
13386 e->expType->refCount++;
13387 }
13388 if(!e->isConstant)
13389 exp->isConstant = 0x0;
13390 }
13391 e = (*exp->list).first;
13392 if(!e->next && e->type == 8)
13393 {
13394 struct Expression * next = exp->next, * prev = exp->prev;
13395
13396 FreeType(exp->expType);
13397 FreeType(exp->destType);
13398 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
13399 *exp = *e;
13400 exp->prev = prev;
13401 exp->next = next;
13402 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
13403 ProcessExpressionType(exp);
13404 }
13405 break;
13406 }
13407 case 6:
13408 {
13409 struct Expression * e;
13410
13411 exp->isConstant = 0x1;
13412 ProcessExpressionType(exp->index.exp);
13413 if(!exp->index.exp->isConstant)
13414 exp->isConstant = 0x0;
13415 if(exp->index.exp->expType)
13416 {
13417 struct Type * source = exp->index.exp->expType;
13418
13419 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)
13420 {
13421 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
13422
13423 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
13424 if(exp->index.index && (*exp->index.index).last)
13425 {
13426 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
13427 }
13428 }
13429 }
13430 for(e = (*exp->index.index).first; e; e = e->next)
13431 {
13432 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
13433 {
13434 if(e->destType)
13435 FreeType(e->destType);
13436 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
13437 }
13438 ProcessExpressionType(e);
13439 if(!e->next)
13440 {
13441 }
13442 if(!e->isConstant)
13443 exp->isConstant = 0x0;
13444 }
13445 if(!exp->expType)
13446 exp->expType = Dereference(exp->index.exp->expType);
13447 if(exp->expType)
13448 DeclareType(exp->expType, 0x0, 0x0);
13449 break;
13450 }
13451 case 7:
13452 {
13453 struct Expression * e;
13454 struct Type * functionType;
13455 struct Type * methodType = (((void *)0));
13456 char name[1024];
13457
13458 name[0] = '\0';
13459 if(inCompiler)
13460 {
13461 PrintExpression(exp->call.exp, name);
13462 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
13463 {
13464 PrintExpression(exp->call.exp, name);
13465 }
13466 }
13467 if(exp->call.exp->type == 0)
13468 {
13469 struct Expression * idExp = exp->call.exp;
13470 struct Identifier * id = idExp->identifier;
13471
13472 if(!strcmp(id->string, "__builtin_frame_address"))
13473 {
13474 exp->expType = ProcessTypeString("void *", 0x1);
13475 if(exp->call.arguments && (*exp->call.arguments).first)
13476 ProcessExpressionType((*exp->call.arguments).first);
13477 break;
13478 }
13479 else if(!strcmp(id->string, "__ENDIAN_PAD"))
13480 {
13481 exp->expType = ProcessTypeString("int", 0x1);
13482 if(exp->call.arguments && (*exp->call.arguments).first)
13483 ProcessExpressionType((*exp->call.arguments).first);
13484 break;
13485 }
13486 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
13487 {
13488 struct Expression * a = (((void *)0));
13489 struct Expression * b = (((void *)0));
13490 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
13491
13492 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
13493 {
13494 a = (*exp->call.arguments).first;
13495 b = (*exp->call.arguments).last;
13496 tempExp1 = a;
13497 tempExp2 = b;
13498 }
13499 else if((*exp->call.arguments).count == 1)
13500 {
13501 a = (*exp->call.arguments).first;
13502 tempExp1 = a;
13503 }
13504 if(a)
13505 {
13506 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
13507 idExp->identifier = (((void *)0));
13508 FreeExpContents(exp);
13509 ProcessExpressionType(a);
13510 if(b)
13511 ProcessExpressionType(b);
13512 exp->type = 5;
13513 exp->list = MkList();
13514 if(a->expType && (!b || b->expType))
13515 {
13516 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
13517 {
13518 if(inCompiler)
13519 {
13520 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13521 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
13522 struct Declaration * decl;
13523 char temp1[1024], temp2[1024];
13524
13525 GetTypeSpecs(a->expType, specs);
13526 if(a && !a->isConstant && a->type != 0)
13527 {
13528 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
13529 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
13530 tempExp1 = QMkExpId(temp1);
13531 tempExp1->expType = a->expType;
13532 if(a->expType)
13533 a->expType->refCount++;
13534 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
13535 }
13536 if(b && !b->isConstant && b->type != 0)
13537 {
13538 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
13539 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
13540 tempExp2 = QMkExpId(temp2);
13541 tempExp2->expType = b->expType;
13542 if(b->expType)
13543 b->expType->refCount++;
13544 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
13545 }
13546 decl = MkDeclaration(specs, decls);
13547 if(!curCompound->compound.declarations)
13548 curCompound->compound.declarations = MkList();
13549 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
13550 }
13551 }
13552 }
13553 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13554 {
13555 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13556
13557 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13558 exp->expType = a->expType;
13559 if(a->expType)
13560 a->expType->refCount++;
13561 }
13562 else if(!strcmp(id->string, "Abs"))
13563 {
13564 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13565 exp->expType = a->expType;
13566 if(a->expType)
13567 a->expType->refCount++;
13568 }
13569 else if(!strcmp(id->string, "Sgn"))
13570 {
13571 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"))))));
13572 exp->expType = ProcessTypeString("int", 0x0);
13573 }
13574 FreeExpression(tempExp1);
13575 if(tempExp2)
13576 FreeExpression(tempExp2);
13577 FreeIdentifier(id);
13578 break;
13579 }
13580 }
13581 }
13582 {
13583 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
13584
13585 if(!exp->call.exp->destType)
13586 {
13587 exp->call.exp->destType = dummy;
13588 dummy->refCount++;
13589 }
13590 ProcessExpressionType(exp->call.exp);
13591 if(exp->call.exp->destType == dummy)
13592 {
13593 FreeType(dummy);
13594 exp->call.exp->destType = (((void *)0));
13595 }
13596 FreeType(dummy);
13597 }
13598 functionType = exp->call.exp->expType;
13599 if(functionType && functionType->kind == 16)
13600 {
13601 methodType = functionType;
13602 functionType = methodType->method->dataType;
13603 if(exp->call.exp->expType->usedClass)
13604 {
13605 char typeString[1024];
13606
13607 typeString[0] = '\0';
13608 {
13609 struct Symbol * back = functionType->thisClass;
13610
13611 functionType->thisClass = (((void *)0));
13612 PrintType(functionType, typeString, 0x1, 0x1);
13613 functionType->thisClass = back;
13614 }
13615 if(strstr(typeString, "thisclass"))
13616 {
13617 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13618 struct Declarator * decl;
13619
13620 {
13621 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13622
13623 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13624 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13625 thisClassParams = 0x0;
13626 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13627 {
13628 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13629
13630 thisClass = exp->call.exp->expType->usedClass;
13631 ProcessDeclarator(decl);
13632 thisClass = backupThisClass;
13633 }
13634 thisClassParams = 0x1;
13635 functionType = ProcessType(specs, decl);
13636 functionType->refCount = 0;
13637 FinishTemplatesContext(context);
13638 }
13639 FreeList(specs, FreeSpecifier);
13640 FreeDeclarator(decl);
13641 }
13642 }
13643 }
13644 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13645 {
13646 struct Type * type = functionType->type;
13647
13648 if(!functionType->refCount)
13649 {
13650 functionType->type = (((void *)0));
13651 FreeType(functionType);
13652 }
13653 functionType = type;
13654 }
13655 if(functionType && functionType->kind != 11)
13656 {
13657 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13658 }
13659 else if(functionType)
13660 {
13661 unsigned int emptyParams = 0x0, noParams = 0x0;
13662 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13663 struct Type * type = functionType->params.first;
13664 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13665 int extra = 0;
13666 struct Location oldyylloc = yylloc;
13667
13668 if(!type)
13669 emptyParams = 0x1;
13670 if(functionType->extraParam && e && functionType->thisClass)
13671 {
13672 e->destType = MkClassType(functionType->thisClass->string);
13673 e = e->next;
13674 }
13675 if(!functionType->staticMethod)
13676 {
13677 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13678 {
13679 type = MkClassType(memberExp->member.exp->expType->_class->string);
13680 if(e)
13681 {
13682 e->destType = type;
13683 e = e->next;
13684 type = functionType->params.first;
13685 }
13686 else
13687 type->refCount = 0;
13688 }
13689 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13690 {
13691 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13692 if(e)
13693 {
13694 e->destType = type;
13695 e = e->next;
13696 type = functionType->params.first;
13697 }
13698 else
13699 type->refCount = 0;
13700 }
13701 }
13702 if(type && type->kind == 0)
13703 {
13704 noParams = 0x1;
13705 if(!type->refCount)
13706 FreeType(type);
13707 type = (((void *)0));
13708 }
13709 for(; e; e = e->next)
13710 {
13711 if(!type && !emptyParams)
13712 {
13713 yylloc = e->loc;
13714 if(methodType && methodType->methodClass)
13715 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);
13716 else
13717 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);
13718 break;
13719 }
13720 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13721 {
13722 struct Type * templatedType = (((void *)0));
13723 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13724 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13725 int id = 0;
13726
13727 if(_class && _class->templateArgs)
13728 {
13729 struct __ecereNameSpace__ecere__com__Class * sClass;
13730
13731 for(sClass = _class; sClass; sClass = sClass->base)
13732 {
13733 if(sClass->templateClass)
13734 sClass = sClass->templateClass;
13735 id = 0;
13736 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13737 {
13738 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13739 {
13740 struct __ecereNameSpace__ecere__com__Class * nextClass;
13741
13742 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13743 {
13744 if(nextClass->templateClass)
13745 nextClass = nextClass->templateClass;
13746 id += nextClass->templateParams.count;
13747 }
13748 break;
13749 }
13750 id++;
13751 }
13752 if(curParam)
13753 break;
13754 }
13755 }
13756 if(curParam && _class->templateArgs[id].dataTypeString)
13757 {
13758 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13759
13760 {
13761 struct Context * context = SetupTemplatesContext(_class);
13762
13763 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13764 FinishTemplatesContext(context);
13765 }
13766 e->destType = templatedType;
13767 if(templatedType)
13768 {
13769 templatedType->passAsTemplate = 0x1;
13770 }
13771 }
13772 else
13773 {
13774 e->destType = type;
13775 if(type)
13776 type->refCount++;
13777 }
13778 }
13779 else
13780 {
13781 if(type && type->kind == 14 && type->prev && type->prev->kind == 8 && type->prev->classObjectType)
13782 {
13783 e->destType = type->prev;
13784 e->destType->refCount++;
13785 }
13786 else
13787 {
13788 e->destType = type;
13789 if(type)
13790 type->refCount++;
13791 }
13792 }
13793 if(type && type->kind != 14)
13794 {
13795 struct Type * next = type->next;
13796
13797 if(!type->refCount)
13798 FreeType(type);
13799 type = next;
13800 }
13801 }
13802 if(type && type->kind != 14)
13803 {
13804 if(methodType && methodType->methodClass)
13805 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);
13806 else
13807 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);
13808 }
13809 yylloc = oldyylloc;
13810 if(type && !type->refCount)
13811 FreeType(type);
13812 }
13813 else
13814 {
13815 functionType = __extension__ ({
13816 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13817
13818 __ecereInstance1->refCount = 0, __ecereInstance1->kind = 11, __ecereInstance1;
13819 });
13820 if(exp->call.exp->type == 0)
13821 {
13822 char * string = exp->call.exp->identifier->string;
13823
13824 if(inCompiler)
13825 {
13826 struct Symbol * symbol;
13827 struct Location oldyylloc = yylloc;
13828
13829 yylloc = exp->call.exp->identifier->loc;
13830 if(strstr(string, "__builtin_") == string)
13831 {
13832 if(exp->destType)
13833 {
13834 functionType->returnType = exp->destType;
13835 exp->destType->refCount++;
13836 }
13837 }
13838 else
13839 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13840 symbol = __extension__ ({
13841 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
13842
13843 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString(string), __ecereInstance1->type = ProcessTypeString("int()", 0x1), __ecereInstance1;
13844 });
13845 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13846 if(strstr(symbol->string, "::"))
13847 globalContext->hasNameSpace = 0x1;
13848 yylloc = oldyylloc;
13849 }
13850 }
13851 else if(exp->call.exp->type == 8)
13852 {
13853 }
13854 else
13855 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13856 if(!functionType->returnType)
13857 {
13858 functionType->returnType = __extension__ ({
13859 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13860
13861 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
13862 });
13863 }
13864 }
13865 if(functionType && functionType->kind == 11)
13866 {
13867 exp->expType = functionType->returnType;
13868 if(functionType->returnType)
13869 functionType->returnType->refCount++;
13870 if(!functionType->refCount)
13871 FreeType(functionType);
13872 }
13873 if(exp->call.arguments)
13874 {
13875 for(e = (*exp->call.arguments).first; e; e = e->next)
13876 {
13877 struct Type * destType = e->destType;
13878
13879 ProcessExpressionType(e);
13880 }
13881 }
13882 break;
13883 }
13884 case 8:
13885 {
13886 struct Type * type;
13887 struct Location oldyylloc = yylloc;
13888 unsigned int thisPtr = (exp->member.exp && exp->member.exp->type == 0 && !strcmp(exp->member.exp->identifier->string, "this"));
13889
13890 exp->thisPtr = thisPtr;
13891 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13892 {
13893 exp->member.member->classSym = exp->member.member->_class->symbol;
13894 }
13895 ProcessExpressionType(exp->member.exp);
13896 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)
13897 {
13898 exp->isConstant = 0x0;
13899 }
13900 else
13901 exp->isConstant = exp->member.exp->isConstant;
13902 type = exp->member.exp->expType;
13903 yylloc = exp->loc;
13904 if(type && (type->kind == 20))
13905 {
13906 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13907 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13908
13909 if(_class)
13910 {
13911 for(param = _class->templateParams.first; param; param = param->next)
13912 {
13913 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
13914 break;
13915 }
13916 }
13917 if(param && param->defaultArg.member)
13918 {
13919 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
13920
13921 if(argExp)
13922 {
13923 struct Expression * expMember = exp->member.exp;
13924 struct Declarator * decl;
13925 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13926 char thisClassTypeString[1024];
13927
13928 FreeIdentifier(exp->member.member);
13929 ProcessExpressionType(argExp);
13930 {
13931 char * colon = strstr(param->defaultArg.memberString, "::");
13932
13933 if(colon)
13934 {
13935 char className[1024];
13936 struct __ecereNameSpace__ecere__com__Class * sClass;
13937
13938 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
13939 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
13940 }
13941 else
13942 strcpy(thisClassTypeString, _class->fullName);
13943 }
13944 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
13945 exp->expType = ProcessType(specs, decl);
13946 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
13947 {
13948 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13949 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13950 int c;
13951 int paramCount = 0;
13952 int lastParam = -1;
13953 char templateString[1024];
13954 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13955
13956 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13957 for(cClass = expClass; cClass; cClass = cClass->base)
13958 {
13959 int p = 0;
13960
13961 for(param = cClass->templateParams.first; param; param = param->next)
13962 {
13963 int id = p;
13964 struct __ecereNameSpace__ecere__com__Class * sClass;
13965 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13966
13967 for(sClass = cClass->base; sClass; sClass = sClass->base)
13968 id += sClass->templateParams.count;
13969 arg = expClass->templateArgs[id];
13970 for(sClass = _class; sClass; sClass = sClass->base)
13971 {
13972 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
13973 int p = 0;
13974 struct __ecereNameSpace__ecere__com__Class * nextClass;
13975
13976 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13977 p += nextClass->templateParams.count;
13978 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
13979 {
13980 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
13981 {
13982 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13983 {
13984 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
13985 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
13986 break;
13987 }
13988 }
13989 }
13990 }
13991 {
13992 char argument[256];
13993
13994 argument[0] = '\0';
13995 switch(param->type)
13996 {
13997 case 2:
13998 {
13999 char expString[1024];
14000 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14001 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14002 struct Expression * exp;
14003 char * string = PrintHexUInt64(arg.expression.ui64);
14004
14005 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14006 ProcessExpressionType(exp);
14007 ComputeExpression(exp);
14008 expString[0] = '\0';
14009 PrintExpression(exp, expString);
14010 strcat(argument, expString);
14011 FreeExpression(exp);
14012 break;
14013 }
14014 case 1:
14015 {
14016 strcat(argument, arg.member->name);
14017 break;
14018 }
14019 case 0:
14020 {
14021 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14022 {
14023 if(!strcmp(arg.dataTypeString, "thisclass"))
14024 strcat(argument, thisClassTypeString);
14025 else
14026 strcat(argument, arg.dataTypeString);
14027 }
14028 break;
14029 }
14030 }
14031 if(argument[0])
14032 {
14033 if(paramCount)
14034 strcat(templateString, ", ");
14035 if(lastParam != p - 1)
14036 {
14037 strcat(templateString, param->name);
14038 strcat(templateString, " = ");
14039 }
14040 strcat(templateString, argument);
14041 paramCount++;
14042 lastParam = p;
14043 }
14044 p++;
14045 }
14046 }
14047 }
14048 {
14049 int len = strlen(templateString);
14050
14051 if(templateString[len - 1] == '>')
14052 templateString[len++] = ' ';
14053 templateString[len++] = '>';
14054 templateString[len++] = '\0';
14055 }
14056 {
14057 struct Context * context = SetupTemplatesContext(_class);
14058
14059 FreeType(exp->expType);
14060 exp->expType = ProcessTypeString(templateString, 0x0);
14061 FinishTemplatesContext(context);
14062 }
14063 }
14064 exp->type = 5;
14065 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")))))))));
14066 }
14067 }
14068 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
14069 {
14070 type = ProcessTemplateParameterType(type->templateParameter);
14071 }
14072 }
14073 if(type && (type->kind == 20))
14074 ;
14075 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15 || type->kind == 4 || type->kind == 2 || type->kind == 5 || type->kind == 1 || type->kind == 22 || type->kind == 23 || type->kind == 6 || type->kind == 7))
14076 {
14077 struct Identifier * id = exp->member.member;
14078 int typeKind = type->kind;
14079 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));
14080
14081 if(typeKind == 19 && exp->member.exp->type == 26)
14082 {
14083 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
14084 typeKind = 8;
14085 }
14086 if(id)
14087 {
14088 if(typeKind == 3 || typeKind == 15)
14089 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
14090 else if(!_class)
14091 {
14092 if(type->kind == 8 && type->_class && type->_class->registered)
14093 {
14094 _class = type->_class->registered;
14095 }
14096 else if((type->kind == 12 || type->kind == 13) && type->type && type->type->kind == 1)
14097 {
14098 _class = FindClass("char *")->registered;
14099 }
14100 else if(type->kind == 13)
14101 {
14102 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "uintptr");
14103 FreeType(exp->expType);
14104 exp->expType = ProcessTypeString("uintptr", 0x0);
14105 exp->byReference = 0x0;
14106 }
14107 else
14108 {
14109 char string[1024] = "";
14110 struct Symbol * classSym;
14111
14112 PrintTypeNoConst(type, string, 0x0, 0x1);
14113 classSym = FindClass(string);
14114 if(classSym)
14115 _class = classSym->registered;
14116 }
14117 }
14118 }
14119 if(_class && id)
14120 {
14121 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
14122 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
14123 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
14124 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
14125 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
14126
14127 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
14128 exp->member.memberType = 1;
14129 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
14130 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
14131 if(typeKind != 19)
14132 {
14133 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
14134 {
14135 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
14136 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
14137 {
14138 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14139 if(prop)
14140 member = (((void *)0));
14141 }
14142 if(!member && !prop)
14143 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14144 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
14145 exp->member.thisPtr = 0x1;
14146 }
14147 else
14148 {
14149 if(!id->classSym)
14150 {
14151 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
14152 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
14153 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
14154 }
14155 if(!prop && !member)
14156 {
14157 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
14158 if(!method)
14159 {
14160 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14161 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
14162 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
14163 }
14164 }
14165 if(member && prop)
14166 {
14167 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
14168 prop = (((void *)0));
14169 else
14170 member = (((void *)0));
14171 }
14172 }
14173 }
14174 if(!prop && !member && !method)
14175 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
14176 if(!prop && !member && !method)
14177 {
14178 if(typeKind == 19)
14179 {
14180 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
14181 if(classProp)
14182 {
14183 exp->member.memberType = 5;
14184 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
14185 }
14186 else
14187 {
14188 char structName[1024];
14189 struct Identifier * id = exp->member.member;
14190 struct Expression * classExp = exp->member.exp;
14191
14192 type->refCount++;
14193 FreeType(classExp->expType);
14194 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
14195 strcpy(structName, "__ecereClassData_");
14196 FullClassNameCat(structName, type->_class->string, 0x0);
14197 exp->type = 9;
14198 exp->member.member = id;
14199 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"))))))));
14200 FreeType(type);
14201 ProcessExpressionType(exp);
14202 return ;
14203 }
14204 }
14205 else
14206 {
14207 struct Symbol * classSym = FindClass(id->string);
14208
14209 if(classSym)
14210 {
14211 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
14212
14213 if(convertClass)
14214 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
14215 }
14216 }
14217 }
14218 if(prop)
14219 {
14220 exp->member.memberType = 1;
14221 if(!prop->dataType)
14222 ProcessPropertyType(prop);
14223 exp->expType = prop->dataType;
14224 if(prop->dataType)
14225 prop->dataType->refCount++;
14226 }
14227 else if(member)
14228 {
14229 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14230 {
14231 FreeExpContents(exp);
14232 exp->type = 0;
14233 exp->identifier = MkIdentifier("class");
14234 ProcessExpressionType(exp);
14235 return ;
14236 }
14237 exp->member.memberType = 3;
14238 DeclareStruct(_class->fullName, 0x0);
14239 if(!member->dataType)
14240 {
14241 struct Context * context = SetupTemplatesContext(_class);
14242
14243 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
14244 FinishTemplatesContext(context);
14245 }
14246 exp->expType = member->dataType;
14247 if(member->dataType)
14248 member->dataType->refCount++;
14249 }
14250 else if(revConvert)
14251 {
14252 exp->member.memberType = 4;
14253 exp->expType = MkClassType(revConvert->_class->fullName);
14254 }
14255 else if(method)
14256 {
14257 {
14258 exp->member.memberType = 2;
14259 }
14260 if(!method->dataType)
14261 ProcessMethodType(method);
14262 exp->expType = __extension__ ({
14263 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14264
14265 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1;
14266 });
14267 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
14268 exp->expType->usedClass = _class;
14269 }
14270 else if(!classProp)
14271 {
14272 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14273 {
14274 FreeExpContents(exp);
14275 exp->type = 0;
14276 exp->identifier = MkIdentifier("class");
14277 ProcessExpressionType(exp);
14278 return ;
14279 }
14280 yylloc = exp->member.member->loc;
14281 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
14282 if(inCompiler)
14283 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
14284 }
14285 if(_class && exp->expType)
14286 {
14287 struct __ecereNameSpace__ecere__com__Class * tClass;
14288
14289 tClass = _class;
14290 while(tClass && !tClass->templateClass)
14291 tClass = tClass->base;
14292 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
14293 {
14294 int id = 0;
14295 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14296 struct __ecereNameSpace__ecere__com__Class * sClass;
14297
14298 for(sClass = tClass; sClass; sClass = sClass->base)
14299 {
14300 id = 0;
14301 if(sClass->templateClass)
14302 sClass = sClass->templateClass;
14303 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14304 {
14305 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
14306 {
14307 for(sClass = sClass->base; sClass; sClass = sClass->base)
14308 id += sClass->templateParams.count;
14309 break;
14310 }
14311 id++;
14312 }
14313 if(curParam)
14314 break;
14315 }
14316 if(curParam && tClass->templateArgs[id].dataTypeString)
14317 {
14318 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14319 struct Context * context = SetupTemplatesContext(tClass);
14320
14321 FreeType(exp->expType);
14322 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
14323 if(exp->expType)
14324 {
14325 if(exp->expType->kind == 21)
14326 {
14327 FreeType(exp->expType);
14328 exp->expType = ReplaceThisClassType(_class);
14329 }
14330 if(tClass->templateClass)
14331 exp->expType->passAsTemplate = 0x1;
14332 if(!exp->destType)
14333 {
14334 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
14335 if(exp->destType->kind == 21)
14336 {
14337 FreeType(exp->destType);
14338 exp->destType = ReplaceThisClassType(_class);
14339 }
14340 }
14341 }
14342 FinishTemplatesContext(context);
14343 }
14344 }
14345 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
14346 {
14347 int id = 0;
14348 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14349 struct __ecereNameSpace__ecere__com__Class * sClass;
14350
14351 for(sClass = tClass; sClass; sClass = sClass->base)
14352 {
14353 id = 0;
14354 if(sClass->templateClass)
14355 sClass = sClass->templateClass;
14356 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14357 {
14358 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
14359 {
14360 for(sClass = sClass->base; sClass; sClass = sClass->base)
14361 id += sClass->templateParams.count;
14362 break;
14363 }
14364 id++;
14365 }
14366 if(curParam)
14367 break;
14368 }
14369 if(curParam)
14370 {
14371 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14372 struct Context * context = SetupTemplatesContext(tClass);
14373 struct Type * basicType;
14374
14375 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
14376 if(basicType)
14377 {
14378 if(basicType->kind == 21)
14379 {
14380 FreeType(basicType);
14381 basicType = ReplaceThisClassType(_class);
14382 }
14383 FreeType(exp->expType);
14384 exp->expType = __extension__ ({
14385 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14386
14387 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = basicType, __ecereInstance1;
14388 });
14389 if(!exp->destType)
14390 {
14391 exp->destType = exp->expType;
14392 exp->destType->refCount++;
14393 }
14394 {
14395 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14396 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14397 struct Declarator * decl;
14398
14399 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
14400 *newExp = *exp;
14401 if(exp->destType)
14402 exp->destType->refCount++;
14403 if(exp->expType)
14404 exp->expType->refCount++;
14405 exp->type = 11;
14406 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
14407 exp->cast.exp = newExp;
14408 }
14409 }
14410 FinishTemplatesContext(context);
14411 }
14412 }
14413 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
14414 {
14415 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
14416
14417 if(expClass)
14418 {
14419 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
14420 int c;
14421 int p = 0;
14422 int paramCount = 0;
14423 int lastParam = -1;
14424 char templateString[1024];
14425 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
14426
14427 sprintf(templateString, "%s<", expClass->templateClass->fullName);
14428 while(cClass != expClass)
14429 {
14430 struct __ecereNameSpace__ecere__com__Class * sClass;
14431
14432 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
14433 ;
14434 cClass = sClass;
14435 for(param = cClass->templateParams.first; param; param = param->next)
14436 {
14437 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
14438 int c;
14439 int cp = 0;
14440 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
14441 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
14442
14443 while(cClassCur != tClass && !paramCur)
14444 {
14445 struct __ecereNameSpace__ecere__com__Class * sClassCur;
14446
14447 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
14448 ;
14449 cClassCur = sClassCur;
14450 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
14451 {
14452 if(!strcmp(paramCur->name, param->name))
14453 {
14454 break;
14455 }
14456 cp++;
14457 }
14458 }
14459 if(paramCur && paramCur->type == 0)
14460 arg = tClass->templateArgs[cp];
14461 else
14462 arg = expClass->templateArgs[p];
14463 {
14464 char argument[256];
14465
14466 argument[0] = '\0';
14467 switch(param->type)
14468 {
14469 case 2:
14470 {
14471 char expString[1024];
14472 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14473 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14474 struct Expression * exp;
14475 char * string = PrintHexUInt64(arg.expression.ui64);
14476
14477 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14478 ProcessExpressionType(exp);
14479 ComputeExpression(exp);
14480 expString[0] = '\0';
14481 PrintExpression(exp, expString);
14482 strcat(argument, expString);
14483 FreeExpression(exp);
14484 break;
14485 }
14486 case 1:
14487 {
14488 strcat(argument, arg.member->name);
14489 break;
14490 }
14491 case 0:
14492 {
14493 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14494 strcat(argument, arg.dataTypeString);
14495 break;
14496 }
14497 }
14498 if(argument[0])
14499 {
14500 if(paramCount)
14501 strcat(templateString, ", ");
14502 if(lastParam != p - 1)
14503 {
14504 strcat(templateString, param->name);
14505 strcat(templateString, " = ");
14506 }
14507 strcat(templateString, argument);
14508 paramCount++;
14509 lastParam = p;
14510 }
14511 }
14512 p++;
14513 }
14514 }
14515 {
14516 int len = strlen(templateString);
14517
14518 if(templateString[len - 1] == '>')
14519 templateString[len++] = ' ';
14520 templateString[len++] = '>';
14521 templateString[len++] = '\0';
14522 }
14523 FreeType(exp->expType);
14524 {
14525 struct Context * context = SetupTemplatesContext(tClass);
14526
14527 exp->expType = ProcessTypeString(templateString, 0x0);
14528 FinishTemplatesContext(context);
14529 }
14530 }
14531 }
14532 }
14533 }
14534 else
14535 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)");
14536 }
14537 else if(type && (type->kind == 9 || type->kind == 10))
14538 {
14539 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
14540
14541 if(memberType)
14542 {
14543 exp->expType = memberType;
14544 if(memberType)
14545 memberType->refCount++;
14546 }
14547 }
14548 else
14549 {
14550 char expString[10240];
14551
14552 expString[0] = '\0';
14553 if(inCompiler)
14554 {
14555 PrintExpression(exp, expString);
14556 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14557 }
14558 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
14559 }
14560 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
14561 {
14562 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
14563 {
14564 struct Identifier * id = exp->member.member;
14565 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));
14566
14567 if(_class)
14568 {
14569 FreeType(exp->expType);
14570 exp->expType = ReplaceThisClassType(_class);
14571 }
14572 }
14573 }
14574 yylloc = oldyylloc;
14575 break;
14576 }
14577 case 9:
14578 {
14579 struct Type * destType = exp->destType;
14580
14581 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
14582 {
14583 exp->member.member->classSym = exp->member.member->_class->symbol;
14584 }
14585 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
14586 exp->type = 8;
14587 if(destType)
14588 destType->count++;
14589 ProcessExpressionType(exp);
14590 if(destType)
14591 destType->count--;
14592 break;
14593 }
14594 case 15:
14595 {
14596 struct Symbol * classSym = exp->_class->symbol;
14597
14598 if(classSym && classSym->registered)
14599 {
14600 if(classSym->registered->type == 5)
14601 {
14602 char name[1024];
14603
14604 name[0] = '\0';
14605 DeclareStruct(classSym->string, 0x0);
14606 FreeSpecifier(exp->_class);
14607 exp->type = 10;
14608 FullClassNameCat(name, classSym->string, 0x0);
14609 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
14610 }
14611 else
14612 {
14613 if(classSym->registered->fixed)
14614 {
14615 FreeSpecifier(exp->_class);
14616 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
14617 exp->type = 2;
14618 }
14619 else
14620 {
14621 char className[1024];
14622
14623 strcpy(className, "__ecereClass_");
14624 FullClassNameCat(className, classSym->string, 0x1);
14625 MangleClassName(className);
14626 DeclareClass(classSym, className);
14627 FreeExpContents(exp);
14628 exp->type = 9;
14629 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14630 exp->member.member = MkIdentifier("structSize");
14631 }
14632 }
14633 }
14634 exp->expType = __extension__ ({
14635 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14636
14637 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
14638 });
14639 break;
14640 }
14641 case 10:
14642 {
14643 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
14644
14645 exp->expType = __extension__ ({
14646 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14647
14648 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
14649 });
14650 exp->isConstant = 0x1;
14651 DeclareType(type, 0x0, 0x0);
14652 FreeType(type);
14653 break;
14654 }
14655 case 11:
14656 {
14657 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14658
14659 type->count = 1;
14660 FreeType(exp->cast.exp->destType);
14661 exp->cast.exp->destType = type;
14662 type->refCount++;
14663 ProcessExpressionType(exp->cast.exp);
14664 type->count = 0;
14665 exp->expType = type;
14666 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14667 {
14668 void * prev = exp->prev, * next = exp->next;
14669 struct Type * expType = exp->cast.exp->destType;
14670 struct Expression * castExp = exp->cast.exp;
14671 struct Type * destType = exp->destType;
14672
14673 if(expType)
14674 expType->refCount++;
14675 FreeType(exp->expType);
14676 FreeTypeName(exp->cast.typeName);
14677 *exp = *castExp;
14678 FreeType(exp->expType);
14679 FreeType(exp->destType);
14680 exp->expType = expType;
14681 exp->destType = destType;
14682 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14683 exp->prev = prev;
14684 exp->next = next;
14685 }
14686 else
14687 {
14688 exp->isConstant = exp->cast.exp->isConstant;
14689 }
14690 break;
14691 }
14692 case 35:
14693 {
14694 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14695
14696 exp->expType = type;
14697 break;
14698 }
14699 case 36:
14700 {
14701 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14702
14703 ProcessExpressionType(exp->vaArg.exp);
14704 exp->expType = type;
14705 break;
14706 }
14707 case 12:
14708 {
14709 struct Expression * e;
14710
14711 exp->isConstant = 0x1;
14712 FreeType(exp->cond.cond->destType);
14713 exp->cond.cond->destType = MkClassType("bool");
14714 exp->cond.cond->destType->truth = 0x1;
14715 ProcessExpressionType(exp->cond.cond);
14716 if(!exp->cond.cond->isConstant)
14717 exp->isConstant = 0x0;
14718 for(e = (*exp->cond.exp).first; e; e = e->next)
14719 {
14720 if(!e->next)
14721 {
14722 FreeType(e->destType);
14723 e->destType = exp->destType;
14724 if(e->destType)
14725 e->destType->refCount++;
14726 }
14727 ProcessExpressionType(e);
14728 if(!e->next)
14729 {
14730 exp->expType = e->expType;
14731 if(e->expType)
14732 e->expType->refCount++;
14733 }
14734 if(!e->isConstant)
14735 exp->isConstant = 0x0;
14736 }
14737 FreeType(exp->cond.elseExp->destType);
14738 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14739 if(exp->cond.elseExp->destType)
14740 exp->cond.elseExp->destType->refCount++;
14741 ProcessExpressionType(exp->cond.elseExp);
14742 if(!exp->cond.elseExp->isConstant)
14743 exp->isConstant = 0x0;
14744 break;
14745 }
14746 case 25:
14747 {
14748 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14749 {
14750 struct Statement * last = (*exp->compound->compound.statements).last;
14751
14752 if(last->type == 3 && last->expressions && (*last->expressions).last)
14753 {
14754 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14755 if(exp->destType)
14756 exp->destType->refCount++;
14757 }
14758 ProcessStatement(exp->compound);
14759 exp->expType = (last->expressions && (*last->expressions).last) ? ((struct Expression *)(*last->expressions).last)->expType : (((void *)0));
14760 if(exp->expType)
14761 exp->expType->refCount++;
14762 }
14763 break;
14764 }
14765 case 26:
14766 {
14767 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14768
14769 if(spec && spec->type == 1)
14770 {
14771 exp->expType = MkClassType(spec->name);
14772 exp->expType->kind = 19;
14773 exp->byReference = 0x1;
14774 }
14775 else
14776 {
14777 exp->expType = MkClassType("ecere::com::Class");
14778 exp->byReference = 0x1;
14779 }
14780 break;
14781 }
14782 case 27:
14783 {
14784 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14785
14786 if(_class)
14787 {
14788 struct Identifier * id = exp->classData.id;
14789 char structName[1024];
14790 struct Expression * classExp;
14791
14792 strcpy(structName, "__ecereClassData_");
14793 FullClassNameCat(structName, _class->fullName, 0x0);
14794 exp->type = 9;
14795 exp->member.member = id;
14796 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14797 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14798 else
14799 classExp = MkExpIdentifier(MkIdentifier("class"));
14800 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"))))))));
14801 ProcessExpressionType(exp);
14802 return ;
14803 }
14804 break;
14805 }
14806 case 37:
14807 {
14808 struct Type * type = (((void *)0));
14809 char * typeString = (((void *)0));
14810 char typeStringBuf[1024];
14811
14812 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))
14813 {
14814 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14815
14816 typeString = templateClass->templateArgs[2].dataTypeString;
14817 }
14818 else if(exp->list)
14819 {
14820 struct Expression * e;
14821
14822 for(e = (*exp->list).first; e; e = e->next)
14823 {
14824 ProcessExpressionType(e);
14825 if(e->expType)
14826 {
14827 if(!type)
14828 {
14829 type = e->expType;
14830 type->refCount++;
14831 }
14832 else
14833 {
14834 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14835 {
14836 FreeType(type);
14837 type = e->expType;
14838 e->expType = (((void *)0));
14839 e = (*exp->list).first;
14840 ProcessExpressionType(e);
14841 if(e->expType)
14842 {
14843 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14844 {
14845 FreeType(e->expType);
14846 e->expType = (((void *)0));
14847 FreeType(type);
14848 type = (((void *)0));
14849 break;
14850 }
14851 }
14852 }
14853 }
14854 if(e->expType)
14855 {
14856 FreeType(e->expType);
14857 e->expType = (((void *)0));
14858 }
14859 }
14860 }
14861 if(type)
14862 {
14863 typeStringBuf[0] = '\0';
14864 PrintTypeNoConst(type, typeStringBuf, 0x0, 0x1);
14865 typeString = typeStringBuf;
14866 FreeType(type);
14867 type = (((void *)0));
14868 }
14869 }
14870 if(typeString)
14871 {
14872 char templateString[1024];
14873 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14874 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14875 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14876 struct Expression * expExt;
14877 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14878
14879 sprintf(templateString, "Container<%s>", typeString);
14880 if(exp->list)
14881 {
14882 struct Expression * e;
14883
14884 type = ProcessTypeString(typeString, 0x0);
14885 while(e = (*exp->list).first)
14886 {
14887 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14888 e->destType = type;
14889 type->refCount++;
14890 ProcessExpressionType(e);
14891 ListAdd(initializers, MkInitializerAssignment(e));
14892 }
14893 FreeType(type);
14894 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14895 }
14896 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
14897 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
14898 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14899 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
14900 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14901 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
14902 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14903 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
14904 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14905 ListAdd(structInitializers, MkInitializerAssignment(__extension__ ({
14906 struct Expression * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14907
14908 __ecereInstance1->type = 2, __ecereInstance1->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, (void *)0), __ecereInstance1;
14909 })));
14910 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14911 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
14912 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14913 exp->expType = ProcessTypeString(templateString, 0x0);
14914 exp->type = 5;
14915 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
14916 ProcessExpressionType(expExt);
14917 }
14918 else
14919 {
14920 exp->expType = ProcessTypeString("Container", 0x0);
14921 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
14922 }
14923 break;
14924 }
14925 }
14926 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
14927 {
14928 FreeType(exp->expType);
14929 exp->expType = ReplaceThisClassType(thisClass);
14930 }
14931 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
14932 {
14933 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
14934
14935 if(symbol)
14936 {
14937 if(exp->expType->kind != 15)
14938 {
14939 struct Type * member;
14940 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
14941
14942 FreeType(exp->expType);
14943 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14944 exp->expType->kind = symbol->type->kind;
14945 exp->expType->refCount++;
14946 exp->expType->enumName = enumName;
14947 exp->expType->members = symbol->type->members;
14948 for(member = symbol->type->members.first; member; member = member->next)
14949 member->refCount++;
14950 }
14951 else
14952 {
14953 struct __ecereNameSpace__ecere__sys__NamedLink * member;
14954
14955 for(member = symbol->type->members.first; member; member = member->next)
14956 {
14957 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(structSize_NamedLink), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
14958
14959 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
14960 }
14961 }
14962 }
14963 }
14964 yylloc = exp->loc;
14965 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
14966 ;
14967 else if(exp->destType && !exp->destType->keepCast)
14968 {
14969 if(!CheckExpressionType(exp, exp->destType, 0x0))
14970 {
14971 if(!exp->destType->count || unresolved)
14972 {
14973 if(!exp->expType)
14974 {
14975 yylloc = exp->loc;
14976 if(exp->destType->kind != 14)
14977 {
14978 char type2[1024];
14979
14980 type2[0] = '\0';
14981 if(inCompiler)
14982 {
14983 char expString[10240];
14984
14985 expString[0] = '\0';
14986 PrintType(exp->destType, type2, 0x0, 0x1);
14987 if(inCompiler)
14988 {
14989 PrintExpression(exp, expString);
14990 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14991 }
14992 if(unresolved)
14993 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
14994 else if(exp->type != 16)
14995 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
14996 }
14997 }
14998 else
14999 {
15000 char expString[10240];
15001
15002 expString[0] = '\0';
15003 if(inCompiler)
15004 {
15005 PrintExpression(exp, expString);
15006 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15007 }
15008 if(unresolved)
15009 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
15010 else if(exp->type != 16)
15011 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
15012 }
15013 }
15014 else
15015 {
15016 char type1[1024];
15017 char type2[1024];
15018
15019 type1[0] = '\0';
15020 type2[0] = '\0';
15021 if(inCompiler)
15022 {
15023 PrintType(exp->expType, type1, 0x0, 0x1);
15024 PrintType(exp->destType, type2, 0x0, 0x1);
15025 }
15026 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)))
15027 ;
15028 else
15029 {
15030 char expString[10240];
15031
15032 expString[0] = '\0';
15033 if(inCompiler)
15034 {
15035 PrintExpression(exp, expString);
15036 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15037 }
15038 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
15039 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
15040 FreeType(exp->expType);
15041 exp->destType->refCount++;
15042 exp->expType = exp->destType;
15043 }
15044 }
15045 }
15046 }
15047 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
15048 {
15049 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
15050 char typeString[1024];
15051 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15052 struct Declarator * decl;
15053
15054 typeString[0] = '\0';
15055 *newExp = *exp;
15056 if(exp->expType)
15057 exp->expType->refCount++;
15058 if(exp->expType)
15059 exp->expType->refCount++;
15060 exp->type = 11;
15061 newExp->destType = exp->expType;
15062 PrintType(exp->expType, typeString, 0x0, 0x0);
15063 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
15064 exp->cast.typeName = MkTypeName(specs, decl);
15065 exp->cast.exp = newExp;
15066 }
15067 }
15068 else if(unresolved)
15069 {
15070 if(exp->identifier->_class && exp->identifier->_class->name)
15071 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
15072 else if(exp->identifier->string && exp->identifier->string[0])
15073 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
15074 }
15075 else if(!exp->expType && exp->type != 16)
15076 {
15077 char expString[10240];
15078
15079 expString[0] = '\0';
15080 if(inCompiler)
15081 {
15082 PrintExpression(exp, expString);
15083 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15084 }
15085 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
15086 }
15087 if(inCompiler)
15088 ApplyAnyObjectLogic(exp);
15089 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5 && (!exp->destType || (exp->destType->kind != 3 && exp->destType->kind != 4 && exp->destType->kind != 22 && exp->destType->kind != 23 && exp->destType->kind != 5 && exp->destType->kind != 2 && exp->destType->kind != 1)))
15090 {
15091 exp->byReference = 0x1;
15092 }
15093 yylloc = oldyylloc;
15094 }
15095
15096 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)
15097 {
15098 if(*curMember)
15099 {
15100 *curMember = (*curMember)->next;
15101 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
15102 {
15103 *curMember = subMemberStack[--(*subMemberStackPos)];
15104 *curMember = (*curMember)->next;
15105 }
15106 while((*curMember) && (*curMember)->isProperty)
15107 *curMember = (*curMember)->next;
15108 if(subMemberStackPos)
15109 {
15110 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
15111 {
15112 subMemberStack[(*subMemberStackPos)++] = *curMember;
15113 *curMember = (*curMember)->members.first;
15114 while(*curMember && (*curMember)->isProperty)
15115 *curMember = (*curMember)->next;
15116 }
15117 }
15118 }
15119 while(!*curMember)
15120 {
15121 if(!*curMember)
15122 {
15123 if(subMemberStackPos && *subMemberStackPos)
15124 {
15125 *curMember = subMemberStack[--(*subMemberStackPos)];
15126 *curMember = (*curMember)->next;
15127 }
15128 else
15129 {
15130 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
15131
15132 if(*curClass == _class)
15133 break;
15134 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
15135 ;
15136 *curMember = (*curClass)->membersAndProperties.first;
15137 }
15138 while((*curMember) && (*curMember)->isProperty)
15139 *curMember = (*curMember)->next;
15140 if(subMemberStackPos)
15141 {
15142 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
15143 {
15144 subMemberStack[(*subMemberStackPos)++] = *curMember;
15145 *curMember = (*curMember)->members.first;
15146 while(*curMember && (*curMember)->isProperty)
15147 *curMember = (*curMember)->next;
15148 }
15149 }
15150 }
15151 }
15152 }
15153
15154 static void ProcessInitializer(struct Initializer * init, struct Type * type)
15155 {
15156 switch(init->type)
15157 {
15158 case 0:
15159 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
15160 {
15161 if(init->exp && !init->exp->destType)
15162 {
15163 FreeType(init->exp->destType);
15164 init->exp->destType = type;
15165 if(type)
15166 type->refCount++;
15167 }
15168 if(init->exp)
15169 {
15170 ProcessExpressionType(init->exp);
15171 init->isConstant = init->exp->isConstant;
15172 }
15173 break;
15174 }
15175 else
15176 {
15177 struct Expression * exp = init->exp;
15178 struct Instantiation * inst = exp->instance;
15179 struct MembersInit * members;
15180
15181 init->type = 1;
15182 init->list = MkList();
15183 if(inst->members)
15184 {
15185 for(members = (*inst->members).first; members; members = members->next)
15186 {
15187 if(members->type == 0)
15188 {
15189 struct MemberInit * member;
15190
15191 for(member = (*members->dataMembers).first; member; member = member->next)
15192 {
15193 ListAdd(init->list, member->initializer);
15194 member->initializer = (((void *)0));
15195 }
15196 }
15197 }
15198 }
15199 FreeExpression(exp);
15200 }
15201 case 1:
15202 {
15203 struct Initializer * i;
15204 struct Type * initializerType = (((void *)0));
15205 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
15206 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
15207 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
15208 int subMemberStackPos = 0;
15209
15210 if(type && type->kind == 12)
15211 initializerType = Dereference(type);
15212 else if(type && (type->kind == 9 || type->kind == 10))
15213 initializerType = type->members.first;
15214 for(i = (*init->list).first; i; i = i->next)
15215 {
15216 if(type && type->kind == 8 && type->_class && type->_class->registered)
15217 {
15218 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
15219 if(curMember)
15220 {
15221 if(!curMember->dataType)
15222 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
15223 initializerType = curMember->dataType;
15224 }
15225 }
15226 ProcessInitializer(i, initializerType);
15227 if(initializerType && type && (type->kind == 9 || type->kind == 10))
15228 initializerType = initializerType->next;
15229 if(!i->isConstant)
15230 init->isConstant = 0x0;
15231 }
15232 if(type && type->kind == 12)
15233 FreeType(initializerType);
15234 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
15235 {
15236 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
15237 }
15238 break;
15239 }
15240 }
15241 }
15242
15243 extern struct Symbol * FindType(struct Context * ctx, char *  name);
15244
15245 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
15246
15247 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
15248 {
15249 switch(spec->type)
15250 {
15251 case 0:
15252 {
15253 if(spec->specifier == THISCLASS)
15254 {
15255 if(thisClass)
15256 {
15257 spec->type = 1;
15258 spec->name = ReplaceThisClass(thisClass);
15259 spec->symbol = FindClass(spec->name);
15260 ProcessSpecifier(spec, declareStruct);
15261 }
15262 }
15263 break;
15264 }
15265 case 1:
15266 {
15267 struct Symbol * symbol = FindType(curContext, spec->name);
15268
15269 if(symbol)
15270 DeclareType(symbol->type, 0x1, 0x1);
15271 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
15272 DeclareStruct(spec->name, 0x0);
15273 break;
15274 }
15275 case 2:
15276 {
15277 struct Enumerator * e;
15278
15279 if(spec->list)
15280 {
15281 for(e = (*spec->list).first; e; e = e->next)
15282 {
15283 if(e->exp)
15284 ProcessExpressionType(e->exp);
15285 }
15286 }
15287 break;
15288 }
15289 case 3:
15290 case 4:
15291 {
15292 if(spec->definitions)
15293 {
15294 struct ClassDef * def;
15295 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
15296
15297 ProcessClass(spec->definitions, symbol);
15298 }
15299 break;
15300 }
15301 }
15302 }
15303
15304 static void ProcessDeclarator(struct Declarator * decl)
15305 {
15306 switch(decl->type)
15307 {
15308 case 1:
15309 if(decl->identifier->classSym)
15310 {
15311 FreeSpecifier(decl->identifier->_class);
15312 decl->identifier->_class = (((void *)0));
15313 }
15314 break;
15315 case 3:
15316 if(decl->array.exp)
15317 ProcessExpressionType(decl->array.exp);
15318 case 0:
15319 case 2:
15320 case 4:
15321 case 5:
15322 case 6:
15323 case 7:
15324 if(decl->declarator)
15325 ProcessDeclarator(decl->declarator);
15326 if(decl->type == 4)
15327 {
15328 struct Identifier * id = GetDeclId(decl);
15329
15330 if(id && id->_class)
15331 {
15332 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
15333
15334 if(!decl->function.parameters)
15335 decl->function.parameters = MkList();
15336 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
15337 id->_class = (((void *)0));
15338 }
15339 if(decl->function.parameters)
15340 {
15341 struct TypeName * param;
15342
15343 for(param = (*decl->function.parameters).first; param; param = param->next)
15344 {
15345 if(param->qualifiers && (*param->qualifiers).first)
15346 {
15347 struct Specifier * spec = (*param->qualifiers).first;
15348
15349 if(spec && spec->specifier == TYPED_OBJECT)
15350 {
15351 struct Declarator * d = param->declarator;
15352 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);
15353
15354 FreeList(param->qualifiers, FreeSpecifier);
15355 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
15356 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
15357 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
15358 param = newParam;
15359 }
15360 else if(spec && spec->specifier == ANY_OBJECT)
15361 {
15362 struct Declarator * d = param->declarator;
15363
15364 FreeList(param->qualifiers, FreeSpecifier);
15365 param->qualifiers = MkListOne(MkSpecifier(VOID));
15366 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
15367 }
15368 else if(spec->specifier == THISCLASS)
15369 {
15370 if(thisClass)
15371 {
15372 spec->type = 1;
15373 spec->name = ReplaceThisClass(thisClass);
15374 spec->symbol = FindClass(spec->name);
15375 ProcessSpecifier(spec, 0x0);
15376 }
15377 }
15378 }
15379 if(param->declarator)
15380 ProcessDeclarator(param->declarator);
15381 }
15382 }
15383 }
15384 break;
15385 }
15386 }
15387
15388 extern struct Identifier * CopyIdentifier(struct Identifier * id);
15389
15390 extern void FreeInitDeclarator(struct InitDeclarator * decl);
15391
15392 static void ProcessDeclaration(struct Declaration * decl)
15393 {
15394 yylloc = decl->loc;
15395 switch(decl->type)
15396 {
15397 case 1:
15398 {
15399 unsigned int declareStruct = 0x0;
15400
15401 if(decl->declarators)
15402 {
15403 struct InitDeclarator * d;
15404
15405 for(d = (*decl->declarators).first; d; d = d->next)
15406 {
15407 struct Type * type, * subType;
15408
15409 ProcessDeclarator(d->declarator);
15410 type = ProcessType(decl->specifiers, d->declarator);
15411 if(d->initializer)
15412 {
15413 ProcessInitializer(d->initializer, type);
15414 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
15415 {
15416 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
15417 {
15418 struct Instantiation * inst = d->initializer->exp->instance;
15419
15420 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
15421 d->initializer->exp->instance = (((void *)0));
15422 if(decl->specifiers)
15423 FreeList(decl->specifiers, FreeSpecifier);
15424 FreeList(decl->declarators, FreeInitDeclarator);
15425 d = (((void *)0));
15426 decl->type = 2;
15427 decl->inst = inst;
15428 }
15429 }
15430 }
15431 for(subType = type; subType; )
15432 {
15433 if(subType->kind == 8)
15434 {
15435 declareStruct = 0x1;
15436 break;
15437 }
15438 else if(subType->kind == 13)
15439 break;
15440 else if(subType->kind == 12)
15441 subType = subType->arrayType;
15442 else
15443 break;
15444 }
15445 FreeType(type);
15446 if(!d)
15447 break;
15448 }
15449 }
15450 if(decl->specifiers)
15451 {
15452 struct Specifier * s;
15453
15454 for(s = (*decl->specifiers).first; s; s = s->next)
15455 {
15456 ProcessSpecifier(s, declareStruct);
15457 }
15458 }
15459 break;
15460 }
15461 case 2:
15462 {
15463 ProcessInstantiationType(decl->inst);
15464 break;
15465 }
15466 case 0:
15467 {
15468 struct Specifier * spec;
15469 struct Declarator * d;
15470 unsigned int declareStruct = 0x0;
15471
15472 if(decl->declarators)
15473 {
15474 for(d = (*decl->declarators).first; d; d = d->next)
15475 {
15476 struct Type * type = ProcessType(decl->specifiers, d->declarator);
15477 struct Type * subType;
15478
15479 ProcessDeclarator(d);
15480 for(subType = type; subType; )
15481 {
15482 if(subType->kind == 8)
15483 {
15484 declareStruct = 0x1;
15485 break;
15486 }
15487 else if(subType->kind == 13)
15488 break;
15489 else if(subType->kind == 12)
15490 subType = subType->arrayType;
15491 else
15492 break;
15493 }
15494 FreeType(type);
15495 }
15496 }
15497 if(decl->specifiers)
15498 {
15499 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
15500 ProcessSpecifier(spec, declareStruct);
15501 }
15502 break;
15503 }
15504 }
15505 }
15506
15507 static struct FunctionDefinition * curFunction;
15508
15509 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
15510 {
15511 char propName[1024], propNameM[1024];
15512 char getName[1024], setName[1024];
15513 struct __ecereNameSpace__ecere__sys__OldList * args;
15514
15515 DeclareProperty(prop, setName, getName);
15516 strcpy(propName, "__ecereProp_");
15517 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15518 strcat(propName, "_");
15519 FullClassNameCat(propName, prop->name, 0x1);
15520 MangleClassName(propName);
15521 strcpy(propNameM, "__ecerePropM_");
15522 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
15523 strcat(propNameM, "_");
15524 FullClassNameCat(propNameM, prop->name, 0x1);
15525 MangleClassName(propNameM);
15526 if(prop->isWatchable)
15527 {
15528 args = MkList();
15529 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15530 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15531 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15532 args = MkList();
15533 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15534 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15535 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15536 }
15537 {
15538 args = MkList();
15539 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15540 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15541 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15542 args = MkList();
15543 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15544 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15545 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15546 }
15547 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15548 curFunction->propSet->fireWatchersDone = 0x1;
15549 }
15550
15551 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
15552
15553 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
15554
15555 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
15556
15557 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
15558
15559 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
15560
15561 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
15562
15563 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
15564
15565 extern void FreePropertyWatch(struct PropertyWatch * watcher);
15566
15567 static void ProcessStatement(struct Statement * stmt)
15568 {
15569 yylloc = stmt->loc;
15570 switch(stmt->type)
15571 {
15572 case 0:
15573 ProcessStatement(stmt->labeled.stmt);
15574 break;
15575 case 1:
15576 if(stmt->caseStmt.exp)
15577 {
15578 FreeType(stmt->caseStmt.exp->destType);
15579 stmt->caseStmt.exp->destType = curSwitchType;
15580 if(curSwitchType)
15581 curSwitchType->refCount++;
15582 ProcessExpressionType(stmt->caseStmt.exp);
15583 ComputeExpression(stmt->caseStmt.exp);
15584 }
15585 if(stmt->caseStmt.stmt)
15586 ProcessStatement(stmt->caseStmt.stmt);
15587 break;
15588 case 2:
15589 {
15590 if(stmt->compound.context)
15591 {
15592 struct Declaration * decl;
15593 struct Statement * s;
15594 struct Statement * prevCompound = curCompound;
15595 struct Context * prevContext = curContext;
15596
15597 if(!stmt->compound.isSwitch)
15598 {
15599 curCompound = stmt;
15600 curContext = stmt->compound.context;
15601 }
15602 if(stmt->compound.declarations)
15603 {
15604 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
15605 ProcessDeclaration(decl);
15606 }
15607 if(stmt->compound.statements)
15608 {
15609 for(s = (*stmt->compound.statements).first; s; s = s->next)
15610 ProcessStatement(s);
15611 }
15612 curContext = prevContext;
15613 curCompound = prevCompound;
15614 }
15615 break;
15616 }
15617 case 3:
15618 {
15619 struct Expression * exp;
15620
15621 if(stmt->expressions)
15622 {
15623 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15624 ProcessExpressionType(exp);
15625 }
15626 break;
15627 }
15628 case 4:
15629 {
15630 struct Expression * exp;
15631
15632 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15633 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15634 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15635 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15636 {
15637 ProcessExpressionType(exp);
15638 }
15639 if(stmt->ifStmt.stmt)
15640 ProcessStatement(stmt->ifStmt.stmt);
15641 if(stmt->ifStmt.elseStmt)
15642 ProcessStatement(stmt->ifStmt.elseStmt);
15643 break;
15644 }
15645 case 5:
15646 {
15647 struct Type * oldSwitchType = curSwitchType;
15648
15649 if(stmt->switchStmt.exp)
15650 {
15651 struct Expression * exp;
15652
15653 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15654 {
15655 if(!exp->next)
15656 {
15657 ProcessExpressionType(exp);
15658 }
15659 if(!exp->next)
15660 curSwitchType = exp->expType;
15661 }
15662 }
15663 ProcessStatement(stmt->switchStmt.stmt);
15664 curSwitchType = oldSwitchType;
15665 break;
15666 }
15667 case 6:
15668 {
15669 if(stmt->whileStmt.exp)
15670 {
15671 struct Expression * exp;
15672
15673 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15674 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15675 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15676 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15677 {
15678 ProcessExpressionType(exp);
15679 }
15680 }
15681 if(stmt->whileStmt.stmt)
15682 ProcessStatement(stmt->whileStmt.stmt);
15683 break;
15684 }
15685 case 7:
15686 {
15687 if(stmt->doWhile.exp)
15688 {
15689 struct Expression * exp;
15690
15691 if((*stmt->doWhile.exp).last)
15692 {
15693 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15694 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15695 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15696 }
15697 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15698 {
15699 ProcessExpressionType(exp);
15700 }
15701 }
15702 if(stmt->doWhile.stmt)
15703 ProcessStatement(stmt->doWhile.stmt);
15704 break;
15705 }
15706 case 8:
15707 {
15708 struct Expression * exp;
15709
15710 if(stmt->forStmt.init)
15711 ProcessStatement(stmt->forStmt.init);
15712 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15713 {
15714 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15715 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15716 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15717 }
15718 if(stmt->forStmt.check)
15719 ProcessStatement(stmt->forStmt.check);
15720 if(stmt->forStmt.increment)
15721 {
15722 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15723 ProcessExpressionType(exp);
15724 }
15725 if(stmt->forStmt.stmt)
15726 ProcessStatement(stmt->forStmt.stmt);
15727 break;
15728 }
15729 case 18:
15730 {
15731 struct Identifier * id = stmt->forEachStmt.id;
15732 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15733 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15734 struct Statement * block = stmt->forEachStmt.stmt;
15735 char iteratorType[1024];
15736 struct Type * source;
15737 struct Expression * e;
15738 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));
15739 struct Expression * arrayExp;
15740 char * typeString = (((void *)0));
15741 int builtinCount = 0;
15742
15743 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15744 {
15745 if(!e->next)
15746 {
15747 FreeType(e->destType);
15748 e->destType = ProcessTypeString("Container", 0x0);
15749 }
15750 if(!isBuiltin || e->next)
15751 ProcessExpressionType(e);
15752 }
15753 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15754 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15755 {
15756 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15757 struct Symbol * symbol;
15758 struct Expression * expIt = (((void *)0));
15759 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15760 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15761 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15762 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15763
15764 stmt->type = 2;
15765 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15766 stmt->compound.context->parent = curContext;
15767 curContext = stmt->compound.context;
15768 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15769 {
15770 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15771 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15772
15773 isCustomAVLTree = 0x1;
15774 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15775 isAVLTree = 0x1;
15776 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15777 isMap = 0x1;
15778 }
15779 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15780 isArray = 0x1;
15781 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15782 {
15783 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15784
15785 isLinkList = 0x1;
15786 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15787 }
15788 if(isArray)
15789 {
15790 struct Declarator * decl;
15791 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15792
15793 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15794 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15795 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15796 }
15797 else if(isBuiltin)
15798 {
15799 struct Type * type = (((void *)0));
15800 char typeStringBuf[1024];
15801
15802 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15803 if(((struct Expression *)(*exp).last)->type == 11)
15804 {
15805 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15806
15807 if(typeName)
15808 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15809 }
15810 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)
15811 {
15812 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15813
15814 typeString = templateClass->templateArgs[2].dataTypeString;
15815 }
15816 else if(arrayExp->list)
15817 {
15818 struct Expression * e;
15819
15820 for(e = (*arrayExp->list).first; e; e = e->next)
15821 {
15822 ProcessExpressionType(e);
15823 if(e->expType)
15824 {
15825 if(!type)
15826 {
15827 type = e->expType;
15828 type->refCount++;
15829 }
15830 else
15831 {
15832 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15833 {
15834 FreeType(type);
15835 type = e->expType;
15836 e->expType = (((void *)0));
15837 e = (*arrayExp->list).first;
15838 ProcessExpressionType(e);
15839 if(e->expType)
15840 {
15841 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15842 {
15843 FreeType(e->expType);
15844 e->expType = (((void *)0));
15845 FreeType(type);
15846 type = (((void *)0));
15847 break;
15848 }
15849 }
15850 }
15851 }
15852 if(e->expType)
15853 {
15854 FreeType(e->expType);
15855 e->expType = (((void *)0));
15856 }
15857 }
15858 }
15859 if(type)
15860 {
15861 typeStringBuf[0] = '\0';
15862 PrintType(type, typeStringBuf, 0x0, 0x1);
15863 typeString = typeStringBuf;
15864 FreeType(type);
15865 }
15866 }
15867 if(typeString)
15868 {
15869 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15870 struct Declarator * decl;
15871 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15872
15873 if(arrayExp->list)
15874 {
15875 struct Expression * e;
15876
15877 builtinCount = (*arrayExp->list).count;
15878 type = ProcessTypeString(typeString, 0x0);
15879 while(e = (*arrayExp->list).first)
15880 {
15881 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15882 e->destType = type;
15883 type->refCount++;
15884 ProcessExpressionType(e);
15885 ListAdd(initializers, MkInitializerAssignment(e));
15886 }
15887 FreeType(type);
15888 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15889 }
15890 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15891 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15892 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(PlugDeclarator(decl, MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), (((void *)0)))), MkInitializerList(initializers)))));
15893 FreeList(exp, FreeExpression);
15894 }
15895 else
15896 {
15897 arrayExp->expType = ProcessTypeString("Container", 0x0);
15898 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15899 }
15900 }
15901 else if(isLinkList && !isList)
15902 {
15903 struct Declarator * decl;
15904 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15905
15906 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15907 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15908 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15909 }
15910 else if(_class->templateArgs)
15911 {
15912 if(isMap)
15913 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15914 else
15915 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
15916 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
15917 }
15918 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
15919 if(block && block->type == 2 && block->compound.context)
15920 {
15921 block->compound.context->parent = stmt->compound.context;
15922 }
15923 if(filter)
15924 {
15925 block = MkIfStmt(filter, block, (((void *)0)));
15926 }
15927 if(isArray)
15928 {
15929 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));
15930 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15931 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15932 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15933 }
15934 else if(isBuiltin)
15935 {
15936 char count[128];
15937
15938 sprintf(count, "%d", builtinCount);
15939 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));
15940 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15941 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15942 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15943 }
15944 else if(isLinkList && !isList)
15945 {
15946 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
15947 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
15948
15949 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
15950 {
15951 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));
15952 }
15953 else
15954 {
15955 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15956 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
15957
15958 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));
15959 }
15960 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15961 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15962 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15963 }
15964 else
15965 {
15966 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
15967 }
15968 ProcessExpressionType(expIt);
15969 if((*stmt->compound.declarations).first)
15970 ProcessDeclaration((*stmt->compound.declarations).first);
15971 if(symbol)
15972 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
15973 ProcessStatement(stmt);
15974 curContext = stmt->compound.context->parent;
15975 break;
15976 }
15977 else
15978 {
15979 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
15980 }
15981 break;
15982 }
15983 case 9:
15984 break;
15985 case 10:
15986 break;
15987 case 11:
15988 break;
15989 case 12:
15990 {
15991 struct Expression * exp;
15992
15993 if(stmt->expressions)
15994 {
15995 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15996 {
15997 if(!exp->next)
15998 {
15999 if(curFunction && !curFunction->type)
16000 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
16001 FreeType(exp->destType);
16002 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
16003 if(exp->destType)
16004 exp->destType->refCount++;
16005 }
16006 ProcessExpressionType(exp);
16007 }
16008 }
16009 break;
16010 }
16011 case 14:
16012 {
16013 ProcessDeclaration(stmt->decl);
16014 break;
16015 }
16016 case 13:
16017 {
16018 struct AsmField * field;
16019
16020 if(stmt->asmStmt.inputFields)
16021 {
16022 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
16023 if(field->expression)
16024 ProcessExpressionType(field->expression);
16025 }
16026 if(stmt->asmStmt.outputFields)
16027 {
16028 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
16029 if(field->expression)
16030 ProcessExpressionType(field->expression);
16031 }
16032 if(stmt->asmStmt.clobberedFields)
16033 {
16034 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
16035 {
16036 if(field->expression)
16037 ProcessExpressionType(field->expression);
16038 }
16039 }
16040 break;
16041 }
16042 case 17:
16043 {
16044 struct PropertyWatch * propWatch;
16045 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16046 struct Expression * object = stmt->_watch.object;
16047 struct Expression * watcher = stmt->_watch.watcher;
16048
16049 if(watcher)
16050 ProcessExpressionType(watcher);
16051 if(object)
16052 ProcessExpressionType(object);
16053 if(inCompiler)
16054 {
16055 if(watcher || thisClass)
16056 {
16057 struct External * external = curExternal;
16058 struct Context * context = curContext;
16059
16060 stmt->type = 3;
16061 stmt->expressions = MkList();
16062 curExternal = external->prev;
16063 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
16064 {
16065 struct ClassFunction * func;
16066 char watcherName[1024];
16067 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
16068 struct External * createdExternal;
16069 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
16070
16071 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
16072 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
16073 if(propWatch->deleteWatch)
16074 strcat(watcherName, "_delete");
16075 else
16076 {
16077 struct Identifier * propID;
16078
16079 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
16080 {
16081 strcat(watcherName, "_");
16082 strcat(watcherName, propID->string);
16083 }
16084 }
16085 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
16086 {
16087 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
16088 ProcessClassFunctionBody(func, propWatch->compound);
16089 propWatch->compound = (((void *)0));
16090 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
16091 createdExternal->symbol->idCode = external->symbol->idCode;
16092 curExternal = createdExternal;
16093 ProcessFunction(createdExternal->function);
16094 {
16095 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
16096
16097 externalDecl->declaration = decl;
16098 if(decl->symbol && !decl->symbol->pointerExternal)
16099 decl->symbol->pointerExternal = externalDecl;
16100 }
16101 if(propWatch->deleteWatch)
16102 {
16103 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16104
16105 ListAdd(args, CopyExpression(object));
16106 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16107 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
16108 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
16109 }
16110 else
16111 {
16112 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
16113 struct Identifier * propID;
16114
16115 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
16116 {
16117 char propName[1024];
16118 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16119
16120 if(prop)
16121 {
16122 char getName[1024], setName[1024];
16123 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16124
16125 DeclareProperty(prop, setName, getName);
16126 strcpy(propName, "__ecereProp_");
16127 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16128 strcat(propName, "_");
16129 FullClassNameCat(propName, prop->name, 0x1);
16130 ListAdd(args, CopyExpression(object));
16131 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16132 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16133 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
16134 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
16135 }
16136 else
16137 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16138 }
16139 }
16140 }
16141 else
16142 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
16143 }
16144 curExternal = external;
16145 curContext = context;
16146 if(watcher)
16147 FreeExpression(watcher);
16148 if(object)
16149 FreeExpression(object);
16150 FreeList(watches, FreePropertyWatch);
16151 }
16152 else
16153 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
16154 }
16155 else
16156 {
16157 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
16158 {
16159 ProcessStatement(propWatch->compound);
16160 }
16161 }
16162 break;
16163 }
16164 case 15:
16165 {
16166 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16167 struct Expression * object = stmt->_watch.object;
16168 struct __ecereNameSpace__ecere__com__Class * _class;
16169
16170 if(object)
16171 ProcessExpressionType(object);
16172 if(inCompiler)
16173 {
16174 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
16175 if(_class)
16176 {
16177 struct Identifier * propID;
16178
16179 stmt->type = 3;
16180 stmt->expressions = MkList();
16181 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
16182 {
16183 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
16184 }
16185 else if(!watches)
16186 {
16187 }
16188 if(watches)
16189 {
16190 for(propID = (*watches).first; propID; propID = propID->next)
16191 {
16192 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16193
16194 if(prop)
16195 {
16196 CreateFireWatcher(prop, object, stmt);
16197 }
16198 else
16199 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
16200 }
16201 }
16202 else
16203 {
16204 struct __ecereNameSpace__ecere__com__Property * prop;
16205 struct __ecereNameSpace__ecere__com__Class * base;
16206
16207 for(base = _class; base; base = base->base)
16208 {
16209 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
16210 {
16211 if(prop->isProperty && prop->isWatchable)
16212 {
16213 CreateFireWatcher(prop, object, stmt);
16214 }
16215 }
16216 }
16217 }
16218 if(object)
16219 FreeExpression(object);
16220 FreeList(watches, FreeIdentifier);
16221 }
16222 else
16223 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16224 }
16225 break;
16226 }
16227 case 16:
16228 {
16229 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16230 struct Expression * object = stmt->_watch.object;
16231 struct Expression * watcher = stmt->_watch.watcher;
16232 struct __ecereNameSpace__ecere__com__Class * _class;
16233
16234 if(object)
16235 ProcessExpressionType(object);
16236 if(watcher)
16237 ProcessExpressionType(watcher);
16238 if(inCompiler)
16239 {
16240 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
16241 if(watcher || thisClass)
16242 {
16243 if(_class)
16244 {
16245 struct Identifier * propID;
16246
16247 stmt->type = 3;
16248 stmt->expressions = MkList();
16249 if(!watches)
16250 {
16251 struct __ecereNameSpace__ecere__sys__OldList * args;
16252
16253 args = MkList();
16254 ListAdd(args, CopyExpression(object));
16255 ListAdd(args, MkExpConstant("0"));
16256 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16257 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16258 }
16259 else
16260 {
16261 for(propID = (*watches).first; propID; propID = propID->next)
16262 {
16263 char propName[1024];
16264 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16265
16266 if(prop)
16267 {
16268 char getName[1024], setName[1024];
16269 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16270
16271 DeclareProperty(prop, setName, getName);
16272 strcpy(propName, "__ecereProp_");
16273 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16274 strcat(propName, "_");
16275 FullClassNameCat(propName, prop->name, 0x1);
16276 MangleClassName(propName);
16277 ListAdd(args, CopyExpression(object));
16278 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16279 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16280 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16281 }
16282 else
16283 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16284 }
16285 }
16286 if(object)
16287 FreeExpression(object);
16288 if(watcher)
16289 FreeExpression(watcher);
16290 FreeList(watches, FreeIdentifier);
16291 }
16292 else
16293 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16294 }
16295 else
16296 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
16297 }
16298 break;
16299 }
16300 }
16301 }
16302
16303 extern struct Expression * QBrackets(struct Expression * exp);
16304
16305 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
16306
16307 extern struct Declarator * QMkPtrDecl(char *  id);
16308
16309 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
16310
16311 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
16312
16313 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
16314
16315 static void ProcessFunction(struct FunctionDefinition * function)
16316 {
16317 struct Identifier * id = GetDeclId(function->declarator);
16318 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
16319 struct Type * type = symbol ? symbol->type : (((void *)0));
16320 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
16321 struct Context * oldTopContext = topContext;
16322
16323 yylloc = function->loc;
16324 if(type && type->thisClass)
16325 {
16326 struct Symbol * classSym = type->thisClass;
16327 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
16328 char className[1024];
16329 char structName[1024];
16330 struct Declarator * funcDecl;
16331 struct Symbol * thisSymbol;
16332 unsigned int typedObject = 0x0;
16333
16334 if(_class && !_class->base)
16335 {
16336 _class = currentClass;
16337 if(_class && !_class->symbol)
16338 _class->symbol = FindClass(_class->fullName);
16339 classSym = _class ? _class->symbol : (((void *)0));
16340 typedObject = 0x1;
16341 }
16342 thisClass = _class;
16343 if(inCompiler && _class)
16344 {
16345 if(type->kind == 11)
16346 {
16347 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
16348 {
16349 struct Type * param = symbol->type->params.first;
16350
16351 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
16352 FreeType(param);
16353 }
16354 if(type->classObjectType != 1)
16355 {
16356 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
16357 symbol->type->staticMethod = 0x1;
16358 symbol->type->thisClass = (((void *)0));
16359 symbol->type->extraParam = 0x0;
16360 }
16361 }
16362 strcpy(className, "__ecereClass_");
16363 FullClassNameCat(className, _class->fullName, 0x1);
16364 MangleClassName(className);
16365 structName[0] = (char)0;
16366 FullClassNameCat(structName, _class->fullName, 0x0);
16367 funcDecl = GetFuncDecl(function->declarator);
16368 if(funcDecl)
16369 {
16370 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16371 {
16372 struct TypeName * param = (*funcDecl->function.parameters).first;
16373
16374 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16375 {
16376 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16377 FreeTypeName(param);
16378 }
16379 }
16380 if(!function->propertyNoThis)
16381 {
16382 struct TypeName * thisParam;
16383
16384 if(type->classObjectType != 1)
16385 {
16386 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16387 if(!funcDecl->function.parameters)
16388 funcDecl->function.parameters = MkList();
16389 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16390 }
16391 if(typedObject)
16392 {
16393 if(type->classObjectType != 1)
16394 {
16395 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
16396 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
16397 }
16398 thisParam = __extension__ ({
16399 struct TypeName * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName);
16400
16401 __ecereInstance1->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), __ecereInstance1->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), __ecereInstance1;
16402 });
16403 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16404 }
16405 }
16406 }
16407 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16408 {
16409 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16410
16411 funcDecl = GetFuncDecl(initDecl->declarator);
16412 if(funcDecl)
16413 {
16414 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16415 {
16416 struct TypeName * param = (*funcDecl->function.parameters).first;
16417
16418 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16419 {
16420 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16421 FreeTypeName(param);
16422 }
16423 }
16424 if(type->classObjectType != 1)
16425 {
16426 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
16427 {
16428 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16429
16430 if(!funcDecl->function.parameters)
16431 funcDecl->function.parameters = MkList();
16432 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16433 }
16434 }
16435 }
16436 }
16437 }
16438 if(function->body)
16439 {
16440 if(type->classObjectType != 1)
16441 {
16442 thisSymbol = __extension__ ({
16443 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
16444
16445 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("this"), __ecereInstance1->type = classSym ? MkClassType(classSym->string) : (((void *)0)), __ecereInstance1;
16446 });
16447 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16448 if(typedObject && thisSymbol->type)
16449 {
16450 thisSymbol->type->classObjectType = 2;
16451 thisSymbol->type->byReference = type->byReference;
16452 }
16453 }
16454 }
16455 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
16456 {
16457 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
16458
16459 {
16460 struct __ecereNameSpace__ecere__com__Class * base;
16461
16462 for(base = _class; base && base->type != 1000; base = base->next)
16463 {
16464 for(member = base->membersAndProperties.first; member; member = member->next)
16465 if(!member->isProperty)
16466 break;
16467 if(member)
16468 break;
16469 }
16470 }
16471 for(member = _class->membersAndProperties.first; member; member = member->next)
16472 if(!member->isProperty)
16473 break;
16474 if(member)
16475 {
16476 char pointerName[1024];
16477 struct Declaration * decl;
16478 struct Initializer * initializer;
16479 struct Expression * exp, * bytePtr;
16480
16481 strcpy(pointerName, "__ecerePointer_");
16482 FullClassNameCat(pointerName, _class->fullName, 0x0);
16483 {
16484 char className[1024];
16485
16486 strcpy(className, "__ecereClass_");
16487 FullClassNameCat(className, classSym->string, 0x1);
16488 MangleClassName(className);
16489 DeclareClass(classSym, className);
16490 }
16491 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
16492 if(_class->fixed)
16493 {
16494 char string[256];
16495
16496 sprintf(string, "%d", _class->offset);
16497 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
16498 }
16499 else
16500 {
16501 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
16502 }
16503 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
16504 exp->expType = __extension__ ({
16505 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16506
16507 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
16508 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16509
16510 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 0, __ecereInstance1;
16511 }), __ecereInstance2;
16512 });
16513 if(function->body)
16514 {
16515 yylloc = function->body->loc;
16516 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
16517 {
16518 struct Context * prevContext = curContext;
16519
16520 curContext = function->body->compound.context;
16521 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
16522 curContext = prevContext;
16523 }
16524 decl->symbol = (((void *)0));
16525 if(!function->body->compound.declarations)
16526 function->body->compound.declarations = MkList();
16527 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
16528 }
16529 }
16530 }
16531 }
16532 else
16533 thisClass = (((void *)0));
16534 if(id)
16535 {
16536 FreeSpecifier(id->_class);
16537 id->_class = (((void *)0));
16538 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16539 {
16540 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16541
16542 id = GetDeclId(initDecl->declarator);
16543 FreeSpecifier(id->_class);
16544 id->_class = (((void *)0));
16545 }
16546 }
16547 if(function->body)
16548 topContext = function->body->compound.context;
16549 {
16550 struct FunctionDefinition * oldFunction = curFunction;
16551
16552 curFunction = function;
16553 if(function->body)
16554 ProcessStatement(function->body);
16555 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
16556 {
16557 struct Statement * prevCompound = curCompound;
16558 struct Context * prevContext = curContext;
16559 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
16560
16561 if(!function->body->compound.statements)
16562 function->body->compound.statements = MkList();
16563 ListAdd(function->body->compound.statements, fireWatchers);
16564 curCompound = function->body;
16565 curContext = function->body->compound.context;
16566 ProcessStatement(fireWatchers);
16567 curContext = prevContext;
16568 curCompound = prevCompound;
16569 }
16570 curFunction = oldFunction;
16571 }
16572 if(function->declarator)
16573 {
16574 ProcessDeclarator(function->declarator);
16575 }
16576 topContext = oldTopContext;
16577 thisClass = oldThisClass;
16578 }
16579
16580 extern void FreeSymbol(struct Symbol * symbol);
16581
16582 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
16583
16584 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
16585 {
16586 struct ClassDef * def;
16587 struct External * external = curExternal;
16588 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
16589
16590 for(def = definitions->first; def; def = def->next)
16591 {
16592 if(def->type == 0)
16593 {
16594 if(def->function->declarator)
16595 curExternal = def->function->declarator->symbol->pointerExternal;
16596 else
16597 curExternal = external;
16598 ProcessFunction((struct FunctionDefinition *)def->function);
16599 }
16600 else if(def->type == 2)
16601 {
16602 if(def->decl->type == 2)
16603 {
16604 thisClass = regClass;
16605 ProcessInstantiationType(def->decl->inst);
16606 thisClass = (((void *)0));
16607 }
16608 else
16609 {
16610 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
16611
16612 if(regClass)
16613 thisClass = regClass;
16614 ProcessDeclaration(def->decl);
16615 thisClass = backThisClass;
16616 }
16617 }
16618 else if(def->type == 1 && def->defProperties)
16619 {
16620 struct MemberInit * defProperty;
16621 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);
16622
16623 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16624 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
16625 {
16626 thisClass = regClass;
16627 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
16628 thisClass = (((void *)0));
16629 }
16630 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16631 FreeSymbol(thisSymbol);
16632 }
16633 else if(def->type == 3 && def->propertyDef)
16634 {
16635 struct PropertyDef * prop = def->propertyDef;
16636
16637 thisClass = regClass;
16638 if(prop->setStmt)
16639 {
16640 if(regClass)
16641 {
16642 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16643
16644 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16645 }
16646 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16647 ProcessStatement(prop->setStmt);
16648 }
16649 if(prop->getStmt)
16650 {
16651 if(regClass)
16652 {
16653 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16654
16655 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16656 }
16657 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16658 ProcessStatement(prop->getStmt);
16659 }
16660 if(prop->issetStmt)
16661 {
16662 if(regClass)
16663 {
16664 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16665
16666 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16667 }
16668 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16669 ProcessStatement(prop->issetStmt);
16670 }
16671 thisClass = (((void *)0));
16672 }
16673 else if(def->type == 4 && def->propertyWatch)
16674 {
16675 struct PropertyWatch * propertyWatch = def->propertyWatch;
16676
16677 thisClass = regClass;
16678 if(propertyWatch->compound)
16679 {
16680 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);
16681
16682 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16683 curExternal = (((void *)0));
16684 ProcessStatement(propertyWatch->compound);
16685 }
16686 thisClass = (((void *)0));
16687 }
16688 }
16689 }
16690
16691 void DeclareFunctionUtil(char * s)
16692 {
16693 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
16694
16695 if(function)
16696 {
16697 char name[1024];
16698
16699 name[0] = (char)0;
16700 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
16701 strcpy(name, "__ecereFunction_");
16702 FullClassNameCat(name, s, 0x0);
16703 DeclareFunction(function, name);
16704 }
16705 }
16706
16707 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16708
16709 void ComputeDataTypes()
16710 {
16711 struct External * external;
16712 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16713 struct External * after = (((void *)0));
16714
16715 currentClass = (((void *)0));
16716 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16717 for(external = (*ast).first; external; external = external->next)
16718 {
16719 if(external->type == 1)
16720 {
16721 struct Declaration * decl = external->declaration;
16722
16723 if(decl)
16724 {
16725 struct __ecereNameSpace__ecere__sys__OldList * decls = decl->declarators;
16726
16727 if(decls)
16728 {
16729 struct InitDeclarator * initDecl = (*decls).first;
16730
16731 if(initDecl)
16732 {
16733 struct Declarator * declarator = initDecl->declarator;
16734
16735 if(declarator && declarator->type == 1)
16736 {
16737 struct Identifier * id = declarator->identifier;
16738
16739 if(id && id->string)
16740 {
16741 if(!strcmp(id->string, "uintptr_t") || !strcmp(id->string, "intptr_t") || !strcmp(id->string, "size_t") || !strcmp(id->string, "ssize_t"))
16742 {
16743 external->symbol->id = -1001, external->symbol->idCode = -1001;
16744 after = external;
16745 }
16746 }
16747 }
16748 }
16749 }
16750 }
16751 }
16752 }
16753 temp->symbol = __extension__ ({
16754 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
16755
16756 __ecereInstance1->id = -1000, __ecereInstance1->idCode = -1000, __ecereInstance1;
16757 });
16758 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), after, temp);
16759 curExternal = temp;
16760 DeclareFunctionUtil("eSystem_New");
16761 DeclareFunctionUtil("eSystem_New0");
16762 DeclareFunctionUtil("eSystem_Renew");
16763 DeclareFunctionUtil("eSystem_Renew0");
16764 DeclareFunctionUtil("eClass_GetProperty");
16765 DeclareStruct("ecere::com::Class", 0x0);
16766 DeclareStruct("ecere::com::Instance", 0x0);
16767 DeclareStruct("ecere::com::Property", 0x0);
16768 DeclareStruct("ecere::com::DataMember", 0x0);
16769 DeclareStruct("ecere::com::Method", 0x0);
16770 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16771 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16772 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16773 for(external = (*ast).first; external; external = external->next)
16774 {
16775 afterExternal = curExternal = external;
16776 if(external->type == 0)
16777 {
16778 currentClass = external->function->_class;
16779 ProcessFunction(external->function);
16780 }
16781 else if(external->type == 1)
16782 {
16783 currentClass = (((void *)0));
16784 ProcessDeclaration(external->declaration);
16785 }
16786 else if(external->type == 2)
16787 {
16788 struct ClassDefinition * _class = external->_class;
16789
16790 currentClass = external->symbol->registered;
16791 if(_class->definitions)
16792 {
16793 ProcessClass(_class->definitions, _class->symbol);
16794 }
16795 if(inCompiler)
16796 {
16797 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16798 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16799 }
16800 }
16801 else if(external->type == 4)
16802 {
16803 thisNameSpace = external->id->string;
16804 }
16805 }
16806 currentClass = (((void *)0));
16807 thisNameSpace = (((void *)0));
16808 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16809 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16810 }
16811
16812 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);
16813
16814 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, char *  name, char *  baseName, int size, int sizeClass, unsigned int (*  Constructor)(void * ), void (*  Destructor)(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
16815
16816 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16817 {
16818 struct __ecereNameSpace__ecere__com__Class * class;
16819
16820 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16821 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16822 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16823 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16824 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16825 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16826 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16827 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16828 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16829 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16830 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16831 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16832 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16833 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16834 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16835 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16836 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16837 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16838 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16839 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16840 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16841 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16842 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
16843 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
16844 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntSize", "bool GetIntSize(Expression exp, intsize * value2)", GetIntSize, module, 1);
16845 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntSize", "bool GetUIntSize(Expression exp, uintsize * value2)", GetUIntSize, module, 1);
16846 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16847 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16848 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16849 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16850 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16851 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16852 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16853 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16854 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16855 __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);
16856 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16857 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16858 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16859 __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);
16860 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16861 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16862 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16863 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16864 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16865 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16866 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16867 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16868 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16869 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16870 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16871 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16872 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16873 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
16874 __ecereClass_Conversion = class;
16875 __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);
16876 __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);
16877 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16878 __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);
16879 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16880 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16881 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16882 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16883 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16884 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16885 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16886 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16887 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16888 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16889 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintTypeNoConst", "void PrintTypeNoConst(Type type, char * string, bool printName, bool fullName)", PrintTypeNoConst, module, 1);
16890 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16891 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16892 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16893 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16894 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16895 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
16896 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16897 }
16898
16899 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16900 {
16901
16902 }
16903