1e875d021005a5705512ff414a9db20ecb39c8e4
[sdk] / compiler / bootstrap / libec / bootstrap / pass15.c
1 /* Code generated from eC source file: pass15.ec */
2 #if defined(__GNUC__)
3 typedef long long int64;
4 typedef unsigned long long uint64;
5 #ifndef _WIN32
6 #define __declspec(x)
7 #endif
8 #elif defined(__TINYC__)
9 #include <stdarg.h>
10 #define __builtin_va_list va_list
11 #define __builtin_va_start va_start
12 #define __builtin_va_end va_end
13 #ifdef _WIN32
14 #define strcasecmp stricmp
15 #define strncasecmp strnicmp
16 #define __declspec(x) __attribute__((x))
17 #else
18 #define __declspec(x)
19 #endif
20 typedef long long int64;
21 typedef unsigned long long uint64;
22 #else
23 typedef __int64 int64;
24 typedef unsigned __int64 uint64;
25 #endif
26 #ifdef __BIG_ENDIAN__
27 #define __ENDIAN_PAD(x) (8 - (x))
28 #else
29 #define __ENDIAN_PAD(x) 0
30 #endif
31 #include <stdint.h>
32 #include <sys/types.h>
33
34 #if /*defined(_W64) || */(defined(__WORDSIZE) && __WORDSIZE == 8) || defined(__x86_64__)
35 #define _64BIT 1
36 #else
37 #define _64BIT 0
38 #endif
39
40 #define arch_PointerSize                  sizeof(void *)
41 #define structSize_Instance               (_64BIT ? 24 : 12)
42 #define structSize_Module                 (_64BIT ? 560 : 300)
43 #define structSize_NamedLink              (_64BIT ? 32 : 16)
44
45 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
46
47 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
48
49 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
50
51 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
52
53 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
54
55 struct __ecereNameSpace__ecere__sys__BTNode;
56
57 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;
58
59 struct __ecereNameSpace__ecere__sys__BinaryTree
60 {
61 struct __ecereNameSpace__ecere__sys__BTNode * root;
62 int count;
63 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
64 void (*  FreeKey)(void *  key);
65 } __attribute__ ((gcc_struct));
66
67 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;
68
69 struct __ecereNameSpace__ecere__sys__OldList
70 {
71 void *  first;
72 void *  last;
73 int count;
74 unsigned int offset;
75 unsigned int circ;
76 } __attribute__ ((gcc_struct));
77
78 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;
79
80 struct __ecereNameSpace__ecere__com__Method
81 {
82 char *  name;
83 struct __ecereNameSpace__ecere__com__Method * parent;
84 struct __ecereNameSpace__ecere__com__Method * left;
85 struct __ecereNameSpace__ecere__com__Method * right;
86 int depth;
87 int (*  function)();
88 int vid;
89 int type;
90 struct __ecereNameSpace__ecere__com__Class * _class;
91 void *  symbol;
92 char *  dataTypeString;
93 struct Type * dataType;
94 int memberAccess;
95 } __attribute__ ((gcc_struct));
96
97 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;
98
99 struct __ecereNameSpace__ecere__com__Property
100 {
101 struct __ecereNameSpace__ecere__com__Property * prev;
102 struct __ecereNameSpace__ecere__com__Property * next;
103 char *  name;
104 unsigned int isProperty;
105 int memberAccess;
106 int id;
107 struct __ecereNameSpace__ecere__com__Class * _class;
108 char *  dataTypeString;
109 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
110 struct Type * dataType;
111 void (*  Set)(void * , int);
112 int (*  Get)(void * );
113 unsigned int (*  IsSet)(void * );
114 void *  data;
115 void *  symbol;
116 int vid;
117 unsigned int conversion;
118 unsigned int watcherOffset;
119 char *  category;
120 unsigned int compiled;
121 unsigned int selfWatchable;
122 unsigned int isWatchable;
123 } __attribute__ ((gcc_struct));
124
125 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
126
127 struct CodePosition
128 {
129 int line;
130 int charPos;
131 int pos;
132 int included;
133 } __attribute__ ((gcc_struct));
134
135 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
136
137 struct Location
138 {
139 struct CodePosition start;
140 struct CodePosition end;
141 } __attribute__ ((gcc_struct));
142
143 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attrib;
144
145 struct Attrib;
146
147 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ExtDecl;
148
149 struct ExtDecl
150 {
151 struct Location loc;
152 int type;
153 union
154 {
155 char * s;
156 struct Attrib * attr;
157 } __attribute__ ((gcc_struct));
158 } __attribute__ ((gcc_struct));
159
160 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
161
162 struct ClassDefinition
163 {
164 struct ClassDefinition * prev;
165 struct ClassDefinition * next;
166 struct Location loc;
167 struct Specifier * _class;
168 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
169 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
170 struct Symbol * symbol;
171 struct Location blockStart;
172 struct Location nameLoc;
173 int endid;
174 int declMode;
175 unsigned int deleteWatchable;
176 } __attribute__ ((gcc_struct));
177
178 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
179
180 struct Context
181 {
182 struct Context * parent;
183 struct __ecereNameSpace__ecere__sys__BinaryTree types;
184 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
185 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
186 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
187 int nextID;
188 int simpleID;
189 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
190 struct ClassDefinition * classDef;
191 unsigned int templateTypesOnly;
192 unsigned int hasNameSpace;
193 } __attribute__ ((gcc_struct));
194
195 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
196
197 struct Instantiation
198 {
199 struct Instantiation * prev;
200 struct Instantiation * next;
201 struct Location loc;
202 struct Specifier * _class;
203 struct Expression * exp;
204 struct __ecereNameSpace__ecere__sys__OldList *  members;
205 struct Symbol * symbol;
206 unsigned int fullSet;
207 unsigned int isConstant;
208 unsigned char *  data;
209 struct Location nameLoc;
210 struct Location insideLoc;
211 unsigned int built;
212 } __attribute__ ((gcc_struct));
213
214 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
215
216 struct Declaration
217 {
218 struct Declaration * prev;
219 struct Declaration * next;
220 struct Location loc;
221 int type;
222 union
223 {
224 struct
225 {
226 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
227 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
228 } __attribute__ ((gcc_struct));
229 struct Instantiation * inst;
230 struct
231 {
232 struct Identifier * id;
233 struct Expression * exp;
234 } __attribute__ ((gcc_struct));
235 } __attribute__ ((gcc_struct));
236 struct Specifier * extStorage;
237 struct Symbol * symbol;
238 int declMode;
239 } __attribute__ ((gcc_struct));
240
241 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
242
243 struct Statement
244 {
245 struct Statement * prev;
246 struct Statement * next;
247 struct Location loc;
248 int type;
249 union
250 {
251 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
252 struct
253 {
254 struct Identifier * id;
255 struct Statement * stmt;
256 } __attribute__ ((gcc_struct)) labeled;
257 struct
258 {
259 struct Expression * exp;
260 struct Statement * stmt;
261 } __attribute__ ((gcc_struct)) caseStmt;
262 struct
263 {
264 struct __ecereNameSpace__ecere__sys__OldList * declarations;
265 struct __ecereNameSpace__ecere__sys__OldList * statements;
266 struct Context * context;
267 unsigned int isSwitch;
268 } __attribute__ ((gcc_struct)) compound;
269 struct
270 {
271 struct __ecereNameSpace__ecere__sys__OldList * exp;
272 struct Statement * stmt;
273 struct Statement * elseStmt;
274 } __attribute__ ((gcc_struct)) ifStmt;
275 struct
276 {
277 struct __ecereNameSpace__ecere__sys__OldList * exp;
278 struct Statement * stmt;
279 } __attribute__ ((gcc_struct)) switchStmt;
280 struct
281 {
282 struct __ecereNameSpace__ecere__sys__OldList * exp;
283 struct Statement * stmt;
284 } __attribute__ ((gcc_struct)) whileStmt;
285 struct
286 {
287 struct __ecereNameSpace__ecere__sys__OldList * exp;
288 struct Statement * stmt;
289 } __attribute__ ((gcc_struct)) doWhile;
290 struct
291 {
292 struct Statement * init;
293 struct Statement * check;
294 struct __ecereNameSpace__ecere__sys__OldList * increment;
295 struct Statement * stmt;
296 } __attribute__ ((gcc_struct)) forStmt;
297 struct
298 {
299 struct Identifier * id;
300 } __attribute__ ((gcc_struct)) gotoStmt;
301 struct
302 {
303 struct Specifier * spec;
304 char * statements;
305 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
306 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
307 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
308 } __attribute__ ((gcc_struct)) asmStmt;
309 struct
310 {
311 struct Expression * watcher;
312 struct Expression * object;
313 struct __ecereNameSpace__ecere__sys__OldList * watches;
314 } __attribute__ ((gcc_struct)) _watch;
315 struct
316 {
317 struct Identifier * id;
318 struct __ecereNameSpace__ecere__sys__OldList * exp;
319 struct __ecereNameSpace__ecere__sys__OldList * filter;
320 struct Statement * stmt;
321 } __attribute__ ((gcc_struct)) forEachStmt;
322 struct Declaration * decl;
323 } __attribute__ ((gcc_struct));
324 } __attribute__ ((gcc_struct));
325
326 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
327
328 struct TypeName
329 {
330 struct TypeName * prev;
331 struct TypeName * next;
332 struct Location loc;
333 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
334 struct Declarator * declarator;
335 int classObjectType;
336 struct Expression * bitCount;
337 } __attribute__ ((gcc_struct));
338
339 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
340
341 struct Initializer
342 {
343 struct Initializer * prev;
344 struct Initializer * next;
345 struct Location loc;
346 int type;
347 union
348 {
349 struct Expression * exp;
350 struct __ecereNameSpace__ecere__sys__OldList *  list;
351 } __attribute__ ((gcc_struct));
352 unsigned int isConstant;
353 } __attribute__ ((gcc_struct));
354
355 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
356
357 struct __ecereNameSpace__ecere__com__DataValue
358 {
359 union
360 {
361 char c;
362 unsigned char uc;
363 short s;
364 unsigned short us;
365 int i;
366 unsigned int ui;
367 void *  p;
368 float f;
369 double d;
370 long long i64;
371 uint64 ui64;
372 } __attribute__ ((gcc_struct));
373 } __attribute__ ((gcc_struct));
374
375 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
376
377 struct Expression
378 {
379 struct Expression * prev;
380 struct Expression * next;
381 struct Location loc;
382 int type;
383 union
384 {
385 struct
386 {
387 char *  constant;
388 struct Identifier * identifier;
389 } __attribute__ ((gcc_struct));
390 struct Statement * compound;
391 struct Instantiation * instance;
392 char *  string;
393 struct __ecereNameSpace__ecere__sys__OldList *  list;
394 struct
395 {
396 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
397 struct Declarator * decl;
398 } __attribute__ ((gcc_struct)) _classExp;
399 struct
400 {
401 struct Identifier * id;
402 } __attribute__ ((gcc_struct)) classData;
403 struct
404 {
405 struct Expression * exp;
406 struct __ecereNameSpace__ecere__sys__OldList * arguments;
407 struct Location argLoc;
408 } __attribute__ ((gcc_struct)) call;
409 struct
410 {
411 struct Expression * exp;
412 struct __ecereNameSpace__ecere__sys__OldList * index;
413 } __attribute__ ((gcc_struct)) index;
414 struct
415 {
416 struct Expression * exp;
417 struct Identifier * member;
418 int memberType;
419 unsigned int thisPtr;
420 } __attribute__ ((gcc_struct)) member;
421 struct
422 {
423 int op;
424 struct Expression * exp1;
425 struct Expression * exp2;
426 } __attribute__ ((gcc_struct)) op;
427 struct TypeName * typeName;
428 struct Specifier * _class;
429 struct
430 {
431 struct TypeName * typeName;
432 struct Expression * exp;
433 } __attribute__ ((gcc_struct)) cast;
434 struct
435 {
436 struct Expression * cond;
437 struct __ecereNameSpace__ecere__sys__OldList * exp;
438 struct Expression * elseExp;
439 } __attribute__ ((gcc_struct)) cond;
440 struct
441 {
442 struct TypeName * typeName;
443 struct Expression * size;
444 } __attribute__ ((gcc_struct)) _new;
445 struct
446 {
447 struct TypeName * typeName;
448 struct Expression * size;
449 struct Expression * exp;
450 } __attribute__ ((gcc_struct)) _renew;
451 struct
452 {
453 char * table;
454 struct Identifier * id;
455 } __attribute__ ((gcc_struct)) db;
456 struct
457 {
458 struct Expression * ds;
459 struct Expression * name;
460 } __attribute__ ((gcc_struct)) dbopen;
461 struct
462 {
463 struct TypeName * typeName;
464 struct Initializer * initializer;
465 } __attribute__ ((gcc_struct)) initializer;
466 struct
467 {
468 struct Expression * exp;
469 struct TypeName * typeName;
470 } __attribute__ ((gcc_struct)) vaArg;
471 } __attribute__ ((gcc_struct));
472 unsigned int debugValue;
473 struct __ecereNameSpace__ecere__com__DataValue val;
474 uint64 address;
475 unsigned int hasAddress;
476 struct Type * expType;
477 struct Type * destType;
478 unsigned int usage;
479 int tempCount;
480 unsigned int byReference;
481 unsigned int isConstant;
482 unsigned int addedThis;
483 unsigned int needCast;
484 unsigned int thisPtr;
485 } __attribute__ ((gcc_struct));
486
487 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
488
489 struct TemplateDatatype
490 {
491 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
492 struct Declarator * decl;
493 } __attribute__ ((gcc_struct));
494
495 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
496
497 struct TemplateArgument;
498
499 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
500
501 struct TemplateParameter
502 {
503 struct TemplateParameter * prev;
504 struct TemplateParameter * next;
505 struct Location loc;
506 int type;
507 struct Identifier * identifier;
508 union
509 {
510 struct TemplateDatatype * dataType;
511 int memberType;
512 } __attribute__ ((gcc_struct));
513 struct TemplateArgument * defaultArgument;
514 char *  dataTypeString;
515 struct Type * baseType;
516 } __attribute__ ((gcc_struct));
517
518 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
519
520 struct Specifier
521 {
522 struct Specifier * prev;
523 struct Specifier * next;
524 struct Location loc;
525 int type;
526 union
527 {
528 int specifier;
529 struct
530 {
531 struct ExtDecl * extDecl;
532 char *  name;
533 struct Symbol * symbol;
534 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
535 } __attribute__ ((gcc_struct));
536 struct
537 {
538 struct Identifier * id;
539 struct __ecereNameSpace__ecere__sys__OldList *  list;
540 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
541 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
542 unsigned int addNameSpace;
543 struct Context * ctx;
544 struct ExtDecl * extDeclStruct;
545 } __attribute__ ((gcc_struct));
546 struct Expression * expression;
547 struct Specifier * _class;
548 struct TemplateParameter * templateParameter;
549 } __attribute__ ((gcc_struct));
550 } __attribute__ ((gcc_struct));
551
552 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
553
554 struct Identifier
555 {
556 struct Identifier * prev;
557 struct Identifier * next;
558 struct Location loc;
559 struct Symbol * classSym;
560 struct Specifier * _class;
561 char *  string;
562 struct Identifier * badID;
563 } __attribute__ ((gcc_struct));
564
565 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
566
567 struct Pointer;
568
569 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
570
571 struct Declarator
572 {
573 struct Declarator * prev;
574 struct Declarator * next;
575 struct Location loc;
576 int type;
577 struct Symbol * symbol;
578 struct Declarator * declarator;
579 union
580 {
581 struct Identifier * identifier;
582 struct
583 {
584 struct Expression * exp;
585 struct Expression * posExp;
586 struct Attrib * attrib;
587 } __attribute__ ((gcc_struct)) structDecl;
588 struct
589 {
590 struct Expression * exp;
591 struct Specifier * enumClass;
592 } __attribute__ ((gcc_struct)) array;
593 struct
594 {
595 struct __ecereNameSpace__ecere__sys__OldList * parameters;
596 } __attribute__ ((gcc_struct)) function;
597 struct
598 {
599 struct Pointer * pointer;
600 } __attribute__ ((gcc_struct)) pointer;
601 struct
602 {
603 struct ExtDecl * extended;
604 } __attribute__ ((gcc_struct)) extended;
605 } __attribute__ ((gcc_struct));
606 } __attribute__ ((gcc_struct));
607
608 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
609
610 struct FunctionDefinition
611 {
612 struct FunctionDefinition * prev;
613 struct FunctionDefinition * next;
614 struct Location loc;
615 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
616 struct Declarator * declarator;
617 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
618 struct Statement * body;
619 struct __ecereNameSpace__ecere__com__Class * _class;
620 struct __ecereNameSpace__ecere__sys__OldList attached;
621 int declMode;
622 struct Type * type;
623 struct Symbol * propSet;
624 int tempCount;
625 unsigned int propertyNoThis;
626 } __attribute__ ((gcc_struct));
627
628 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
629
630 struct DBTableDef;
631
632 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
633
634 struct External
635 {
636 struct External * prev;
637 struct External * next;
638 struct Location loc;
639 int type;
640 struct Symbol * symbol;
641 union
642 {
643 struct FunctionDefinition * function;
644 struct ClassDefinition * _class;
645 struct Declaration * declaration;
646 char *  importString;
647 struct Identifier * id;
648 struct DBTableDef * table;
649 } __attribute__ ((gcc_struct));
650 int importType;
651 } __attribute__ ((gcc_struct));
652
653 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
654
655 struct ModuleImport
656 {
657 struct ModuleImport * prev;
658 struct ModuleImport * next;
659 char *  name;
660 struct __ecereNameSpace__ecere__sys__OldList classes;
661 struct __ecereNameSpace__ecere__sys__OldList functions;
662 int importType;
663 int importAccess;
664 } __attribute__ ((gcc_struct));
665
666 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
667
668 struct ClassImport
669 {
670 struct ClassImport * prev;
671 struct ClassImport * next;
672 char *  name;
673 struct __ecereNameSpace__ecere__sys__OldList methods;
674 struct __ecereNameSpace__ecere__sys__OldList properties;
675 unsigned int itself;
676 unsigned int isRemote;
677 } __attribute__ ((gcc_struct));
678
679 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
680
681 struct Symbol
682 {
683 char *  string;
684 struct Symbol * parent;
685 struct Symbol * left;
686 struct Symbol * right;
687 int depth;
688 struct Type * type;
689 union
690 {
691 struct __ecereNameSpace__ecere__com__Method * method;
692 struct __ecereNameSpace__ecere__com__Property * _property;
693 struct __ecereNameSpace__ecere__com__Class * registered;
694 } __attribute__ ((gcc_struct));
695 int id;
696 int idCode;
697 union
698 {
699 struct
700 {
701 struct External * pointerExternal;
702 struct External * structExternal;
703 } __attribute__ ((gcc_struct));
704 struct
705 {
706 struct External * externalGet;
707 struct External * externalSet;
708 struct External * externalPtr;
709 struct External * externalIsSet;
710 } __attribute__ ((gcc_struct));
711 struct
712 {
713 struct External * methodExternal;
714 struct External * methodCodeExternal;
715 } __attribute__ ((gcc_struct));
716 } __attribute__ ((gcc_struct));
717 unsigned int imported;
718 unsigned int declaredStructSym;
719 struct __ecereNameSpace__ecere__com__Class * _class;
720 unsigned int declaredStruct;
721 unsigned int needConstructor;
722 unsigned int needDestructor;
723 char *  constructorName;
724 char *  structName;
725 char *  className;
726 char *  destructorName;
727 struct ModuleImport * module;
728 struct ClassImport * _import;
729 struct Location nameLoc;
730 unsigned int isParam;
731 unsigned int isRemote;
732 unsigned int isStruct;
733 unsigned int fireWatchersDone;
734 int declaring;
735 unsigned int classData;
736 unsigned int isStatic;
737 char *  shortName;
738 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
739 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
740 struct Context * ctx;
741 int isIterator;
742 struct Expression * propCategory;
743 } __attribute__ ((gcc_struct));
744
745 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
746
747 struct Type
748 {
749 struct Type * prev;
750 struct Type * next;
751 int refCount;
752 union
753 {
754 struct Symbol * _class;
755 struct
756 {
757 struct __ecereNameSpace__ecere__sys__OldList members;
758 char *  enumName;
759 } __attribute__ ((gcc_struct));
760 struct
761 {
762 struct Type * returnType;
763 struct __ecereNameSpace__ecere__sys__OldList params;
764 struct Symbol * thisClass;
765 unsigned int staticMethod;
766 struct TemplateParameter * thisClassTemplate;
767 } __attribute__ ((gcc_struct));
768 struct
769 {
770 struct __ecereNameSpace__ecere__com__Method * method;
771 struct __ecereNameSpace__ecere__com__Class * methodClass;
772 struct __ecereNameSpace__ecere__com__Class * usedClass;
773 } __attribute__ ((gcc_struct));
774 struct
775 {
776 struct Type * arrayType;
777 int arraySize;
778 struct Expression * arraySizeExp;
779 unsigned int freeExp;
780 struct Symbol * enumClass;
781 } __attribute__ ((gcc_struct));
782 struct Type * type;
783 struct TemplateParameter * templateParameter;
784 } __attribute__ ((gcc_struct));
785 int kind;
786 unsigned int size;
787 char *  name;
788 char *  typeName;
789 int classObjectType;
790 int alignment;
791 unsigned int offset;
792 int bitFieldCount;
793 int count;
794 unsigned int isSigned : 1;
795 unsigned int constant : 1;
796 unsigned int truth : 1;
797 unsigned int byReference : 1;
798 unsigned int extraParam : 1;
799 unsigned int directClassAccess : 1;
800 unsigned int computing : 1;
801 unsigned int keepCast : 1;
802 unsigned int passAsTemplate : 1;
803 unsigned int dllExport : 1;
804 unsigned int attrStdcall : 1;
805 unsigned int declaredWithStruct : 1;
806 } __attribute__ ((gcc_struct));
807
808 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
809
810 struct __ecereNameSpace__ecere__com__Class
811 {
812 struct __ecereNameSpace__ecere__com__Class * prev;
813 struct __ecereNameSpace__ecere__com__Class * next;
814 char *  name;
815 int offset;
816 int structSize;
817 int (* *  _vTbl)();
818 int vTblSize;
819 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
820 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
821 int offsetClass;
822 int sizeClass;
823 struct __ecereNameSpace__ecere__com__Class * base;
824 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
825 struct __ecereNameSpace__ecere__sys__BinaryTree members;
826 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
827 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
828 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
829 struct __ecereNameSpace__ecere__sys__OldList derivatives;
830 int memberID;
831 int startMemberID;
832 int type;
833 struct __ecereNameSpace__ecere__com__Instance * module;
834 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
835 char *  dataTypeString;
836 struct Type * dataType;
837 int typeSize;
838 int defaultAlignment;
839 void (*  Initialize)();
840 int memberOffset;
841 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
842 char *  designerClass;
843 unsigned int noExpansion;
844 char *  defaultProperty;
845 unsigned int comRedefinition;
846 int count;
847 unsigned int isRemote;
848 unsigned int internalDecl;
849 void *  data;
850 unsigned int computeSize;
851 int structAlignment;
852 int destructionWatchOffset;
853 unsigned int fixed;
854 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
855 int inheritanceAccess;
856 char *  fullName;
857 void *  symbol;
858 struct __ecereNameSpace__ecere__sys__OldList conversions;
859 struct __ecereNameSpace__ecere__sys__OldList templateParams;
860 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
861 struct __ecereNameSpace__ecere__com__Class * templateClass;
862 struct __ecereNameSpace__ecere__sys__OldList templatized;
863 int numParams;
864 unsigned int isInstanceClass;
865 } __attribute__ ((gcc_struct));
866
867 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
868
869 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
870
871 struct __ecereNameSpace__ecere__com__Instance
872 {
873 int (* *  _vTbl)();
874 struct __ecereNameSpace__ecere__com__Class * _class;
875 int _refCount;
876 } __attribute__ ((gcc_struct));
877
878 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
879
880 struct __ecereNameSpace__ecere__com__DataMember
881 {
882 struct __ecereNameSpace__ecere__com__DataMember * prev;
883 struct __ecereNameSpace__ecere__com__DataMember * next;
884 char *  name;
885 unsigned int isProperty;
886 int memberAccess;
887 int id;
888 struct __ecereNameSpace__ecere__com__Class * _class;
889 char *  dataTypeString;
890 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
891 struct Type * dataType;
892 int type;
893 int offset;
894 int memberID;
895 struct __ecereNameSpace__ecere__sys__OldList members;
896 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
897 int memberOffset;
898 int structAlignment;
899 } __attribute__ ((gcc_struct));
900
901 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
902
903 struct __ecereNameSpace__ecere__com__SerialBuffer
904 {
905 unsigned char *  _buffer;
906 unsigned int count;
907 unsigned int _size;
908 unsigned int pos;
909 } __attribute__ ((gcc_struct));
910
911 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
912
913 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
914 {
915 union
916 {
917 struct
918 {
919 char *  dataTypeString;
920 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
921 } __attribute__ ((gcc_struct));
922 struct __ecereNameSpace__ecere__com__DataValue expression;
923 struct
924 {
925 char *  memberString;
926 union
927 {
928 struct __ecereNameSpace__ecere__com__DataMember * member;
929 struct __ecereNameSpace__ecere__com__Property * prop;
930 struct __ecereNameSpace__ecere__com__Method * method;
931 } __attribute__ ((gcc_struct));
932 } __attribute__ ((gcc_struct));
933 } __attribute__ ((gcc_struct));
934 } __attribute__ ((gcc_struct));
935
936 void exit(int status);
937
938 void * calloc(size_t nmemb, size_t size);
939
940 void free(void * ptr);
941
942 void * malloc(size_t size);
943
944 void * realloc(void * ptr, size_t size);
945
946 long int strtol(const char * nptr, char ** endptr, int base);
947
948 long long int strtoll(const char * nptr, char ** endptr, int base);
949
950 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
951
952 enum yytokentype
953 {
954 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
955 };
956
957 typedef union YYSTYPE
958 {
959 int specifierType;
960 int i;
961 int declMode;
962 struct Identifier * id;
963 struct Expression * exp;
964 struct Specifier * specifier;
965 struct __ecereNameSpace__ecere__sys__OldList * list;
966 struct Enumerator * enumerator;
967 struct Declarator * declarator;
968 struct Pointer * pointer;
969 struct Initializer * initializer;
970 struct InitDeclarator * initDeclarator;
971 struct TypeName * typeName;
972 struct Declaration * declaration;
973 struct Statement * stmt;
974 struct FunctionDefinition * function;
975 struct External * external;
976 struct Context * context;
977 struct AsmField * asmField;
978 struct Attrib * attrib;
979 struct ExtDecl * extDecl;
980 struct Attribute * attribute;
981 struct Instantiation * instance;
982 struct MembersInit * membersInit;
983 struct MemberInit * memberInit;
984 struct ClassFunction * classFunction;
985 struct ClassDefinition * _class;
986 struct ClassDef * classDef;
987 struct PropertyDef * prop;
988 char * string;
989 struct Symbol * symbol;
990 struct PropertyWatch * propertyWatch;
991 struct TemplateParameter * templateParameter;
992 struct TemplateArgument * templateArgument;
993 struct TemplateDatatype * templateDatatype;
994 struct DBTableEntry * dbtableEntry;
995 struct DBIndexItem * dbindexItem;
996 struct DBTableDef * dbtableDef;
997 } __attribute__ ((gcc_struct)) YYSTYPE;
998
999 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
1000
1001 struct Enumerator
1002 {
1003 struct Enumerator * prev;
1004 struct Enumerator * next;
1005 struct Location loc;
1006 struct Identifier * id;
1007 struct Expression * exp;
1008 } __attribute__ ((gcc_struct));
1009
1010 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
1011
1012 struct InitDeclarator
1013 {
1014 struct InitDeclarator * prev;
1015 struct InitDeclarator * next;
1016 struct Location loc;
1017 struct Declarator * declarator;
1018 struct Initializer * initializer;
1019 } __attribute__ ((gcc_struct));
1020
1021 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
1022
1023 struct AsmField
1024 {
1025 struct AsmField * prev;
1026 struct AsmField * next;
1027 struct Location loc;
1028 char *  command;
1029 struct Expression * expression;
1030 } __attribute__ ((gcc_struct));
1031
1032 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
1033
1034 struct Attribute;
1035
1036 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
1037
1038 struct ClassFunction
1039 {
1040 struct ClassFunction * prev;
1041 struct ClassFunction * next;
1042 struct Location loc;
1043 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1044 struct Declarator * declarator;
1045 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1046 struct Statement * body;
1047 struct __ecereNameSpace__ecere__com__Class * _class;
1048 struct __ecereNameSpace__ecere__sys__OldList attached;
1049 int declMode;
1050 struct Type * type;
1051 struct Symbol * propSet;
1052 unsigned int isVirtual;
1053 unsigned int isConstructor;
1054 unsigned int isDestructor;
1055 unsigned int dontMangle;
1056 int id;
1057 int idCode;
1058 } __attribute__ ((gcc_struct));
1059
1060 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1061
1062 struct MembersInit
1063 {
1064 struct MembersInit * prev;
1065 struct MembersInit * next;
1066 struct Location loc;
1067 int type;
1068 union
1069 {
1070 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1071 struct ClassFunction * function;
1072 } __attribute__ ((gcc_struct));
1073 } __attribute__ ((gcc_struct));
1074
1075 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1076
1077 struct MemberInit
1078 {
1079 struct MemberInit * prev;
1080 struct MemberInit * next;
1081 struct Location loc;
1082 struct Location realLoc;
1083 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1084 struct Initializer * initializer;
1085 unsigned int used;
1086 unsigned int variable;
1087 unsigned int takeOutExp;
1088 } __attribute__ ((gcc_struct));
1089
1090 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1091
1092 struct PropertyDef
1093 {
1094 struct PropertyDef * prev;
1095 struct PropertyDef * next;
1096 struct Location loc;
1097 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1098 struct Declarator * declarator;
1099 struct Identifier * id;
1100 struct Statement * getStmt;
1101 struct Statement * setStmt;
1102 struct Statement * issetStmt;
1103 struct Symbol * symbol;
1104 unsigned int conversion;
1105 unsigned int isWatchable;
1106 struct Expression * category;
1107 } __attribute__ ((gcc_struct));
1108
1109 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1110
1111 struct PropertyWatch
1112 {
1113 struct PropertyWatch * prev;
1114 struct PropertyWatch * next;
1115 struct Location loc;
1116 struct Statement * compound;
1117 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1118 unsigned int deleteWatch;
1119 } __attribute__ ((gcc_struct));
1120
1121 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1122
1123 struct ClassDef
1124 {
1125 struct ClassDef * prev;
1126 struct ClassDef * next;
1127 struct Location loc;
1128 int type;
1129 union
1130 {
1131 struct Declaration * decl;
1132 struct ClassFunction * function;
1133 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1134 struct PropertyDef * propertyDef;
1135 struct PropertyWatch * propertyWatch;
1136 char *  designer;
1137 struct Identifier * defaultProperty;
1138 struct
1139 {
1140 struct Identifier * id;
1141 struct Initializer * initializer;
1142 } __attribute__ ((gcc_struct));
1143 } __attribute__ ((gcc_struct));
1144 int memberAccess;
1145 void *  object;
1146 } __attribute__ ((gcc_struct));
1147
1148 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1149
1150 struct DBTableEntry;
1151
1152 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1153
1154 struct DBIndexItem;
1155
1156 extern YYSTYPE yylval;
1157
1158 extern struct Location yylloc;
1159
1160 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1161
1162 extern int returnCode;
1163
1164 extern struct Expression * parsedExpression;
1165
1166 extern unsigned int yydebug;
1167
1168 void SetYydebug(unsigned int b)
1169 {
1170 yydebug = b;
1171 }
1172
1173 extern unsigned int echoOn;
1174
1175 void resetScanner();
1176
1177 int propWatcherID;
1178
1179 int expression_yyparse();
1180
1181 static struct Statement * curCompound;
1182
1183 struct External * curExternal, * afterExternal;
1184
1185 static struct Type * curSwitchType;
1186
1187 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1188
1189 struct __ecereNameSpace__ecere__com__Class * thisClass;
1190
1191 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1192 {
1193 thisClass = c;
1194 }
1195
1196 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1197 {
1198 return thisClass;
1199 }
1200
1201 static char * thisNameSpace;
1202
1203 struct __ecereNameSpace__ecere__com__Class * containerClass;
1204
1205 unsigned int thisClassParams = 0x1;
1206
1207 unsigned int internalValueCounter;
1208
1209 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1210
1211 extern size_t strlen(const char * );
1212
1213 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1214
1215 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1216
1217 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1218
1219 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1220
1221 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1222
1223 void PrintExpression(struct Expression * exp, char * string)
1224 {
1225 {
1226 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1227 int count;
1228
1229 if(exp)
1230 OutputExpression(exp, f);
1231 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1232 count = strlen(string);
1233 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);
1234 string[count] = '\0';
1235 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1236 }
1237 }
1238
1239 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1240
1241 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1242
1243 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1244 {
1245 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1246 {
1247 if(!param->baseType)
1248 {
1249 if(param->dataTypeString)
1250 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1251 else
1252 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1253 }
1254 return param->baseType;
1255 }
1256 return (((void *)0));
1257 }
1258
1259 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1260 {
1261 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1262 return 0x1;
1263 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1264 {
1265 return 0x0;
1266 }
1267 if(type1->kind == type2->kind)
1268 {
1269 switch(type1->kind)
1270 {
1271 case 1:
1272 case 2:
1273 case 3:
1274 case 4:
1275 case 22:
1276 case 23:
1277 if(type1->passAsTemplate && !type2->passAsTemplate)
1278 return 0x1;
1279 return type1->isSigned != type2->isSigned;
1280 case 8:
1281 return type1->_class != type2->_class;
1282 case 13:
1283 return NeedCast(type1->type, type2->type);
1284 default:
1285 return 0x1;
1286 }
1287 }
1288 return 0x1;
1289 }
1290
1291 extern int strcmp(const char * , const char * );
1292
1293 extern struct Context * curContext;
1294
1295 extern struct Context * topContext;
1296
1297 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1298
1299 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);
1300
1301 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1302
1303 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);
1304
1305 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);
1306
1307 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1308
1309 struct __ecereNameSpace__ecere__com__ClassProperty
1310 {
1311 char *  name;
1312 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1313 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1314 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1315 int depth;
1316 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, long long);
1317 long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1318 char *  dataTypeString;
1319 struct Type * dataType;
1320 unsigned int constant;
1321 } __attribute__ ((gcc_struct));
1322
1323 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1324
1325 extern struct Expression * QMkExpId(char *  id);
1326
1327 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1328
1329 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1330 {
1331 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1332 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1333 char *  name;
1334 int type;
1335 union
1336 {
1337 char *  dataTypeString;
1338 int memberType;
1339 } __attribute__ ((gcc_struct));
1340 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1341 void *  param;
1342 } __attribute__ ((gcc_struct));
1343
1344 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1345
1346 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1347
1348 extern void FreeIdentifier(struct Identifier * id);
1349
1350 void ProcessExpressionType(struct Expression * exp);
1351
1352 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1353
1354 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1355
1356 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1357
1358 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1359
1360 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1361
1362 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1363
1364 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1365
1366 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1367
1368 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1369 {
1370 if(exp->type == 0 && exp->identifier)
1371 {
1372 struct Identifier * id = exp->identifier;
1373 struct Context * ctx;
1374 struct Symbol * symbol = (((void *)0));
1375
1376 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1377 {
1378 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1379 {
1380 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1381 if(symbol)
1382 break;
1383 }
1384 }
1385 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1386 {
1387 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1388 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1389 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1390 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
1391
1392 if(!prop)
1393 {
1394 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1395 }
1396 if(!prop && !method)
1397 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1398 if(!prop && !method && !member)
1399 {
1400 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1401 }
1402 if(prop || method || member || classProp)
1403 {
1404 exp->type = 8;
1405 exp->member.member = id;
1406 exp->member.memberType = 0;
1407 exp->member.exp = QMkExpId("this");
1408 exp->addedThis = 0x1;
1409 }
1410 else if(_class && _class->templateParams.first)
1411 {
1412 struct __ecereNameSpace__ecere__com__Class * sClass;
1413
1414 for(sClass = _class; sClass; sClass = sClass->base)
1415 {
1416 if(sClass->templateParams.first)
1417 {
1418 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1419
1420 for(param = sClass->templateParams.first; param; param = param->next)
1421 {
1422 if(param->type == 2 && !strcmp(param->name, id->string))
1423 {
1424 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1425
1426 if(argExp)
1427 {
1428 struct Declarator * decl;
1429 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1430
1431 FreeIdentifier(exp->member.member);
1432 ProcessExpressionType(argExp);
1433 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1434 exp->expType = ProcessType(specs, decl);
1435 exp->type = 5;
1436 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1437 }
1438 }
1439 }
1440 }
1441 }
1442 }
1443 }
1444 }
1445 }
1446
1447 extern int sprintf(char * , char * , ...);
1448
1449 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1450
1451 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1452
1453 char * PrintInt(long long result)
1454 {
1455 char temp[100];
1456
1457 if(result > (((long long)0x7fffffffffffffffLL)))
1458 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1459 else
1460 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1461 return __ecereNameSpace__ecere__sys__CopyString(temp);
1462 }
1463
1464 char * PrintUInt(uint64 result)
1465 {
1466 char temp[100];
1467
1468 if(result > (0xffffffff))
1469 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1470 else if(result > (((int)0x7fffffff)))
1471 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1472 else
1473 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1474 return __ecereNameSpace__ecere__sys__CopyString(temp);
1475 }
1476
1477 char * PrintInt64(long long result)
1478 {
1479 char temp[100];
1480
1481 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1482 return __ecereNameSpace__ecere__sys__CopyString(temp);
1483 }
1484
1485 char * PrintUInt64(uint64 result)
1486 {
1487 char temp[100];
1488
1489 if(result > (((long long)0x7fffffffffffffffLL)))
1490 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1491 else
1492 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1493 return __ecereNameSpace__ecere__sys__CopyString(temp);
1494 }
1495
1496 char * PrintHexUInt(uint64 result)
1497 {
1498 char temp[100];
1499
1500 if(result > (0xffffffff))
1501 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1502 else
1503 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1504 return __ecereNameSpace__ecere__sys__CopyString(temp);
1505 }
1506
1507 char * PrintHexUInt64(uint64 result)
1508 {
1509 char temp[100];
1510
1511 if(result > (0xffffffff))
1512 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1513 else
1514 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1515 return __ecereNameSpace__ecere__sys__CopyString(temp);
1516 }
1517
1518 char * PrintShort(short result)
1519 {
1520 char temp[100];
1521
1522 sprintf(temp, "%d", (unsigned short)result);
1523 return __ecereNameSpace__ecere__sys__CopyString(temp);
1524 }
1525
1526 char * PrintUShort(unsigned short result)
1527 {
1528 char temp[100];
1529
1530 if(result > (unsigned short)32767)
1531 sprintf(temp, "0x%X", (int)result);
1532 else
1533 sprintf(temp, "%d", (int)result);
1534 return __ecereNameSpace__ecere__sys__CopyString(temp);
1535 }
1536
1537 extern int isprint(int c);
1538
1539 char * PrintChar(char result)
1540 {
1541 char temp[100];
1542
1543 if(result > (char)0 && isprint(result))
1544 sprintf(temp, "'%c'", result);
1545 else if(result < (char)0)
1546 sprintf(temp, "%d", (int)result);
1547 else
1548 sprintf(temp, "0x%X", (unsigned char)result);
1549 return __ecereNameSpace__ecere__sys__CopyString(temp);
1550 }
1551
1552 char * PrintUChar(unsigned char result)
1553 {
1554 char temp[100];
1555
1556 sprintf(temp, "0x%X", result);
1557 return __ecereNameSpace__ecere__sys__CopyString(temp);
1558 }
1559
1560 char * PrintFloat(float result)
1561 {
1562 char temp[350];
1563
1564 sprintf(temp, "%.16ff", result);
1565 return __ecereNameSpace__ecere__sys__CopyString(temp);
1566 }
1567
1568 char * PrintDouble(double result)
1569 {
1570 char temp[350];
1571
1572 sprintf(temp, "%.16f", result);
1573 return __ecereNameSpace__ecere__sys__CopyString(temp);
1574 }
1575
1576 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1577
1578 struct OpTable
1579 {
1580 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1581 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1582 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1583 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1584 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1585 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1586 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1587 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1588 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1589 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1590 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1591 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1592 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1593 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1594 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1595 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1596 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1597 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1598 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1599 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1600 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1601 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1602 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1603 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1604 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1605 unsigned int (*  Not)(struct Expression *, struct Operand *);
1606 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1607 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1608 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1609 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1610 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1611 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1612 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1613 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1614 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1615 } __attribute__ ((gcc_struct));
1616
1617 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1618
1619 struct Operand
1620 {
1621 int kind;
1622 struct Type * type;
1623 unsigned int ptrSize;
1624 union
1625 {
1626 char c;
1627 unsigned char uc;
1628 short s;
1629 unsigned short us;
1630 int i;
1631 unsigned int ui;
1632 float f;
1633 double d;
1634 long long i64;
1635 uint64 ui64;
1636 } __attribute__ ((gcc_struct));
1637 struct OpTable ops;
1638 } __attribute__ ((gcc_struct));
1639
1640 struct Operand GetOperand(struct Expression * exp);
1641
1642 unsigned int GetInt(struct Expression * exp, int * value2)
1643 {
1644 struct Operand op2 = GetOperand(exp);
1645
1646 if(op2.kind == 3 && op2.type->isSigned)
1647 *value2 = op2.i;
1648 else if(op2.kind == 3)
1649 *value2 = (int)op2.ui;
1650 else if(op2.kind == 4 && op2.type->isSigned)
1651 *value2 = (int)op2.i64;
1652 else if(op2.kind == 4)
1653 *value2 = (int)op2.ui64;
1654 else if(op2.kind == 23 && op2.type->isSigned)
1655 *value2 = (int)op2.i64;
1656 else if(op2.kind == 23)
1657 *value2 = (int)op2.ui64;
1658 else if(op2.kind == 22 && op2.type->isSigned)
1659 *value2 = (int)op2.i64;
1660 else if(op2.kind == 22)
1661 *value2 = (int)op2.ui64;
1662 else if(op2.kind == 2 && op2.type->isSigned)
1663 *value2 = (int)op2.s;
1664 else if(op2.kind == 2)
1665 *value2 = (int)op2.us;
1666 else if(op2.kind == 1 && op2.type->isSigned)
1667 *value2 = (int)op2.c;
1668 else if(op2.kind == 1)
1669 *value2 = (int)op2.uc;
1670 else if(op2.kind == 6)
1671 *value2 = (int)op2.f;
1672 else if(op2.kind == 7)
1673 *value2 = (int)op2.d;
1674 else if(op2.kind == 13)
1675 *value2 = (int)op2.ui64;
1676 else
1677 return 0x0;
1678 return 0x1;
1679 }
1680
1681 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1682 {
1683 struct Operand op2 = GetOperand(exp);
1684
1685 if(op2.kind == 3 && op2.type->isSigned)
1686 *value2 = (unsigned int)op2.i;
1687 else if(op2.kind == 3)
1688 *value2 = op2.ui;
1689 else if(op2.kind == 4 && op2.type->isSigned)
1690 *value2 = (unsigned int)op2.i64;
1691 else if(op2.kind == 4)
1692 *value2 = (unsigned int)op2.ui64;
1693 else if(op2.kind == 23 && op2.type->isSigned)
1694 *value2 = (unsigned int)op2.i64;
1695 else if(op2.kind == 23)
1696 *value2 = (unsigned int)op2.ui64;
1697 else if(op2.kind == 22 && op2.type->isSigned)
1698 *value2 = (unsigned int)op2.i64;
1699 else if(op2.kind == 22)
1700 *value2 = (unsigned int)op2.ui64;
1701 else if(op2.kind == 2 && op2.type->isSigned)
1702 *value2 = (unsigned int)op2.s;
1703 else if(op2.kind == 2)
1704 *value2 = (unsigned int)op2.us;
1705 else if(op2.kind == 1 && op2.type->isSigned)
1706 *value2 = (unsigned int)op2.c;
1707 else if(op2.kind == 1)
1708 *value2 = (unsigned int)op2.uc;
1709 else if(op2.kind == 6)
1710 *value2 = (unsigned int)op2.f;
1711 else if(op2.kind == 7)
1712 *value2 = (unsigned int)op2.d;
1713 else if(op2.kind == 13)
1714 *value2 = (unsigned int)op2.ui64;
1715 else
1716 return 0x0;
1717 return 0x1;
1718 }
1719
1720 unsigned int GetInt64(struct Expression * exp, long long * value2)
1721 {
1722 struct Operand op2 = GetOperand(exp);
1723
1724 if(op2.kind == 3 && op2.type->isSigned)
1725 *value2 = (long long)op2.i;
1726 else if(op2.kind == 3)
1727 *value2 = (long long)op2.ui;
1728 else if(op2.kind == 4 && op2.type->isSigned)
1729 *value2 = op2.i64;
1730 else if(op2.kind == 4)
1731 *value2 = (long long)op2.ui64;
1732 else if(op2.kind == 23 && op2.type->isSigned)
1733 *value2 = op2.i64;
1734 else if(op2.kind == 23)
1735 *value2 = (long long)op2.ui64;
1736 else if(op2.kind == 22 && op2.type->isSigned)
1737 *value2 = op2.i64;
1738 else if(op2.kind == 22)
1739 *value2 = (long long)op2.ui64;
1740 else if(op2.kind == 2 && op2.type->isSigned)
1741 *value2 = (long long)op2.s;
1742 else if(op2.kind == 2)
1743 *value2 = (long long)op2.us;
1744 else if(op2.kind == 1 && op2.type->isSigned)
1745 *value2 = (long long)op2.c;
1746 else if(op2.kind == 1)
1747 *value2 = (long long)op2.uc;
1748 else if(op2.kind == 6)
1749 *value2 = (long long)op2.f;
1750 else if(op2.kind == 7)
1751 *value2 = (long long)op2.d;
1752 else if(op2.kind == 13)
1753 *value2 = (long long)op2.ui64;
1754 else
1755 return 0x0;
1756 return 0x1;
1757 }
1758
1759 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1760 {
1761 struct Operand op2 = GetOperand(exp);
1762
1763 if(op2.kind == 3 && op2.type->isSigned)
1764 *value2 = (uint64)op2.i;
1765 else if(op2.kind == 3)
1766 *value2 = (uint64)op2.ui;
1767 else if(op2.kind == 4 && op2.type->isSigned)
1768 *value2 = (uint64)op2.i64;
1769 else if(op2.kind == 4)
1770 *value2 = op2.ui64;
1771 else if(op2.kind == 23 && op2.type->isSigned)
1772 *value2 = (uint64)op2.i64;
1773 else if(op2.kind == 23)
1774 *value2 = op2.ui64;
1775 else if(op2.kind == 22 && op2.type->isSigned)
1776 *value2 = (uint64)op2.i64;
1777 else if(op2.kind == 22)
1778 *value2 = op2.ui64;
1779 else if(op2.kind == 2 && op2.type->isSigned)
1780 *value2 = (uint64)op2.s;
1781 else if(op2.kind == 2)
1782 *value2 = (uint64)op2.us;
1783 else if(op2.kind == 1 && op2.type->isSigned)
1784 *value2 = (uint64)op2.c;
1785 else if(op2.kind == 1)
1786 *value2 = (uint64)op2.uc;
1787 else if(op2.kind == 6)
1788 *value2 = (uint64)op2.f;
1789 else if(op2.kind == 7)
1790 *value2 = (uint64)op2.d;
1791 else if(op2.kind == 13)
1792 *value2 = op2.ui64;
1793 else
1794 return 0x0;
1795 return 0x1;
1796 }
1797
1798 unsigned int GetIntPtr(struct Expression * exp, intptr_t * value2)
1799 {
1800 struct Operand op2 = GetOperand(exp);
1801
1802 if(op2.kind == 3 && op2.type->isSigned)
1803 *value2 = (intptr_t)op2.i;
1804 else if(op2.kind == 3)
1805 *value2 = (intptr_t)op2.ui;
1806 else if(op2.kind == 4 && op2.type->isSigned)
1807 *value2 = (intptr_t)op2.i64;
1808 else if(op2.kind == 4)
1809 *value2 = (intptr_t)op2.ui64;
1810 else if(op2.kind == 23 && op2.type->isSigned)
1811 *value2 = (intptr_t)op2.i64;
1812 else if(op2.kind == 23)
1813 *value2 = (intptr_t)op2.ui64;
1814 else if(op2.kind == 22 && op2.type->isSigned)
1815 *value2 = (intptr_t)op2.i64;
1816 else if(op2.kind == 22)
1817 *value2 = (intptr_t)op2.ui64;
1818 else if(op2.kind == 2 && op2.type->isSigned)
1819 *value2 = (intptr_t)op2.s;
1820 else if(op2.kind == 2)
1821 *value2 = (intptr_t)op2.us;
1822 else if(op2.kind == 1 && op2.type->isSigned)
1823 *value2 = (intptr_t)op2.c;
1824 else if(op2.kind == 1)
1825 *value2 = (intptr_t)op2.uc;
1826 else if(op2.kind == 6)
1827 *value2 = (intptr_t)op2.f;
1828 else if(op2.kind == 7)
1829 *value2 = (intptr_t)op2.d;
1830 else if(op2.kind == 13)
1831 *value2 = (intptr_t)op2.ui64;
1832 else
1833 return 0x0;
1834 return 0x1;
1835 }
1836
1837 unsigned int GetUIntPtr(struct Expression * exp, uintptr_t * value2)
1838 {
1839 struct Operand op2 = GetOperand(exp);
1840
1841 if(op2.kind == 3 && op2.type->isSigned)
1842 *value2 = (uintptr_t)op2.i;
1843 else if(op2.kind == 3)
1844 *value2 = (uintptr_t)op2.ui;
1845 else if(op2.kind == 4 && op2.type->isSigned)
1846 *value2 = (uintptr_t)op2.i64;
1847 else if(op2.kind == 4)
1848 *value2 = (uintptr_t)op2.ui64;
1849 else if(op2.kind == 23 && op2.type->isSigned)
1850 *value2 = (uintptr_t)op2.i64;
1851 else if(op2.kind == 23)
1852 *value2 = (uintptr_t)op2.ui64;
1853 else if(op2.kind == 22 && op2.type->isSigned)
1854 *value2 = (uintptr_t)op2.i64;
1855 else if(op2.kind == 22)
1856 *value2 = (uintptr_t)op2.ui64;
1857 else if(op2.kind == 2 && op2.type->isSigned)
1858 *value2 = (uintptr_t)op2.s;
1859 else if(op2.kind == 2)
1860 *value2 = (uintptr_t)op2.us;
1861 else if(op2.kind == 1 && op2.type->isSigned)
1862 *value2 = (uintptr_t)op2.c;
1863 else if(op2.kind == 1)
1864 *value2 = (uintptr_t)op2.uc;
1865 else if(op2.kind == 6)
1866 *value2 = (uintptr_t)op2.f;
1867 else if(op2.kind == 7)
1868 *value2 = (uintptr_t)op2.d;
1869 else if(op2.kind == 13)
1870 *value2 = (uintptr_t)op2.ui64;
1871 else
1872 return 0x0;
1873 return 0x1;
1874 }
1875
1876 unsigned int GetIntSize(struct Expression * exp, ssize_t * value2)
1877 {
1878 struct Operand op2 = GetOperand(exp);
1879
1880 if(op2.kind == 3 && op2.type->isSigned)
1881 *value2 = (ssize_t)op2.i;
1882 else if(op2.kind == 3)
1883 *value2 = (ssize_t)op2.ui;
1884 else if(op2.kind == 4 && op2.type->isSigned)
1885 *value2 = (ssize_t)op2.i64;
1886 else if(op2.kind == 4)
1887 *value2 = (ssize_t)op2.ui64;
1888 else if(op2.kind == 23 && op2.type->isSigned)
1889 *value2 = (ssize_t)op2.i64;
1890 else if(op2.kind == 23)
1891 *value2 = (ssize_t)op2.ui64;
1892 else if(op2.kind == 22 && op2.type->isSigned)
1893 *value2 = (ssize_t)op2.i64;
1894 else if(op2.kind == 22)
1895 *value2 = (ssize_t)op2.ui64;
1896 else if(op2.kind == 2 && op2.type->isSigned)
1897 *value2 = (ssize_t)op2.s;
1898 else if(op2.kind == 2)
1899 *value2 = (ssize_t)op2.us;
1900 else if(op2.kind == 1 && op2.type->isSigned)
1901 *value2 = (ssize_t)op2.c;
1902 else if(op2.kind == 1)
1903 *value2 = (ssize_t)op2.uc;
1904 else if(op2.kind == 6)
1905 *value2 = (ssize_t)op2.f;
1906 else if(op2.kind == 7)
1907 *value2 = (ssize_t)op2.d;
1908 else if(op2.kind == 13)
1909 *value2 = (ssize_t)op2.ui64;
1910 else
1911 return 0x0;
1912 return 0x1;
1913 }
1914
1915 unsigned int GetUIntSize(struct Expression * exp, size_t * value2)
1916 {
1917 struct Operand op2 = GetOperand(exp);
1918
1919 if(op2.kind == 3 && op2.type->isSigned)
1920 *value2 = (size_t)op2.i;
1921 else if(op2.kind == 3)
1922 *value2 = (size_t)op2.ui;
1923 else if(op2.kind == 4 && op2.type->isSigned)
1924 *value2 = (size_t)op2.i64;
1925 else if(op2.kind == 4)
1926 *value2 = (size_t)op2.ui64;
1927 else if(op2.kind == 23 && op2.type->isSigned)
1928 *value2 = (size_t)op2.i64;
1929 else if(op2.kind == 23)
1930 *value2 = (size_t)op2.ui64;
1931 else if(op2.kind == 22 && op2.type->isSigned)
1932 *value2 = (size_t)op2.i64;
1933 else if(op2.kind == 22)
1934 *value2 = (size_t)op2.ui64;
1935 else if(op2.kind == 2 && op2.type->isSigned)
1936 *value2 = (size_t)op2.s;
1937 else if(op2.kind == 2)
1938 *value2 = (size_t)op2.us;
1939 else if(op2.kind == 1 && op2.type->isSigned)
1940 *value2 = (size_t)op2.c;
1941 else if(op2.kind == 1)
1942 *value2 = (size_t)op2.uc;
1943 else if(op2.kind == 6)
1944 *value2 = (size_t)op2.f;
1945 else if(op2.kind == 7)
1946 *value2 = (size_t)op2.d;
1947 else if(op2.kind == 13)
1948 *value2 = (size_t)op2.ui64;
1949 else
1950 return 0x0;
1951 return 0x1;
1952 }
1953
1954 unsigned int GetShort(struct Expression * exp, short * value2)
1955 {
1956 struct Operand op2 = GetOperand(exp);
1957
1958 if(op2.kind == 3 && op2.type->isSigned)
1959 *value2 = (short)op2.i;
1960 else if(op2.kind == 3)
1961 *value2 = (short)op2.ui;
1962 else if(op2.kind == 4 && op2.type->isSigned)
1963 *value2 = (short)op2.i64;
1964 else if(op2.kind == 4)
1965 *value2 = (short)op2.ui64;
1966 else if(op2.kind == 23 && op2.type->isSigned)
1967 *value2 = (short)op2.i64;
1968 else if(op2.kind == 23)
1969 *value2 = (short)op2.ui64;
1970 else if(op2.kind == 22 && op2.type->isSigned)
1971 *value2 = (short)op2.i64;
1972 else if(op2.kind == 22)
1973 *value2 = (short)op2.ui64;
1974 else if(op2.kind == 2 && op2.type->isSigned)
1975 *value2 = op2.s;
1976 else if(op2.kind == 2)
1977 *value2 = (short)op2.us;
1978 else if(op2.kind == 1 && op2.type->isSigned)
1979 *value2 = (short)op2.c;
1980 else if(op2.kind == 1)
1981 *value2 = (short)op2.uc;
1982 else if(op2.kind == 6)
1983 *value2 = (short)op2.f;
1984 else if(op2.kind == 7)
1985 *value2 = (short)op2.d;
1986 else if(op2.kind == 13)
1987 *value2 = (short)op2.ui64;
1988 else
1989 return 0x0;
1990 return 0x1;
1991 }
1992
1993 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
1994 {
1995 struct Operand op2 = GetOperand(exp);
1996
1997 if(op2.kind == 3 && op2.type->isSigned)
1998 *value2 = (unsigned short)op2.i;
1999 else if(op2.kind == 3)
2000 *value2 = (unsigned short)op2.ui;
2001 else if(op2.kind == 4 && op2.type->isSigned)
2002 *value2 = (unsigned short)op2.i64;
2003 else if(op2.kind == 4)
2004 *value2 = (unsigned short)op2.ui64;
2005 else if(op2.kind == 23 && op2.type->isSigned)
2006 *value2 = (unsigned short)op2.i64;
2007 else if(op2.kind == 23)
2008 *value2 = (unsigned short)op2.ui64;
2009 else if(op2.kind == 22 && op2.type->isSigned)
2010 *value2 = (unsigned short)op2.i64;
2011 else if(op2.kind == 22)
2012 *value2 = (unsigned short)op2.ui64;
2013 else if(op2.kind == 2 && op2.type->isSigned)
2014 *value2 = (unsigned short)op2.s;
2015 else if(op2.kind == 2)
2016 *value2 = op2.us;
2017 else if(op2.kind == 1 && op2.type->isSigned)
2018 *value2 = (unsigned short)op2.c;
2019 else if(op2.kind == 1)
2020 *value2 = (unsigned short)op2.uc;
2021 else if(op2.kind == 6)
2022 *value2 = (unsigned short)op2.f;
2023 else if(op2.kind == 7)
2024 *value2 = (unsigned short)op2.d;
2025 else if(op2.kind == 13)
2026 *value2 = (unsigned short)op2.ui64;
2027 else
2028 return 0x0;
2029 return 0x1;
2030 }
2031
2032 unsigned int GetChar(struct Expression * exp, char * value2)
2033 {
2034 struct Operand op2 = GetOperand(exp);
2035
2036 if(op2.kind == 3 && op2.type->isSigned)
2037 *value2 = (char)op2.i;
2038 else if(op2.kind == 3)
2039 *value2 = (char)op2.ui;
2040 else if(op2.kind == 4 && op2.type->isSigned)
2041 *value2 = (char)op2.i64;
2042 else if(op2.kind == 4)
2043 *value2 = (char)op2.ui64;
2044 else if(op2.kind == 23 && op2.type->isSigned)
2045 *value2 = (char)op2.i64;
2046 else if(op2.kind == 23)
2047 *value2 = (char)op2.ui64;
2048 else if(op2.kind == 22 && op2.type->isSigned)
2049 *value2 = (char)op2.i64;
2050 else if(op2.kind == 22)
2051 *value2 = (char)op2.ui64;
2052 else if(op2.kind == 2 && op2.type->isSigned)
2053 *value2 = (char)op2.s;
2054 else if(op2.kind == 2)
2055 *value2 = (char)op2.us;
2056 else if(op2.kind == 1 && op2.type->isSigned)
2057 *value2 = op2.c;
2058 else if(op2.kind == 1)
2059 *value2 = (char)op2.uc;
2060 else if(op2.kind == 6)
2061 *value2 = (char)op2.f;
2062 else if(op2.kind == 7)
2063 *value2 = (char)op2.d;
2064 else if(op2.kind == 13)
2065 *value2 = (char)op2.ui64;
2066 else
2067 return 0x0;
2068 return 0x1;
2069 }
2070
2071 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
2072 {
2073 struct Operand op2 = GetOperand(exp);
2074
2075 if(op2.kind == 3 && op2.type->isSigned)
2076 *value2 = (unsigned char)op2.i;
2077 else if(op2.kind == 3)
2078 *value2 = (unsigned char)op2.ui;
2079 else if(op2.kind == 4 && op2.type->isSigned)
2080 *value2 = (unsigned char)op2.i64;
2081 else if(op2.kind == 4)
2082 *value2 = (unsigned char)op2.ui64;
2083 else if(op2.kind == 23 && op2.type->isSigned)
2084 *value2 = (unsigned char)op2.i64;
2085 else if(op2.kind == 23)
2086 *value2 = (unsigned char)op2.ui64;
2087 else if(op2.kind == 22 && op2.type->isSigned)
2088 *value2 = (unsigned char)op2.i64;
2089 else if(op2.kind == 22)
2090 *value2 = (unsigned char)op2.ui64;
2091 else if(op2.kind == 2 && op2.type->isSigned)
2092 *value2 = (unsigned char)op2.s;
2093 else if(op2.kind == 2)
2094 *value2 = (unsigned char)op2.us;
2095 else if(op2.kind == 1 && op2.type->isSigned)
2096 *value2 = (unsigned char)op2.c;
2097 else if(op2.kind == 1)
2098 *value2 = op2.uc;
2099 else if(op2.kind == 6)
2100 *value2 = (unsigned char)op2.f;
2101 else if(op2.kind == 7)
2102 *value2 = (unsigned char)op2.d;
2103 else if(op2.kind == 13)
2104 *value2 = (unsigned char)op2.ui64;
2105 else
2106 return 0x0;
2107 return 0x1;
2108 }
2109
2110 unsigned int GetFloat(struct Expression * exp, float * value2)
2111 {
2112 struct Operand op2 = GetOperand(exp);
2113
2114 if(op2.kind == 3 && op2.type->isSigned)
2115 *value2 = (float)(float)op2.i;
2116 else if(op2.kind == 3)
2117 *value2 = (float)(float)op2.ui;
2118 else if(op2.kind == 4 && op2.type->isSigned)
2119 *value2 = (float)(float)op2.i64;
2120 else if(op2.kind == 4)
2121 *value2 = (float)(float)op2.ui64;
2122 else if(op2.kind == 23 && op2.type->isSigned)
2123 *value2 = (float)(float)op2.i64;
2124 else if(op2.kind == 23)
2125 *value2 = (float)(float)op2.ui64;
2126 else if(op2.kind == 22 && op2.type->isSigned)
2127 *value2 = (float)(float)op2.i64;
2128 else if(op2.kind == 22)
2129 *value2 = (float)(float)op2.ui64;
2130 else if(op2.kind == 2 && op2.type->isSigned)
2131 *value2 = (float)(float)op2.s;
2132 else if(op2.kind == 2)
2133 *value2 = (float)(float)op2.us;
2134 else if(op2.kind == 1 && op2.type->isSigned)
2135 *value2 = (float)(float)op2.c;
2136 else if(op2.kind == 1)
2137 *value2 = (float)(float)op2.uc;
2138 else if(op2.kind == 6)
2139 *value2 = (float)op2.f;
2140 else if(op2.kind == 7)
2141 *value2 = (float)op2.d;
2142 else if(op2.kind == 13)
2143 *value2 = (float)(float)op2.ui64;
2144 else
2145 return 0x0;
2146 return 0x1;
2147 }
2148
2149 unsigned int GetDouble(struct Expression * exp, double * value2)
2150 {
2151 struct Operand op2 = GetOperand(exp);
2152
2153 if(op2.kind == 3 && op2.type->isSigned)
2154 *value2 = (double)(double)op2.i;
2155 else if(op2.kind == 3)
2156 *value2 = (double)(double)op2.ui;
2157 else if(op2.kind == 4 && op2.type->isSigned)
2158 *value2 = (double)(double)op2.i64;
2159 else if(op2.kind == 4)
2160 *value2 = (double)(double)op2.ui64;
2161 else if(op2.kind == 23 && op2.type->isSigned)
2162 *value2 = (double)(double)op2.i64;
2163 else if(op2.kind == 23)
2164 *value2 = (double)(double)op2.ui64;
2165 else if(op2.kind == 22 && op2.type->isSigned)
2166 *value2 = (double)(double)op2.i64;
2167 else if(op2.kind == 22)
2168 *value2 = (double)(double)op2.ui64;
2169 else if(op2.kind == 2 && op2.type->isSigned)
2170 *value2 = (double)(double)op2.s;
2171 else if(op2.kind == 2)
2172 *value2 = (double)(double)op2.us;
2173 else if(op2.kind == 1 && op2.type->isSigned)
2174 *value2 = (double)(double)op2.c;
2175 else if(op2.kind == 1)
2176 *value2 = (double)(double)op2.uc;
2177 else if(op2.kind == 6)
2178 *value2 = (double)op2.f;
2179 else if(op2.kind == 7)
2180 *value2 = (double)op2.d;
2181 else if(op2.kind == 13)
2182 *value2 = (double)(double)op2.ui64;
2183 else
2184 return 0x0;
2185 return 0x1;
2186 }
2187
2188 void ComputeExpression(struct Expression * exp);
2189
2190 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2191
2192 extern int targetBits;
2193
2194 int ComputeTypeSize(struct Type * type);
2195
2196 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2197
2198 struct __ecereNameSpace__ecere__com__BitMember
2199 {
2200 struct __ecereNameSpace__ecere__com__BitMember * prev;
2201 struct __ecereNameSpace__ecere__com__BitMember * next;
2202 char *  name;
2203 unsigned int isProperty;
2204 int memberAccess;
2205 int id;
2206 struct __ecereNameSpace__ecere__com__Class * _class;
2207 char *  dataTypeString;
2208 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2209 struct Type * dataType;
2210 int type;
2211 int size;
2212 int pos;
2213 uint64 mask;
2214 } __attribute__ ((gcc_struct));
2215
2216 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2217
2218 struct __ecereNameSpace__ecere__sys__OldLink
2219 {
2220 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2221 struct __ecereNameSpace__ecere__sys__OldLink * next;
2222 void *  data;
2223 } __attribute__ ((gcc_struct));
2224
2225 void FinishTemplatesContext(struct Context * context);
2226
2227 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2228 {
2229 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2230 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2231
2232 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))
2233 {
2234 int c;
2235 int unionMemberOffset = 0;
2236 int bitFields = 0;
2237
2238 if(member)
2239 {
2240 member->memberOffset = 0;
2241 if(targetBits < sizeof(void *) * 8)
2242 member->structAlignment = 0;
2243 }
2244 else if(targetBits < sizeof(void *) * 8)
2245 _class->structAlignment = 0;
2246 if(!member && ((_class->type == 0 || _class->type == 5) || (_class->type == 1 && _class->memberOffset && _class->memberOffset > _class->base->structSize)))
2247 _class->memberOffset = (_class->base && _class->type == 1) ? _class->base->structSize : 0;
2248 if(!member && _class->destructionWatchOffset)
2249 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2250 {
2251 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2252
2253 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2254 {
2255 if(!dataMember->isProperty)
2256 {
2257 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2258 {
2259 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2260 }
2261 }
2262 }
2263 }
2264 {
2265 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2266
2267 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2268 {
2269 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2270 {
2271 if(!isMember && _class->type == 2 && dataMember->dataType)
2272 {
2273 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2274 uint64 mask = 0;
2275 int d;
2276
2277 ComputeTypeSize(dataMember->dataType);
2278 if(bitMember->pos == -1)
2279 bitMember->pos = _class->memberOffset;
2280 if(!bitMember->size)
2281 bitMember->size = dataMember->dataType->size * 8;
2282 _class->memberOffset = bitMember->pos + bitMember->size;
2283 for(d = 0; d < bitMember->size; d++)
2284 {
2285 if(d)
2286 mask <<= 1;
2287 mask |= 1;
2288 }
2289 bitMember->mask = mask << bitMember->pos;
2290 }
2291 else if(dataMember->type == 0 && dataMember->dataType)
2292 {
2293 int size;
2294 int alignment = 0;
2295
2296 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2297 ComputeTypeSize(dataMember->dataType);
2298 if(dataMember->dataType->bitFieldCount)
2299 {
2300 bitFields += dataMember->dataType->bitFieldCount;
2301 size = 0;
2302 }
2303 else
2304 {
2305 if(bitFields)
2306 {
2307 int size = (bitFields + 7) / 8;
2308
2309 if(isMember)
2310 {
2311 int __simpleStruct0;
2312
2313 if(alignment)
2314 {
2315 int __simpleStruct0;
2316
2317 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2318 if(member->memberOffset % alignment)
2319 member->memberOffset += alignment - (member->memberOffset % alignment);
2320 }
2321 dataMember->offset = member->memberOffset;
2322 if(member->type == 1)
2323 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2324 else
2325 {
2326 member->memberOffset += size;
2327 }
2328 }
2329 else
2330 {
2331 if(alignment)
2332 {
2333 int __simpleStruct0;
2334
2335 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2336 if(_class->memberOffset % alignment)
2337 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2338 }
2339 dataMember->offset = _class->memberOffset;
2340 _class->memberOffset += size;
2341 }
2342 bitFields = 0;
2343 }
2344 size = dataMember->dataType->size;
2345 alignment = dataMember->dataType->alignment;
2346 }
2347 if(isMember)
2348 {
2349 int __simpleStruct0;
2350
2351 if(alignment)
2352 {
2353 int __simpleStruct0;
2354
2355 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2356 if(member->memberOffset % alignment)
2357 member->memberOffset += alignment - (member->memberOffset % alignment);
2358 }
2359 dataMember->offset = member->memberOffset;
2360 if(member->type == 1)
2361 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2362 else
2363 {
2364 member->memberOffset += size;
2365 }
2366 }
2367 else
2368 {
2369 if(alignment)
2370 {
2371 int __simpleStruct0;
2372
2373 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2374 if(_class->memberOffset % alignment)
2375 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2376 }
2377 dataMember->offset = _class->memberOffset;
2378 _class->memberOffset += size;
2379 }
2380 }
2381 else
2382 {
2383 int alignment;
2384
2385 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2386 alignment = dataMember->structAlignment;
2387 if(isMember)
2388 {
2389 int __simpleStruct0;
2390
2391 if(alignment)
2392 {
2393 int __simpleStruct0;
2394
2395 if(member->memberOffset % alignment)
2396 member->memberOffset += alignment - (member->memberOffset % alignment);
2397 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2398 }
2399 dataMember->offset = member->memberOffset;
2400 if(member->type == 1)
2401 unionMemberOffset = (__simpleStruct0 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2402 else
2403 member->memberOffset += dataMember->memberOffset;
2404 }
2405 else
2406 {
2407 if(alignment)
2408 {
2409 int __simpleStruct0;
2410
2411 if(_class->memberOffset % alignment)
2412 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2413 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2414 }
2415 dataMember->offset = _class->memberOffset;
2416 _class->memberOffset += dataMember->memberOffset;
2417 }
2418 }
2419 }
2420 }
2421 if(bitFields)
2422 {
2423 int alignment = 0;
2424 int size = (bitFields + 7) / 8;
2425
2426 if(isMember)
2427 {
2428 int __simpleStruct0;
2429
2430 if(alignment)
2431 {
2432 int __simpleStruct0;
2433
2434 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2435 if(member->memberOffset % alignment)
2436 member->memberOffset += alignment - (member->memberOffset % alignment);
2437 }
2438 if(member->type == 1)
2439 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2440 else
2441 {
2442 member->memberOffset += size;
2443 }
2444 }
2445 else
2446 {
2447 if(alignment)
2448 {
2449 int __simpleStruct0;
2450
2451 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2452 if(_class->memberOffset % alignment)
2453 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2454 }
2455 _class->memberOffset += size;
2456 }
2457 bitFields = 0;
2458 }
2459 }
2460 if(member && member->type == 1)
2461 {
2462 member->memberOffset = unionMemberOffset;
2463 }
2464 if(!isMember)
2465 {
2466 if(_class->type != 2)
2467 {
2468 int extra = 0;
2469
2470 if(_class->structAlignment)
2471 {
2472 if(_class->memberOffset % _class->structAlignment)
2473 extra += _class->structAlignment - (_class->memberOffset % _class->structAlignment);
2474 }
2475 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset + extra;
2476 if(!member)
2477 {
2478 struct __ecereNameSpace__ecere__com__Property * prop;
2479
2480 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2481 {
2482 if(prop->isProperty && prop->isWatchable)
2483 {
2484 prop->watcherOffset = _class->structSize;
2485 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2486 }
2487 }
2488 }
2489 {
2490 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2491
2492 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2493 {
2494 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2495
2496 if(deriv->computeSize)
2497 {
2498 deriv->offset = _class->structSize;
2499 deriv->memberOffset = 0;
2500 deriv->structSize = deriv->offset;
2501 ComputeClassMembers(deriv, 0x0);
2502 }
2503 }
2504 }
2505 }
2506 }
2507 }
2508 if(context)
2509 FinishTemplatesContext(context);
2510 }
2511
2512 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2513
2514 struct __ecereNameSpace__ecere__com__NameSpace
2515 {
2516 char *  name;
2517 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2518 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2519 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2520 int depth;
2521 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2522 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2523 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2524 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2525 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2526 } __attribute__ ((gcc_struct));
2527
2528 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2529
2530 struct __ecereNameSpace__ecere__com__Module
2531 {
2532 struct __ecereNameSpace__ecere__com__Instance * application;
2533 struct __ecereNameSpace__ecere__sys__OldList classes;
2534 struct __ecereNameSpace__ecere__sys__OldList defines;
2535 struct __ecereNameSpace__ecere__sys__OldList functions;
2536 struct __ecereNameSpace__ecere__sys__OldList modules;
2537 struct __ecereNameSpace__ecere__com__Instance * prev;
2538 struct __ecereNameSpace__ecere__com__Instance * next;
2539 char *  name;
2540 void *  library;
2541 void *  Unload;
2542 int importType;
2543 int origImportType;
2544 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2545 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2546 } __attribute__ ((gcc_struct));
2547
2548 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2549 {
2550 struct __ecereNameSpace__ecere__com__Class * _class;
2551 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2552
2553 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
2554 ComputeModuleClasses(subModule->data);
2555 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->classes.first; _class; _class = _class->next)
2556 ComputeClassMembers(_class, 0x0);
2557 }
2558
2559 extern unsigned int inCompiler;
2560
2561 extern void Compiler_Error(char *  format, ...);
2562
2563 extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
2564
2565 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
2566
2567 int ComputeTypeSize(struct Type * type)
2568 {
2569 unsigned int size = type ? type->size : 0;
2570
2571 if(!size && type && !type->computing)
2572 {
2573 type->computing = 0x1;
2574 switch(type->kind)
2575 {
2576 case 1:
2577 type->alignment = size = sizeof(char);
2578 break;
2579 case 3:
2580 type->alignment = size = sizeof(int);
2581 break;
2582 case 4:
2583 type->alignment = size = sizeof(long long);
2584 break;
2585 case 22:
2586 type->alignment = size = targetBits / 8;
2587 break;
2588 case 23:
2589 type->alignment = size = targetBits / 8;
2590 break;
2591 case 5:
2592 type->alignment = size = sizeof(long);
2593 break;
2594 case 2:
2595 type->alignment = size = sizeof(short);
2596 break;
2597 case 6:
2598 type->alignment = size = sizeof(float);
2599 break;
2600 case 7:
2601 type->alignment = size = sizeof(double);
2602 break;
2603 case 8:
2604 {
2605 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2606
2607 if(_class && _class->type == 1)
2608 {
2609 ComputeClassMembers(_class, 0x0);
2610 type->alignment = _class->structAlignment;
2611 size = _class->structSize;
2612 if(type->alignment && size % type->alignment)
2613 size += type->alignment - (size % type->alignment);
2614 }
2615 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2616 {
2617 if(!_class->dataType)
2618 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2619 size = type->alignment = ComputeTypeSize(_class->dataType);
2620 }
2621 else
2622 size = type->alignment = targetBits / 8;
2623 break;
2624 }
2625 case 13:
2626 case 19:
2627 size = type->alignment = targetBits / 8;
2628 break;
2629 case 12:
2630 if(type->arraySizeExp)
2631 {
2632 ProcessExpressionType(type->arraySizeExp);
2633 ComputeExpression(type->arraySizeExp);
2634 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)))
2635 {
2636 struct Location oldLoc = yylloc;
2637 char expression[10240];
2638
2639 expression[0] = '\0';
2640 type->arraySizeExp->expType = (((void *)0));
2641 yylloc = type->arraySizeExp->loc;
2642 if(inCompiler)
2643 PrintExpression(type->arraySizeExp, expression);
2644 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Array size not constant int (%s)\n", (((void *)0))), expression);
2645 yylloc = oldLoc;
2646 }
2647 GetInt(type->arraySizeExp, &type->arraySize);
2648 }
2649 else if(type->enumClass)
2650 {
2651 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2652 {
2653 type->arraySize = (int)__ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2654 }
2655 else
2656 type->arraySize = 0;
2657 }
2658 else
2659 {
2660 type->arraySize = 0;
2661 }
2662 size = ComputeTypeSize(type->type) * type->arraySize;
2663 if(type->type)
2664 type->alignment = type->type->alignment;
2665 break;
2666 case 9:
2667 {
2668 struct Type * member;
2669
2670 for(member = type->members.first; member; member = member->next)
2671 {
2672 int __simpleStruct0, __simpleStruct1;
2673 unsigned int addSize = ComputeTypeSize(member);
2674
2675 member->offset = size;
2676 if(member->alignment && size % member->alignment)
2677 member->offset += member->alignment - (size % member->alignment);
2678 size = member->offset;
2679 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2680 size += addSize;
2681 }
2682 if(type->alignment && size % type->alignment)
2683 size += type->alignment - (size % type->alignment);
2684 break;
2685 }
2686 case 10:
2687 {
2688 struct Type * member;
2689
2690 for(member = type->members.first; member; member = member->next)
2691 {
2692 int __simpleStruct0, __simpleStruct1;
2693 unsigned int addSize = ComputeTypeSize(member);
2694
2695 member->offset = size;
2696 if(member->alignment && size % member->alignment)
2697 member->offset += member->alignment - (size % member->alignment);
2698 size = member->offset;
2699 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2700 size = ((size > addSize) ? size : addSize);
2701 }
2702 if(type->alignment && size % type->alignment)
2703 size += type->alignment - (size % type->alignment);
2704 break;
2705 }
2706 case 20:
2707 {
2708 struct TemplateParameter * param = type->templateParameter;
2709 struct Type * baseType = ProcessTemplateParameterType(param);
2710
2711 if(baseType)
2712 {
2713 size = ComputeTypeSize(baseType);
2714 type->alignment = baseType->alignment;
2715 }
2716 else
2717 type->alignment = size = sizeof(uint64);
2718 break;
2719 }
2720 case 15:
2721 {
2722 type->alignment = size = sizeof(enum
2723 {
2724 test
2725 });
2726 break;
2727 }
2728 case 21:
2729 {
2730 type->alignment = size = targetBits / 8;
2731 break;
2732 }
2733 }
2734 type->size = size;
2735 type->computing = 0x0;
2736 }
2737 return size;
2738 }
2739
2740 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2741
2742 extern struct Identifier * MkIdentifier(char *  string);
2743
2744 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2745
2746 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2747
2748 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2749
2750 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2751
2752 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2753
2754 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2755
2756 extern void FreeType(struct Type * type);
2757
2758 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2759
2760 extern struct Specifier * MkSpecifier(int specifier);
2761
2762 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2763
2764 extern struct Expression * MkExpConstant(char *  string);
2765
2766 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)
2767 {
2768 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2769 unsigned int totalSize = 0;
2770 unsigned int maxSize = 0;
2771 int alignment, size;
2772 struct __ecereNameSpace__ecere__com__DataMember * member;
2773 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2774
2775 if(addedPadding)
2776 *addedPadding = 0x0;
2777 if(!isMember && _class->base)
2778 {
2779 maxSize = _class->structSize;
2780 {
2781 if(_class->type == 1 || _class->type == 5)
2782 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass, (((void *)0)));
2783 else
2784 {
2785 unsigned int baseSize = _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2786
2787 if(maxSize > baseSize)
2788 maxSize -= baseSize;
2789 else
2790 maxSize = 0;
2791 }
2792 }
2793 }
2794 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2795 {
2796 if(!member->isProperty)
2797 {
2798 switch(member->type)
2799 {
2800 case 0:
2801 {
2802 if(member->dataTypeString)
2803 {
2804 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2805 struct Declarator * decl;
2806
2807 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2808 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2809 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2810 if(!member->dataType)
2811 member->dataType = ProcessType(specs, decl);
2812 ReplaceThisClassSpecifiers(specs, topClass);
2813 {
2814 struct Type * type = ProcessType(specs, decl);
2815
2816 DeclareType(member->dataType, 0x0, 0x0);
2817 FreeType(type);
2818 }
2819 ComputeTypeSize(member->dataType);
2820 size = member->dataType->size;
2821 alignment = member->dataType->alignment;
2822 if(alignment)
2823 {
2824 if(totalSize % alignment)
2825 totalSize += alignment - (totalSize % alignment);
2826 }
2827 totalSize += size;
2828 }
2829 break;
2830 }
2831 case 1:
2832 case 2:
2833 {
2834 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2835
2836 size = 0;
2837 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass, (((void *)0)));
2838 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
2839 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
2840 alignment = member->structAlignment;
2841 if(alignment)
2842 {
2843 if(totalSize % alignment)
2844 totalSize += alignment - (totalSize % alignment);
2845 }
2846 totalSize += size;
2847 break;
2848 }
2849 }
2850 }
2851 }
2852 if(retSize)
2853 {
2854 unsigned int __simpleStruct0;
2855
2856 if(topMember && topMember->type == 1)
2857 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
2858 else
2859 *retSize += totalSize;
2860 }
2861 else if(totalSize < maxSize && _class->type != 1000)
2862 {
2863 int autoPadding = 0;
2864
2865 if(!isMember && _class->structAlignment && totalSize % _class->structAlignment)
2866 autoPadding = _class->structAlignment - (totalSize % _class->structAlignment);
2867 if(totalSize + autoPadding < maxSize)
2868 {
2869 char sizeString[50];
2870
2871 sprintf(sizeString, "%d", maxSize - totalSize);
2872 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
2873 if(addedPadding)
2874 *addedPadding = 0x1;
2875 }
2876 }
2877 if(context)
2878 FinishTemplatesContext(context);
2879 return topMember ? topMember->memberID : _class->memberID;
2880 }
2881
2882 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2883 {
2884 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2885 unsigned int totalSize = 0;
2886 struct __ecereNameSpace__ecere__com__DataMember * member;
2887 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2888
2889 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
2890 DeclareMembers(_class->base, 0x0);
2891 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2892 {
2893 if(!member->isProperty)
2894 {
2895 switch(member->type)
2896 {
2897 case 0:
2898 {
2899 if(!member->dataType && member->dataTypeString)
2900 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
2901 if(member->dataType)
2902 DeclareType(member->dataType, 0x0, 0x0);
2903 break;
2904 }
2905 case 1:
2906 case 2:
2907 {
2908 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
2909 break;
2910 }
2911 }
2912 }
2913 }
2914 if(context)
2915 FinishTemplatesContext(context);
2916 return topMember ? topMember->memberID : _class->memberID;
2917 }
2918
2919 extern struct Symbol * FindClass(char *  name);
2920
2921 extern char *  strchr(const char * , int);
2922
2923 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
2924
2925 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (*  FreeFunction)(void * ));
2926
2927 extern void FreeClassDef(struct ClassDef * def);
2928
2929 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
2930
2931 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
2932
2933 extern char *  strcpy(char * , const char * );
2934
2935 extern void MangleClassName(char *  className);
2936
2937 extern void DeclareClass(struct Symbol * classSym, char *  className);
2938
2939 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
2940
2941 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
2942
2943 void DeclareStruct(char * name, unsigned int skipNoHead)
2944 {
2945 struct External * external = (((void *)0));
2946 struct Symbol * classSym = FindClass(name);
2947
2948 if(!inCompiler || !classSym)
2949 return ;
2950 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
2951 return ;
2952 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
2953 {
2954 struct Declaration * decl;
2955 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2956 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
2957 char structName[1024];
2958
2959 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
2960 classSym->declaring++;
2961 if(strchr(classSym->string, '<'))
2962 {
2963 if(classSym->registered->templateClass)
2964 {
2965 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
2966 classSym->declaring--;
2967 }
2968 return ;
2969 }
2970 DeclareMembers(classSym->registered, 0x0);
2971 structName[0] = (char)0;
2972 FullClassNameCat(structName, name, 0x0);
2973 if(!skipNoHead)
2974 {
2975 unsigned int addedPadding = 0x0;
2976
2977 classSym->declaredStructSym = 0x1;
2978 declarations = MkList();
2979 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered, &addedPadding);
2980 if(!(*declarations).count || ((*declarations).count == 1 && addedPadding))
2981 {
2982 FreeList(declarations, FreeClassDef);
2983 declarations = (((void *)0));
2984 }
2985 }
2986 if(skipNoHead || declarations)
2987 {
2988 if(external && external->declaration)
2989 {
2990 ((struct Specifier *)(*external->declaration->specifiers).first)->definitions = declarations;
2991 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2992 {
2993 if(classSym->structExternal)
2994 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2995 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2996 classSym->id = curExternal->symbol->idCode;
2997 classSym->idCode = curExternal->symbol->idCode;
2998 }
2999 }
3000 else
3001 {
3002 if(!external)
3003 external = MkExternalDeclaration((((void *)0)));
3004 specifiers = MkList();
3005 declarators = MkList();
3006 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
3007 external->declaration = decl = MkDeclaration(specifiers, declarators);
3008 if(decl->symbol && !decl->symbol->pointerExternal)
3009 decl->symbol->pointerExternal = external;
3010 if(classSym->registered && classSym->registered->type == 1)
3011 {
3012 char className[1024];
3013
3014 strcpy(className, "__ecereClass_");
3015 FullClassNameCat(className, classSym->string, 0x1);
3016 MangleClassName(className);
3017 DeclareClass(classSym, className);
3018 external->symbol = classSym;
3019 classSym->pointerExternal = external;
3020 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3021 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3022 }
3023 else
3024 {
3025 char className[1024];
3026
3027 strcpy(className, "__ecereClass_");
3028 FullClassNameCat(className, classSym->string, 0x1);
3029 MangleClassName(className);
3030 classSym->structExternal = external;
3031 DeclareClass(classSym, className);
3032 external->symbol = classSym;
3033 }
3034 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
3035 }
3036 }
3037 classSym->declaring--;
3038 }
3039 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3040 {
3041 classSym->declaring++;
3042 {
3043 if(classSym->registered)
3044 DeclareMembers(classSym->registered, 0x0);
3045 }
3046 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
3047 {
3048 if(classSym->structExternal)
3049 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3050 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3051 classSym->id = curExternal->symbol->idCode;
3052 classSym->idCode = curExternal->symbol->idCode;
3053 }
3054 classSym->declaring--;
3055 }
3056 }
3057
3058 extern char *  strcat(char * , const char * );
3059
3060 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
3061
3062 extern struct ModuleImport * mainModule;
3063
3064 extern struct Specifier * MkSpecifierName(char *  name);
3065
3066 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
3067
3068 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
3069
3070 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
3071
3072 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
3073
3074 extern void FreeDeclarator(struct Declarator * decl);
3075
3076 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
3077
3078 struct PropertyImport
3079 {
3080 struct PropertyImport * prev;
3081 struct PropertyImport * next;
3082 char *  name;
3083 unsigned int isVirtual;
3084 unsigned int hasSet;
3085 unsigned int hasGet;
3086 } __attribute__ ((gcc_struct));
3087
3088 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3089
3090 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
3091 {
3092 struct Symbol * symbol = prop->symbol;
3093 char propName[1024];
3094
3095 strcpy(setName, "__ecereProp_");
3096 FullClassNameCat(setName, prop->_class->fullName, 0x0);
3097 strcat(setName, "_Set_");
3098 FullClassNameCat(setName, prop->name, 0x1);
3099 strcpy(getName, "__ecereProp_");
3100 FullClassNameCat(getName, prop->_class->fullName, 0x0);
3101 strcat(getName, "_Get_");
3102 FullClassNameCat(getName, prop->name, 0x1);
3103 strcpy(propName, "__ecereProp_");
3104 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3105 strcat(propName, "_");
3106 FullClassNameCat(propName, prop->name, 0x1);
3107 MangleClassName(getName);
3108 MangleClassName(setName);
3109 MangleClassName(propName);
3110 if(prop->_class->type == 1)
3111 DeclareStruct(prop->_class->fullName, 0x0);
3112 if(!symbol || curExternal->symbol->idCode < symbol->id)
3113 {
3114 unsigned int imported = 0x0;
3115 unsigned int dllImport = 0x0;
3116
3117 if(!symbol || symbol->_import)
3118 {
3119 if(!symbol)
3120 {
3121 struct Symbol * classSym;
3122
3123 if(!prop->_class->symbol)
3124 prop->_class->symbol = FindClass(prop->_class->fullName);
3125 classSym = prop->_class->symbol;
3126 if(classSym && !classSym->_import)
3127 {
3128 struct ModuleImport * module;
3129
3130 if(prop->_class->module)
3131 module = FindModule(prop->_class->module);
3132 else
3133 module = mainModule;
3134 classSym->_import = __extension__ ({
3135 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
3136
3137 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), __ecereInstance1->isRemote = prop->_class->isRemote, __ecereInstance1;
3138 });
3139 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3140 }
3141 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3142 symbol->_import = (struct ClassImport *)__extension__ ({
3143 struct PropertyImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport);
3144
3145 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), __ecereInstance1->isVirtual = 0x0, __ecereInstance1->hasSet = prop->Set ? 0x1 : 0x0, __ecereInstance1->hasGet = prop->Get ? 0x1 : 0x0, __ecereInstance1;
3146 });
3147 if(classSym)
3148 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
3149 }
3150 imported = 0x1;
3151 if(prop->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + structSize_Instance)))->importType != 1)
3152 dllImport = 0x1;
3153 }
3154 if(!symbol->type)
3155 {
3156 struct Context * context = SetupTemplatesContext(prop->_class);
3157
3158 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
3159 FinishTemplatesContext(context);
3160 }
3161 if(prop->Get)
3162 {
3163 if(!symbol->externalGet || symbol->externalGet->type == 0)
3164 {
3165 struct Declaration * decl;
3166 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3167 struct Declarator * d;
3168 struct __ecereNameSpace__ecere__sys__OldList * params;
3169 struct Specifier * spec;
3170 struct External * external;
3171 struct Declarator * typeDecl;
3172 unsigned int simple = 0x0;
3173
3174 specifiers = MkList();
3175 declarators = MkList();
3176 params = MkList();
3177 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3178 d = MkDeclaratorIdentifier(MkIdentifier(getName));
3179 if(dllImport)
3180 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3181 {
3182 struct Context * context = SetupTemplatesContext(prop->_class);
3183
3184 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
3185 FinishTemplatesContext(context);
3186 }
3187 for(spec = (*specifiers).first; spec; spec = spec->next)
3188 {
3189 if(spec->type == 1)
3190 {
3191 if((!typeDecl || typeDecl->type == 1))
3192 {
3193 struct Symbol * classSym = spec->symbol;
3194
3195 symbol->_class = classSym->registered;
3196 if(classSym->registered && classSym->registered->type == 1)
3197 {
3198 DeclareStruct(spec->name, 0x0);
3199 simple = 0x1;
3200 }
3201 }
3202 }
3203 }
3204 if(!simple)
3205 d = PlugDeclarator(typeDecl, d);
3206 else
3207 {
3208 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3209 specifiers = MkList();
3210 }
3211 d = MkDeclaratorFunction(d, params);
3212 if(dllImport)
3213 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3214 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3215 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3216 if(simple)
3217 ListAdd(specifiers, MkSpecifier(VOID));
3218 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3219 decl = MkDeclaration(specifiers, declarators);
3220 external = MkExternalDeclaration(decl);
3221 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3222 external->symbol = symbol;
3223 symbol->externalGet = external;
3224 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3225 if(typeDecl)
3226 FreeDeclarator(typeDecl);
3227 }
3228 else
3229 {
3230 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3231 }
3232 }
3233 if(prop->Set)
3234 {
3235 if(!symbol->externalSet || symbol->externalSet->type == 0)
3236 {
3237 struct Declaration * decl;
3238 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3239 struct Declarator * d;
3240 struct __ecereNameSpace__ecere__sys__OldList * params;
3241 struct Specifier * spec;
3242 struct External * external;
3243 struct Declarator * typeDecl;
3244
3245 declarators = MkList();
3246 params = MkList();
3247 if(!prop->conversion || prop->_class->type == 1)
3248 {
3249 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3250 }
3251 specifiers = MkList();
3252 {
3253 struct Context * context = SetupTemplatesContext(prop->_class);
3254
3255 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3256 FinishTemplatesContext(context);
3257 }
3258 ListAdd(params, MkTypeName(specifiers, d));
3259 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3260 if(dllImport)
3261 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3262 d = MkDeclaratorFunction(d, params);
3263 for(spec = (*specifiers).first; spec; spec = spec->next)
3264 {
3265 if(spec->type == 1)
3266 {
3267 if((!typeDecl || typeDecl->type == 1))
3268 {
3269 struct Symbol * classSym = spec->symbol;
3270
3271 symbol->_class = classSym->registered;
3272 if(classSym->registered && classSym->registered->type == 1)
3273 DeclareStruct(spec->name, 0x0);
3274 }
3275 }
3276 }
3277 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3278 specifiers = MkList();
3279 if(dllImport)
3280 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3281 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3282 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3283 if(!prop->conversion || prop->_class->type == 1)
3284 ListAdd(specifiers, MkSpecifier(VOID));
3285 else
3286 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3287 decl = MkDeclaration(specifiers, declarators);
3288 external = MkExternalDeclaration(decl);
3289 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3290 external->symbol = symbol;
3291 symbol->externalSet = external;
3292 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3293 }
3294 else
3295 {
3296 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3297 }
3298 }
3299 if(!symbol->externalPtr)
3300 {
3301 struct Declaration * decl;
3302 struct External * external;
3303 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3304
3305 if(imported)
3306 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3307 else
3308 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3309 ListAdd(specifiers, MkSpecifierName("Property"));
3310 {
3311 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3312
3313 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3314 if(!imported)
3315 {
3316 strcpy(propName, "__ecerePropM_");
3317 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3318 strcat(propName, "_");
3319 FullClassNameCat(propName, prop->name, 0x1);
3320 MangleClassName(propName);
3321 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3322 }
3323 decl = MkDeclaration(specifiers, list);
3324 }
3325 external = MkExternalDeclaration(decl);
3326 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3327 external->symbol = symbol;
3328 symbol->externalPtr = external;
3329 }
3330 else
3331 {
3332 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3333 }
3334 symbol->id = curExternal->symbol->idCode;
3335 }
3336 }
3337
3338 struct Type * Dereference(struct Type * source)
3339 {
3340 struct Type * type = (((void *)0));
3341
3342 if(source)
3343 {
3344 if(source->kind == 13 || source->kind == 12)
3345 {
3346 type = source->type;
3347 source->type->refCount++;
3348 }
3349 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3350 {
3351 type = __extension__ ({
3352 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3353
3354 __ecereInstance1->kind = 1, __ecereInstance1->refCount = 1, __ecereInstance1;
3355 });
3356 }
3357 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3358 {
3359 type = source;
3360 source->refCount++;
3361 }
3362 else
3363 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot dereference type\n", (((void *)0))));
3364 }
3365 return type;
3366 }
3367
3368 static struct Type * Reference(struct Type * source)
3369 {
3370 struct Type * type = (((void *)0));
3371
3372 if(source)
3373 {
3374 type = __extension__ ({
3375 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3376
3377 __ecereInstance1->kind = 13, __ecereInstance1->type = source, __ecereInstance1->refCount = 1, __ecereInstance1;
3378 });
3379 source->refCount++;
3380 }
3381 return type;
3382 }
3383
3384 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);
3385
3386 extern void *  memcpy(void * , const void * , size_t size);
3387
3388 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3389
3390 extern void FreeExpression(struct Expression * exp);
3391
3392 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3393
3394 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);
3395
3396 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3397
3398 extern struct Type * MkClassType(char *  name);
3399
3400 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);
3401
3402 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)
3403 {
3404 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3405 unsigned int found = 0x0;
3406 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3407 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3408 unsigned int freeType = 0x0;
3409
3410 yylloc = member->loc;
3411 if(!ident)
3412 {
3413 if(curMember)
3414 {
3415 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3416 if(*curMember)
3417 {
3418 found = 0x1;
3419 dataMember = *curMember;
3420 }
3421 }
3422 }
3423 else
3424 {
3425 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3426 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3427 int _subMemberStackPos = 0;
3428
3429 if(!thisMember)
3430 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3431 if(thisMember)
3432 {
3433 dataMember = thisMember;
3434 if(curMember && thisMember->memberAccess == 1)
3435 {
3436 *curMember = thisMember;
3437 *curClass = thisMember->_class;
3438 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
3439 *subMemberStackPos = _subMemberStackPos;
3440 }
3441 found = 0x1;
3442 }
3443 else
3444 {
3445 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3446 if(method && method->type == 1)
3447 found = 0x1;
3448 else
3449 method = (((void *)0));
3450 }
3451 }
3452 if(found)
3453 {
3454 struct Type * type = (((void *)0));
3455
3456 if(dataMember)
3457 {
3458 if(!dataMember->dataType && dataMember->dataTypeString)
3459 {
3460 struct Context * context = SetupTemplatesContext(_class);
3461
3462 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3463 FinishTemplatesContext(context);
3464 }
3465 type = dataMember->dataType;
3466 }
3467 else if(method)
3468 {
3469 if(!method->dataType)
3470 ProcessMethodType(method);
3471 type = method->dataType;
3472 }
3473 if(ident && ident->next)
3474 {
3475 for(ident = ident->next; ident && type; ident = ident->next)
3476 {
3477 if(type->kind == 8)
3478 {
3479 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3480 if(!dataMember)
3481 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3482 if(dataMember)
3483 type = dataMember->dataType;
3484 }
3485 else if(type->kind == 9 || type->kind == 10)
3486 {
3487 struct Type * memberType;
3488
3489 for(memberType = type->members.first; memberType; memberType = memberType->next)
3490 {
3491 if(!strcmp(memberType->name, ident->string))
3492 {
3493 type = memberType;
3494 break;
3495 }
3496 }
3497 }
3498 }
3499 }
3500 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3501 {
3502 int id = 0;
3503 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3504 struct __ecereNameSpace__ecere__com__Class * sClass;
3505
3506 for(sClass = _class; sClass; sClass = sClass->base)
3507 {
3508 id = 0;
3509 if(sClass->templateClass)
3510 sClass = sClass->templateClass;
3511 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3512 {
3513 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3514 {
3515 for(sClass = sClass->base; sClass; sClass = sClass->base)
3516 {
3517 if(sClass->templateClass)
3518 sClass = sClass->templateClass;
3519 id += sClass->templateParams.count;
3520 }
3521 break;
3522 }
3523 id++;
3524 }
3525 if(curParam)
3526 break;
3527 }
3528 if(curParam)
3529 {
3530 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3531
3532 if(arg.dataTypeString)
3533 {
3534 type = ProcessTypeString(arg.dataTypeString, 0x0);
3535 freeType = 0x1;
3536 if(type && _class->templateClass)
3537 type->passAsTemplate = 0x1;
3538 if(type)
3539 {
3540 }
3541 }
3542 }
3543 }
3544 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3545 {
3546 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3547 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3548 int c;
3549 int paramCount = 0;
3550 int lastParam = -1;
3551 char templateString[1024];
3552 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3553
3554 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3555 for(cClass = expClass; cClass; cClass = cClass->base)
3556 {
3557 int p = 0;
3558
3559 if(cClass->templateClass)
3560 cClass = cClass->templateClass;
3561 for(param = cClass->templateParams.first; param; param = param->next)
3562 {
3563 int id = p;
3564 struct __ecereNameSpace__ecere__com__Class * sClass;
3565 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3566
3567 for(sClass = cClass->base; sClass; sClass = sClass->base)
3568 {
3569 if(sClass->templateClass)
3570 sClass = sClass->templateClass;
3571 id += sClass->templateParams.count;
3572 }
3573 arg = expClass->templateArgs[id];
3574 for(sClass = _class; sClass; sClass = sClass->base)
3575 {
3576 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3577 int p = 0;
3578 struct __ecereNameSpace__ecere__com__Class * nextClass;
3579
3580 if(sClass->templateClass)
3581 sClass = sClass->templateClass;
3582 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3583 {
3584 if(nextClass->templateClass)
3585 nextClass = nextClass->templateClass;
3586 p += nextClass->templateParams.count;
3587 }
3588 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3589 {
3590 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3591 {
3592 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3593 {
3594 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3595 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3596 break;
3597 }
3598 }
3599 }
3600 }
3601 {
3602 char argument[256];
3603
3604 argument[0] = '\0';
3605 switch(param->type)
3606 {
3607 case 2:
3608 {
3609 char expString[1024];
3610 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3611 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3612 struct Expression * exp;
3613 char * string = PrintHexUInt64(arg.expression.ui64);
3614
3615 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3616 ProcessExpressionType(exp);
3617 ComputeExpression(exp);
3618 expString[0] = '\0';
3619 PrintExpression(exp, expString);
3620 strcat(argument, expString);
3621 FreeExpression(exp);
3622 break;
3623 }
3624 case 1:
3625 {
3626 strcat(argument, arg.member->name);
3627 break;
3628 }
3629 case 0:
3630 {
3631 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3632 strcat(argument, arg.dataTypeString);
3633 break;
3634 }
3635 }
3636 if(argument[0])
3637 {
3638 if(paramCount)
3639 strcat(templateString, ", ");
3640 if(lastParam != p - 1)
3641 {
3642 strcat(templateString, param->name);
3643 strcat(templateString, " = ");
3644 }
3645 strcat(templateString, argument);
3646 paramCount++;
3647 lastParam = p;
3648 }
3649 p++;
3650 }
3651 }
3652 }
3653 {
3654 int len = strlen(templateString);
3655
3656 if(templateString[len - 1] == '<')
3657 len--;
3658 else
3659 {
3660 if(templateString[len - 1] == '>')
3661 templateString[len++] = ' ';
3662 templateString[len++] = '>';
3663 }
3664 templateString[len++] = '\0';
3665 }
3666 {
3667 struct Context * context = SetupTemplatesContext(_class);
3668
3669 if(freeType)
3670 FreeType(type);
3671 type = ProcessTypeString(templateString, 0x0);
3672 freeType = 0x1;
3673 FinishTemplatesContext(context);
3674 }
3675 }
3676 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3677 {
3678 ProcessExpressionType(member->initializer->exp);
3679 if(!member->initializer->exp->expType)
3680 {
3681 if(inCompiler)
3682 {
3683 char expString[10240];
3684
3685 expString[0] = '\0';
3686 PrintExpression(member->initializer->exp, expString);
3687 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3688 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3689 }
3690 }
3691 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3692 {
3693 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible instance method %s\n", (((void *)0))), ident->string);
3694 }
3695 }
3696 else if(member->initializer)
3697 {
3698 ProcessInitializer(member->initializer, type);
3699 }
3700 if(freeType)
3701 FreeType(type);
3702 }
3703 else
3704 {
3705 if(_class && _class->type == 3)
3706 {
3707 if(member->initializer)
3708 {
3709 struct Type * type = MkClassType(_class->fullName);
3710
3711 ProcessInitializer(member->initializer, type);
3712 FreeType(type);
3713 }
3714 }
3715 else
3716 {
3717 if(member->initializer)
3718 {
3719 ProcessInitializer(member->initializer, (((void *)0)));
3720 }
3721 if(ident)
3722 {
3723 if(method)
3724 {
3725 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3726 }
3727 else if(_class)
3728 {
3729 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3730 if(inCompiler)
3731 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3732 }
3733 }
3734 else if(_class)
3735 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3736 }
3737 }
3738 }
3739
3740 extern struct Identifier * GetDeclId(struct Declarator * decl);
3741
3742 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);
3743
3744 extern void FreeSpecifier(struct Specifier * spec);
3745
3746 static void ProcessFunction(struct FunctionDefinition * function);
3747
3748 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (*  CopyFunction)(void * ));
3749
3750 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3751
3752 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3753
3754 extern void FreeClassFunction(struct ClassFunction * func);
3755
3756 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3757
3758 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3759
3760 void ProcessInstantiationType(struct Instantiation * inst)
3761 {
3762 yylloc = inst->loc;
3763 if(inst->_class)
3764 {
3765 struct MembersInit * members;
3766 struct Symbol * classSym;
3767 struct __ecereNameSpace__ecere__com__Class * _class;
3768
3769 classSym = inst->_class->symbol;
3770 _class = classSym ? classSym->registered : (((void *)0));
3771 if(!_class || _class->type != 5)
3772 DeclareStruct(inst->_class->name, 0x0);
3773 afterExternal = afterExternal ? afterExternal : curExternal;
3774 if(inst->exp)
3775 ProcessExpressionType(inst->exp);
3776 inst->isConstant = 0x1;
3777 if(inst->members)
3778 {
3779 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3780 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3781 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3782 int subMemberStackPos = 0;
3783
3784 for(members = (*inst->members).first; members; members = members->next)
3785 {
3786 switch(members->type)
3787 {
3788 case 1:
3789 {
3790 char name[1024];
3791 static unsigned int instMethodID = 0;
3792 struct External * external = curExternal;
3793 struct Context * context = curContext;
3794 struct Declarator * declarator = members->function->declarator;
3795 struct Identifier * nameID = GetDeclId(declarator);
3796 char * unmangled = nameID ? nameID->string : (((void *)0));
3797 struct Expression * exp;
3798 struct External * createdExternal = (((void *)0));
3799
3800 if(inCompiler)
3801 {
3802 char number[16];
3803
3804 strcpy(name, "__ecereInstMeth_");
3805 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3806 strcat(name, "_");
3807 strcat(name, nameID->string);
3808 strcat(name, "_");
3809 sprintf(number, "_%08d", instMethodID++);
3810 strcat(name, number);
3811 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3812 }
3813 if(declarator)
3814 {
3815 struct Symbol * symbol = declarator->symbol;
3816 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3817
3818 if(method && method->type == 1)
3819 {
3820 symbol->method = method;
3821 ProcessMethodType(method);
3822 if(!symbol->type->thisClass)
3823 {
3824 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3825 {
3826 if(!currentClass->symbol)
3827 currentClass->symbol = FindClass(currentClass->fullName);
3828 symbol->type->thisClass = currentClass->symbol;
3829 }
3830 else
3831 {
3832 if(!_class->symbol)
3833 _class->symbol = FindClass(_class->fullName);
3834 symbol->type->thisClass = _class->symbol;
3835 }
3836 }
3837 DeclareType(symbol->type, 0x1, 0x1);
3838 }
3839 else if(classSym)
3840 {
3841 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
3842 }
3843 }
3844 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
3845 if(nameID)
3846 {
3847 FreeSpecifier(nameID->_class);
3848 nameID->_class = (((void *)0));
3849 }
3850 if(inCompiler)
3851 {
3852 struct Type * type = declarator->symbol->type;
3853 struct External * oldExternal = curExternal;
3854
3855 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
3856 {
3857 struct External * externalDecl;
3858
3859 externalDecl = MkExternalDeclaration((((void *)0)));
3860 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
3861 if(createdExternal->function)
3862 {
3863 ProcessFunction(createdExternal->function);
3864 {
3865 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
3866
3867 externalDecl->declaration = decl;
3868 if(decl->symbol && !decl->symbol->pointerExternal)
3869 decl->symbol->pointerExternal = externalDecl;
3870 declarator->symbol->pointerExternal = externalDecl;
3871 }
3872 }
3873 }
3874 }
3875 else if(declarator)
3876 {
3877 curExternal = declarator->symbol->pointerExternal;
3878 ProcessFunction((struct FunctionDefinition *)members->function);
3879 }
3880 curExternal = external;
3881 curContext = context;
3882 if(inCompiler)
3883 {
3884 FreeClassFunction(members->function);
3885 exp = QMkExpId(name);
3886 members->type = 0;
3887 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
3888 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
3889 }
3890 break;
3891 }
3892 case 0:
3893 {
3894 if(members->dataMembers && classSym)
3895 {
3896 struct MemberInit * member;
3897 struct Location oldyyloc = yylloc;
3898
3899 for(member = (*members->dataMembers).first; member; member = member->next)
3900 {
3901 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
3902 if(member->initializer && !member->initializer->isConstant)
3903 inst->isConstant = 0x0;
3904 }
3905 yylloc = oldyyloc;
3906 }
3907 break;
3908 }
3909 }
3910 }
3911 }
3912 }
3913 }
3914
3915 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
3916 {
3917 if(inCompiler)
3918 {
3919 if(type->kind == 11)
3920 {
3921 struct Type * param;
3922
3923 if(declareParams)
3924 {
3925 for(param = type->params.first; param; param = param->next)
3926 DeclareType(param, declarePointers, 0x1);
3927 }
3928 DeclareType(type->returnType, declarePointers, 0x1);
3929 }
3930 else if(type->kind == 13 && declarePointers)
3931 DeclareType(type->type, declarePointers, 0x0);
3932 else if(type->kind == 8)
3933 {
3934 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
3935 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
3936 }
3937 else if(type->kind == 9 || type->kind == 10)
3938 {
3939 struct Type * member;
3940
3941 for(member = type->members.first; member; member = member->next)
3942 DeclareType(member, 0x0, 0x0);
3943 }
3944 else if(type->kind == 12)
3945 DeclareType(type->arrayType, declarePointers, 0x0);
3946 }
3947 }
3948
3949 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
3950
3951 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
3952 {
3953 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
3954 int id = 0;
3955 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3956 struct __ecereNameSpace__ecere__com__Class * sClass;
3957
3958 for(sClass = _class; sClass; sClass = sClass->base)
3959 {
3960 id = 0;
3961 if(sClass->templateClass)
3962 sClass = sClass->templateClass;
3963 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3964 {
3965 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
3966 {
3967 for(sClass = sClass->base; sClass; sClass = sClass->base)
3968 {
3969 if(sClass->templateClass)
3970 sClass = sClass->templateClass;
3971 id += sClass->templateParams.count;
3972 }
3973 break;
3974 }
3975 id++;
3976 }
3977 if(curParam)
3978 break;
3979 }
3980 if(curParam)
3981 {
3982 arg = &_class->templateArgs[id];
3983 if(arg && param->type == 0)
3984 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
3985 }
3986 return arg;
3987 }
3988
3989 extern struct Context * PushContext(void);
3990
3991 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
3992
3993 struct TemplatedType
3994 {
3995 uintptr_t key;
3996 struct __ecereNameSpace__ecere__sys__BTNode * parent;
3997 struct __ecereNameSpace__ecere__sys__BTNode * left;
3998 struct __ecereNameSpace__ecere__sys__BTNode * right;
3999 int depth;
4000 struct TemplateParameter * param;
4001 } __attribute__ ((gcc_struct));
4002
4003 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
4004
4005 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
4006 {
4007 struct Context * context = PushContext();
4008
4009 context->templateTypesOnly = 0x1;
4010 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
4011 {
4012 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
4013
4014 for(; param; param = param->next)
4015 {
4016 if(param->type == 0 && param->identifier)
4017 {
4018 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (uintptr_t)param->identifier->string, type->param = param, type);
4019
4020 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4021 }
4022 }
4023 }
4024 else if(_class)
4025 {
4026 struct __ecereNameSpace__ecere__com__Class * sClass;
4027
4028 for(sClass = _class; sClass; sClass = sClass->base)
4029 {
4030 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
4031
4032 for(p = sClass->templateParams.first; p; p = p->next)
4033 {
4034 if(p->type == 0)
4035 {
4036 struct TemplateParameter * param = p->param;
4037 struct TemplatedType * type;
4038
4039 if(!param)
4040 {
4041 p->param = param = __extension__ ({
4042 struct TemplateParameter * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter);
4043
4044 __ecereInstance1->identifier = MkIdentifier(p->name), __ecereInstance1->type = p->type, __ecereInstance1->dataTypeString = p->dataTypeString, __ecereInstance1;
4045 });
4046 }
4047 type = __extension__ ({
4048 struct TemplatedType * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType);
4049
4050 __ecereInstance1->key = (uintptr_t)p->name, __ecereInstance1->param = param, __ecereInstance1;
4051 });
4052 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4053 }
4054 }
4055 }
4056 }
4057 return context;
4058 }
4059
4060 extern void PopContext(struct Context * ctx);
4061
4062 extern void FreeContext(struct Context * context);
4063
4064 void FinishTemplatesContext(struct Context * context)
4065 {
4066 PopContext(context);
4067 FreeContext(context);
4068 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
4069 }
4070
4071 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
4072 {
4073 if(!method->dataType)
4074 {
4075 struct Context * context = SetupTemplatesContext(method->_class);
4076
4077 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4078 FinishTemplatesContext(context);
4079 if(method->type != 1 && method->dataType)
4080 {
4081 if(!method->dataType->thisClass && !method->dataType->staticMethod)
4082 {
4083 if(!method->_class->symbol)
4084 method->_class->symbol = FindClass(method->_class->fullName);
4085 method->dataType->thisClass = method->_class->symbol;
4086 }
4087 }
4088 }
4089 }
4090
4091 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
4092 {
4093 if(!prop->dataType)
4094 {
4095 struct Context * context = SetupTemplatesContext(prop->_class);
4096
4097 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
4098 FinishTemplatesContext(context);
4099 }
4100 }
4101
4102 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
4103
4104 extern void FreeTypeName(struct TypeName * typeName);
4105
4106 static void ProcessDeclarator(struct Declarator * decl);
4107
4108 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
4109
4110 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
4111
4112 struct MethodImport
4113 {
4114 struct MethodImport * prev;
4115 struct MethodImport * next;
4116 char *  name;
4117 unsigned int isVirtual;
4118 } __attribute__ ((gcc_struct));
4119
4120 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
4121
4122 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
4123 {
4124 struct Symbol * symbol = method->symbol;
4125
4126 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
4127 {
4128 unsigned int imported = 0x0;
4129 unsigned int dllImport = 0x0;
4130
4131 if(!method->dataType)
4132 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4133 if(!symbol || symbol->_import || method->type == 1)
4134 {
4135 if(!symbol || method->type == 1)
4136 {
4137 struct Symbol * classSym;
4138
4139 if(!method->_class->symbol)
4140 method->_class->symbol = FindClass(method->_class->fullName);
4141 classSym = method->_class->symbol;
4142 if(!classSym->_import)
4143 {
4144 struct ModuleImport * module;
4145
4146 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->name)
4147 module = FindModule(method->_class->module);
4148 else
4149 module = mainModule;
4150 classSym->_import = __extension__ ({
4151 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
4152
4153 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), __ecereInstance1->isRemote = method->_class->isRemote, __ecereInstance1;
4154 });
4155 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
4156 }
4157 if(!symbol)
4158 {
4159 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4160 }
4161 if(!symbol->_import)
4162 {
4163 symbol->_import = (struct ClassImport *)__extension__ ({
4164 struct MethodImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport);
4165
4166 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->name), __ecereInstance1->isVirtual = method->type == 1, __ecereInstance1;
4167 });
4168 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
4169 }
4170 if(!symbol)
4171 {
4172 symbol->type = method->dataType;
4173 if(symbol->type)
4174 symbol->type->refCount++;
4175 }
4176 }
4177 if(!method->dataType->dllExport)
4178 {
4179 imported = 0x1;
4180 if(method->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->importType != 1)
4181 dllImport = 0x1;
4182 }
4183 }
4184 if(method->type != 1 && method->dataType)
4185 DeclareType(method->dataType, 0x1, 0x1);
4186 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4187 {
4188 struct Declaration * decl;
4189 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4190 struct Declarator * d;
4191 struct Declarator * funcDecl;
4192 struct External * external;
4193
4194 specifiers = MkList();
4195 declarators = MkList();
4196 if(dllImport)
4197 ListAdd(specifiers, MkSpecifier(EXTERN));
4198 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
4199 ListAdd(specifiers, MkSpecifier(STATIC));
4200 if(method->type == 1)
4201 {
4202 ListAdd(specifiers, MkSpecifier(INT));
4203 d = MkDeclaratorIdentifier(MkIdentifier(name));
4204 }
4205 else
4206 {
4207 d = MkDeclaratorIdentifier(MkIdentifier(name));
4208 if(dllImport)
4209 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4210 {
4211 struct Context * context = SetupTemplatesContext(method->_class);
4212
4213 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
4214 FinishTemplatesContext(context);
4215 }
4216 funcDecl = GetFuncDecl(d);
4217 if(dllImport)
4218 {
4219 struct Specifier * spec, * next;
4220
4221 for(spec = (*specifiers).first; spec; spec = next)
4222 {
4223 next = spec->next;
4224 if(spec->type == 5)
4225 {
4226 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4227 FreeSpecifier(spec);
4228 }
4229 }
4230 }
4231 if(method->dataType && !method->dataType->staticMethod)
4232 {
4233 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4234 {
4235 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4236 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")));
4237 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4238 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4239
4240 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4241 {
4242 struct TypeName * param = (*funcDecl->function.parameters).first;
4243
4244 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4245 FreeTypeName(param);
4246 }
4247 if(!funcDecl->function.parameters)
4248 funcDecl->function.parameters = MkList();
4249 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4250 }
4251 }
4252 }
4253 ProcessDeclarator(d);
4254 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4255 decl = MkDeclaration(specifiers, declarators);
4256 ReplaceThisClassSpecifiers(specifiers, method->_class);
4257 if(symbol->pointerExternal)
4258 {
4259 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4260
4261 {
4262 *functionSymbol = *symbol;
4263 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4264 if(functionSymbol->type)
4265 functionSymbol->type->refCount++;
4266 }
4267 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4268 symbol->pointerExternal->symbol = functionSymbol;
4269 }
4270 external = MkExternalDeclaration(decl);
4271 if(curExternal)
4272 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4273 external->symbol = symbol;
4274 symbol->pointerExternal = external;
4275 }
4276 else if(ast)
4277 {
4278 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4279 }
4280 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4281 }
4282 }
4283
4284 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4285 {
4286 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4287 {
4288 unsigned int first = 0x1;
4289 int p = 0;
4290 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4291 int lastParam = -1;
4292 char className[1024];
4293
4294 strcpy(className, _class->fullName);
4295 for(param = _class->templateParams.first; param; param = param->next)
4296 {
4297 {
4298 if(first)
4299 strcat(className, "<");
4300 if(!first)
4301 strcat(className, ", ");
4302 if(lastParam + 1 != p)
4303 {
4304 strcat(className, param->name);
4305 strcat(className, " = ");
4306 }
4307 strcat(className, param->name);
4308 first = 0x0;
4309 lastParam = p;
4310 }
4311 p++;
4312 }
4313 if(!first)
4314 {
4315 int len = strlen(className);
4316
4317 if(className[len - 1] == '>')
4318 className[len++] = ' ';
4319 className[len++] = '>';
4320 className[len++] = '\0';
4321 }
4322 return __ecereNameSpace__ecere__sys__CopyString(className);
4323 }
4324 else
4325 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4326 }
4327
4328 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4329 {
4330 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4331 {
4332 unsigned int first = 0x1;
4333 int p = 0;
4334 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4335 int lastParam = -1;
4336 char className[1024];
4337
4338 strcpy(className, _class->fullName);
4339 for(param = _class->templateParams.first; param; param = param->next)
4340 {
4341 {
4342 if(first)
4343 strcat(className, "<");
4344 if(!first)
4345 strcat(className, ", ");
4346 if(lastParam + 1 != p)
4347 {
4348 strcat(className, param->name);
4349 strcat(className, " = ");
4350 }
4351 strcat(className, param->name);
4352 first = 0x0;
4353 lastParam = p;
4354 }
4355 p++;
4356 }
4357 if(!first)
4358 {
4359 int len = strlen(className);
4360
4361 if(className[len - 1] == '>')
4362 className[len++] = ' ';
4363 className[len++] = '>';
4364 className[len++] = '\0';
4365 }
4366 return MkClassType(className);
4367 }
4368 else
4369 {
4370 return MkClassType(_class->fullName);
4371 }
4372 }
4373
4374 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4375 {
4376 if(specs != (((void *)0)) && _class)
4377 {
4378 struct Specifier * spec;
4379
4380 for(spec = specs->first; spec; spec = spec->next)
4381 {
4382 if(spec->type == 0 && spec->specifier == THISCLASS)
4383 {
4384 spec->type = 1;
4385 spec->name = ReplaceThisClass(_class);
4386 spec->symbol = FindClass(spec->name);
4387 }
4388 }
4389 }
4390 }
4391
4392 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4393
4394 struct __ecereNameSpace__ecere__com__GlobalFunction
4395 {
4396 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4397 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4398 char *  name;
4399 int (*  function)();
4400 struct __ecereNameSpace__ecere__com__Instance * module;
4401 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4402 char *  dataTypeString;
4403 struct Type * dataType;
4404 void *  symbol;
4405 } __attribute__ ((gcc_struct));
4406
4407 extern struct Context * globalContext;
4408
4409 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4410
4411 struct FunctionImport
4412 {
4413 struct FunctionImport * prev;
4414 struct FunctionImport * next;
4415 char *  name;
4416 } __attribute__ ((gcc_struct));
4417
4418 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4419 {
4420 struct Symbol * symbol = function->symbol;
4421
4422 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4423 {
4424 unsigned int imported = 0x0;
4425 unsigned int dllImport = 0x0;
4426
4427 if(!function->dataType)
4428 {
4429 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4430 if(!function->dataType->thisClass)
4431 function->dataType->staticMethod = 0x1;
4432 }
4433 if(inCompiler)
4434 {
4435 if(!symbol)
4436 {
4437 struct ModuleImport * module = FindModule(function->module);
4438
4439 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4440 if(module->name)
4441 {
4442 if(!function->dataType->dllExport)
4443 {
4444 symbol->_import = (struct ClassImport *)__extension__ ({
4445 struct FunctionImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport);
4446
4447 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(function->name), __ecereInstance1;
4448 });
4449 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4450 }
4451 }
4452 {
4453 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4454 if(!symbol->type->thisClass)
4455 symbol->type->staticMethod = 0x1;
4456 }
4457 }
4458 imported = symbol->_import ? 0x1 : 0x0;
4459 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1)
4460 dllImport = 0x1;
4461 }
4462 DeclareType(function->dataType, 0x1, 0x1);
4463 if(inCompiler)
4464 {
4465 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4466 {
4467 struct Declaration * decl;
4468 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4469 struct Declarator * d;
4470 struct Declarator * funcDecl;
4471 struct External * external;
4472
4473 specifiers = MkList();
4474 declarators = MkList();
4475 ListAdd(specifiers, MkSpecifier(EXTERN));
4476 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4477 if(dllImport)
4478 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4479 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4480 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType == 1)
4481 {
4482 struct Specifier * spec;
4483
4484 for(spec = (*specifiers).first; spec; spec = spec->next)
4485 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4486 {
4487 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4488 FreeSpecifier(spec);
4489 break;
4490 }
4491 }
4492 funcDecl = GetFuncDecl(d);
4493 if(funcDecl && !funcDecl->function.parameters)
4494 {
4495 funcDecl->function.parameters = MkList();
4496 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4497 }
4498 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4499 {
4500 struct Context * oldCtx = curContext;
4501
4502 curContext = globalContext;
4503 decl = MkDeclaration(specifiers, declarators);
4504 curContext = oldCtx;
4505 }
4506 if(symbol->pointerExternal)
4507 {
4508 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4509
4510 {
4511 *functionSymbol = *symbol;
4512 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4513 if(functionSymbol->type)
4514 functionSymbol->type->refCount++;
4515 }
4516 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4517 symbol->pointerExternal->symbol = functionSymbol;
4518 }
4519 external = MkExternalDeclaration(decl);
4520 if(curExternal)
4521 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4522 external->symbol = symbol;
4523 symbol->pointerExternal = external;
4524 }
4525 else
4526 {
4527 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4528 }
4529 if(curExternal)
4530 symbol->id = curExternal->symbol->idCode;
4531 }
4532 }
4533 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1) ? 0x1 : 0x0;
4534 }
4535
4536 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4537
4538 struct GlobalData
4539 {
4540 uintptr_t key;
4541 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4542 struct __ecereNameSpace__ecere__sys__BTNode * left;
4543 struct __ecereNameSpace__ecere__sys__BTNode * right;
4544 int depth;
4545 struct __ecereNameSpace__ecere__com__Instance * module;
4546 char *  dataTypeString;
4547 struct Type * dataType;
4548 void *  symbol;
4549 char *  fullName;
4550 } __attribute__ ((gcc_struct));
4551
4552 void DeclareGlobalData(struct GlobalData * data)
4553 {
4554 struct Symbol * symbol = data->symbol;
4555
4556 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4557 {
4558 if(inCompiler)
4559 {
4560 if(!symbol)
4561 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4562 }
4563 if(!data->dataType)
4564 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4565 DeclareType(data->dataType, 0x1, 0x1);
4566 if(inCompiler)
4567 {
4568 if(!symbol->pointerExternal)
4569 {
4570 struct Declaration * decl;
4571 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4572 struct Declarator * d;
4573 struct External * external;
4574
4575 specifiers = MkList();
4576 declarators = MkList();
4577 ListAdd(specifiers, MkSpecifier(EXTERN));
4578 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4579 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4580 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4581 decl = MkDeclaration(specifiers, declarators);
4582 external = MkExternalDeclaration(decl);
4583 if(curExternal)
4584 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4585 external->symbol = symbol;
4586 symbol->pointerExternal = external;
4587 }
4588 else
4589 {
4590 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4591 }
4592 if(curExternal)
4593 symbol->id = curExternal->symbol->idCode;
4594 }
4595 }
4596 }
4597
4598 struct Conversion
4599 {
4600 struct Conversion * prev, * next;
4601 struct __ecereNameSpace__ecere__com__Property * convert;
4602 unsigned int isGet;
4603 struct Type * resultType;
4604 } __attribute__ ((gcc_struct));
4605
4606 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4607
4608 extern void Compiler_Warning(char *  format, ...);
4609
4610 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4611
4612 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)
4613 {
4614 if(source && dest)
4615 {
4616 if(source->kind == 20 && dest->kind != 20)
4617 {
4618 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4619
4620 if(type)
4621 source = type;
4622 }
4623 if(dest->kind == 20 && source->kind != 20)
4624 {
4625 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4626
4627 if(type)
4628 dest = type;
4629 }
4630 if(dest->classObjectType == 2)
4631 {
4632 if(source->classObjectType != 3)
4633 return 0x1;
4634 else
4635 {
4636 if((dest->_class && strcmp(dest->_class->string, "class")) || (source->_class && strcmp(source->_class->string, "class")))
4637 {
4638 return 0x1;
4639 }
4640 }
4641 }
4642 else
4643 {
4644 if(source->classObjectType == 3)
4645 return 0x1;
4646 if(dest->classObjectType == 3 && source->classObjectType != 2)
4647 return 0x1;
4648 }
4649 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4650 {
4651 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4652 return 0x1;
4653 }
4654 if(dest->kind == 14 && source->kind != 0)
4655 return 0x1;
4656 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))
4657 return 0x1;
4658 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))
4659 return 0x1;
4660 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4661 {
4662 if(source->_class->registered && source->_class->registered->type == 3)
4663 {
4664 if(conversions != (((void *)0)))
4665 {
4666 if(source->_class->registered == dest->_class->registered)
4667 return 0x1;
4668 }
4669 else
4670 {
4671 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4672
4673 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4674 ;
4675 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4676 ;
4677 if(sourceBase == destBase)
4678 return 0x1;
4679 }
4680 }
4681 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))
4682 return 0x1;
4683 else
4684 {
4685 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4 && ((source->_class && source->_class->registered && source->_class->registered->type != 4) || source->kind == 8))
4686 {
4687 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4688 {
4689 return 0x1;
4690 }
4691 }
4692 }
4693 }
4694 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4695 return 0x1;
4696 if(doConversion)
4697 {
4698 if(source->kind == 8)
4699 {
4700 struct __ecereNameSpace__ecere__com__Class * _class;
4701
4702 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4703 {
4704 struct __ecereNameSpace__ecere__com__Property * convert;
4705
4706 for(convert = _class->conversions.first; convert; convert = convert->next)
4707 {
4708 if(convert->memberAccess == 1 || _class->module == privateModule)
4709 {
4710 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4711
4712 if(!convert->dataType)
4713 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4714 if(MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x0, 0x1, 0x0, 0x1))
4715 {
4716 if(!conversions && !convert->Get)
4717 return 0x1;
4718 else if(conversions != (((void *)0)))
4719 {
4720 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))
4721 return 0x1;
4722 else
4723 {
4724 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4725
4726 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4727 return 0x1;
4728 }
4729 }
4730 }
4731 }
4732 }
4733 }
4734 }
4735 if(dest->kind == 8)
4736 {
4737 struct __ecereNameSpace__ecere__com__Class * _class;
4738
4739 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4740 {
4741 struct __ecereNameSpace__ecere__com__Property * convert;
4742
4743 for(convert = _class->conversions.first; convert; convert = convert->next)
4744 {
4745 if(convert->memberAccess == 1 || _class->module == privateModule)
4746 {
4747 if(!convert->dataType)
4748 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4749 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4750 {
4751 if(!conversions && !convert->Set)
4752 return 0x1;
4753 else if(conversions != (((void *)0)))
4754 {
4755 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))
4756 return 0x1;
4757 else
4758 {
4759 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4760
4761 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4762 return 0x1;
4763 }
4764 }
4765 }
4766 }
4767 }
4768 }
4769 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4770 {
4771 if(!dest->_class->registered->dataType)
4772 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4773 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4774 {
4775 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4776 {
4777 return 0x1;
4778 }
4779 }
4780 }
4781 }
4782 if(source->kind == 8)
4783 {
4784 struct __ecereNameSpace__ecere__com__Class * _class;
4785
4786 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4787 {
4788 struct __ecereNameSpace__ecere__com__Property * convert;
4789
4790 for(convert = _class->conversions.first; convert; convert = convert->next)
4791 {
4792 if(convert->memberAccess == 1 || _class->module == privateModule)
4793 {
4794 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4795
4796 if(!convert->dataType)
4797 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4798 if(convert->dataType != source && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x1))
4799 {
4800 if(!conversions && !convert->Get)
4801 return 0x1;
4802 else if(conversions != (((void *)0)))
4803 {
4804 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))
4805 return 0x1;
4806 else
4807 {
4808 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4809
4810 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4811 return 0x1;
4812 }
4813 }
4814 }
4815 }
4816 }
4817 }
4818 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4819 {
4820 if(!source->_class->registered->dataType)
4821 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4822 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4823 {
4824 return 0x1;
4825 }
4826 }
4827 }
4828 }
4829 if(source->kind == 8 || source->kind == 19)
4830 ;
4831 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
4832 return 0x1;
4833 else if(dest->kind == 7 && source->kind == 6)
4834 return 0x1;
4835 else if(dest->kind == 2 && source->kind == 1)
4836 return 0x1;
4837 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1 || source->kind == 23))
4838 return 0x1;
4839 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 22 || source->kind == 23))
4840 return 0x1;
4841 else if(dest->kind == 22 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 23 || source->kind == 4))
4842 return 0x1;
4843 else if(dest->kind == 23 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4 || source->kind == 22))
4844 return 0x1;
4845 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))
4846 return 0x1;
4847 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))
4848 return 0x1;
4849 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)))
4850 {
4851 struct Type * paramSource, * paramDest;
4852
4853 if(dest->kind == 16)
4854 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
4855 if(source->kind == 16)
4856 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
4857 if(dest->kind == 13 && dest->type->kind == 11)
4858 dest = dest->type;
4859 if(source->kind == 13 && source->type->kind == 11)
4860 source = source->type;
4861 if(dest->kind == 16)
4862 dest = dest->method->dataType;
4863 if(source->kind == 16)
4864 source = source->method->dataType;
4865 paramSource = source->params.first;
4866 if(paramSource && paramSource->kind == 0)
4867 paramSource = (((void *)0));
4868 paramDest = dest->params.first;
4869 if(paramDest && paramDest->kind == 0)
4870 paramDest = (((void *)0));
4871 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
4872 {
4873 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))))
4874 {
4875 if(paramDest && paramDest->kind == 8)
4876 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
4877 else
4878 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class should not take an object\n", (((void *)0))));
4879 return 0x0;
4880 }
4881 paramDest = paramDest->next;
4882 }
4883 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
4884 {
4885 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
4886 {
4887 if(dest->thisClass)
4888 {
4889 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
4890 {
4891 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4892 return 0x0;
4893 }
4894 }
4895 else
4896 {
4897 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
4898 {
4899 if(owningClassDest)
4900 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
4901 else
4902 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "overriding class expected to be derived from method class\n", (((void *)0))));
4903 return 0x0;
4904 }
4905 }
4906 paramSource = paramSource->next;
4907 }
4908 else
4909 {
4910 if(dest->thisClass)
4911 {
4912 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
4913 {
4914 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4915 return 0x0;
4916 }
4917 }
4918 else
4919 {
4920 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
4921 {
4922 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
4923 return 0x0;
4924 }
4925 }
4926 }
4927 }
4928 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4929 {
4930 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible return type for function\n", (((void *)0))));
4931 return 0x0;
4932 }
4933 for(; paramDest; paramDest = paramDest->next)
4934 {
4935 if(!paramSource)
4936 {
4937 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough parameters\n", (((void *)0))));
4938 return 0x0;
4939 }
4940 {
4941 struct Type * paramDestType = paramDest;
4942 struct Type * paramSourceType = paramSource;
4943 struct Type * type = paramDestType;
4944
4945 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
4946 {
4947 int id = 0;
4948 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4949 struct __ecereNameSpace__ecere__com__Class * sClass;
4950
4951 for(sClass = owningClassSource; sClass; sClass = sClass->base)
4952 {
4953 id = 0;
4954 if(sClass->templateClass)
4955 sClass = sClass->templateClass;
4956 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4957 {
4958 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
4959 {
4960 for(sClass = sClass->base; sClass; sClass = sClass->base)
4961 {
4962 if(sClass->templateClass)
4963 sClass = sClass->templateClass;
4964 id += sClass->templateParams.count;
4965 }
4966 break;
4967 }
4968 id++;
4969 }
4970 if(curParam)
4971 break;
4972 }
4973 if(curParam)
4974 {
4975 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
4976
4977 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
4978 }
4979 }
4980 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)))
4981 {
4982 char type[1024];
4983
4984 type[0] = (char)0;
4985 PrintType(paramDest, type, 0x0, 0x1);
4986 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
4987 if(paramDestType != paramDest)
4988 FreeType(paramDestType);
4989 return 0x0;
4990 }
4991 if(paramDestType != paramDest)
4992 FreeType(paramDestType);
4993 }
4994 paramSource = paramSource->next;
4995 }
4996 if(paramSource)
4997 {
4998 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many parameters\n", (((void *)0))));
4999 return 0x0;
5000 }
5001 return 0x1;
5002 }
5003 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
5004 {
5005 return 0x1;
5006 }
5007 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
5008 {
5009 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5010 return 0x1;
5011 }
5012 }
5013 return 0x0;
5014 }
5015
5016 static void FreeConvert(struct Conversion * convert)
5017 {
5018 if(convert->resultType)
5019 FreeType(convert->resultType);
5020 }
5021
5022 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
5023
5024 struct __ecereNameSpace__ecere__com__BTNamedLink
5025 {
5026 char *  name;
5027 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
5028 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
5029 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
5030 int depth;
5031 void *  data;
5032 } __attribute__ ((gcc_struct));
5033
5034 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
5035
5036 struct __ecereNameSpace__ecere__com__EnumClassData
5037 {
5038 struct __ecereNameSpace__ecere__sys__OldList values;
5039 int largest;
5040 } __attribute__ ((gcc_struct));
5041
5042 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
5043
5044 struct __ecereNameSpace__ecere__sys__NamedLink
5045 {
5046 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
5047 struct __ecereNameSpace__ecere__sys__NamedLink * next;
5048 char *  name;
5049 void *  data;
5050 } __attribute__ ((gcc_struct));
5051
5052 extern void FreeExpContents(struct Expression * exp);
5053
5054 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
5055
5056 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
5057
5058 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
5059
5060 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
5061
5062 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
5063
5064 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5065 {
5066 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
5067
5068 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)))
5069 {
5070 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
5071
5072 if(_class->type == 4)
5073 {
5074 struct __ecereNameSpace__ecere__sys__OldList converts = 
5075 {
5076 0, 0, 0, 0, 0
5077 };
5078 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5079
5080 type->kind = 8;
5081 if(!_class->symbol)
5082 _class->symbol = FindClass(_class->fullName);
5083 type->_class = _class->symbol;
5084 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
5085 {
5086 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5087 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5088
5089 if(enumClass)
5090 {
5091 struct __ecereNameSpace__ecere__com__Class * baseClass;
5092
5093 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
5094 {
5095 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
5096
5097 for(value = e->values.first; value; value = value->next)
5098 {
5099 if(!strcmp(value->name, string))
5100 break;
5101 }
5102 if(value)
5103 {
5104 FreeExpContents(sourceExp);
5105 FreeType(sourceExp->expType);
5106 sourceExp->isConstant = 0x1;
5107 sourceExp->expType = MkClassType(baseClass->fullName);
5108 {
5109 char constant[256];
5110
5111 sourceExp->type = 2;
5112 if(!strcmp(baseClass->dataTypeString, "int"))
5113 sprintf(constant, "%d", (int)value->data);
5114 else
5115 sprintf(constant, "0x%X", (int)value->data);
5116 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5117 }
5118 while(converts.first)
5119 {
5120 struct Conversion * convert = converts.first;
5121
5122 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
5123 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
5124 }
5125 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5126 return 0x1;
5127 }
5128 }
5129 }
5130 }
5131 if(converts.first)
5132 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
5133 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5134 }
5135 }
5136 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)))
5137 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
5138 return 0x1;
5139 return 0x0;
5140 }
5141
5142 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
5143
5144 struct __ecereNameSpace__ecere__com__SubModule
5145 {
5146 struct __ecereNameSpace__ecere__com__SubModule * prev;
5147 struct __ecereNameSpace__ecere__com__SubModule * next;
5148 struct __ecereNameSpace__ecere__com__Instance * module;
5149 int importMode;
5150 } __attribute__ ((gcc_struct));
5151
5152 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
5153 {
5154 struct __ecereNameSpace__ecere__com__SubModule * subModule;
5155
5156 if(searchFor == searchIn)
5157 return 0x1;
5158 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
5159 {
5160 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->application)
5161 {
5162 if(ModuleVisibility(subModule->module, searchFor))
5163 return 0x1;
5164 }
5165 }
5166 return 0x0;
5167 }
5168
5169 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
5170
5171 struct __ecereNameSpace__ecere__com__Application
5172 {
5173 int argc;
5174 char * *  argv;
5175 int exitCode;
5176 unsigned int isGUIApp;
5177 struct __ecereNameSpace__ecere__sys__OldList allModules;
5178 char *  parsedCommand;
5179 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
5180 } __attribute__ ((gcc_struct));
5181
5182 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5183 {
5184 struct __ecereNameSpace__ecere__com__Instance * module;
5185
5186 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))
5187 return 0x1;
5188 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))
5189 return 0x1;
5190 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))
5191 return 0x1;
5192 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)
5193 {
5194 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5195 return 0x1;
5196 }
5197 return 0x0;
5198 }
5199
5200 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
5201
5202 void ReadString(char *  output, char *  string);
5203
5204 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
5205
5206 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
5207
5208 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
5209
5210 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
5211 {
5212 struct Type * source = sourceExp->expType;
5213 struct Type * realDest = dest;
5214 struct Type * backupSourceExpType = (((void *)0));
5215
5216 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5217 return 0x1;
5218 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5219 {
5220 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5221 {
5222 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5223
5224 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5225 ;
5226 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5227 ;
5228 if(sourceBase == destBase)
5229 return 0x1;
5230 }
5231 }
5232 if(source)
5233 {
5234 struct __ecereNameSpace__ecere__sys__OldList * specs;
5235 unsigned int flag = 0x0;
5236 long long value = (((int)0x7fffffff));
5237
5238 source->refCount++;
5239 dest->refCount++;
5240 if(sourceExp->type == 2)
5241 {
5242 if(source->isSigned)
5243 value = strtoll(sourceExp->constant, (((void *)0)), 0);
5244 else
5245 value = strtoull(sourceExp->constant, (((void *)0)), 0);
5246 }
5247 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
5248 {
5249 if(source->isSigned)
5250 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
5251 else
5252 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
5253 }
5254 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5255 {
5256 FreeType(source);
5257 source = __extension__ ({
5258 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5259
5260 __ecereInstance1->kind = 3, __ecereInstance1->isSigned = 0x0, __ecereInstance1->refCount = 1, __ecereInstance1;
5261 });
5262 }
5263 if(dest->kind == 8)
5264 {
5265 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5266
5267 if(_class && _class->type == 3)
5268 {
5269 if(source->kind != 8)
5270 {
5271 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5272 struct Type * tempDest, * tempSource;
5273
5274 for(; _class->base->type != 1000; _class = _class->base)
5275 ;
5276 tempSource = dest;
5277 tempDest = tempType;
5278 tempType->kind = 8;
5279 if(!_class->symbol)
5280 _class->symbol = FindClass(_class->fullName);
5281 tempType->_class = _class->symbol;
5282 tempType->truth = dest->truth;
5283 if(tempType->_class)
5284 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5285 backupSourceExpType = sourceExp->expType;
5286 sourceExp->expType = dest;
5287 dest->refCount++;
5288 flag = 0x1;
5289 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5290 }
5291 }
5292 if(_class && _class->type == 2 && source->kind != 8)
5293 {
5294 if(!dest->_class->registered->dataType)
5295 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5296 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5297 {
5298 FreeType(source);
5299 FreeType(sourceExp->expType);
5300 source = sourceExp->expType = MkClassType(dest->_class->string);
5301 source->refCount++;
5302 }
5303 }
5304 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5305 {
5306 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5307 struct Declarator * decl;
5308 char string[1024];
5309
5310 ReadString(string, sourceExp->string);
5311 decl = SpecDeclFromString(string, specs, (((void *)0)));
5312 FreeExpContents(sourceExp);
5313 FreeType(sourceExp->expType);
5314 sourceExp->type = 26;
5315 sourceExp->_classExp.specifiers = specs;
5316 sourceExp->_classExp.decl = decl;
5317 sourceExp->expType = dest;
5318 dest->refCount++;
5319 FreeType(source);
5320 FreeType(dest);
5321 if(backupSourceExpType)
5322 FreeType(backupSourceExpType);
5323 return 0x1;
5324 }
5325 }
5326 else if(source->kind == 8)
5327 {
5328 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5329
5330 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5331 {
5332 if(dest->kind != 8)
5333 {
5334 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5335 struct Type * tempDest, * tempSource;
5336
5337 if(!source->_class->registered->dataType)
5338 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5339 for(; _class->base->type != 1000; _class = _class->base)
5340 ;
5341 tempDest = source;
5342 tempSource = tempType;
5343 tempType->kind = 8;
5344 tempType->_class = FindClass(_class->fullName);
5345 tempType->truth = source->truth;
5346 tempType->classObjectType = source->classObjectType;
5347 if(tempType->_class)
5348 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5349 if(conversions->last)
5350 {
5351 ((struct Conversion *)conversions->last)->resultType = dest;
5352 dest->refCount++;
5353 }
5354 FreeType(sourceExp->expType);
5355 sourceExp->expType = MkClassType(_class->fullName);
5356 sourceExp->expType->truth = source->truth;
5357 sourceExp->expType->classObjectType = source->classObjectType;
5358 if(!sourceExp->destType)
5359 {
5360 FreeType(sourceExp->destType);
5361 sourceExp->destType = sourceExp->expType;
5362 if(sourceExp->expType)
5363 sourceExp->expType->refCount++;
5364 }
5365 if(!_class->dataType)
5366 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5367 FreeType(dest);
5368 dest = MkClassType(source->_class->string);
5369 dest->truth = source->truth;
5370 dest->classObjectType = source->classObjectType;
5371 FreeType(source);
5372 source = _class->dataType;
5373 source->refCount++;
5374 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5375 }
5376 }
5377 }
5378 if(!flag)
5379 {
5380 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5381 {
5382 FreeType(source);
5383 FreeType(dest);
5384 return 0x1;
5385 }
5386 }
5387 if(dest->kind == 8)
5388 {
5389 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5390
5391 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5392 {
5393 if(_class->type == 0 || _class->type == 5)
5394 {
5395 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5396
5397 *newExp = *sourceExp;
5398 if(sourceExp->destType)
5399 sourceExp->destType->refCount++;
5400 if(sourceExp->expType)
5401 sourceExp->expType->refCount++;
5402 sourceExp->type = 11;
5403 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5404 sourceExp->cast.exp = newExp;
5405 FreeType(sourceExp->expType);
5406 sourceExp->expType = (((void *)0));
5407 ProcessExpressionType(sourceExp);
5408 if(!inCompiler)
5409 {
5410 FreeType(sourceExp->expType);
5411 sourceExp->expType = dest;
5412 }
5413 FreeType(source);
5414 if(inCompiler)
5415 FreeType(dest);
5416 if(backupSourceExpType)
5417 FreeType(backupSourceExpType);
5418 return 0x1;
5419 }
5420 if(!_class->dataType)
5421 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5422 FreeType(dest);
5423 dest = _class->dataType;
5424 dest->refCount++;
5425 }
5426 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5427 {
5428 specs = MkListOne(MkSpecifier(DOUBLE));
5429 }
5430 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 7))
5431 {
5432 specs = MkListOne(MkSpecifier(FLOAT));
5433 }
5434 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5435 {
5436 specs = MkList();
5437 if(!dest->isSigned)
5438 ListAdd(specs, MkSpecifier(UNSIGNED));
5439 ListAdd(specs, MkSpecifier(INT64));
5440 }
5441 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5442 {
5443 specs = MkList();
5444 if(!dest->isSigned)
5445 ListAdd(specs, MkSpecifier(UNSIGNED));
5446 ListAdd(specs, MkSpecifier(INT));
5447 }
5448 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5449 {
5450 specs = MkList();
5451 if(!dest->isSigned)
5452 ListAdd(specs, MkSpecifier(UNSIGNED));
5453 ListAdd(specs, MkSpecifier(SHORT));
5454 }
5455 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5456 {
5457 specs = MkList();
5458 if(!dest->isSigned)
5459 ListAdd(specs, MkSpecifier(UNSIGNED));
5460 ListAdd(specs, MkSpecifier(CHAR));
5461 }
5462 else
5463 {
5464 FreeType(source);
5465 FreeType(dest);
5466 if(backupSourceExpType)
5467 {
5468 if(sourceExp->expType)
5469 FreeType(sourceExp->expType);
5470 sourceExp->expType = backupSourceExpType;
5471 }
5472 return 0x0;
5473 }
5474 }
5475 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))
5476 {
5477 specs = MkListOne(MkSpecifier(DOUBLE));
5478 }
5479 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5480 {
5481 specs = MkListOne(MkSpecifier(FLOAT));
5482 }
5483 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)))
5484 {
5485 specs = MkList();
5486 if(!dest->isSigned)
5487 ListAdd(specs, MkSpecifier(UNSIGNED));
5488 ListAdd(specs, MkSpecifier(CHAR));
5489 }
5490 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)))))
5491 {
5492 specs = MkList();
5493 if(!dest->isSigned)
5494 ListAdd(specs, MkSpecifier(UNSIGNED));
5495 ListAdd(specs, MkSpecifier(SHORT));
5496 }
5497 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3))
5498 {
5499 specs = MkList();
5500 if(!dest->isSigned)
5501 ListAdd(specs, MkSpecifier(UNSIGNED));
5502 ListAdd(specs, MkSpecifier(INT));
5503 }
5504 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5505 {
5506 specs = MkList();
5507 if(!dest->isSigned)
5508 ListAdd(specs, MkSpecifier(UNSIGNED));
5509 ListAdd(specs, MkSpecifier(INT64));
5510 }
5511 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5512 {
5513 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5514 }
5515 else
5516 {
5517 FreeType(source);
5518 FreeType(dest);
5519 if(backupSourceExpType)
5520 {
5521 if(sourceExp->expType)
5522 FreeType(sourceExp->expType);
5523 sourceExp->expType = backupSourceExpType;
5524 }
5525 return 0x0;
5526 }
5527 if(!flag)
5528 {
5529 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5530
5531 *newExp = *sourceExp;
5532 newExp->prev = (((void *)0));
5533 newExp->next = (((void *)0));
5534 if(sourceExp->destType)
5535 sourceExp->destType->refCount++;
5536 if(sourceExp->expType)
5537 sourceExp->expType->refCount++;
5538 sourceExp->type = 11;
5539 if(realDest->kind == 8)
5540 {
5541 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5542 FreeList(specs, FreeSpecifier);
5543 }
5544 else
5545 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5546 if(newExp->type == 4)
5547 {
5548 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5549 }
5550 else
5551 sourceExp->cast.exp = newExp;
5552 FreeType(sourceExp->expType);
5553 sourceExp->expType = (((void *)0));
5554 ProcessExpressionType(sourceExp);
5555 }
5556 else
5557 FreeList(specs, FreeSpecifier);
5558 FreeType(dest);
5559 FreeType(source);
5560 if(backupSourceExpType)
5561 FreeType(backupSourceExpType);
5562 return 0x1;
5563 }
5564 else
5565 {
5566 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5567 sourceExp = (*sourceExp->list).last;
5568 if(sourceExp->type == 0)
5569 {
5570 struct Identifier * id = sourceExp->identifier;
5571
5572 if(dest->kind == 8)
5573 {
5574 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5575 {
5576 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5577 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5578
5579 if(enumClass)
5580 {
5581 for(; _class && _class->type == 4; _class = _class->base)
5582 {
5583 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5584 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5585
5586 for(value = e->values.first; value; value = value->next)
5587 {
5588 if(!strcmp(value->name, id->string))
5589 break;
5590 }
5591 if(value)
5592 {
5593 FreeExpContents(sourceExp);
5594 FreeType(sourceExp->expType);
5595 sourceExp->isConstant = 0x1;
5596 sourceExp->expType = MkClassType(_class->fullName);
5597 {
5598 char constant[256];
5599
5600 sourceExp->type = 2;
5601 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5602 sprintf(constant, "%d", (int)value->data);
5603 else
5604 sprintf(constant, "0x%X", (int)value->data);
5605 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5606 }
5607 return 0x1;
5608 }
5609 }
5610 }
5611 }
5612 }
5613 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5614 return 0x1;
5615 }
5616 }
5617 return 0x0;
5618 }
5619
5620 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5621 {
5622 int value2 = op2->i;
5623
5624 exp->type = 2;
5625 exp->string = PrintInt(op1->i + value2);
5626 if(!exp->expType)
5627 {
5628 exp->expType = op1->type;
5629 if(op1->type)
5630 op1->type->refCount++;
5631 }
5632 return 0x1;
5633 }
5634
5635 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5636 {
5637 unsigned int value2 = op2->ui;
5638
5639 exp->type = 2;
5640 exp->string = PrintUInt(op1->ui + value2);
5641 if(!exp->expType)
5642 {
5643 exp->expType = op1->type;
5644 if(op1->type)
5645 op1->type->refCount++;
5646 }
5647 return 0x1;
5648 }
5649
5650 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5651 {
5652 short value2 = op2->s;
5653
5654 exp->type = 2;
5655 exp->string = PrintShort(op1->s + value2);
5656 if(!exp->expType)
5657 {
5658 exp->expType = op1->type;
5659 if(op1->type)
5660 op1->type->refCount++;
5661 }
5662 return 0x1;
5663 }
5664
5665 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5666 {
5667 unsigned short value2 = op2->us;
5668
5669 exp->type = 2;
5670 exp->string = PrintUShort(op1->us + value2);
5671 if(!exp->expType)
5672 {
5673 exp->expType = op1->type;
5674 if(op1->type)
5675 op1->type->refCount++;
5676 }
5677 return 0x1;
5678 }
5679
5680 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5681 {
5682 char value2 = op2->c;
5683
5684 exp->type = 2;
5685 exp->string = PrintChar(op1->c + value2);
5686 if(!exp->expType)
5687 {
5688 exp->expType = op1->type;
5689 if(op1->type)
5690 op1->type->refCount++;
5691 }
5692 return 0x1;
5693 }
5694
5695 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5696 {
5697 unsigned char value2 = op2->uc;
5698
5699 exp->type = 2;
5700 exp->string = PrintUChar(op1->uc + value2);
5701 if(!exp->expType)
5702 {
5703 exp->expType = op1->type;
5704 if(op1->type)
5705 op1->type->refCount++;
5706 }
5707 return 0x1;
5708 }
5709
5710 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5711 {
5712 float value2 = op2->f;
5713
5714 exp->type = 2;
5715 exp->string = PrintFloat(op1->f + value2);
5716 if(!exp->expType)
5717 {
5718 exp->expType = op1->type;
5719 if(op1->type)
5720 op1->type->refCount++;
5721 }
5722 return 0x1;
5723 }
5724
5725 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5726 {
5727 double value2 = op2->d;
5728
5729 exp->type = 2;
5730 exp->string = PrintDouble(op1->d + value2);
5731 if(!exp->expType)
5732 {
5733 exp->expType = op1->type;
5734 if(op1->type)
5735 op1->type->refCount++;
5736 }
5737 return 0x1;
5738 }
5739
5740 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5741 {
5742 int value2 = op2->i;
5743
5744 exp->type = 2;
5745 exp->string = PrintInt(op1->i - value2);
5746 if(!exp->expType)
5747 {
5748 exp->expType = op1->type;
5749 if(op1->type)
5750 op1->type->refCount++;
5751 }
5752 return 0x1;
5753 }
5754
5755 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5756 {
5757 unsigned int value2 = op2->ui;
5758
5759 exp->type = 2;
5760 exp->string = PrintUInt(op1->ui - value2);
5761 if(!exp->expType)
5762 {
5763 exp->expType = op1->type;
5764 if(op1->type)
5765 op1->type->refCount++;
5766 }
5767 return 0x1;
5768 }
5769
5770 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5771 {
5772 short value2 = op2->s;
5773
5774 exp->type = 2;
5775 exp->string = PrintShort(op1->s - value2);
5776 if(!exp->expType)
5777 {
5778 exp->expType = op1->type;
5779 if(op1->type)
5780 op1->type->refCount++;
5781 }
5782 return 0x1;
5783 }
5784
5785 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5786 {
5787 unsigned short value2 = op2->us;
5788
5789 exp->type = 2;
5790 exp->string = PrintUShort(op1->us - value2);
5791 if(!exp->expType)
5792 {
5793 exp->expType = op1->type;
5794 if(op1->type)
5795 op1->type->refCount++;
5796 }
5797 return 0x1;
5798 }
5799
5800 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5801 {
5802 char value2 = op2->c;
5803
5804 exp->type = 2;
5805 exp->string = PrintChar(op1->c - value2);
5806 if(!exp->expType)
5807 {
5808 exp->expType = op1->type;
5809 if(op1->type)
5810 op1->type->refCount++;
5811 }
5812 return 0x1;
5813 }
5814
5815 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5816 {
5817 unsigned char value2 = op2->uc;
5818
5819 exp->type = 2;
5820 exp->string = PrintUChar(op1->uc - value2);
5821 if(!exp->expType)
5822 {
5823 exp->expType = op1->type;
5824 if(op1->type)
5825 op1->type->refCount++;
5826 }
5827 return 0x1;
5828 }
5829
5830 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5831 {
5832 float value2 = op2->f;
5833
5834 exp->type = 2;
5835 exp->string = PrintFloat(op1->f - value2);
5836 if(!exp->expType)
5837 {
5838 exp->expType = op1->type;
5839 if(op1->type)
5840 op1->type->refCount++;
5841 }
5842 return 0x1;
5843 }
5844
5845 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5846 {
5847 double value2 = op2->d;
5848
5849 exp->type = 2;
5850 exp->string = PrintDouble(op1->d - value2);
5851 if(!exp->expType)
5852 {
5853 exp->expType = op1->type;
5854 if(op1->type)
5855 op1->type->refCount++;
5856 }
5857 return 0x1;
5858 }
5859
5860 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5861 {
5862 int value2 = op2->i;
5863
5864 exp->type = 2;
5865 exp->string = PrintInt(op1->i * value2);
5866 if(!exp->expType)
5867 {
5868 exp->expType = op1->type;
5869 if(op1->type)
5870 op1->type->refCount++;
5871 }
5872 return 0x1;
5873 }
5874
5875 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5876 {
5877 unsigned int value2 = op2->ui;
5878
5879 exp->type = 2;
5880 exp->string = PrintUInt(op1->ui * value2);
5881 if(!exp->expType)
5882 {
5883 exp->expType = op1->type;
5884 if(op1->type)
5885 op1->type->refCount++;
5886 }
5887 return 0x1;
5888 }
5889
5890 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5891 {
5892 short value2 = op2->s;
5893
5894 exp->type = 2;
5895 exp->string = PrintShort(op1->s * value2);
5896 if(!exp->expType)
5897 {
5898 exp->expType = op1->type;
5899 if(op1->type)
5900 op1->type->refCount++;
5901 }
5902 return 0x1;
5903 }
5904
5905 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5906 {
5907 unsigned short value2 = op2->us;
5908
5909 exp->type = 2;
5910 exp->string = PrintUShort(op1->us * value2);
5911 if(!exp->expType)
5912 {
5913 exp->expType = op1->type;
5914 if(op1->type)
5915 op1->type->refCount++;
5916 }
5917 return 0x1;
5918 }
5919
5920 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5921 {
5922 char value2 = op2->c;
5923
5924 exp->type = 2;
5925 exp->string = PrintChar(op1->c * value2);
5926 if(!exp->expType)
5927 {
5928 exp->expType = op1->type;
5929 if(op1->type)
5930 op1->type->refCount++;
5931 }
5932 return 0x1;
5933 }
5934
5935 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5936 {
5937 unsigned char value2 = op2->uc;
5938
5939 exp->type = 2;
5940 exp->string = PrintUChar(op1->uc * value2);
5941 if(!exp->expType)
5942 {
5943 exp->expType = op1->type;
5944 if(op1->type)
5945 op1->type->refCount++;
5946 }
5947 return 0x1;
5948 }
5949
5950 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5951 {
5952 float value2 = op2->f;
5953
5954 exp->type = 2;
5955 exp->string = PrintFloat(op1->f * value2);
5956 if(!exp->expType)
5957 {
5958 exp->expType = op1->type;
5959 if(op1->type)
5960 op1->type->refCount++;
5961 }
5962 return 0x1;
5963 }
5964
5965 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5966 {
5967 double value2 = op2->d;
5968
5969 exp->type = 2;
5970 exp->string = PrintDouble(op1->d * value2);
5971 if(!exp->expType)
5972 {
5973 exp->expType = op1->type;
5974 if(op1->type)
5975 op1->type->refCount++;
5976 }
5977 return 0x1;
5978 }
5979
5980 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5981 {
5982 int value2 = op2->i;
5983
5984 exp->type = 2;
5985 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
5986 if(!exp->expType)
5987 {
5988 exp->expType = op1->type;
5989 if(op1->type)
5990 op1->type->refCount++;
5991 }
5992 return 0x1;
5993 }
5994
5995 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5996 {
5997 unsigned int value2 = op2->ui;
5998
5999 exp->type = 2;
6000 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
6001 if(!exp->expType)
6002 {
6003 exp->expType = op1->type;
6004 if(op1->type)
6005 op1->type->refCount++;
6006 }
6007 return 0x1;
6008 }
6009
6010 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6011 {
6012 short value2 = op2->s;
6013
6014 exp->type = 2;
6015 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
6016 if(!exp->expType)
6017 {
6018 exp->expType = op1->type;
6019 if(op1->type)
6020 op1->type->refCount++;
6021 }
6022 return 0x1;
6023 }
6024
6025 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6026 {
6027 unsigned short value2 = op2->us;
6028
6029 exp->type = 2;
6030 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
6031 if(!exp->expType)
6032 {
6033 exp->expType = op1->type;
6034 if(op1->type)
6035 op1->type->refCount++;
6036 }
6037 return 0x1;
6038 }
6039
6040 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6041 {
6042 char value2 = op2->c;
6043
6044 exp->type = 2;
6045 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
6046 if(!exp->expType)
6047 {
6048 exp->expType = op1->type;
6049 if(op1->type)
6050 op1->type->refCount++;
6051 }
6052 return 0x1;
6053 }
6054
6055 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6056 {
6057 unsigned char value2 = op2->uc;
6058
6059 exp->type = 2;
6060 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
6061 if(!exp->expType)
6062 {
6063 exp->expType = op1->type;
6064 if(op1->type)
6065 op1->type->refCount++;
6066 }
6067 return 0x1;
6068 }
6069
6070 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6071 {
6072 float value2 = op2->f;
6073
6074 exp->type = 2;
6075 exp->string = PrintFloat(value2 ? (op1->f / value2) : 0);
6076 if(!exp->expType)
6077 {
6078 exp->expType = op1->type;
6079 if(op1->type)
6080 op1->type->refCount++;
6081 }
6082 return 0x1;
6083 }
6084
6085 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6086 {
6087 double value2 = op2->d;
6088
6089 exp->type = 2;
6090 exp->string = PrintDouble(value2 ? (op1->d / value2) : 0);
6091 if(!exp->expType)
6092 {
6093 exp->expType = op1->type;
6094 if(op1->type)
6095 op1->type->refCount++;
6096 }
6097 return 0x1;
6098 }
6099
6100 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6101 {
6102 int value2 = op2->i;
6103
6104 exp->type = 2;
6105 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
6106 if(!exp->expType)
6107 {
6108 exp->expType = op1->type;
6109 if(op1->type)
6110 op1->type->refCount++;
6111 }
6112 return 0x1;
6113 }
6114
6115 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6116 {
6117 unsigned int value2 = op2->ui;
6118
6119 exp->type = 2;
6120 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
6121 if(!exp->expType)
6122 {
6123 exp->expType = op1->type;
6124 if(op1->type)
6125 op1->type->refCount++;
6126 }
6127 return 0x1;
6128 }
6129
6130 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6131 {
6132 short value2 = op2->s;
6133
6134 exp->type = 2;
6135 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
6136 if(!exp->expType)
6137 {
6138 exp->expType = op1->type;
6139 if(op1->type)
6140 op1->type->refCount++;
6141 }
6142 return 0x1;
6143 }
6144
6145 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6146 {
6147 unsigned short value2 = op2->us;
6148
6149 exp->type = 2;
6150 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
6151 if(!exp->expType)
6152 {
6153 exp->expType = op1->type;
6154 if(op1->type)
6155 op1->type->refCount++;
6156 }
6157 return 0x1;
6158 }
6159
6160 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6161 {
6162 char value2 = op2->c;
6163
6164 exp->type = 2;
6165 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
6166 if(!exp->expType)
6167 {
6168 exp->expType = op1->type;
6169 if(op1->type)
6170 op1->type->refCount++;
6171 }
6172 return 0x1;
6173 }
6174
6175 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6176 {
6177 unsigned char value2 = op2->uc;
6178
6179 exp->type = 2;
6180 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
6181 if(!exp->expType)
6182 {
6183 exp->expType = op1->type;
6184 if(op1->type)
6185 op1->type->refCount++;
6186 }
6187 return 0x1;
6188 }
6189
6190 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
6191 {
6192 exp->type = 2;
6193 exp->string = PrintInt(-op1->i);
6194 if(!exp->expType)
6195 {
6196 exp->expType = op1->type;
6197 if(op1->type)
6198 op1->type->refCount++;
6199 }
6200 return 0x1;
6201 }
6202
6203 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
6204 {
6205 exp->type = 2;
6206 exp->string = PrintUInt(-op1->ui);
6207 if(!exp->expType)
6208 {
6209 exp->expType = op1->type;
6210 if(op1->type)
6211 op1->type->refCount++;
6212 }
6213 return 0x1;
6214 }
6215
6216 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
6217 {
6218 exp->type = 2;
6219 exp->string = PrintShort(-op1->s);
6220 if(!exp->expType)
6221 {
6222 exp->expType = op1->type;
6223 if(op1->type)
6224 op1->type->refCount++;
6225 }
6226 return 0x1;
6227 }
6228
6229 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
6230 {
6231 exp->type = 2;
6232 exp->string = PrintUShort(-op1->us);
6233 if(!exp->expType)
6234 {
6235 exp->expType = op1->type;
6236 if(op1->type)
6237 op1->type->refCount++;
6238 }
6239 return 0x1;
6240 }
6241
6242 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
6243 {
6244 exp->type = 2;
6245 exp->string = PrintChar(-op1->c);
6246 if(!exp->expType)
6247 {
6248 exp->expType = op1->type;
6249 if(op1->type)
6250 op1->type->refCount++;
6251 }
6252 return 0x1;
6253 }
6254
6255 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
6256 {
6257 exp->type = 2;
6258 exp->string = PrintUChar(-op1->uc);
6259 if(!exp->expType)
6260 {
6261 exp->expType = op1->type;
6262 if(op1->type)
6263 op1->type->refCount++;
6264 }
6265 return 0x1;
6266 }
6267
6268 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
6269 {
6270 exp->type = 2;
6271 exp->string = PrintFloat(-op1->f);
6272 if(!exp->expType)
6273 {
6274 exp->expType = op1->type;
6275 if(op1->type)
6276 op1->type->refCount++;
6277 }
6278 return 0x1;
6279 }
6280
6281 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6282 {
6283 exp->type = 2;
6284 exp->string = PrintDouble(-op1->d);
6285 if(!exp->expType)
6286 {
6287 exp->expType = op1->type;
6288 if(op1->type)
6289 op1->type->refCount++;
6290 }
6291 return 0x1;
6292 }
6293
6294 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6295 {
6296 exp->type = 2;
6297 exp->string = PrintInt(++op1->i);
6298 if(!exp->expType)
6299 {
6300 exp->expType = op1->type;
6301 if(op1->type)
6302 op1->type->refCount++;
6303 }
6304 return 0x1;
6305 }
6306
6307 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6308 {
6309 exp->type = 2;
6310 exp->string = PrintUInt(++op1->ui);
6311 if(!exp->expType)
6312 {
6313 exp->expType = op1->type;
6314 if(op1->type)
6315 op1->type->refCount++;
6316 }
6317 return 0x1;
6318 }
6319
6320 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6321 {
6322 exp->type = 2;
6323 exp->string = PrintShort(++op1->s);
6324 if(!exp->expType)
6325 {
6326 exp->expType = op1->type;
6327 if(op1->type)
6328 op1->type->refCount++;
6329 }
6330 return 0x1;
6331 }
6332
6333 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6334 {
6335 exp->type = 2;
6336 exp->string = PrintUShort(++op1->us);
6337 if(!exp->expType)
6338 {
6339 exp->expType = op1->type;
6340 if(op1->type)
6341 op1->type->refCount++;
6342 }
6343 return 0x1;
6344 }
6345
6346 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6347 {
6348 exp->type = 2;
6349 exp->string = PrintChar(++op1->c);
6350 if(!exp->expType)
6351 {
6352 exp->expType = op1->type;
6353 if(op1->type)
6354 op1->type->refCount++;
6355 }
6356 return 0x1;
6357 }
6358
6359 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6360 {
6361 exp->type = 2;
6362 exp->string = PrintUChar(++op1->uc);
6363 if(!exp->expType)
6364 {
6365 exp->expType = op1->type;
6366 if(op1->type)
6367 op1->type->refCount++;
6368 }
6369 return 0x1;
6370 }
6371
6372 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6373 {
6374 exp->type = 2;
6375 exp->string = PrintFloat(++op1->f);
6376 if(!exp->expType)
6377 {
6378 exp->expType = op1->type;
6379 if(op1->type)
6380 op1->type->refCount++;
6381 }
6382 return 0x1;
6383 }
6384
6385 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6386 {
6387 exp->type = 2;
6388 exp->string = PrintDouble(++op1->d);
6389 if(!exp->expType)
6390 {
6391 exp->expType = op1->type;
6392 if(op1->type)
6393 op1->type->refCount++;
6394 }
6395 return 0x1;
6396 }
6397
6398 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6399 {
6400 exp->type = 2;
6401 exp->string = PrintInt(--op1->i);
6402 if(!exp->expType)
6403 {
6404 exp->expType = op1->type;
6405 if(op1->type)
6406 op1->type->refCount++;
6407 }
6408 return 0x1;
6409 }
6410
6411 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6412 {
6413 exp->type = 2;
6414 exp->string = PrintUInt(--op1->ui);
6415 if(!exp->expType)
6416 {
6417 exp->expType = op1->type;
6418 if(op1->type)
6419 op1->type->refCount++;
6420 }
6421 return 0x1;
6422 }
6423
6424 static unsigned int ShortDec(struct Expression * exp, struct Operand * op1)
6425 {
6426 exp->type = 2;
6427 exp->string = PrintShort(--op1->s);
6428 if(!exp->expType)
6429 {
6430 exp->expType = op1->type;
6431 if(op1->type)
6432 op1->type->refCount++;
6433 }
6434 return 0x1;
6435 }
6436
6437 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6438 {
6439 exp->type = 2;
6440 exp->string = PrintUShort(--op1->us);
6441 if(!exp->expType)
6442 {
6443 exp->expType = op1->type;
6444 if(op1->type)
6445 op1->type->refCount++;
6446 }
6447 return 0x1;
6448 }
6449
6450 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6451 {
6452 exp->type = 2;
6453 exp->string = PrintChar(--op1->c);
6454 if(!exp->expType)
6455 {
6456 exp->expType = op1->type;
6457 if(op1->type)
6458 op1->type->refCount++;
6459 }
6460 return 0x1;
6461 }
6462
6463 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6464 {
6465 exp->type = 2;
6466 exp->string = PrintUChar(--op1->uc);
6467 if(!exp->expType)
6468 {
6469 exp->expType = op1->type;
6470 if(op1->type)
6471 op1->type->refCount++;
6472 }
6473 return 0x1;
6474 }
6475
6476 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6477 {
6478 exp->type = 2;
6479 exp->string = PrintFloat(--op1->f);
6480 if(!exp->expType)
6481 {
6482 exp->expType = op1->type;
6483 if(op1->type)
6484 op1->type->refCount++;
6485 }
6486 return 0x1;
6487 }
6488
6489 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6490 {
6491 exp->type = 2;
6492 exp->string = PrintDouble(--op1->d);
6493 if(!exp->expType)
6494 {
6495 exp->expType = op1->type;
6496 if(op1->type)
6497 op1->type->refCount++;
6498 }
6499 return 0x1;
6500 }
6501
6502 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6503 {
6504 int value2 = op2->i;
6505
6506 exp->type = 2;
6507 exp->string = PrintInt(op1->i = value2);
6508 if(!exp->expType)
6509 {
6510 exp->expType = op1->type;
6511 if(op1->type)
6512 op1->type->refCount++;
6513 }
6514 return 0x1;
6515 }
6516
6517 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6518 {
6519 unsigned int value2 = op2->ui;
6520
6521 exp->type = 2;
6522 exp->string = PrintUInt(op1->ui = value2);
6523 if(!exp->expType)
6524 {
6525 exp->expType = op1->type;
6526 if(op1->type)
6527 op1->type->refCount++;
6528 }
6529 return 0x1;
6530 }
6531
6532 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6533 {
6534 short value2 = op2->s;
6535
6536 exp->type = 2;
6537 exp->string = PrintShort(op1->s = value2);
6538 if(!exp->expType)
6539 {
6540 exp->expType = op1->type;
6541 if(op1->type)
6542 op1->type->refCount++;
6543 }
6544 return 0x1;
6545 }
6546
6547 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6548 {
6549 unsigned short value2 = op2->us;
6550
6551 exp->type = 2;
6552 exp->string = PrintUShort(op1->us = value2);
6553 if(!exp->expType)
6554 {
6555 exp->expType = op1->type;
6556 if(op1->type)
6557 op1->type->refCount++;
6558 }
6559 return 0x1;
6560 }
6561
6562 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6563 {
6564 char value2 = op2->c;
6565
6566 exp->type = 2;
6567 exp->string = PrintChar(op1->c = value2);
6568 if(!exp->expType)
6569 {
6570 exp->expType = op1->type;
6571 if(op1->type)
6572 op1->type->refCount++;
6573 }
6574 return 0x1;
6575 }
6576
6577 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6578 {
6579 unsigned char value2 = op2->uc;
6580
6581 exp->type = 2;
6582 exp->string = PrintUChar(op1->uc = value2);
6583 if(!exp->expType)
6584 {
6585 exp->expType = op1->type;
6586 if(op1->type)
6587 op1->type->refCount++;
6588 }
6589 return 0x1;
6590 }
6591
6592 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6593 {
6594 float value2 = op2->f;
6595
6596 exp->type = 2;
6597 exp->string = PrintFloat(op1->f = value2);
6598 if(!exp->expType)
6599 {
6600 exp->expType = op1->type;
6601 if(op1->type)
6602 op1->type->refCount++;
6603 }
6604 return 0x1;
6605 }
6606
6607 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6608 {
6609 double value2 = op2->d;
6610
6611 exp->type = 2;
6612 exp->string = PrintDouble(op1->d = value2);
6613 if(!exp->expType)
6614 {
6615 exp->expType = op1->type;
6616 if(op1->type)
6617 op1->type->refCount++;
6618 }
6619 return 0x1;
6620 }
6621
6622 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6623 {
6624 int value2 = op2->i;
6625
6626 exp->type = 2;
6627 exp->string = PrintInt(op1->i += value2);
6628 if(!exp->expType)
6629 {
6630 exp->expType = op1->type;
6631 if(op1->type)
6632 op1->type->refCount++;
6633 }
6634 return 0x1;
6635 }
6636
6637 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6638 {
6639 unsigned int value2 = op2->ui;
6640
6641 exp->type = 2;
6642 exp->string = PrintUInt(op1->ui += value2);
6643 if(!exp->expType)
6644 {
6645 exp->expType = op1->type;
6646 if(op1->type)
6647 op1->type->refCount++;
6648 }
6649 return 0x1;
6650 }
6651
6652 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6653 {
6654 short value2 = op2->s;
6655
6656 exp->type = 2;
6657 exp->string = PrintShort(op1->s += value2);
6658 if(!exp->expType)
6659 {
6660 exp->expType = op1->type;
6661 if(op1->type)
6662 op1->type->refCount++;
6663 }
6664 return 0x1;
6665 }
6666
6667 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6668 {
6669 unsigned short value2 = op2->us;
6670
6671 exp->type = 2;
6672 exp->string = PrintUShort(op1->us += value2);
6673 if(!exp->expType)
6674 {
6675 exp->expType = op1->type;
6676 if(op1->type)
6677 op1->type->refCount++;
6678 }
6679 return 0x1;
6680 }
6681
6682 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6683 {
6684 char value2 = op2->c;
6685
6686 exp->type = 2;
6687 exp->string = PrintChar(op1->c += value2);
6688 if(!exp->expType)
6689 {
6690 exp->expType = op1->type;
6691 if(op1->type)
6692 op1->type->refCount++;
6693 }
6694 return 0x1;
6695 }
6696
6697 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6698 {
6699 unsigned char value2 = op2->uc;
6700
6701 exp->type = 2;
6702 exp->string = PrintUChar(op1->uc += value2);
6703 if(!exp->expType)
6704 {
6705 exp->expType = op1->type;
6706 if(op1->type)
6707 op1->type->refCount++;
6708 }
6709 return 0x1;
6710 }
6711
6712 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6713 {
6714 float value2 = op2->f;
6715
6716 exp->type = 2;
6717 exp->string = PrintFloat(op1->f += value2);
6718 if(!exp->expType)
6719 {
6720 exp->expType = op1->type;
6721 if(op1->type)
6722 op1->type->refCount++;
6723 }
6724 return 0x1;
6725 }
6726
6727 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6728 {
6729 double value2 = op2->d;
6730
6731 exp->type = 2;
6732 exp->string = PrintDouble(op1->d += value2);
6733 if(!exp->expType)
6734 {
6735 exp->expType = op1->type;
6736 if(op1->type)
6737 op1->type->refCount++;
6738 }
6739 return 0x1;
6740 }
6741
6742 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6743 {
6744 int value2 = op2->i;
6745
6746 exp->type = 2;
6747 exp->string = PrintInt(op1->i -= value2);
6748 if(!exp->expType)
6749 {
6750 exp->expType = op1->type;
6751 if(op1->type)
6752 op1->type->refCount++;
6753 }
6754 return 0x1;
6755 }
6756
6757 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6758 {
6759 unsigned int value2 = op2->ui;
6760
6761 exp->type = 2;
6762 exp->string = PrintUInt(op1->ui -= value2);
6763 if(!exp->expType)
6764 {
6765 exp->expType = op1->type;
6766 if(op1->type)
6767 op1->type->refCount++;
6768 }
6769 return 0x1;
6770 }
6771
6772 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6773 {
6774 short value2 = op2->s;
6775
6776 exp->type = 2;
6777 exp->string = PrintShort(op1->s -= value2);
6778 if(!exp->expType)
6779 {
6780 exp->expType = op1->type;
6781 if(op1->type)
6782 op1->type->refCount++;
6783 }
6784 return 0x1;
6785 }
6786
6787 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6788 {
6789 unsigned short value2 = op2->us;
6790
6791 exp->type = 2;
6792 exp->string = PrintUShort(op1->us -= value2);
6793 if(!exp->expType)
6794 {
6795 exp->expType = op1->type;
6796 if(op1->type)
6797 op1->type->refCount++;
6798 }
6799 return 0x1;
6800 }
6801
6802 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6803 {
6804 char value2 = op2->c;
6805
6806 exp->type = 2;
6807 exp->string = PrintChar(op1->c -= value2);
6808 if(!exp->expType)
6809 {
6810 exp->expType = op1->type;
6811 if(op1->type)
6812 op1->type->refCount++;
6813 }
6814 return 0x1;
6815 }
6816
6817 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6818 {
6819 unsigned char value2 = op2->uc;
6820
6821 exp->type = 2;
6822 exp->string = PrintUChar(op1->uc -= value2);
6823 if(!exp->expType)
6824 {
6825 exp->expType = op1->type;
6826 if(op1->type)
6827 op1->type->refCount++;
6828 }
6829 return 0x1;
6830 }
6831
6832 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6833 {
6834 float value2 = op2->f;
6835
6836 exp->type = 2;
6837 exp->string = PrintFloat(op1->f -= value2);
6838 if(!exp->expType)
6839 {
6840 exp->expType = op1->type;
6841 if(op1->type)
6842 op1->type->refCount++;
6843 }
6844 return 0x1;
6845 }
6846
6847 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6848 {
6849 double value2 = op2->d;
6850
6851 exp->type = 2;
6852 exp->string = PrintDouble(op1->d -= value2);
6853 if(!exp->expType)
6854 {
6855 exp->expType = op1->type;
6856 if(op1->type)
6857 op1->type->refCount++;
6858 }
6859 return 0x1;
6860 }
6861
6862 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6863 {
6864 int value2 = op2->i;
6865
6866 exp->type = 2;
6867 exp->string = PrintInt(op1->i *= value2);
6868 if(!exp->expType)
6869 {
6870 exp->expType = op1->type;
6871 if(op1->type)
6872 op1->type->refCount++;
6873 }
6874 return 0x1;
6875 }
6876
6877 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6878 {
6879 unsigned int value2 = op2->ui;
6880
6881 exp->type = 2;
6882 exp->string = PrintUInt(op1->ui *= value2);
6883 if(!exp->expType)
6884 {
6885 exp->expType = op1->type;
6886 if(op1->type)
6887 op1->type->refCount++;
6888 }
6889 return 0x1;
6890 }
6891
6892 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6893 {
6894 short value2 = op2->s;
6895
6896 exp->type = 2;
6897 exp->string = PrintShort(op1->s *= value2);
6898 if(!exp->expType)
6899 {
6900 exp->expType = op1->type;
6901 if(op1->type)
6902 op1->type->refCount++;
6903 }
6904 return 0x1;
6905 }
6906
6907 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6908 {
6909 unsigned short value2 = op2->us;
6910
6911 exp->type = 2;
6912 exp->string = PrintUShort(op1->us *= value2);
6913 if(!exp->expType)
6914 {
6915 exp->expType = op1->type;
6916 if(op1->type)
6917 op1->type->refCount++;
6918 }
6919 return 0x1;
6920 }
6921
6922 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6923 {
6924 char value2 = op2->c;
6925
6926 exp->type = 2;
6927 exp->string = PrintChar(op1->c *= value2);
6928 if(!exp->expType)
6929 {
6930 exp->expType = op1->type;
6931 if(op1->type)
6932 op1->type->refCount++;
6933 }
6934 return 0x1;
6935 }
6936
6937 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6938 {
6939 unsigned char value2 = op2->uc;
6940
6941 exp->type = 2;
6942 exp->string = PrintUChar(op1->uc *= value2);
6943 if(!exp->expType)
6944 {
6945 exp->expType = op1->type;
6946 if(op1->type)
6947 op1->type->refCount++;
6948 }
6949 return 0x1;
6950 }
6951
6952 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6953 {
6954 float value2 = op2->f;
6955
6956 exp->type = 2;
6957 exp->string = PrintFloat(op1->f *= value2);
6958 if(!exp->expType)
6959 {
6960 exp->expType = op1->type;
6961 if(op1->type)
6962 op1->type->refCount++;
6963 }
6964 return 0x1;
6965 }
6966
6967 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6968 {
6969 double value2 = op2->d;
6970
6971 exp->type = 2;
6972 exp->string = PrintDouble(op1->d *= value2);
6973 if(!exp->expType)
6974 {
6975 exp->expType = op1->type;
6976 if(op1->type)
6977 op1->type->refCount++;
6978 }
6979 return 0x1;
6980 }
6981
6982 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6983 {
6984 int value2 = op2->i;
6985
6986 exp->type = 2;
6987 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
6988 if(!exp->expType)
6989 {
6990 exp->expType = op1->type;
6991 if(op1->type)
6992 op1->type->refCount++;
6993 }
6994 return 0x1;
6995 }
6996
6997 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6998 {
6999 unsigned int value2 = op2->ui;
7000
7001 exp->type = 2;
7002 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
7003 if(!exp->expType)
7004 {
7005 exp->expType = op1->type;
7006 if(op1->type)
7007 op1->type->refCount++;
7008 }
7009 return 0x1;
7010 }
7011
7012 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7013 {
7014 short value2 = op2->s;
7015
7016 exp->type = 2;
7017 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
7018 if(!exp->expType)
7019 {
7020 exp->expType = op1->type;
7021 if(op1->type)
7022 op1->type->refCount++;
7023 }
7024 return 0x1;
7025 }
7026
7027 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7028 {
7029 unsigned short value2 = op2->us;
7030
7031 exp->type = 2;
7032 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
7033 if(!exp->expType)
7034 {
7035 exp->expType = op1->type;
7036 if(op1->type)
7037 op1->type->refCount++;
7038 }
7039 return 0x1;
7040 }
7041
7042 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7043 {
7044 char value2 = op2->c;
7045
7046 exp->type = 2;
7047 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
7048 if(!exp->expType)
7049 {
7050 exp->expType = op1->type;
7051 if(op1->type)
7052 op1->type->refCount++;
7053 }
7054 return 0x1;
7055 }
7056
7057 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7058 {
7059 unsigned char value2 = op2->uc;
7060
7061 exp->type = 2;
7062 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
7063 if(!exp->expType)
7064 {
7065 exp->expType = op1->type;
7066 if(op1->type)
7067 op1->type->refCount++;
7068 }
7069 return 0x1;
7070 }
7071
7072 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7073 {
7074 float value2 = op2->f;
7075
7076 exp->type = 2;
7077 exp->string = PrintFloat(value2 ? (op1->f /= value2) : 0);
7078 if(!exp->expType)
7079 {
7080 exp->expType = op1->type;
7081 if(op1->type)
7082 op1->type->refCount++;
7083 }
7084 return 0x1;
7085 }
7086
7087 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7088 {
7089 double value2 = op2->d;
7090
7091 exp->type = 2;
7092 exp->string = PrintDouble(value2 ? (op1->d /= value2) : 0);
7093 if(!exp->expType)
7094 {
7095 exp->expType = op1->type;
7096 if(op1->type)
7097 op1->type->refCount++;
7098 }
7099 return 0x1;
7100 }
7101
7102 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7103 {
7104 int value2 = op2->i;
7105
7106 exp->type = 2;
7107 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
7108 if(!exp->expType)
7109 {
7110 exp->expType = op1->type;
7111 if(op1->type)
7112 op1->type->refCount++;
7113 }
7114 return 0x1;
7115 }
7116
7117 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7118 {
7119 unsigned int value2 = op2->ui;
7120
7121 exp->type = 2;
7122 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
7123 if(!exp->expType)
7124 {
7125 exp->expType = op1->type;
7126 if(op1->type)
7127 op1->type->refCount++;
7128 }
7129 return 0x1;
7130 }
7131
7132 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7133 {
7134 short value2 = op2->s;
7135
7136 exp->type = 2;
7137 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
7138 if(!exp->expType)
7139 {
7140 exp->expType = op1->type;
7141 if(op1->type)
7142 op1->type->refCount++;
7143 }
7144 return 0x1;
7145 }
7146
7147 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7148 {
7149 unsigned short value2 = op2->us;
7150
7151 exp->type = 2;
7152 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
7153 if(!exp->expType)
7154 {
7155 exp->expType = op1->type;
7156 if(op1->type)
7157 op1->type->refCount++;
7158 }
7159 return 0x1;
7160 }
7161
7162 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7163 {
7164 char value2 = op2->c;
7165
7166 exp->type = 2;
7167 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
7168 if(!exp->expType)
7169 {
7170 exp->expType = op1->type;
7171 if(op1->type)
7172 op1->type->refCount++;
7173 }
7174 return 0x1;
7175 }
7176
7177 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7178 {
7179 unsigned char value2 = op2->uc;
7180
7181 exp->type = 2;
7182 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
7183 if(!exp->expType)
7184 {
7185 exp->expType = op1->type;
7186 if(op1->type)
7187 op1->type->refCount++;
7188 }
7189 return 0x1;
7190 }
7191
7192 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7193 {
7194 int value2 = op2->i;
7195
7196 exp->type = 2;
7197 exp->string = PrintInt(op1->i & value2);
7198 if(!exp->expType)
7199 {
7200 exp->expType = op1->type;
7201 if(op1->type)
7202 op1->type->refCount++;
7203 }
7204 return 0x1;
7205 }
7206
7207 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7208 {
7209 unsigned int value2 = op2->ui;
7210
7211 exp->type = 2;
7212 exp->string = PrintUInt(op1->ui & value2);
7213 if(!exp->expType)
7214 {
7215 exp->expType = op1->type;
7216 if(op1->type)
7217 op1->type->refCount++;
7218 }
7219 return 0x1;
7220 }
7221
7222 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7223 {
7224 short value2 = op2->s;
7225
7226 exp->type = 2;
7227 exp->string = PrintShort(op1->s & value2);
7228 if(!exp->expType)
7229 {
7230 exp->expType = op1->type;
7231 if(op1->type)
7232 op1->type->refCount++;
7233 }
7234 return 0x1;
7235 }
7236
7237 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7238 {
7239 unsigned short value2 = op2->us;
7240
7241 exp->type = 2;
7242 exp->string = PrintUShort(op1->us & value2);
7243 if(!exp->expType)
7244 {
7245 exp->expType = op1->type;
7246 if(op1->type)
7247 op1->type->refCount++;
7248 }
7249 return 0x1;
7250 }
7251
7252 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7253 {
7254 char value2 = op2->c;
7255
7256 exp->type = 2;
7257 exp->string = PrintChar(op1->c & value2);
7258 if(!exp->expType)
7259 {
7260 exp->expType = op1->type;
7261 if(op1->type)
7262 op1->type->refCount++;
7263 }
7264 return 0x1;
7265 }
7266
7267 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7268 {
7269 unsigned char value2 = op2->uc;
7270
7271 exp->type = 2;
7272 exp->string = PrintUChar(op1->uc & value2);
7273 if(!exp->expType)
7274 {
7275 exp->expType = op1->type;
7276 if(op1->type)
7277 op1->type->refCount++;
7278 }
7279 return 0x1;
7280 }
7281
7282 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7283 {
7284 int value2 = op2->i;
7285
7286 exp->type = 2;
7287 exp->string = PrintInt(op1->i | value2);
7288 if(!exp->expType)
7289 {
7290 exp->expType = op1->type;
7291 if(op1->type)
7292 op1->type->refCount++;
7293 }
7294 return 0x1;
7295 }
7296
7297 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7298 {
7299 unsigned int value2 = op2->ui;
7300
7301 exp->type = 2;
7302 exp->string = PrintUInt(op1->ui | value2);
7303 if(!exp->expType)
7304 {
7305 exp->expType = op1->type;
7306 if(op1->type)
7307 op1->type->refCount++;
7308 }
7309 return 0x1;
7310 }
7311
7312 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7313 {
7314 short value2 = op2->s;
7315
7316 exp->type = 2;
7317 exp->string = PrintShort(op1->s | value2);
7318 if(!exp->expType)
7319 {
7320 exp->expType = op1->type;
7321 if(op1->type)
7322 op1->type->refCount++;
7323 }
7324 return 0x1;
7325 }
7326
7327 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7328 {
7329 unsigned short value2 = op2->us;
7330
7331 exp->type = 2;
7332 exp->string = PrintUShort(op1->us | value2);
7333 if(!exp->expType)
7334 {
7335 exp->expType = op1->type;
7336 if(op1->type)
7337 op1->type->refCount++;
7338 }
7339 return 0x1;
7340 }
7341
7342 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7343 {
7344 char value2 = op2->c;
7345
7346 exp->type = 2;
7347 exp->string = PrintChar(op1->c | value2);
7348 if(!exp->expType)
7349 {
7350 exp->expType = op1->type;
7351 if(op1->type)
7352 op1->type->refCount++;
7353 }
7354 return 0x1;
7355 }
7356
7357 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7358 {
7359 unsigned char value2 = op2->uc;
7360
7361 exp->type = 2;
7362 exp->string = PrintUChar(op1->uc | value2);
7363 if(!exp->expType)
7364 {
7365 exp->expType = op1->type;
7366 if(op1->type)
7367 op1->type->refCount++;
7368 }
7369 return 0x1;
7370 }
7371
7372 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7373 {
7374 int value2 = op2->i;
7375
7376 exp->type = 2;
7377 exp->string = PrintInt(op1->i ^ value2);
7378 if(!exp->expType)
7379 {
7380 exp->expType = op1->type;
7381 if(op1->type)
7382 op1->type->refCount++;
7383 }
7384 return 0x1;
7385 }
7386
7387 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7388 {
7389 unsigned int value2 = op2->ui;
7390
7391 exp->type = 2;
7392 exp->string = PrintUInt(op1->ui ^ value2);
7393 if(!exp->expType)
7394 {
7395 exp->expType = op1->type;
7396 if(op1->type)
7397 op1->type->refCount++;
7398 }
7399 return 0x1;
7400 }
7401
7402 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7403 {
7404 short value2 = op2->s;
7405
7406 exp->type = 2;
7407 exp->string = PrintShort(op1->s ^ value2);
7408 if(!exp->expType)
7409 {
7410 exp->expType = op1->type;
7411 if(op1->type)
7412 op1->type->refCount++;
7413 }
7414 return 0x1;
7415 }
7416
7417 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7418 {
7419 unsigned short value2 = op2->us;
7420
7421 exp->type = 2;
7422 exp->string = PrintUShort(op1->us ^ value2);
7423 if(!exp->expType)
7424 {
7425 exp->expType = op1->type;
7426 if(op1->type)
7427 op1->type->refCount++;
7428 }
7429 return 0x1;
7430 }
7431
7432 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7433 {
7434 char value2 = op2->c;
7435
7436 exp->type = 2;
7437 exp->string = PrintChar(op1->c ^ value2);
7438 if(!exp->expType)
7439 {
7440 exp->expType = op1->type;
7441 if(op1->type)
7442 op1->type->refCount++;
7443 }
7444 return 0x1;
7445 }
7446
7447 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7448 {
7449 unsigned char value2 = op2->uc;
7450
7451 exp->type = 2;
7452 exp->string = PrintUChar(op1->uc ^ value2);
7453 if(!exp->expType)
7454 {
7455 exp->expType = op1->type;
7456 if(op1->type)
7457 op1->type->refCount++;
7458 }
7459 return 0x1;
7460 }
7461
7462 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7463 {
7464 int value2 = op2->i;
7465
7466 exp->type = 2;
7467 exp->string = PrintInt(op1->i << value2);
7468 if(!exp->expType)
7469 {
7470 exp->expType = op1->type;
7471 if(op1->type)
7472 op1->type->refCount++;
7473 }
7474 return 0x1;
7475 }
7476
7477 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7478 {
7479 unsigned int value2 = op2->ui;
7480
7481 exp->type = 2;
7482 exp->string = PrintUInt(op1->ui << value2);
7483 if(!exp->expType)
7484 {
7485 exp->expType = op1->type;
7486 if(op1->type)
7487 op1->type->refCount++;
7488 }
7489 return 0x1;
7490 }
7491
7492 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7493 {
7494 short value2 = op2->s;
7495
7496 exp->type = 2;
7497 exp->string = PrintShort(op1->s << value2);
7498 if(!exp->expType)
7499 {
7500 exp->expType = op1->type;
7501 if(op1->type)
7502 op1->type->refCount++;
7503 }
7504 return 0x1;
7505 }
7506
7507 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7508 {
7509 unsigned short value2 = op2->us;
7510
7511 exp->type = 2;
7512 exp->string = PrintUShort(op1->us << value2);
7513 if(!exp->expType)
7514 {
7515 exp->expType = op1->type;
7516 if(op1->type)
7517 op1->type->refCount++;
7518 }
7519 return 0x1;
7520 }
7521
7522 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7523 {
7524 char value2 = op2->c;
7525
7526 exp->type = 2;
7527 exp->string = PrintChar(op1->c << value2);
7528 if(!exp->expType)
7529 {
7530 exp->expType = op1->type;
7531 if(op1->type)
7532 op1->type->refCount++;
7533 }
7534 return 0x1;
7535 }
7536
7537 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7538 {
7539 unsigned char value2 = op2->uc;
7540
7541 exp->type = 2;
7542 exp->string = PrintUChar(op1->uc << value2);
7543 if(!exp->expType)
7544 {
7545 exp->expType = op1->type;
7546 if(op1->type)
7547 op1->type->refCount++;
7548 }
7549 return 0x1;
7550 }
7551
7552 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7553 {
7554 int value2 = op2->i;
7555
7556 exp->type = 2;
7557 exp->string = PrintInt(op1->i >> value2);
7558 if(!exp->expType)
7559 {
7560 exp->expType = op1->type;
7561 if(op1->type)
7562 op1->type->refCount++;
7563 }
7564 return 0x1;
7565 }
7566
7567 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7568 {
7569 unsigned int value2 = op2->ui;
7570
7571 exp->type = 2;
7572 exp->string = PrintUInt(op1->ui >> value2);
7573 if(!exp->expType)
7574 {
7575 exp->expType = op1->type;
7576 if(op1->type)
7577 op1->type->refCount++;
7578 }
7579 return 0x1;
7580 }
7581
7582 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7583 {
7584 short value2 = op2->s;
7585
7586 exp->type = 2;
7587 exp->string = PrintShort(op1->s >> value2);
7588 if(!exp->expType)
7589 {
7590 exp->expType = op1->type;
7591 if(op1->type)
7592 op1->type->refCount++;
7593 }
7594 return 0x1;
7595 }
7596
7597 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7598 {
7599 unsigned short value2 = op2->us;
7600
7601 exp->type = 2;
7602 exp->string = PrintUShort(op1->us >> value2);
7603 if(!exp->expType)
7604 {
7605 exp->expType = op1->type;
7606 if(op1->type)
7607 op1->type->refCount++;
7608 }
7609 return 0x1;
7610 }
7611
7612 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7613 {
7614 char value2 = op2->c;
7615
7616 exp->type = 2;
7617 exp->string = PrintChar(op1->c >> value2);
7618 if(!exp->expType)
7619 {
7620 exp->expType = op1->type;
7621 if(op1->type)
7622 op1->type->refCount++;
7623 }
7624 return 0x1;
7625 }
7626
7627 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7628 {
7629 unsigned char value2 = op2->uc;
7630
7631 exp->type = 2;
7632 exp->string = PrintUChar(op1->uc >> value2);
7633 if(!exp->expType)
7634 {
7635 exp->expType = op1->type;
7636 if(op1->type)
7637 op1->type->refCount++;
7638 }
7639 return 0x1;
7640 }
7641
7642 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
7643 {
7644 exp->type = 2;
7645 exp->string = PrintInt(~op1->i);
7646 if(!exp->expType)
7647 {
7648 exp->expType = op1->type;
7649 if(op1->type)
7650 op1->type->refCount++;
7651 }
7652 return 0x1;
7653 }
7654
7655 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
7656 {
7657 exp->type = 2;
7658 exp->string = PrintUInt(~op1->ui);
7659 if(!exp->expType)
7660 {
7661 exp->expType = op1->type;
7662 if(op1->type)
7663 op1->type->refCount++;
7664 }
7665 return 0x1;
7666 }
7667
7668 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
7669 {
7670 exp->type = 2;
7671 exp->string = PrintShort(~op1->s);
7672 if(!exp->expType)
7673 {
7674 exp->expType = op1->type;
7675 if(op1->type)
7676 op1->type->refCount++;
7677 }
7678 return 0x1;
7679 }
7680
7681 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
7682 {
7683 exp->type = 2;
7684 exp->string = PrintUShort(~op1->us);
7685 if(!exp->expType)
7686 {
7687 exp->expType = op1->type;
7688 if(op1->type)
7689 op1->type->refCount++;
7690 }
7691 return 0x1;
7692 }
7693
7694 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
7695 {
7696 exp->type = 2;
7697 exp->string = PrintChar(~op1->c);
7698 if(!exp->expType)
7699 {
7700 exp->expType = op1->type;
7701 if(op1->type)
7702 op1->type->refCount++;
7703 }
7704 return 0x1;
7705 }
7706
7707 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
7708 {
7709 exp->type = 2;
7710 exp->string = PrintUChar(~op1->uc);
7711 if(!exp->expType)
7712 {
7713 exp->expType = op1->type;
7714 if(op1->type)
7715 op1->type->refCount++;
7716 }
7717 return 0x1;
7718 }
7719
7720 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7721 {
7722 int value2 = op2->i;
7723
7724 exp->type = 2;
7725 exp->string = PrintInt(op1->i &= value2);
7726 if(!exp->expType)
7727 {
7728 exp->expType = op1->type;
7729 if(op1->type)
7730 op1->type->refCount++;
7731 }
7732 return 0x1;
7733 }
7734
7735 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7736 {
7737 unsigned int value2 = op2->ui;
7738
7739 exp->type = 2;
7740 exp->string = PrintUInt(op1->ui &= value2);
7741 if(!exp->expType)
7742 {
7743 exp->expType = op1->type;
7744 if(op1->type)
7745 op1->type->refCount++;
7746 }
7747 return 0x1;
7748 }
7749
7750 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7751 {
7752 short value2 = op2->s;
7753
7754 exp->type = 2;
7755 exp->string = PrintShort(op1->s &= value2);
7756 if(!exp->expType)
7757 {
7758 exp->expType = op1->type;
7759 if(op1->type)
7760 op1->type->refCount++;
7761 }
7762 return 0x1;
7763 }
7764
7765 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7766 {
7767 unsigned short value2 = op2->us;
7768
7769 exp->type = 2;
7770 exp->string = PrintUShort(op1->us &= value2);
7771 if(!exp->expType)
7772 {
7773 exp->expType = op1->type;
7774 if(op1->type)
7775 op1->type->refCount++;
7776 }
7777 return 0x1;
7778 }
7779
7780 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7781 {
7782 char value2 = op2->c;
7783
7784 exp->type = 2;
7785 exp->string = PrintChar(op1->c &= value2);
7786 if(!exp->expType)
7787 {
7788 exp->expType = op1->type;
7789 if(op1->type)
7790 op1->type->refCount++;
7791 }
7792 return 0x1;
7793 }
7794
7795 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7796 {
7797 unsigned char value2 = op2->uc;
7798
7799 exp->type = 2;
7800 exp->string = PrintUChar(op1->uc &= value2);
7801 if(!exp->expType)
7802 {
7803 exp->expType = op1->type;
7804 if(op1->type)
7805 op1->type->refCount++;
7806 }
7807 return 0x1;
7808 }
7809
7810 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7811 {
7812 int value2 = op2->i;
7813
7814 exp->type = 2;
7815 exp->string = PrintInt(op1->i |= value2);
7816 if(!exp->expType)
7817 {
7818 exp->expType = op1->type;
7819 if(op1->type)
7820 op1->type->refCount++;
7821 }
7822 return 0x1;
7823 }
7824
7825 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7826 {
7827 unsigned int value2 = op2->ui;
7828
7829 exp->type = 2;
7830 exp->string = PrintUInt(op1->ui |= value2);
7831 if(!exp->expType)
7832 {
7833 exp->expType = op1->type;
7834 if(op1->type)
7835 op1->type->refCount++;
7836 }
7837 return 0x1;
7838 }
7839
7840 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7841 {
7842 short value2 = op2->s;
7843
7844 exp->type = 2;
7845 exp->string = PrintShort(op1->s |= value2);
7846 if(!exp->expType)
7847 {
7848 exp->expType = op1->type;
7849 if(op1->type)
7850 op1->type->refCount++;
7851 }
7852 return 0x1;
7853 }
7854
7855 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7856 {
7857 unsigned short value2 = op2->us;
7858
7859 exp->type = 2;
7860 exp->string = PrintUShort(op1->us |= value2);
7861 if(!exp->expType)
7862 {
7863 exp->expType = op1->type;
7864 if(op1->type)
7865 op1->type->refCount++;
7866 }
7867 return 0x1;
7868 }
7869
7870 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7871 {
7872 char value2 = op2->c;
7873
7874 exp->type = 2;
7875 exp->string = PrintChar(op1->c |= value2);
7876 if(!exp->expType)
7877 {
7878 exp->expType = op1->type;
7879 if(op1->type)
7880 op1->type->refCount++;
7881 }
7882 return 0x1;
7883 }
7884
7885 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7886 {
7887 unsigned char value2 = op2->uc;
7888
7889 exp->type = 2;
7890 exp->string = PrintUChar(op1->uc |= value2);
7891 if(!exp->expType)
7892 {
7893 exp->expType = op1->type;
7894 if(op1->type)
7895 op1->type->refCount++;
7896 }
7897 return 0x1;
7898 }
7899
7900 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7901 {
7902 int value2 = op2->i;
7903
7904 exp->type = 2;
7905 exp->string = PrintInt(op1->i ^= value2);
7906 if(!exp->expType)
7907 {
7908 exp->expType = op1->type;
7909 if(op1->type)
7910 op1->type->refCount++;
7911 }
7912 return 0x1;
7913 }
7914
7915 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7916 {
7917 unsigned int value2 = op2->ui;
7918
7919 exp->type = 2;
7920 exp->string = PrintUInt(op1->ui ^= value2);
7921 if(!exp->expType)
7922 {
7923 exp->expType = op1->type;
7924 if(op1->type)
7925 op1->type->refCount++;
7926 }
7927 return 0x1;
7928 }
7929
7930 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7931 {
7932 short value2 = op2->s;
7933
7934 exp->type = 2;
7935 exp->string = PrintShort(op1->s ^= value2);
7936 if(!exp->expType)
7937 {
7938 exp->expType = op1->type;
7939 if(op1->type)
7940 op1->type->refCount++;
7941 }
7942 return 0x1;
7943 }
7944
7945 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7946 {
7947 unsigned short value2 = op2->us;
7948
7949 exp->type = 2;
7950 exp->string = PrintUShort(op1->us ^= value2);
7951 if(!exp->expType)
7952 {
7953 exp->expType = op1->type;
7954 if(op1->type)
7955 op1->type->refCount++;
7956 }
7957 return 0x1;
7958 }
7959
7960 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7961 {
7962 char value2 = op2->c;
7963
7964 exp->type = 2;
7965 exp->string = PrintChar(op1->c ^= value2);
7966 if(!exp->expType)
7967 {
7968 exp->expType = op1->type;
7969 if(op1->type)
7970 op1->type->refCount++;
7971 }
7972 return 0x1;
7973 }
7974
7975 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7976 {
7977 unsigned char value2 = op2->uc;
7978
7979 exp->type = 2;
7980 exp->string = PrintUChar(op1->uc ^= value2);
7981 if(!exp->expType)
7982 {
7983 exp->expType = op1->type;
7984 if(op1->type)
7985 op1->type->refCount++;
7986 }
7987 return 0x1;
7988 }
7989
7990 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7991 {
7992 int value2 = op2->i;
7993
7994 exp->type = 2;
7995 exp->string = PrintInt(op1->i <<= value2);
7996 if(!exp->expType)
7997 {
7998 exp->expType = op1->type;
7999 if(op1->type)
8000 op1->type->refCount++;
8001 }
8002 return 0x1;
8003 }
8004
8005 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8006 {
8007 unsigned int value2 = op2->ui;
8008
8009 exp->type = 2;
8010 exp->string = PrintUInt(op1->ui <<= value2);
8011 if(!exp->expType)
8012 {
8013 exp->expType = op1->type;
8014 if(op1->type)
8015 op1->type->refCount++;
8016 }
8017 return 0x1;
8018 }
8019
8020 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8021 {
8022 short value2 = op2->s;
8023
8024 exp->type = 2;
8025 exp->string = PrintShort(op1->s <<= value2);
8026 if(!exp->expType)
8027 {
8028 exp->expType = op1->type;
8029 if(op1->type)
8030 op1->type->refCount++;
8031 }
8032 return 0x1;
8033 }
8034
8035 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8036 {
8037 unsigned short value2 = op2->us;
8038
8039 exp->type = 2;
8040 exp->string = PrintUShort(op1->us <<= value2);
8041 if(!exp->expType)
8042 {
8043 exp->expType = op1->type;
8044 if(op1->type)
8045 op1->type->refCount++;
8046 }
8047 return 0x1;
8048 }
8049
8050 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8051 {
8052 char value2 = op2->c;
8053
8054 exp->type = 2;
8055 exp->string = PrintChar(op1->c <<= value2);
8056 if(!exp->expType)
8057 {
8058 exp->expType = op1->type;
8059 if(op1->type)
8060 op1->type->refCount++;
8061 }
8062 return 0x1;
8063 }
8064
8065 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8066 {
8067 unsigned char value2 = op2->uc;
8068
8069 exp->type = 2;
8070 exp->string = PrintUChar(op1->uc <<= value2);
8071 if(!exp->expType)
8072 {
8073 exp->expType = op1->type;
8074 if(op1->type)
8075 op1->type->refCount++;
8076 }
8077 return 0x1;
8078 }
8079
8080 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8081 {
8082 int value2 = op2->i;
8083
8084 exp->type = 2;
8085 exp->string = PrintInt(op1->i >>= value2);
8086 if(!exp->expType)
8087 {
8088 exp->expType = op1->type;
8089 if(op1->type)
8090 op1->type->refCount++;
8091 }
8092 return 0x1;
8093 }
8094
8095 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8096 {
8097 unsigned int value2 = op2->ui;
8098
8099 exp->type = 2;
8100 exp->string = PrintUInt(op1->ui >>= value2);
8101 if(!exp->expType)
8102 {
8103 exp->expType = op1->type;
8104 if(op1->type)
8105 op1->type->refCount++;
8106 }
8107 return 0x1;
8108 }
8109
8110 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8111 {
8112 short value2 = op2->s;
8113
8114 exp->type = 2;
8115 exp->string = PrintShort(op1->s >>= value2);
8116 if(!exp->expType)
8117 {
8118 exp->expType = op1->type;
8119 if(op1->type)
8120 op1->type->refCount++;
8121 }
8122 return 0x1;
8123 }
8124
8125 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8126 {
8127 unsigned short value2 = op2->us;
8128
8129 exp->type = 2;
8130 exp->string = PrintUShort(op1->us >>= value2);
8131 if(!exp->expType)
8132 {
8133 exp->expType = op1->type;
8134 if(op1->type)
8135 op1->type->refCount++;
8136 }
8137 return 0x1;
8138 }
8139
8140 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8141 {
8142 char value2 = op2->c;
8143
8144 exp->type = 2;
8145 exp->string = PrintChar(op1->c >>= value2);
8146 if(!exp->expType)
8147 {
8148 exp->expType = op1->type;
8149 if(op1->type)
8150 op1->type->refCount++;
8151 }
8152 return 0x1;
8153 }
8154
8155 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8156 {
8157 unsigned char value2 = op2->uc;
8158
8159 exp->type = 2;
8160 exp->string = PrintUChar(op1->uc >>= value2);
8161 if(!exp->expType)
8162 {
8163 exp->expType = op1->type;
8164 if(op1->type)
8165 op1->type->refCount++;
8166 }
8167 return 0x1;
8168 }
8169
8170 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
8171 {
8172 exp->type = 2;
8173 exp->string = PrintInt(!op1->i);
8174 if(!exp->expType)
8175 {
8176 exp->expType = op1->type;
8177 if(op1->type)
8178 op1->type->refCount++;
8179 }
8180 return 0x1;
8181 }
8182
8183 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
8184 {
8185 exp->type = 2;
8186 exp->string = PrintUInt(!op1->ui);
8187 if(!exp->expType)
8188 {
8189 exp->expType = op1->type;
8190 if(op1->type)
8191 op1->type->refCount++;
8192 }
8193 return 0x1;
8194 }
8195
8196 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
8197 {
8198 exp->type = 2;
8199 exp->string = PrintShort(!op1->s);
8200 if(!exp->expType)
8201 {
8202 exp->expType = op1->type;
8203 if(op1->type)
8204 op1->type->refCount++;
8205 }
8206 return 0x1;
8207 }
8208
8209 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
8210 {
8211 exp->type = 2;
8212 exp->string = PrintUShort(!op1->us);
8213 if(!exp->expType)
8214 {
8215 exp->expType = op1->type;
8216 if(op1->type)
8217 op1->type->refCount++;
8218 }
8219 return 0x1;
8220 }
8221
8222 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
8223 {
8224 exp->type = 2;
8225 exp->string = PrintChar(!op1->c);
8226 if(!exp->expType)
8227 {
8228 exp->expType = op1->type;
8229 if(op1->type)
8230 op1->type->refCount++;
8231 }
8232 return 0x1;
8233 }
8234
8235 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
8236 {
8237 exp->type = 2;
8238 exp->string = PrintUChar(!op1->uc);
8239 if(!exp->expType)
8240 {
8241 exp->expType = op1->type;
8242 if(op1->type)
8243 op1->type->refCount++;
8244 }
8245 return 0x1;
8246 }
8247
8248 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8249 {
8250 int value2 = op2->i;
8251
8252 exp->type = 2;
8253 exp->string = PrintInt(op1->i == value2);
8254 if(!exp->expType)
8255 {
8256 exp->expType = op1->type;
8257 if(op1->type)
8258 op1->type->refCount++;
8259 }
8260 return 0x1;
8261 }
8262
8263 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8264 {
8265 unsigned int value2 = op2->ui;
8266
8267 exp->type = 2;
8268 exp->string = PrintUInt(op1->ui == value2);
8269 if(!exp->expType)
8270 {
8271 exp->expType = op1->type;
8272 if(op1->type)
8273 op1->type->refCount++;
8274 }
8275 return 0x1;
8276 }
8277
8278 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8279 {
8280 short value2 = op2->s;
8281
8282 exp->type = 2;
8283 exp->string = PrintShort(op1->s == value2);
8284 if(!exp->expType)
8285 {
8286 exp->expType = op1->type;
8287 if(op1->type)
8288 op1->type->refCount++;
8289 }
8290 return 0x1;
8291 }
8292
8293 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8294 {
8295 unsigned short value2 = op2->us;
8296
8297 exp->type = 2;
8298 exp->string = PrintUShort(op1->us == value2);
8299 if(!exp->expType)
8300 {
8301 exp->expType = op1->type;
8302 if(op1->type)
8303 op1->type->refCount++;
8304 }
8305 return 0x1;
8306 }
8307
8308 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8309 {
8310 char value2 = op2->c;
8311
8312 exp->type = 2;
8313 exp->string = PrintChar(op1->c == value2);
8314 if(!exp->expType)
8315 {
8316 exp->expType = op1->type;
8317 if(op1->type)
8318 op1->type->refCount++;
8319 }
8320 return 0x1;
8321 }
8322
8323 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8324 {
8325 unsigned char value2 = op2->uc;
8326
8327 exp->type = 2;
8328 exp->string = PrintUChar(op1->uc == value2);
8329 if(!exp->expType)
8330 {
8331 exp->expType = op1->type;
8332 if(op1->type)
8333 op1->type->refCount++;
8334 }
8335 return 0x1;
8336 }
8337
8338 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8339 {
8340 float value2 = op2->f;
8341
8342 exp->type = 2;
8343 exp->string = PrintFloat(op1->f == value2);
8344 if(!exp->expType)
8345 {
8346 exp->expType = op1->type;
8347 if(op1->type)
8348 op1->type->refCount++;
8349 }
8350 return 0x1;
8351 }
8352
8353 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8354 {
8355 double value2 = op2->d;
8356
8357 exp->type = 2;
8358 exp->string = PrintDouble(op1->d == value2);
8359 if(!exp->expType)
8360 {
8361 exp->expType = op1->type;
8362 if(op1->type)
8363 op1->type->refCount++;
8364 }
8365 return 0x1;
8366 }
8367
8368 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8369 {
8370 int value2 = op2->i;
8371
8372 exp->type = 2;
8373 exp->string = PrintInt(op1->i != value2);
8374 if(!exp->expType)
8375 {
8376 exp->expType = op1->type;
8377 if(op1->type)
8378 op1->type->refCount++;
8379 }
8380 return 0x1;
8381 }
8382
8383 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8384 {
8385 unsigned int value2 = op2->ui;
8386
8387 exp->type = 2;
8388 exp->string = PrintUInt(op1->ui != value2);
8389 if(!exp->expType)
8390 {
8391 exp->expType = op1->type;
8392 if(op1->type)
8393 op1->type->refCount++;
8394 }
8395 return 0x1;
8396 }
8397
8398 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8399 {
8400 short value2 = op2->s;
8401
8402 exp->type = 2;
8403 exp->string = PrintShort(op1->s != value2);
8404 if(!exp->expType)
8405 {
8406 exp->expType = op1->type;
8407 if(op1->type)
8408 op1->type->refCount++;
8409 }
8410 return 0x1;
8411 }
8412
8413 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8414 {
8415 unsigned short value2 = op2->us;
8416
8417 exp->type = 2;
8418 exp->string = PrintUShort(op1->us != value2);
8419 if(!exp->expType)
8420 {
8421 exp->expType = op1->type;
8422 if(op1->type)
8423 op1->type->refCount++;
8424 }
8425 return 0x1;
8426 }
8427
8428 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8429 {
8430 char value2 = op2->c;
8431
8432 exp->type = 2;
8433 exp->string = PrintChar(op1->c != value2);
8434 if(!exp->expType)
8435 {
8436 exp->expType = op1->type;
8437 if(op1->type)
8438 op1->type->refCount++;
8439 }
8440 return 0x1;
8441 }
8442
8443 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8444 {
8445 unsigned char value2 = op2->uc;
8446
8447 exp->type = 2;
8448 exp->string = PrintUChar(op1->uc != value2);
8449 if(!exp->expType)
8450 {
8451 exp->expType = op1->type;
8452 if(op1->type)
8453 op1->type->refCount++;
8454 }
8455 return 0x1;
8456 }
8457
8458 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8459 {
8460 float value2 = op2->f;
8461
8462 exp->type = 2;
8463 exp->string = PrintFloat(op1->f != value2);
8464 if(!exp->expType)
8465 {
8466 exp->expType = op1->type;
8467 if(op1->type)
8468 op1->type->refCount++;
8469 }
8470 return 0x1;
8471 }
8472
8473 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8474 {
8475 double value2 = op2->d;
8476
8477 exp->type = 2;
8478 exp->string = PrintDouble(op1->d != value2);
8479 if(!exp->expType)
8480 {
8481 exp->expType = op1->type;
8482 if(op1->type)
8483 op1->type->refCount++;
8484 }
8485 return 0x1;
8486 }
8487
8488 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8489 {
8490 int value2 = op2->i;
8491
8492 exp->type = 2;
8493 exp->string = PrintInt(op1->i && value2);
8494 if(!exp->expType)
8495 {
8496 exp->expType = op1->type;
8497 if(op1->type)
8498 op1->type->refCount++;
8499 }
8500 return 0x1;
8501 }
8502
8503 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8504 {
8505 unsigned int value2 = op2->ui;
8506
8507 exp->type = 2;
8508 exp->string = PrintUInt(op1->ui && value2);
8509 if(!exp->expType)
8510 {
8511 exp->expType = op1->type;
8512 if(op1->type)
8513 op1->type->refCount++;
8514 }
8515 return 0x1;
8516 }
8517
8518 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8519 {
8520 short value2 = op2->s;
8521
8522 exp->type = 2;
8523 exp->string = PrintShort(op1->s && value2);
8524 if(!exp->expType)
8525 {
8526 exp->expType = op1->type;
8527 if(op1->type)
8528 op1->type->refCount++;
8529 }
8530 return 0x1;
8531 }
8532
8533 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8534 {
8535 unsigned short value2 = op2->us;
8536
8537 exp->type = 2;
8538 exp->string = PrintUShort(op1->us && value2);
8539 if(!exp->expType)
8540 {
8541 exp->expType = op1->type;
8542 if(op1->type)
8543 op1->type->refCount++;
8544 }
8545 return 0x1;
8546 }
8547
8548 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8549 {
8550 char value2 = op2->c;
8551
8552 exp->type = 2;
8553 exp->string = PrintChar(op1->c && value2);
8554 if(!exp->expType)
8555 {
8556 exp->expType = op1->type;
8557 if(op1->type)
8558 op1->type->refCount++;
8559 }
8560 return 0x1;
8561 }
8562
8563 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8564 {
8565 unsigned char value2 = op2->uc;
8566
8567 exp->type = 2;
8568 exp->string = PrintUChar(op1->uc && value2);
8569 if(!exp->expType)
8570 {
8571 exp->expType = op1->type;
8572 if(op1->type)
8573 op1->type->refCount++;
8574 }
8575 return 0x1;
8576 }
8577
8578 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8579 {
8580 float value2 = op2->f;
8581
8582 exp->type = 2;
8583 exp->string = PrintFloat(op1->f && value2);
8584 if(!exp->expType)
8585 {
8586 exp->expType = op1->type;
8587 if(op1->type)
8588 op1->type->refCount++;
8589 }
8590 return 0x1;
8591 }
8592
8593 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8594 {
8595 double value2 = op2->d;
8596
8597 exp->type = 2;
8598 exp->string = PrintDouble(op1->d && value2);
8599 if(!exp->expType)
8600 {
8601 exp->expType = op1->type;
8602 if(op1->type)
8603 op1->type->refCount++;
8604 }
8605 return 0x1;
8606 }
8607
8608 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8609 {
8610 int value2 = op2->i;
8611
8612 exp->type = 2;
8613 exp->string = PrintInt(op1->i || value2);
8614 if(!exp->expType)
8615 {
8616 exp->expType = op1->type;
8617 if(op1->type)
8618 op1->type->refCount++;
8619 }
8620 return 0x1;
8621 }
8622
8623 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8624 {
8625 unsigned int value2 = op2->ui;
8626
8627 exp->type = 2;
8628 exp->string = PrintUInt(op1->ui || value2);
8629 if(!exp->expType)
8630 {
8631 exp->expType = op1->type;
8632 if(op1->type)
8633 op1->type->refCount++;
8634 }
8635 return 0x1;
8636 }
8637
8638 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8639 {
8640 short value2 = op2->s;
8641
8642 exp->type = 2;
8643 exp->string = PrintShort(op1->s || value2);
8644 if(!exp->expType)
8645 {
8646 exp->expType = op1->type;
8647 if(op1->type)
8648 op1->type->refCount++;
8649 }
8650 return 0x1;
8651 }
8652
8653 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8654 {
8655 unsigned short value2 = op2->us;
8656
8657 exp->type = 2;
8658 exp->string = PrintUShort(op1->us || value2);
8659 if(!exp->expType)
8660 {
8661 exp->expType = op1->type;
8662 if(op1->type)
8663 op1->type->refCount++;
8664 }
8665 return 0x1;
8666 }
8667
8668 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8669 {
8670 char value2 = op2->c;
8671
8672 exp->type = 2;
8673 exp->string = PrintChar(op1->c || value2);
8674 if(!exp->expType)
8675 {
8676 exp->expType = op1->type;
8677 if(op1->type)
8678 op1->type->refCount++;
8679 }
8680 return 0x1;
8681 }
8682
8683 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8684 {
8685 unsigned char value2 = op2->uc;
8686
8687 exp->type = 2;
8688 exp->string = PrintUChar(op1->uc || value2);
8689 if(!exp->expType)
8690 {
8691 exp->expType = op1->type;
8692 if(op1->type)
8693 op1->type->refCount++;
8694 }
8695 return 0x1;
8696 }
8697
8698 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8699 {
8700 float value2 = op2->f;
8701
8702 exp->type = 2;
8703 exp->string = PrintFloat(op1->f || value2);
8704 if(!exp->expType)
8705 {
8706 exp->expType = op1->type;
8707 if(op1->type)
8708 op1->type->refCount++;
8709 }
8710 return 0x1;
8711 }
8712
8713 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8714 {
8715 double value2 = op2->d;
8716
8717 exp->type = 2;
8718 exp->string = PrintDouble(op1->d || value2);
8719 if(!exp->expType)
8720 {
8721 exp->expType = op1->type;
8722 if(op1->type)
8723 op1->type->refCount++;
8724 }
8725 return 0x1;
8726 }
8727
8728 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8729 {
8730 int value2 = op2->i;
8731
8732 exp->type = 2;
8733 exp->string = PrintInt(op1->i > value2);
8734 if(!exp->expType)
8735 {
8736 exp->expType = op1->type;
8737 if(op1->type)
8738 op1->type->refCount++;
8739 }
8740 return 0x1;
8741 }
8742
8743 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8744 {
8745 unsigned int value2 = op2->ui;
8746
8747 exp->type = 2;
8748 exp->string = PrintUInt(op1->ui > value2);
8749 if(!exp->expType)
8750 {
8751 exp->expType = op1->type;
8752 if(op1->type)
8753 op1->type->refCount++;
8754 }
8755 return 0x1;
8756 }
8757
8758 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8759 {
8760 short value2 = op2->s;
8761
8762 exp->type = 2;
8763 exp->string = PrintShort(op1->s > value2);
8764 if(!exp->expType)
8765 {
8766 exp->expType = op1->type;
8767 if(op1->type)
8768 op1->type->refCount++;
8769 }
8770 return 0x1;
8771 }
8772
8773 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8774 {
8775 unsigned short value2 = op2->us;
8776
8777 exp->type = 2;
8778 exp->string = PrintUShort(op1->us > value2);
8779 if(!exp->expType)
8780 {
8781 exp->expType = op1->type;
8782 if(op1->type)
8783 op1->type->refCount++;
8784 }
8785 return 0x1;
8786 }
8787
8788 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8789 {
8790 char value2 = op2->c;
8791
8792 exp->type = 2;
8793 exp->string = PrintChar(op1->c > value2);
8794 if(!exp->expType)
8795 {
8796 exp->expType = op1->type;
8797 if(op1->type)
8798 op1->type->refCount++;
8799 }
8800 return 0x1;
8801 }
8802
8803 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8804 {
8805 unsigned char value2 = op2->uc;
8806
8807 exp->type = 2;
8808 exp->string = PrintUChar(op1->uc > value2);
8809 if(!exp->expType)
8810 {
8811 exp->expType = op1->type;
8812 if(op1->type)
8813 op1->type->refCount++;
8814 }
8815 return 0x1;
8816 }
8817
8818 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8819 {
8820 float value2 = op2->f;
8821
8822 exp->type = 2;
8823 exp->string = PrintFloat(op1->f > value2);
8824 if(!exp->expType)
8825 {
8826 exp->expType = op1->type;
8827 if(op1->type)
8828 op1->type->refCount++;
8829 }
8830 return 0x1;
8831 }
8832
8833 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8834 {
8835 double value2 = op2->d;
8836
8837 exp->type = 2;
8838 exp->string = PrintDouble(op1->d > value2);
8839 if(!exp->expType)
8840 {
8841 exp->expType = op1->type;
8842 if(op1->type)
8843 op1->type->refCount++;
8844 }
8845 return 0x1;
8846 }
8847
8848 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8849 {
8850 int value2 = op2->i;
8851
8852 exp->type = 2;
8853 exp->string = PrintInt(op1->i < value2);
8854 if(!exp->expType)
8855 {
8856 exp->expType = op1->type;
8857 if(op1->type)
8858 op1->type->refCount++;
8859 }
8860 return 0x1;
8861 }
8862
8863 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8864 {
8865 unsigned int value2 = op2->ui;
8866
8867 exp->type = 2;
8868 exp->string = PrintUInt(op1->ui < value2);
8869 if(!exp->expType)
8870 {
8871 exp->expType = op1->type;
8872 if(op1->type)
8873 op1->type->refCount++;
8874 }
8875 return 0x1;
8876 }
8877
8878 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8879 {
8880 short value2 = op2->s;
8881
8882 exp->type = 2;
8883 exp->string = PrintShort(op1->s < value2);
8884 if(!exp->expType)
8885 {
8886 exp->expType = op1->type;
8887 if(op1->type)
8888 op1->type->refCount++;
8889 }
8890 return 0x1;
8891 }
8892
8893 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8894 {
8895 unsigned short value2 = op2->us;
8896
8897 exp->type = 2;
8898 exp->string = PrintUShort(op1->us < value2);
8899 if(!exp->expType)
8900 {
8901 exp->expType = op1->type;
8902 if(op1->type)
8903 op1->type->refCount++;
8904 }
8905 return 0x1;
8906 }
8907
8908 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8909 {
8910 char value2 = op2->c;
8911
8912 exp->type = 2;
8913 exp->string = PrintChar(op1->c < value2);
8914 if(!exp->expType)
8915 {
8916 exp->expType = op1->type;
8917 if(op1->type)
8918 op1->type->refCount++;
8919 }
8920 return 0x1;
8921 }
8922
8923 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8924 {
8925 unsigned char value2 = op2->uc;
8926
8927 exp->type = 2;
8928 exp->string = PrintUChar(op1->uc < value2);
8929 if(!exp->expType)
8930 {
8931 exp->expType = op1->type;
8932 if(op1->type)
8933 op1->type->refCount++;
8934 }
8935 return 0x1;
8936 }
8937
8938 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8939 {
8940 float value2 = op2->f;
8941
8942 exp->type = 2;
8943 exp->string = PrintFloat(op1->f < value2);
8944 if(!exp->expType)
8945 {
8946 exp->expType = op1->type;
8947 if(op1->type)
8948 op1->type->refCount++;
8949 }
8950 return 0x1;
8951 }
8952
8953 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8954 {
8955 double value2 = op2->d;
8956
8957 exp->type = 2;
8958 exp->string = PrintDouble(op1->d < value2);
8959 if(!exp->expType)
8960 {
8961 exp->expType = op1->type;
8962 if(op1->type)
8963 op1->type->refCount++;
8964 }
8965 return 0x1;
8966 }
8967
8968 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8969 {
8970 int value2 = op2->i;
8971
8972 exp->type = 2;
8973 exp->string = PrintInt(op1->i >= value2);
8974 if(!exp->expType)
8975 {
8976 exp->expType = op1->type;
8977 if(op1->type)
8978 op1->type->refCount++;
8979 }
8980 return 0x1;
8981 }
8982
8983 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8984 {
8985 unsigned int value2 = op2->ui;
8986
8987 exp->type = 2;
8988 exp->string = PrintUInt(op1->ui >= value2);
8989 if(!exp->expType)
8990 {
8991 exp->expType = op1->type;
8992 if(op1->type)
8993 op1->type->refCount++;
8994 }
8995 return 0x1;
8996 }
8997
8998 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8999 {
9000 short value2 = op2->s;
9001
9002 exp->type = 2;
9003 exp->string = PrintShort(op1->s >= value2);
9004 if(!exp->expType)
9005 {
9006 exp->expType = op1->type;
9007 if(op1->type)
9008 op1->type->refCount++;
9009 }
9010 return 0x1;
9011 }
9012
9013 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9014 {
9015 unsigned short value2 = op2->us;
9016
9017 exp->type = 2;
9018 exp->string = PrintUShort(op1->us >= value2);
9019 if(!exp->expType)
9020 {
9021 exp->expType = op1->type;
9022 if(op1->type)
9023 op1->type->refCount++;
9024 }
9025 return 0x1;
9026 }
9027
9028 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9029 {
9030 char value2 = op2->c;
9031
9032 exp->type = 2;
9033 exp->string = PrintChar(op1->c >= value2);
9034 if(!exp->expType)
9035 {
9036 exp->expType = op1->type;
9037 if(op1->type)
9038 op1->type->refCount++;
9039 }
9040 return 0x1;
9041 }
9042
9043 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9044 {
9045 unsigned char value2 = op2->uc;
9046
9047 exp->type = 2;
9048 exp->string = PrintUChar(op1->uc >= value2);
9049 if(!exp->expType)
9050 {
9051 exp->expType = op1->type;
9052 if(op1->type)
9053 op1->type->refCount++;
9054 }
9055 return 0x1;
9056 }
9057
9058 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9059 {
9060 float value2 = op2->f;
9061
9062 exp->type = 2;
9063 exp->string = PrintFloat(op1->f >= value2);
9064 if(!exp->expType)
9065 {
9066 exp->expType = op1->type;
9067 if(op1->type)
9068 op1->type->refCount++;
9069 }
9070 return 0x1;
9071 }
9072
9073 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9074 {
9075 double value2 = op2->d;
9076
9077 exp->type = 2;
9078 exp->string = PrintDouble(op1->d >= value2);
9079 if(!exp->expType)
9080 {
9081 exp->expType = op1->type;
9082 if(op1->type)
9083 op1->type->refCount++;
9084 }
9085 return 0x1;
9086 }
9087
9088 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9089 {
9090 int value2 = op2->i;
9091
9092 exp->type = 2;
9093 exp->string = PrintInt(op1->i <= value2);
9094 if(!exp->expType)
9095 {
9096 exp->expType = op1->type;
9097 if(op1->type)
9098 op1->type->refCount++;
9099 }
9100 return 0x1;
9101 }
9102
9103 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9104 {
9105 unsigned int value2 = op2->ui;
9106
9107 exp->type = 2;
9108 exp->string = PrintUInt(op1->ui <= value2);
9109 if(!exp->expType)
9110 {
9111 exp->expType = op1->type;
9112 if(op1->type)
9113 op1->type->refCount++;
9114 }
9115 return 0x1;
9116 }
9117
9118 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9119 {
9120 short value2 = op2->s;
9121
9122 exp->type = 2;
9123 exp->string = PrintShort(op1->s <= value2);
9124 if(!exp->expType)
9125 {
9126 exp->expType = op1->type;
9127 if(op1->type)
9128 op1->type->refCount++;
9129 }
9130 return 0x1;
9131 }
9132
9133 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9134 {
9135 unsigned short value2 = op2->us;
9136
9137 exp->type = 2;
9138 exp->string = PrintUShort(op1->us <= value2);
9139 if(!exp->expType)
9140 {
9141 exp->expType = op1->type;
9142 if(op1->type)
9143 op1->type->refCount++;
9144 }
9145 return 0x1;
9146 }
9147
9148 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9149 {
9150 char value2 = op2->c;
9151
9152 exp->type = 2;
9153 exp->string = PrintChar(op1->c <= value2);
9154 if(!exp->expType)
9155 {
9156 exp->expType = op1->type;
9157 if(op1->type)
9158 op1->type->refCount++;
9159 }
9160 return 0x1;
9161 }
9162
9163 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9164 {
9165 unsigned char value2 = op2->uc;
9166
9167 exp->type = 2;
9168 exp->string = PrintUChar(op1->uc <= value2);
9169 if(!exp->expType)
9170 {
9171 exp->expType = op1->type;
9172 if(op1->type)
9173 op1->type->refCount++;
9174 }
9175 return 0x1;
9176 }
9177
9178 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9179 {
9180 float value2 = op2->f;
9181
9182 exp->type = 2;
9183 exp->string = PrintFloat(op1->f <= value2);
9184 if(!exp->expType)
9185 {
9186 exp->expType = op1->type;
9187 if(op1->type)
9188 op1->type->refCount++;
9189 }
9190 return 0x1;
9191 }
9192
9193 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9194 {
9195 double value2 = op2->d;
9196
9197 exp->type = 2;
9198 exp->string = PrintDouble(op1->d <= value2);
9199 if(!exp->expType)
9200 {
9201 exp->expType = op1->type;
9202 if(op1->type)
9203 op1->type->refCount++;
9204 }
9205 return 0x1;
9206 }
9207
9208 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9209 {
9210 exp->type = 2;
9211 exp->string = PrintInt(op1->i ? op2->i : op3->i);
9212 if(!exp->expType)
9213 {
9214 exp->expType = op1->type;
9215 if(op1->type)
9216 op1->type->refCount++;
9217 }
9218 return 0x1;
9219 }
9220
9221 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9222 {
9223 exp->type = 2;
9224 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
9225 if(!exp->expType)
9226 {
9227 exp->expType = op1->type;
9228 if(op1->type)
9229 op1->type->refCount++;
9230 }
9231 return 0x1;
9232 }
9233
9234 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9235 {
9236 exp->type = 2;
9237 exp->string = PrintShort(op1->s ? op2->s : op3->s);
9238 if(!exp->expType)
9239 {
9240 exp->expType = op1->type;
9241 if(op1->type)
9242 op1->type->refCount++;
9243 }
9244 return 0x1;
9245 }
9246
9247 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9248 {
9249 exp->type = 2;
9250 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
9251 if(!exp->expType)
9252 {
9253 exp->expType = op1->type;
9254 if(op1->type)
9255 op1->type->refCount++;
9256 }
9257 return 0x1;
9258 }
9259
9260 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9261 {
9262 exp->type = 2;
9263 exp->string = PrintChar(op1->c ? op2->c : op3->c);
9264 if(!exp->expType)
9265 {
9266 exp->expType = op1->type;
9267 if(op1->type)
9268 op1->type->refCount++;
9269 }
9270 return 0x1;
9271 }
9272
9273 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9274 {
9275 exp->type = 2;
9276 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
9277 if(!exp->expType)
9278 {
9279 exp->expType = op1->type;
9280 if(op1->type)
9281 op1->type->refCount++;
9282 }
9283 return 0x1;
9284 }
9285
9286 static unsigned int FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9287 {
9288 exp->type = 2;
9289 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
9290 if(!exp->expType)
9291 {
9292 exp->expType = op1->type;
9293 if(op1->type)
9294 op1->type->refCount++;
9295 }
9296 return 0x1;
9297 }
9298
9299 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9300 {
9301 exp->type = 2;
9302 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
9303 if(!exp->expType)
9304 {
9305 exp->expType = op1->type;
9306 if(op1->type)
9307 op1->type->refCount++;
9308 }
9309 return 0x1;
9310 }
9311
9312 struct OpTable intOps = 
9313 {
9314 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
9315 };
9316
9317 struct OpTable uintOps = 
9318 {
9319 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
9320 };
9321
9322 struct OpTable shortOps = 
9323 {
9324 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
9325 };
9326
9327 struct OpTable ushortOps = 
9328 {
9329 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
9330 };
9331
9332 struct OpTable floatOps = 
9333 {
9334 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
9335 };
9336
9337 struct OpTable doubleOps = 
9338 {
9339 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
9340 };
9341
9342 struct OpTable charOps = 
9343 {
9344 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
9345 };
9346
9347 struct OpTable ucharOps = 
9348 {
9349 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
9350 };
9351
9352 void ReadString(char * output, char * string)
9353 {
9354 int len = strlen(string);
9355 int c, d = 0;
9356 unsigned int quoted = 0x0, escaped = 0x0;
9357
9358 for(c = 0; c < len; c++)
9359 {
9360 char ch = string[c];
9361
9362 if(escaped)
9363 {
9364 switch(ch)
9365 {
9366 case 'n':
9367 output[d] = '\n';
9368 break;
9369 case 't':
9370 output[d] = '\t';
9371 break;
9372 case 'a':
9373 output[d] = '\a';
9374 break;
9375 case 'b':
9376 output[d] = '\b';
9377 break;
9378 case 'f':
9379 output[d] = '\f';
9380 break;
9381 case 'r':
9382 output[d] = '\r';
9383 break;
9384 case 'v':
9385 output[d] = '\v';
9386 break;
9387 case '\\':
9388 output[d] = '\\';
9389 break;
9390 case '\"':
9391 output[d] = '\"';
9392 break;
9393 default:
9394 output[d++] = '\\';
9395 output[d] = ch;
9396 }
9397 d++;
9398 escaped = 0x0;
9399 }
9400 else
9401 {
9402 if(ch == '\"')
9403 quoted ^= 0x1;
9404 else if(quoted)
9405 {
9406 if(ch == '\\')
9407 escaped = 0x1;
9408 else
9409 output[d++] = ch;
9410 }
9411 }
9412 }
9413 output[d] = '\0';
9414 }
9415
9416 extern long long __ecereNameSpace__ecere__com___strtoi64(char *  string, char * *  endString, int base);
9417
9418 extern uint64 __ecereNameSpace__ecere__com___strtoui64(char *  string, char * *  endString, int base);
9419
9420 extern double strtod(char * , char * * );
9421
9422 struct Operand GetOperand(struct Expression * exp)
9423 {
9424 struct Operand op = 
9425 {
9426 0, 0, 0, 0, 
9427 {
9428 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
9429 }
9430 };
9431 struct Type * type = exp->expType;
9432
9433 if(type)
9434 {
9435 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9436 {
9437 if(!type->_class->registered->dataType)
9438 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9439 type = type->_class->registered->dataType;
9440 }
9441 op.kind = type->kind;
9442 op.type = exp->expType;
9443 if(exp->isConstant && exp->type == 2)
9444 {
9445 switch(op.kind)
9446 {
9447 case 1:
9448 {
9449 if(exp->constant[0] == '\'')
9450 op.c = exp->constant[1];
9451 else if(type->isSigned)
9452 {
9453 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9454 op.ops = charOps;
9455 }
9456 else
9457 {
9458 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9459 op.ops = ucharOps;
9460 }
9461 break;
9462 }
9463 case 2:
9464 if(type->isSigned)
9465 {
9466 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9467 op.ops = shortOps;
9468 }
9469 else
9470 {
9471 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9472 op.ops = ushortOps;
9473 }
9474 break;
9475 case 3:
9476 case 5:
9477 if(type->isSigned)
9478 {
9479 op.i = strtol(exp->constant, (((void *)0)), 0);
9480 op.ops = intOps;
9481 }
9482 else
9483 {
9484 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9485 op.ops = uintOps;
9486 }
9487 op.kind = 3;
9488 break;
9489 case 4:
9490 if(type->isSigned)
9491 {
9492 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9493 op.ops = intOps;
9494 }
9495 else
9496 {
9497 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9498 op.ops = uintOps;
9499 }
9500 op.kind = 3;
9501 break;
9502 case 22:
9503 if(type->isSigned)
9504 {
9505 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9506 op.ops = intOps;
9507 }
9508 else
9509 {
9510 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9511 op.ops = uintOps;
9512 }
9513 op.kind = 3;
9514 break;
9515 case 23:
9516 if(type->isSigned)
9517 {
9518 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9519 op.ops = intOps;
9520 }
9521 else
9522 {
9523 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9524 op.ops = uintOps;
9525 }
9526 op.kind = 3;
9527 break;
9528 case 6:
9529 op.f = (float)strtod(exp->constant, (((void *)0)));
9530 op.ops = floatOps;
9531 break;
9532 case 7:
9533 op.d = (double)strtod(exp->constant, (((void *)0)));
9534 op.ops = doubleOps;
9535 break;
9536 case 12:
9537 case 13:
9538 case 8:
9539 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9540 op.kind = 13;
9541 op.ops = uintOps;
9542 break;
9543 }
9544 }
9545 }
9546 return op;
9547 }
9548
9549 int __ecereVMethodID_class_OnGetString;
9550
9551 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9552
9553 static void UnusedFunction()
9554 {
9555 int a;
9556
9557 ((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);
9558 }
9559
9560 extern int __ecereVMethodID_class_OnGetString;
9561
9562 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9563 {
9564 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9565
9566 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9567 {
9568 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9569 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9570 else
9571 {
9572 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9573 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9574 struct Type * type;
9575 void * ptr = inst->data + dataMember->offset + offset;
9576 char * result = (((void *)0));
9577
9578 exp->loc = member->loc = inst->loc;
9579 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9580 if(!dataMember->dataType)
9581 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9582 type = dataMember->dataType;
9583 if(type->kind == 8)
9584 {
9585 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9586
9587 if(_class->type == 4)
9588 {
9589 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9590
9591 if(enumClass)
9592 {
9593 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9594 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9595
9596 for(item = e->values.first; item; item = item->next)
9597 {
9598 if((int)item->data == *(int *)ptr)
9599 {
9600 result = item->name;
9601 break;
9602 }
9603 }
9604 if(result)
9605 {
9606 exp->identifier = MkIdentifier(result);
9607 exp->type = 0;
9608 exp->destType = MkClassType(_class->fullName);
9609 ProcessExpressionType(exp);
9610 }
9611 }
9612 }
9613 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9614 {
9615 if(!_class->dataType)
9616 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9617 type = _class->dataType;
9618 }
9619 }
9620 if(!result)
9621 {
9622 switch(type->kind)
9623 {
9624 case 6:
9625 {
9626 FreeExpContents(exp);
9627 exp->constant = PrintFloat(*(float *)ptr);
9628 exp->type = 2;
9629 break;
9630 }
9631 case 7:
9632 {
9633 FreeExpContents(exp);
9634 exp->constant = PrintDouble(*(double *)ptr);
9635 exp->type = 2;
9636 break;
9637 }
9638 case 3:
9639 {
9640 FreeExpContents(exp);
9641 exp->constant = PrintInt(*(int *)ptr);
9642 exp->type = 2;
9643 break;
9644 }
9645 case 4:
9646 {
9647 FreeExpContents(exp);
9648 exp->constant = PrintInt64(*(long long *)ptr);
9649 exp->type = 2;
9650 break;
9651 }
9652 case 22:
9653 {
9654 FreeExpContents(exp);
9655 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9656 exp->type = 2;
9657 break;
9658 }
9659 case 23:
9660 {
9661 FreeExpContents(exp);
9662 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9663 exp->type = 2;
9664 break;
9665 }
9666 default:
9667 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9668 }
9669 }
9670 ListAdd(memberList, member);
9671 }
9672 if(parentDataMember->type == 1)
9673 break;
9674 }
9675 }
9676
9677 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9678
9679 void PopulateInstance(struct Instantiation * inst)
9680 {
9681 struct Symbol * classSym = inst->_class->symbol;
9682 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9683 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9684 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9685
9686 if(!inst->members)
9687 inst->members = MkListOne(MkMembersInitList(memberList));
9688 else
9689 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*inst->members), MkMembersInitList(memberList));
9690 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9691 {
9692 if(!dataMember->isProperty)
9693 {
9694 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9695 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9696 else
9697 {
9698 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9699 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9700 struct Type * type;
9701 void * ptr = inst->data + dataMember->offset;
9702 char * result = (((void *)0));
9703
9704 exp->loc = member->loc = inst->loc;
9705 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9706 if(!dataMember->dataType)
9707 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9708 type = dataMember->dataType;
9709 if(type->kind == 8)
9710 {
9711 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9712
9713 if(_class->type == 4)
9714 {
9715 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9716
9717 if(enumClass)
9718 {
9719 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9720 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9721
9722 for(item = e->values.first; item; item = item->next)
9723 {
9724 if((int)item->data == *(int *)ptr)
9725 {
9726 result = item->name;
9727 break;
9728 }
9729 }
9730 }
9731 if(result)
9732 {
9733 exp->identifier = MkIdentifier(result);
9734 exp->type = 0;
9735 exp->destType = MkClassType(_class->fullName);
9736 ProcessExpressionType(exp);
9737 }
9738 }
9739 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9740 {
9741 if(!_class->dataType)
9742 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9743 type = _class->dataType;
9744 }
9745 }
9746 if(!result)
9747 {
9748 switch(type->kind)
9749 {
9750 case 6:
9751 {
9752 exp->constant = PrintFloat(*(float *)ptr);
9753 exp->type = 2;
9754 break;
9755 }
9756 case 7:
9757 {
9758 exp->constant = PrintDouble(*(double *)ptr);
9759 exp->type = 2;
9760 break;
9761 }
9762 case 3:
9763 {
9764 exp->constant = PrintInt(*(int *)ptr);
9765 exp->type = 2;
9766 break;
9767 }
9768 case 4:
9769 {
9770 exp->constant = PrintInt64(*(long long *)ptr);
9771 exp->type = 2;
9772 break;
9773 }
9774 case 22:
9775 {
9776 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9777 exp->type = 2;
9778 break;
9779 }
9780 default:
9781 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9782 }
9783 }
9784 ListAdd(memberList, member);
9785 }
9786 }
9787 }
9788 }
9789
9790 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);
9791
9792 extern void FreeInstance(struct Instantiation * inst);
9793
9794 void ComputeInstantiation(struct Expression * exp)
9795 {
9796 struct Instantiation * inst = exp->instance;
9797 struct MembersInit * members;
9798 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9799 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9800 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9801 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9802 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9803 int subMemberStackPos = 0;
9804 uint64 bits = 0;
9805
9806 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9807 {
9808 if(inst->data)
9809 return ;
9810 if(_class->type == 0 || _class->type == 5)
9811 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9812 else
9813 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9814 }
9815 if(inst->members)
9816 {
9817 for(members = (*inst->members).first; members; members = members->next)
9818 {
9819 switch(members->type)
9820 {
9821 case 0:
9822 {
9823 if(members->dataMembers)
9824 {
9825 struct MemberInit * member;
9826
9827 for(member = (*members->dataMembers).first; member; member = member->next)
9828 {
9829 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9830 unsigned int found = 0x0;
9831 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9832 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9833 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9834 unsigned int dataMemberOffset;
9835
9836 if(!ident)
9837 {
9838 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9839 if(curMember)
9840 {
9841 if(curMember->isProperty)
9842 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9843 else
9844 {
9845 dataMember = curMember;
9846 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9847 if(_class->type == 0)
9848 dataMemberOffset += _class->base->structSize;
9849 }
9850 found = 0x1;
9851 }
9852 }
9853 else
9854 {
9855 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9856 if(prop)
9857 {
9858 found = 0x1;
9859 if(prop->memberAccess == 1)
9860 {
9861 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9862 curClass = prop->_class;
9863 }
9864 }
9865 else
9866 {
9867 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9868 int _subMemberStackPos = 0;
9869
9870 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9871 if(dataMember)
9872 {
9873 found = 0x1;
9874 if(dataMember->memberAccess == 1)
9875 {
9876 curMember = dataMember;
9877 curClass = dataMember->_class;
9878 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
9879 subMemberStackPos = _subMemberStackPos;
9880 }
9881 }
9882 }
9883 }
9884 if(found && member->initializer && member->initializer->type == 0)
9885 {
9886 struct Expression * value = member->initializer->exp;
9887 struct Type * type = (((void *)0));
9888 unsigned int deepMember = 0x0;
9889
9890 if(prop)
9891 {
9892 type = prop->dataType;
9893 }
9894 else if(dataMember)
9895 {
9896 if(!dataMember->dataType)
9897 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9898 type = dataMember->dataType;
9899 }
9900 if(ident && ident->next)
9901 {
9902 deepMember = 0x1;
9903 for(ident = ident->next; ident && type; ident = ident->next)
9904 {
9905 if(type->kind == 8)
9906 {
9907 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9908 if(prop)
9909 type = prop->dataType;
9910 else
9911 {
9912 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9913 if(dataMember)
9914 type = dataMember->dataType;
9915 }
9916 }
9917 else if(type->kind == 9 || type->kind == 10)
9918 {
9919 struct Type * memberType;
9920
9921 for(memberType = type->members.first; memberType; memberType = memberType->next)
9922 {
9923 if(!strcmp(memberType->name, ident->string))
9924 {
9925 type = memberType;
9926 break;
9927 }
9928 }
9929 }
9930 }
9931 }
9932 if(value)
9933 {
9934 FreeType(value->destType);
9935 value->destType = type;
9936 if(type)
9937 type->refCount++;
9938 ComputeExpression(value);
9939 }
9940 if(!deepMember && type && value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9941 {
9942 if(type->kind == 8)
9943 {
9944 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9945
9946 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9947 {
9948 if(!_class->dataType)
9949 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9950 type = _class->dataType;
9951 }
9952 }
9953 if(dataMember)
9954 {
9955 void * ptr = inst->data + dataMemberOffset;
9956
9957 if(value->type == 2)
9958 {
9959 switch(type->kind)
9960 {
9961 case 3:
9962 {
9963 GetInt(value, (int *)ptr);
9964 break;
9965 }
9966 case 4:
9967 {
9968 GetInt64(value, (long long *)ptr);
9969 break;
9970 }
9971 case 22:
9972 {
9973 GetIntPtr(value, (intptr_t *)ptr);
9974 break;
9975 }
9976 case 23:
9977 {
9978 GetIntSize(value, (ssize_t *)ptr);
9979 break;
9980 }
9981 case 6:
9982 {
9983 GetFloat(value, (float *)ptr);
9984 break;
9985 }
9986 case 7:
9987 {
9988 GetDouble(value, (double *)ptr);
9989 break;
9990 }
9991 }
9992 }
9993 else if(value->type == 1)
9994 {
9995 if(type->kind == 8)
9996 {
9997 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9998
9999 if(_class->type == 1)
10000 {
10001 ComputeTypeSize(type);
10002 if(value->instance->data)
10003 memcpy(ptr, value->instance->data, type->size);
10004 }
10005 }
10006 }
10007 }
10008 else if(prop)
10009 {
10010 if(value->type == 1 && value->instance->data)
10011 {
10012 if(type->kind == 8)
10013 {
10014 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10015
10016 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)))
10017 {
10018 void (* Set)(void *, void *) = (void *)prop->Set;
10019
10020 Set(inst->data, value->instance->data);
10021 PopulateInstance(inst);
10022 }
10023 }
10024 }
10025 else if(value->type == 2)
10026 {
10027 switch(type->kind)
10028 {
10029 case 7:
10030 {
10031 void (* Set)(void *, double) = (void *)prop->Set;
10032
10033 Set(inst->data, strtod(value->constant, (((void *)0))));
10034 break;
10035 }
10036 case 6:
10037 {
10038 void (* Set)(void *, float) = (void *)prop->Set;
10039
10040 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
10041 break;
10042 }
10043 case 3:
10044 {
10045 void (* Set)(void *, int) = (void *)prop->Set;
10046
10047 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
10048 break;
10049 }
10050 case 4:
10051 {
10052 void (* Set)(void *, long long) = (void *)prop->Set;
10053
10054 Set(inst->data, __ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10055 break;
10056 }
10057 case 22:
10058 {
10059 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10060
10061 Set(inst->data, (intptr_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10062 break;
10063 }
10064 case 23:
10065 {
10066 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10067
10068 Set(inst->data, (ssize_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10069 break;
10070 }
10071 }
10072 }
10073 else if(value->type == 3)
10074 {
10075 char temp[1024];
10076
10077 ReadString(temp, value->string);
10078 ((void (*)(void *, void *))(void *)prop->Set)(inst->data, temp);
10079 }
10080 }
10081 }
10082 else if(!deepMember && type && _class->type == 3)
10083 {
10084 if(prop)
10085 {
10086 if(value->type == 2)
10087 {
10088 if(type->kind == 8)
10089 {
10090 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10091
10092 if(_class->type == 3)
10093 {
10094 if(!_class->dataType)
10095 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10096 type = _class->dataType;
10097 }
10098 }
10099 switch(type->kind)
10100 {
10101 case 6:
10102 {
10103 float fValue;
10104 float (* Set)(float) = (void *)prop->Set;
10105
10106 GetFloat(member->initializer->exp, &fValue);
10107 exp->constant = PrintFloat(Set(fValue));
10108 exp->type = 2;
10109 break;
10110 }
10111 case 7:
10112 {
10113 double dValue;
10114 double (* Set)(double) = (void *)prop->Set;
10115
10116 GetDouble(member->initializer->exp, &dValue);
10117 exp->constant = PrintDouble(Set(dValue));
10118 exp->type = 2;
10119 break;
10120 }
10121 }
10122 }
10123 }
10124 }
10125 else if(!deepMember && type && _class->type == 2)
10126 {
10127 if(prop)
10128 {
10129 if(value->type == 1 && value->instance->data)
10130 {
10131 unsigned int (* Set)(void *) = (void *)prop->Set;
10132
10133 bits = Set(value->instance->data);
10134 }
10135 else if(value->type == 2)
10136 {
10137 }
10138 }
10139 else if(dataMember)
10140 {
10141 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
10142 struct Type * type;
10143 int part = 0;
10144
10145 GetInt(value, &part);
10146 bits = (bits & ~bitMember->mask);
10147 if(!bitMember->dataType)
10148 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
10149 type = bitMember->dataType;
10150 if(type->kind == 8 && type->_class && type->_class->registered)
10151 {
10152 if(!type->_class->registered->dataType)
10153 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
10154 type = type->_class->registered->dataType;
10155 }
10156 switch(type->kind)
10157 {
10158 case 1:
10159 if(type->isSigned)
10160 bits |= ((char)part << bitMember->pos);
10161 else
10162 bits |= ((unsigned char)part << bitMember->pos);
10163 break;
10164 case 2:
10165 if(type->isSigned)
10166 bits |= ((short)part << bitMember->pos);
10167 else
10168 bits |= ((unsigned short)part << bitMember->pos);
10169 break;
10170 case 3:
10171 case 5:
10172 if(type->isSigned)
10173 bits |= (part << bitMember->pos);
10174 else
10175 bits |= ((unsigned int)part << bitMember->pos);
10176 break;
10177 case 4:
10178 if(type->isSigned)
10179 bits |= ((long long)part << bitMember->pos);
10180 else
10181 bits |= ((uint64)part << bitMember->pos);
10182 break;
10183 case 22:
10184 if(type->isSigned)
10185 {
10186 bits |= ((intptr_t)part << bitMember->pos);
10187 }
10188 else
10189 {
10190 bits |= ((uintptr_t)part << bitMember->pos);
10191 }
10192 break;
10193 case 23:
10194 if(type->isSigned)
10195 {
10196 bits |= ((ssize_t)part << bitMember->pos);
10197 }
10198 else
10199 {
10200 bits |= ((size_t)part << bitMember->pos);
10201 }
10202 break;
10203 }
10204 }
10205 }
10206 }
10207 else
10208 {
10209 if(_class && _class->type == 3)
10210 {
10211 ComputeExpression(member->initializer->exp);
10212 exp->constant = member->initializer->exp->constant;
10213 exp->type = 2;
10214 member->initializer->exp->constant = (((void *)0));
10215 }
10216 }
10217 }
10218 }
10219 break;
10220 }
10221 }
10222 }
10223 }
10224 if(_class && _class->type == 2)
10225 {
10226 exp->constant = PrintHexUInt(bits);
10227 exp->type = 2;
10228 }
10229 if(exp->type != 1)
10230 {
10231 FreeInstance(inst);
10232 }
10233 }
10234
10235 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
10236 {
10237 if(exp->op.op == SIZEOF)
10238 {
10239 FreeExpContents(exp);
10240 exp->type = 2;
10241 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
10242 }
10243 else
10244 {
10245 if(!exp->op.exp1)
10246 {
10247 switch(exp->op.op)
10248 {
10249 case '+':
10250 {
10251 struct Expression * exp2 = exp->op.exp2;
10252
10253 exp->op.exp2 = (((void *)0));
10254 FreeExpContents(exp);
10255 FreeType(exp->expType);
10256 FreeType(exp->destType);
10257 *exp = *exp2;
10258 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
10259 break;
10260 }
10261 case '-':
10262 if(op1->ops.Neg)
10263 {
10264 FreeExpContents(exp);
10265 op1->ops.Neg(exp, op1);
10266 }
10267 break;
10268 case '~':
10269 if(op1->ops.BitNot)
10270 {
10271 FreeExpContents(exp);
10272 op1->ops.BitNot(exp, op1);
10273 }
10274 break;
10275 case '!':
10276 if(op1->ops.Not)
10277 {
10278 FreeExpContents(exp);
10279 op1->ops.Not(exp, op1);
10280 }
10281 break;
10282 }
10283 }
10284 else
10285 {
10286 switch(exp->op.op)
10287 {
10288 case '+':
10289 if(op1->ops.Add)
10290 {
10291 FreeExpContents(exp);
10292 op1->ops.Add(exp, op1, op2);
10293 }
10294 break;
10295 case '-':
10296 if(op1->ops.Sub)
10297 {
10298 FreeExpContents(exp);
10299 op1->ops.Sub(exp, op1, op2);
10300 }
10301 break;
10302 case '*':
10303 if(op1->ops.Mul)
10304 {
10305 FreeExpContents(exp);
10306 op1->ops.Mul(exp, op1, op2);
10307 }
10308 break;
10309 case '/':
10310 if(op1->ops.Div)
10311 {
10312 FreeExpContents(exp);
10313 op1->ops.Div(exp, op1, op2);
10314 }
10315 break;
10316 case '%':
10317 if(op1->ops.Mod)
10318 {
10319 FreeExpContents(exp);
10320 op1->ops.Mod(exp, op1, op2);
10321 }
10322 break;
10323 case '&':
10324 if(exp->op.exp2)
10325 {
10326 if(op1->ops.BitAnd)
10327 {
10328 FreeExpContents(exp);
10329 op1->ops.BitAnd(exp, op1, op2);
10330 }
10331 }
10332 break;
10333 case '|':
10334 if(op1->ops.BitOr)
10335 {
10336 FreeExpContents(exp);
10337 op1->ops.BitOr(exp, op1, op2);
10338 }
10339 break;
10340 case '^':
10341 if(op1->ops.BitXor)
10342 {
10343 FreeExpContents(exp);
10344 op1->ops.BitXor(exp, op1, op2);
10345 }
10346 break;
10347 case LEFT_OP:
10348 if(op1->ops.LShift)
10349 {
10350 FreeExpContents(exp);
10351 op1->ops.LShift(exp, op1, op2);
10352 }
10353 break;
10354 case RIGHT_OP:
10355 if(op1->ops.RShift)
10356 {
10357 FreeExpContents(exp);
10358 op1->ops.RShift(exp, op1, op2);
10359 }
10360 break;
10361 case EQ_OP:
10362 if(op1->ops.Equ)
10363 {
10364 FreeExpContents(exp);
10365 op1->ops.Equ(exp, op1, op2);
10366 }
10367 break;
10368 case NE_OP:
10369 if(op1->ops.Nqu)
10370 {
10371 FreeExpContents(exp);
10372 op1->ops.Nqu(exp, op1, op2);
10373 }
10374 break;
10375 case AND_OP:
10376 if(op1->ops.And)
10377 {
10378 FreeExpContents(exp);
10379 op1->ops.And(exp, op1, op2);
10380 }
10381 break;
10382 case OR_OP:
10383 if(op1->ops.Or)
10384 {
10385 FreeExpContents(exp);
10386 op1->ops.Or(exp, op1, op2);
10387 }
10388 break;
10389 case '>':
10390 if(op1->ops.Grt)
10391 {
10392 FreeExpContents(exp);
10393 op1->ops.Grt(exp, op1, op2);
10394 }
10395 break;
10396 case '<':
10397 if(op1->ops.Sma)
10398 {
10399 FreeExpContents(exp);
10400 op1->ops.Sma(exp, op1, op2);
10401 }
10402 break;
10403 case GE_OP:
10404 if(op1->ops.GrtEqu)
10405 {
10406 FreeExpContents(exp);
10407 op1->ops.GrtEqu(exp, op1, op2);
10408 }
10409 break;
10410 case LE_OP:
10411 if(op1->ops.SmaEqu)
10412 {
10413 FreeExpContents(exp);
10414 op1->ops.SmaEqu(exp, op1, op2);
10415 }
10416 break;
10417 }
10418 }
10419 }
10420 }
10421
10422 void PrintTypeNoConst(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
10423
10424 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10425
10426 void ComputeExpression(struct Expression * exp)
10427 {
10428 char expString[10240];
10429
10430 expString[0] = '\0';
10431 switch(exp->type)
10432 {
10433 case 1:
10434 {
10435 ComputeInstantiation(exp);
10436 break;
10437 }
10438 case 4:
10439 {
10440 struct Expression * exp1, * exp2 = (((void *)0));
10441 struct Operand op1 = 
10442 {
10443 0, 0, 0, 0, 
10444 {
10445 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10446 }
10447 };
10448 struct Operand op2 = 
10449 {
10450 0, 0, 0, 0, 
10451 {
10452 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10453 }
10454 };
10455
10456 if(exp->op.exp2)
10457 ComputeExpression(exp->op.exp2);
10458 if(exp->op.exp1)
10459 {
10460 ComputeExpression(exp->op.exp1);
10461 exp1 = exp->op.exp1;
10462 exp2 = exp->op.exp2;
10463 op1 = GetOperand(exp1);
10464 if(op1.type)
10465 op1.type->refCount++;
10466 if(exp2)
10467 {
10468 op2 = GetOperand(exp2);
10469 if(op2.type)
10470 op2.type->refCount++;
10471 }
10472 }
10473 else
10474 {
10475 exp1 = exp->op.exp2;
10476 op1 = GetOperand(exp1);
10477 if(op1.type)
10478 op1.type->refCount++;
10479 }
10480 CallOperator(exp, exp1, exp2, &op1, &op2);
10481 if(op1.type)
10482 FreeType(op1.type);
10483 if(op2.type)
10484 FreeType(op2.type);
10485 break;
10486 }
10487 case 5:
10488 case 34:
10489 {
10490 struct Expression * e, * n;
10491
10492 for(e = (*exp->list).first; e; e = n)
10493 {
10494 n = e->next;
10495 if(!n)
10496 {
10497 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10498
10499 ComputeExpression(e);
10500 FreeType(exp->expType);
10501 FreeType(exp->destType);
10502 *exp = *e;
10503 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10504 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10505 }
10506 else
10507 {
10508 FreeExpression(e);
10509 }
10510 }
10511 break;
10512 }
10513 case 8:
10514 {
10515 struct Expression * memberExp = exp->member.exp;
10516 struct Identifier * memberID = exp->member.member;
10517 struct Type * type;
10518
10519 ComputeExpression(exp->member.exp);
10520 type = exp->member.exp->expType;
10521 if(type)
10522 {
10523 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)));
10524 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10525 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10526 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10527
10528 if(type->kind == 19 && exp->member.exp->type == 26)
10529 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10530 if(!_class)
10531 {
10532 char string[256];
10533 struct Symbol * classSym;
10534
10535 string[0] = '\0';
10536 PrintTypeNoConst(type, string, 0x0, 0x1);
10537 classSym = FindClass(string);
10538 _class = classSym ? classSym->registered : (((void *)0));
10539 }
10540 if(exp->member.member)
10541 {
10542 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10543 if(!prop)
10544 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10545 }
10546 if(!prop && !member && _class && exp->member.member)
10547 {
10548 struct Symbol * classSym = FindClass(exp->member.member->string);
10549
10550 convertTo = _class;
10551 _class = classSym ? classSym->registered : (((void *)0));
10552 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10553 }
10554 if(prop)
10555 {
10556 if(prop->compiled)
10557 {
10558 struct Type * type = prop->dataType;
10559
10560 if(_class->type == 3)
10561 {
10562 if(type->kind == 8)
10563 {
10564 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10565
10566 if(_class->type == 3)
10567 {
10568 if(!_class->dataType)
10569 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10570 type = _class->dataType;
10571 }
10572 }
10573 switch(type->kind)
10574 {
10575 case 6:
10576 {
10577 float value;
10578 float (* Get)(float) = (void *)prop->Get;
10579
10580 GetFloat(exp->member.exp, &value);
10581 exp->constant = PrintFloat(Get ? Get(value) : value);
10582 exp->type = 2;
10583 break;
10584 }
10585 case 7:
10586 {
10587 double value;
10588 double (* Get)(double);
10589
10590 GetDouble(exp->member.exp, &value);
10591 if(convertTo)
10592 Get = (void *)prop->Set;
10593 else
10594 Get = (void *)prop->Get;
10595 exp->constant = PrintDouble(Get ? Get(value) : value);
10596 exp->type = 2;
10597 break;
10598 }
10599 }
10600 }
10601 else
10602 {
10603 if(convertTo)
10604 {
10605 struct Expression * value = exp->member.exp;
10606 struct Type * type;
10607
10608 if(!prop->dataType)
10609 ProcessPropertyType(prop);
10610 type = prop->dataType;
10611 if(!type)
10612 {
10613 }
10614 else if(_class->type == 1)
10615 {
10616 switch(type->kind)
10617 {
10618 case 8:
10619 {
10620 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10621
10622 if(propertyClass->type == 1 && value->type == 1)
10623 {
10624 void (* Set)(void *, void *) = (void *)prop->Set;
10625
10626 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10627 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10628 exp->instance->_class = MkSpecifierName(_class->fullName);
10629 exp->instance->loc = exp->loc;
10630 exp->type = 1;
10631 Set(exp->instance->data, value->instance->data);
10632 PopulateInstance(exp->instance);
10633 }
10634 break;
10635 }
10636 case 3:
10637 {
10638 int intValue;
10639 void (* Set)(void *, int) = (void *)prop->Set;
10640
10641 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10642 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10643 exp->instance->_class = MkSpecifierName(_class->fullName);
10644 exp->instance->loc = exp->loc;
10645 exp->type = 1;
10646 GetInt(value, &intValue);
10647 Set(exp->instance->data, intValue);
10648 PopulateInstance(exp->instance);
10649 break;
10650 }
10651 case 4:
10652 {
10653 long long intValue;
10654 void (* Set)(void *, long long) = (void *)prop->Set;
10655
10656 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10657 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10658 exp->instance->_class = MkSpecifierName(_class->fullName);
10659 exp->instance->loc = exp->loc;
10660 exp->type = 1;
10661 GetInt64(value, &intValue);
10662 Set(exp->instance->data, intValue);
10663 PopulateInstance(exp->instance);
10664 break;
10665 }
10666 case 22:
10667 {
10668 intptr_t intValue;
10669 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10670
10671 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10672 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10673 exp->instance->_class = MkSpecifierName(_class->fullName);
10674 exp->instance->loc = exp->loc;
10675 exp->type = 1;
10676 GetIntPtr(value, &intValue);
10677 Set(exp->instance->data, intValue);
10678 PopulateInstance(exp->instance);
10679 break;
10680 }
10681 case 23:
10682 {
10683 ssize_t intValue;
10684 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10685
10686 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10687 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10688 exp->instance->_class = MkSpecifierName(_class->fullName);
10689 exp->instance->loc = exp->loc;
10690 exp->type = 1;
10691 GetIntSize(value, &intValue);
10692 Set(exp->instance->data, intValue);
10693 PopulateInstance(exp->instance);
10694 break;
10695 }
10696 case 7:
10697 {
10698 double doubleValue;
10699 void (* Set)(void *, double) = (void *)prop->Set;
10700
10701 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10702 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10703 exp->instance->_class = MkSpecifierName(_class->fullName);
10704 exp->instance->loc = exp->loc;
10705 exp->type = 1;
10706 GetDouble(value, &doubleValue);
10707 Set(exp->instance->data, doubleValue);
10708 PopulateInstance(exp->instance);
10709 break;
10710 }
10711 }
10712 }
10713 else if(_class->type == 2)
10714 {
10715 switch(type->kind)
10716 {
10717 case 8:
10718 {
10719 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10720
10721 if(propertyClass->type == 1 && value->instance->data)
10722 {
10723 unsigned int (* Set)(void *) = (void *)prop->Set;
10724 unsigned int bits = Set(value->instance->data);
10725
10726 exp->constant = PrintHexUInt(bits);
10727 exp->type = 2;
10728 break;
10729 }
10730 else if(_class->type == 2)
10731 {
10732 unsigned int value;
10733 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10734 unsigned int bits;
10735
10736 GetUInt(exp->member.exp, &value);
10737 bits = Set(value);
10738 exp->constant = PrintHexUInt(bits);
10739 exp->type = 2;
10740 }
10741 }
10742 }
10743 }
10744 }
10745 else
10746 {
10747 if(_class->type == 2)
10748 {
10749 unsigned int value;
10750
10751 GetUInt(exp->member.exp, &value);
10752 switch(type->kind)
10753 {
10754 case 8:
10755 {
10756 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10757
10758 if(_class->type == 1)
10759 {
10760 void (* Get)(unsigned int, void *) = (void *)prop->Get;
10761
10762 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10763 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10764 exp->instance->_class = MkSpecifierName(_class->fullName);
10765 exp->instance->loc = exp->loc;
10766 exp->type = 1;
10767 Get(value, exp->instance->data);
10768 PopulateInstance(exp->instance);
10769 }
10770 else if(_class->type == 2)
10771 {
10772 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10773 uint64 bits = Get(value);
10774
10775 exp->constant = PrintHexUInt64(bits);
10776 exp->type = 2;
10777 }
10778 break;
10779 }
10780 }
10781 }
10782 else if(_class->type == 1)
10783 {
10784 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10785
10786 switch(type->kind)
10787 {
10788 case 8:
10789 {
10790 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10791
10792 if(_class->type == 1 && value)
10793 {
10794 void (* Get)(void *, void *) = (void *)prop->Get;
10795
10796 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10797 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10798 exp->instance->_class = MkSpecifierName(_class->fullName);
10799 exp->instance->loc = exp->loc;
10800 exp->type = 1;
10801 Get(value, exp->instance->data);
10802 PopulateInstance(exp->instance);
10803 }
10804 break;
10805 }
10806 }
10807 }
10808 }
10809 }
10810 }
10811 else
10812 {
10813 exp->isConstant = 0x0;
10814 }
10815 }
10816 else if(member)
10817 {
10818 }
10819 }
10820 if(exp->type != 8)
10821 {
10822 FreeExpression(memberExp);
10823 FreeIdentifier(memberID);
10824 }
10825 break;
10826 }
10827 case 10:
10828 {
10829 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10830
10831 FreeExpContents(exp);
10832 exp->constant = PrintUInt(ComputeTypeSize(type));
10833 exp->type = 2;
10834 FreeType(type);
10835 break;
10836 }
10837 case 15:
10838 {
10839 struct Symbol * classSym = exp->_class->symbol;
10840
10841 if(classSym && classSym->registered)
10842 {
10843 if(classSym->registered->fixed)
10844 {
10845 FreeSpecifier(exp->_class);
10846 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10847 exp->type = 2;
10848 }
10849 else
10850 {
10851 char className[1024];
10852
10853 strcpy(className, "__ecereClass_");
10854 FullClassNameCat(className, classSym->string, 0x1);
10855 MangleClassName(className);
10856 FreeExpContents(exp);
10857 exp->type = 9;
10858 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10859 exp->member.member = MkIdentifier("structSize");
10860 }
10861 }
10862 break;
10863 }
10864 case 11:
10865 {
10866 struct Type * type;
10867 struct Expression * e = exp;
10868
10869 if(exp->type == 11)
10870 {
10871 if(exp->cast.exp)
10872 ComputeExpression(exp->cast.exp);
10873 e = exp->cast.exp;
10874 }
10875 if(e && exp->expType)
10876 {
10877 type = exp->expType;
10878 if(type->kind == 8)
10879 {
10880 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10881
10882 if(_class && (_class->type == 3 || _class->type == 2))
10883 {
10884 if(!_class->dataType)
10885 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10886 type = _class->dataType;
10887 }
10888 }
10889 switch(type->kind)
10890 {
10891 case 1:
10892 if(type->isSigned)
10893 {
10894 char value;
10895
10896 GetChar(e, &value);
10897 FreeExpContents(exp);
10898 exp->constant = PrintChar(value);
10899 exp->type = 2;
10900 }
10901 else
10902 {
10903 unsigned char value;
10904
10905 GetUChar(e, &value);
10906 FreeExpContents(exp);
10907 exp->constant = PrintUChar(value);
10908 exp->type = 2;
10909 }
10910 break;
10911 case 2:
10912 if(type->isSigned)
10913 {
10914 short value;
10915
10916 GetShort(e, &value);
10917 FreeExpContents(exp);
10918 exp->constant = PrintShort(value);
10919 exp->type = 2;
10920 }
10921 else
10922 {
10923 unsigned short value;
10924
10925 GetUShort(e, &value);
10926 FreeExpContents(exp);
10927 exp->constant = PrintUShort(value);
10928 exp->type = 2;
10929 }
10930 break;
10931 case 3:
10932 if(type->isSigned)
10933 {
10934 int value;
10935
10936 GetInt(e, &value);
10937 FreeExpContents(exp);
10938 exp->constant = PrintInt(value);
10939 exp->type = 2;
10940 }
10941 else
10942 {
10943 unsigned int value;
10944
10945 GetUInt(e, &value);
10946 FreeExpContents(exp);
10947 exp->constant = PrintUInt(value);
10948 exp->type = 2;
10949 }
10950 break;
10951 case 4:
10952 if(type->isSigned)
10953 {
10954 long long value;
10955
10956 GetInt64(e, &value);
10957 FreeExpContents(exp);
10958 exp->constant = PrintInt64(value);
10959 exp->type = 2;
10960 }
10961 else
10962 {
10963 uint64 value;
10964
10965 GetUInt64(e, &value);
10966 FreeExpContents(exp);
10967 exp->constant = PrintUInt64(value);
10968 exp->type = 2;
10969 }
10970 break;
10971 case 22:
10972 if(type->isSigned)
10973 {
10974 intptr_t value;
10975
10976 GetIntPtr(e, &value);
10977 FreeExpContents(exp);
10978 exp->constant = PrintInt64((long long)value);
10979 exp->type = 2;
10980 }
10981 else
10982 {
10983 uintptr_t value;
10984
10985 GetUIntPtr(e, &value);
10986 FreeExpContents(exp);
10987 exp->constant = PrintUInt64((uint64)value);
10988 exp->type = 2;
10989 }
10990 break;
10991 case 23:
10992 if(type->isSigned)
10993 {
10994 ssize_t value;
10995
10996 GetIntSize(e, &value);
10997 FreeExpContents(exp);
10998 exp->constant = PrintInt64((long long)value);
10999 exp->type = 2;
11000 }
11001 else
11002 {
11003 size_t value;
11004
11005 GetUIntSize(e, &value);
11006 FreeExpContents(exp);
11007 exp->constant = PrintUInt64((uint64)value);
11008 exp->type = 2;
11009 }
11010 break;
11011 case 6:
11012 {
11013 float value;
11014
11015 GetFloat(e, &value);
11016 FreeExpContents(exp);
11017 exp->constant = PrintFloat(value);
11018 exp->type = 2;
11019 break;
11020 }
11021 case 7:
11022 {
11023 double value;
11024
11025 GetDouble(e, &value);
11026 FreeExpContents(exp);
11027 exp->constant = PrintDouble(value);
11028 exp->type = 2;
11029 break;
11030 }
11031 }
11032 }
11033 break;
11034 }
11035 case 12:
11036 {
11037 struct Operand op1 = 
11038 {
11039 0, 0, 0, 0, 
11040 {
11041 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11042 }
11043 };
11044 struct Operand op2 = 
11045 {
11046 0, 0, 0, 0, 
11047 {
11048 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11049 }
11050 };
11051 struct Operand op3 = 
11052 {
11053 0, 0, 0, 0, 
11054 {
11055 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11056 }
11057 };
11058
11059 if(exp->cond.exp)
11060 ComputeExpression((*exp->cond.exp).last);
11061 if(exp->cond.elseExp)
11062 ComputeExpression(exp->cond.elseExp);
11063 if(exp->cond.cond)
11064 ComputeExpression(exp->cond.cond);
11065 op1 = GetOperand(exp->cond.cond);
11066 if(op1.type)
11067 op1.type->refCount++;
11068 op2 = GetOperand((*exp->cond.exp).last);
11069 if(op2.type)
11070 op2.type->refCount++;
11071 op3 = GetOperand(exp->cond.elseExp);
11072 if(op3.type)
11073 op3.type->refCount++;
11074 if(op1.ops.Cond)
11075 {
11076 FreeExpContents(exp);
11077 op1.ops.Cond(exp, &op1, &op2, &op3);
11078 }
11079 if(op1.type)
11080 FreeType(op1.type);
11081 if(op2.type)
11082 FreeType(op2.type);
11083 if(op3.type)
11084 FreeType(op3.type);
11085 break;
11086 }
11087 }
11088 }
11089
11090 void ApplyAnyObjectLogic(struct Expression * e);
11091
11092 extern void CopyTypeInto(struct Type * type, struct Type * src);
11093
11094 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
11095 {
11096 unsigned int result = 0x1;
11097
11098 if(destType)
11099 {
11100 struct __ecereNameSpace__ecere__sys__OldList converts = 
11101 {
11102 0, 0, 0, 0, 0
11103 };
11104 struct Conversion * convert;
11105
11106 if(destType->kind == 0)
11107 return 0x0;
11108 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
11109 result = 0x0;
11110 if(converts.count)
11111 {
11112 for(convert = converts.first; convert; convert = convert->next)
11113 {
11114 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
11115
11116 if(!empty)
11117 {
11118 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11119 int objectType = exp->expType ? exp->expType->classObjectType : 0;
11120
11121 *newExp = *exp;
11122 newExp->destType = (((void *)0));
11123 if(convert->isGet)
11124 {
11125 exp->type = 8;
11126 exp->addedThis = 0x1;
11127 exp->member.exp = newExp;
11128 FreeType(exp->member.exp->expType);
11129 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
11130 exp->member.exp->expType->classObjectType = objectType;
11131 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
11132 exp->member.memberType = 1;
11133 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11134 exp->needCast = 0x1;
11135 if(exp->expType)
11136 exp->expType->refCount++;
11137 ApplyAnyObjectLogic(exp->member.exp);
11138 }
11139 else
11140 {
11141 {
11142 exp->type = 8;
11143 exp->addedThis = 0x1;
11144 exp->member.exp = newExp;
11145 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
11146 {
11147 newExp->byReference = 0x1;
11148 }
11149 FreeType(exp->member.exp->expType);
11150 exp->member.exp->expType = (((void *)0));
11151 if(convert->convert->dataType)
11152 {
11153 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11154 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
11155 exp->member.exp->expType->refCount = 1;
11156 exp->member.exp->expType->classObjectType = objectType;
11157 ApplyAnyObjectLogic(exp->member.exp);
11158 }
11159 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
11160 exp->member.memberType = 4;
11161 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11162 exp->needCast = 0x1;
11163 if(convert->resultType)
11164 convert->resultType->refCount++;
11165 }
11166 }
11167 }
11168 else
11169 {
11170 FreeType(exp->expType);
11171 if(convert->isGet)
11172 {
11173 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11174 exp->needCast = 0x1;
11175 if(exp->expType)
11176 exp->expType->refCount++;
11177 }
11178 else
11179 {
11180 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11181 exp->needCast = 0x1;
11182 if(convert->resultType)
11183 convert->resultType->refCount++;
11184 }
11185 }
11186 }
11187 if(exp->isConstant && inCompiler)
11188 ComputeExpression(exp);
11189 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
11190 }
11191 if(!result && exp->expType && converts.count)
11192 {
11193 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
11194 }
11195 if(!result && exp->expType && exp->destType)
11196 {
11197 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))
11198 result = 0x1;
11199 }
11200 }
11201 return result;
11202 }
11203
11204 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
11205
11206 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
11207
11208 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
11209
11210 void CheckTemplateTypes(struct Expression * exp)
11211 {
11212 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
11213 {
11214 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11215 struct Statement * compound;
11216 struct Context * context;
11217
11218 *newExp = *exp;
11219 if(exp->destType)
11220 exp->destType->refCount++;
11221 if(exp->expType)
11222 exp->expType->refCount++;
11223 newExp->prev = (((void *)0));
11224 newExp->next = (((void *)0));
11225 switch(exp->expType->kind)
11226 {
11227 case 7:
11228 if(exp->destType->classObjectType)
11229 {
11230 if(exp->destType)
11231 exp->destType->refCount--;
11232 if(exp->expType)
11233 exp->expType->refCount--;
11234 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11235 }
11236 else
11237 {
11238 struct __ecereNameSpace__ecere__sys__OldList * specs;
11239 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11240 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11241
11242 context = PushContext();
11243 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11244 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11245 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11246 exp->type = 25;
11247 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11248 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
11249 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
11250 exp->compound->compound.context = context;
11251 PopContext(context);
11252 }
11253 break;
11254 default:
11255 exp->type = 11;
11256 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
11257 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11258 break;
11259 }
11260 }
11261 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
11262 {
11263 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11264 struct Statement * compound;
11265 struct Context * context;
11266
11267 *newExp = *exp;
11268 if(exp->destType)
11269 exp->destType->refCount++;
11270 if(exp->expType)
11271 exp->expType->refCount++;
11272 newExp->prev = (((void *)0));
11273 newExp->next = (((void *)0));
11274 switch(exp->expType->kind)
11275 {
11276 case 7:
11277 if(exp->destType->classObjectType)
11278 {
11279 if(exp->destType)
11280 exp->destType->refCount--;
11281 if(exp->expType)
11282 exp->expType->refCount--;
11283 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11284 }
11285 else
11286 {
11287 struct __ecereNameSpace__ecere__sys__OldList * specs;
11288 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11289 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11290
11291 context = PushContext();
11292 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11293 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11294 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11295 exp->type = 25;
11296 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11297 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
11298 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
11299 exp->compound->compound.context = context;
11300 PopContext(context);
11301 }
11302 break;
11303 case 8:
11304 {
11305 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
11306 {
11307 exp->type = 5;
11308 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
11309 ProcessExpressionType((*exp->list).first);
11310 break;
11311 }
11312 else
11313 {
11314 exp->type = 5;
11315 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
11316 newExp->needCast = 0x1;
11317 ProcessExpressionType((*exp->list).first);
11318 break;
11319 }
11320 }
11321 default:
11322 {
11323 if(exp->expType->kind == 20)
11324 {
11325 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
11326
11327 if(type)
11328 {
11329 FreeType(exp->destType);
11330 FreeType(exp->expType);
11331 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11332 break;
11333 }
11334 }
11335 if(newExp->type == 8 && newExp->member.memberType == 3)
11336 {
11337 exp->type = 4;
11338 exp->op.op = '*';
11339 exp->op.exp1 = (((void *)0));
11340 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
11341 }
11342 else
11343 {
11344 char typeString[1024];
11345 struct Declarator * decl;
11346 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11347
11348 typeString[0] = '\0';
11349 PrintType(exp->expType, typeString, 0x0, 0x0);
11350 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11351 exp->type = 11;
11352 exp->cast.typeName = MkTypeName(specs, decl);
11353 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11354 exp->cast.exp->needCast = 0x1;
11355 }
11356 break;
11357 }
11358 }
11359 }
11360 }
11361
11362 extern int strncmp(const char * , const char * , size_t n);
11363
11364 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
11365
11366 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
11367 {
11368 int nsLen = strlen(nameSpace);
11369 struct Symbol * symbol;
11370
11371 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)))
11372 {
11373 char * s = symbol->string;
11374
11375 if(!strncmp(s, nameSpace, nsLen))
11376 {
11377 int c;
11378 char * namePart;
11379
11380 for(c = strlen(s) - 1; c >= 0; c--)
11381 if(s[c] == ':')
11382 break;
11383 namePart = s + c + 1;
11384 if(!strcmp(namePart, name))
11385 {
11386 return symbol;
11387 }
11388 }
11389 else
11390 break;
11391 }
11392 return (((void *)0));
11393 }
11394
11395 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
11396 {
11397 int c;
11398 char nameSpace[1024];
11399 char * namePart;
11400 unsigned int gotColon = 0x0;
11401
11402 nameSpace[0] = '\0';
11403 for(c = strlen(name) - 1; c >= 0; c--)
11404 if(name[c] == ':')
11405 {
11406 gotColon = 0x1;
11407 break;
11408 }
11409 namePart = name + c + 1;
11410 while(c >= 0 && name[c] == ':')
11411 c--;
11412 if(c >= 0)
11413 {
11414 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
11415
11416 if(symbol)
11417 return symbol;
11418 memcpy(nameSpace, name, c + 1);
11419 nameSpace[c + 1] = (char)0;
11420 return ScanWithNameSpace(tree, nameSpace, namePart);
11421 }
11422 else if(gotColon)
11423 {
11424 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11425
11426 return symbol;
11427 }
11428 else
11429 {
11430 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11431
11432 if(symbol)
11433 return symbol;
11434 return ScanWithNameSpace(tree, "", namePart);
11435 }
11436 return (((void *)0));
11437 }
11438
11439 static void ProcessDeclaration(struct Declaration * decl);
11440
11441 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
11442 {
11443 struct Context * ctx;
11444 struct Symbol * symbol = (((void *)0));
11445
11446 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
11447 {
11448 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
11449 {
11450 symbol = (((void *)0));
11451 if(thisNameSpace)
11452 {
11453 char curName[1024];
11454
11455 strcpy(curName, thisNameSpace);
11456 strcat(curName, "::");
11457 strcat(curName, name);
11458 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
11459 }
11460 if(!symbol)
11461 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
11462 }
11463 else
11464 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
11465 if(symbol || ctx == endContext)
11466 break;
11467 }
11468 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
11469 {
11470 if(symbol->pointerExternal->type == 0)
11471 {
11472 struct FunctionDefinition * function = symbol->pointerExternal->function;
11473 struct Context * tmpContext = curContext;
11474
11475 curContext = (((void *)0));
11476 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
11477 curContext = tmpContext;
11478 symbol->pointerExternal->symbol = symbol;
11479 DeclareType(symbol->type, 0x1, 0x1);
11480 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
11481 symbol->id = curExternal->symbol->idCode;
11482 }
11483 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
11484 {
11485 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
11486 symbol->id = curExternal->symbol->idCode;
11487 }
11488 }
11489 return symbol;
11490 }
11491
11492 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
11493 {
11494 if(!type->isSigned && type->kind != 22 && type->kind != 23)
11495 ListAdd(specs, MkSpecifier(UNSIGNED));
11496 switch(type->kind)
11497 {
11498 case 8:
11499 {
11500 if(type->_class->registered)
11501 {
11502 if(!type->_class->registered->dataType)
11503 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11504 GetTypeSpecs(type->_class->registered->dataType, specs);
11505 }
11506 break;
11507 }
11508 case 7:
11509 ListAdd(specs, MkSpecifier(DOUBLE));
11510 break;
11511 case 6:
11512 ListAdd(specs, MkSpecifier(FLOAT));
11513 break;
11514 case 1:
11515 ListAdd(specs, MkSpecifier(CHAR));
11516 break;
11517 case 2:
11518 ListAdd(specs, MkSpecifier(SHORT));
11519 break;
11520 case 4:
11521 ListAdd(specs, MkSpecifier(INT64));
11522 break;
11523 case 22:
11524 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
11525 break;
11526 case 23:
11527 ListAdd(specs, MkSpecifierName(type->isSigned ? "intsize" : "uintsize"));
11528 break;
11529 case 3:
11530 default:
11531 ListAdd(specs, MkSpecifier(INT));
11532 break;
11533 }
11534 }
11535
11536 static void PrintArraySize(struct Type * arrayType, char * string)
11537 {
11538 char size[256];
11539
11540 size[0] = '\0';
11541 strcat(size, "[");
11542 if(arrayType->enumClass)
11543 strcat(size, arrayType->enumClass->string);
11544 else if(arrayType->arraySizeExp)
11545 PrintExpression(arrayType->arraySizeExp, size);
11546 strcat(size, "]");
11547 strcat(string, size);
11548 }
11549
11550 static void PrintTypeSpecs(struct Type * type, char * string, unsigned int fullName, unsigned int printConst)
11551 {
11552 if(type)
11553 {
11554 if(printConst && type->constant)
11555 strcat(string, "const ");
11556 switch(type->kind)
11557 {
11558 case 8:
11559 {
11560 struct Symbol * c = type->_class;
11561
11562 if(type->classObjectType == 2)
11563 strcat(string, "typed_object");
11564 else if(type->classObjectType == 3)
11565 strcat(string, "any_object");
11566 else
11567 {
11568 if(c && c->string)
11569 strcat(string, (fullName || !c->registered) ? c->string : c->registered->name);
11570 }
11571 if(type->byReference)
11572 strcat(string, " &");
11573 break;
11574 }
11575 case 0:
11576 strcat(string, "void");
11577 break;
11578 case 3:
11579 strcat(string, type->isSigned ? "int" : "uint");
11580 break;
11581 case 4:
11582 strcat(string, type->isSigned ? "int64" : "uint64");
11583 break;
11584 case 22:
11585 strcat(string, type->isSigned ? "intptr" : "uintptr");
11586 break;
11587 case 23:
11588 strcat(string, type->isSigned ? "intsize" : "uintsize");
11589 break;
11590 case 1:
11591 strcat(string, type->isSigned ? "char" : "byte");
11592 break;
11593 case 2:
11594 strcat(string, type->isSigned ? "short" : "uint16");
11595 break;
11596 case 6:
11597 strcat(string, "float");
11598 break;
11599 case 7:
11600 strcat(string, "double");
11601 break;
11602 case 9:
11603 if(type->enumName)
11604 {
11605 strcat(string, "struct ");
11606 strcat(string, type->enumName);
11607 }
11608 else if(type->typeName)
11609 strcat(string, type->typeName);
11610 else
11611 {
11612 struct Type * member;
11613
11614 strcat(string, "struct { ");
11615 for(member = type->members.first; member; member = member->next)
11616 {
11617 PrintType(member, string, 0x1, fullName);
11618 strcat(string, "; ");
11619 }
11620 strcat(string, "}");
11621 }
11622 break;
11623 case 10:
11624 if(type->enumName)
11625 {
11626 strcat(string, "union ");
11627 strcat(string, type->enumName);
11628 }
11629 else if(type->typeName)
11630 strcat(string, type->typeName);
11631 else
11632 {
11633 strcat(string, "union ");
11634 strcat(string, "(unnamed)");
11635 }
11636 break;
11637 case 15:
11638 if(type->enumName)
11639 {
11640 strcat(string, "enum ");
11641 strcat(string, type->enumName);
11642 }
11643 else if(type->typeName)
11644 strcat(string, type->typeName);
11645 else
11646 strcat(string, "int");
11647 break;
11648 case 14:
11649 strcat(string, "...");
11650 break;
11651 case 19:
11652 strcat(string, "subclass(");
11653 strcat(string, type->_class ? type->_class->string : "int");
11654 strcat(string, ")");
11655 break;
11656 case 20:
11657 strcat(string, type->templateParameter->identifier->string);
11658 break;
11659 case 21:
11660 strcat(string, "thisclass");
11661 break;
11662 case 17:
11663 strcat(string, "__builtin_va_list");
11664 break;
11665 }
11666 }
11667 }
11668
11669 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
11670
11671 static void PrintName(struct Type * type, char * string, unsigned int fullName)
11672 {
11673 if(type->name && type->name[0])
11674 {
11675 if(fullName)
11676 strcat(string, type->name);
11677 else
11678 {
11679 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11680
11681 if(name)
11682 name += 2;
11683 else
11684 name = type->name;
11685 strcat(string, name);
11686 }
11687 }
11688 }
11689
11690 static void PrintAttribs(struct Type * type, char * string)
11691 {
11692 if(type)
11693 {
11694 if(type->dllExport)
11695 strcat(string, "dllexport ");
11696 if(type->attrStdcall)
11697 strcat(string, "stdcall ");
11698 }
11699 }
11700
11701 static void PrePrintType(struct Type * type, char * string, unsigned int fullName, struct Type * parentType, unsigned int printConst)
11702 {
11703 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
11704 {
11705 struct Type * attrType = (((void *)0));
11706
11707 if((type->kind == 11 || type->kind == 16) && (!parentType || parentType->kind != 13))
11708 PrintAttribs(type, string);
11709 if(printConst && type->constant && (type->kind == 11 || type->kind == 16))
11710 strcat(string, " const");
11711 PrePrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName, type, printConst);
11712 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
11713 strcat(string, " (");
11714 if(type->kind == 13)
11715 {
11716 if(type->type->kind == 11 || type->type->kind == 16)
11717 PrintAttribs(type->type, string);
11718 }
11719 if(type->kind == 13)
11720 {
11721 if(type->type->kind == 11 || type->type->kind == 16 || type->type->kind == 12)
11722 strcat(string, "*");
11723 else
11724 strcat(string, " *");
11725 }
11726 if(printConst && type->constant && type->kind == 13)
11727 strcat(string, " const");
11728 }
11729 else
11730 PrintTypeSpecs(type, string, fullName, printConst);
11731 }
11732
11733 static void PostPrintType(struct Type * type, char * string, unsigned int fullName)
11734 {
11735 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
11736 strcat(string, ")");
11737 if(type->kind == 12)
11738 PrintArraySize(type, string);
11739 else if(type->kind == 11)
11740 {
11741 struct Type * param;
11742
11743 strcat(string, "(");
11744 for(param = type->params.first; param; param = param->next)
11745 {
11746 PrintType(param, string, 0x1, fullName);
11747 if(param->next)
11748 strcat(string, ", ");
11749 }
11750 strcat(string, ")");
11751 }
11752 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
11753 PostPrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName);
11754 }
11755
11756 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName, unsigned int printConst)
11757 {
11758 PrePrintType(type, string, fullName, (((void *)0)), printConst);
11759 if(type->thisClass || (printName && type->name && type->name[0]))
11760 strcat(string, " ");
11761 if((type->thisClass || type->staticMethod))
11762 {
11763 struct Symbol * _class = type->thisClass;
11764
11765 if((type->classObjectType == 2 || type->classObjectType == 1) || (_class && !strcmp(_class->string, "class")))
11766 {
11767 if(type->classObjectType == 1)
11768 strcat(string, "class");
11769 else
11770 strcat(string, type->byReference ? "typed_object&" : "typed_object");
11771 }
11772 else if(_class && _class->string)
11773 {
11774 char * s = _class->string;
11775
11776 if(fullName)
11777 strcat(string, s);
11778 else
11779 {
11780 char * name = __ecereNameSpace__ecere__sys__RSearchString(s, "::", strlen(s), 0x1, 0x0);
11781
11782 if(name)
11783 name += 2;
11784 else
11785 name = s;
11786 strcat(string, name);
11787 }
11788 }
11789 strcat(string, "::");
11790 }
11791 if(printName && type->name)
11792 PrintName(type, string, fullName);
11793 PostPrintType(type, string, fullName);
11794 if(type->bitFieldCount)
11795 {
11796 char count[100];
11797
11798 sprintf(count, ":%d", type->bitFieldCount);
11799 strcat(string, count);
11800 }
11801 }
11802
11803 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11804 {
11805 _PrintType(type, string, printName, fullName, 0x1);
11806 }
11807
11808 void PrintTypeNoConst(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11809 {
11810 _PrintType(type, string, printName, fullName, 0x0);
11811 }
11812
11813 static struct Type * FindMember(struct Type * type, char * string)
11814 {
11815 struct Type * memberType;
11816
11817 for(memberType = type->members.first; memberType; memberType = memberType->next)
11818 {
11819 if(!memberType->name)
11820 {
11821 struct Type * subType = FindMember(memberType, string);
11822
11823 if(subType)
11824 return subType;
11825 }
11826 else if(!strcmp(memberType->name, string))
11827 return memberType;
11828 }
11829 return (((void *)0));
11830 }
11831
11832 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11833 {
11834 struct Type * memberType;
11835
11836 for(memberType = type->members.first; memberType; memberType = memberType->next)
11837 {
11838 if(!memberType->name)
11839 {
11840 struct Type * subType = FindMember(memberType, string);
11841
11842 if(subType)
11843 {
11844 *offset += memberType->offset;
11845 return subType;
11846 }
11847 }
11848 else if(!strcmp(memberType->name, string))
11849 {
11850 *offset += memberType->offset;
11851 return memberType;
11852 }
11853 }
11854 return (((void *)0));
11855 }
11856
11857 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11858
11859 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11860
11861 struct Expression * ParseExpressionString(char * expression)
11862 {
11863 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11864 ((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));
11865 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11866 echoOn = 0x0;
11867 parsedExpression = (((void *)0));
11868 resetScanner();
11869 expression_yyparse();
11870 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11871 return parsedExpression;
11872 }
11873
11874 extern char *  QMkString(char *  source);
11875
11876 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11877 {
11878 struct Identifier * id = exp->identifier;
11879 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11880 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11881 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11882 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11883
11884 if(_class && _class->type == 4)
11885 {
11886 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11887 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11888
11889 if(enumClass)
11890 {
11891 struct __ecereNameSpace__ecere__com__Class * baseClass;
11892
11893 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11894 {
11895 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11896
11897 for(value = e->values.first; value; value = value->next)
11898 {
11899 if(!strcmp(value->name, id->string))
11900 break;
11901 }
11902 if(value)
11903 {
11904 char constant[256];
11905
11906 FreeExpContents(exp);
11907 exp->type = 2;
11908 exp->isConstant = 0x1;
11909 if(!strcmp(baseClass->dataTypeString, "int"))
11910 sprintf(constant, "%d", (int)value->data);
11911 else
11912 sprintf(constant, "0x%X", (int)value->data);
11913 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11914 exp->expType = MkClassType(baseClass->fullName);
11915 break;
11916 }
11917 }
11918 }
11919 if(value)
11920 return 0x1;
11921 }
11922 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11923 {
11924 ProcessMethodType(method);
11925 exp->expType = __extension__ ({
11926 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11927
11928 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), __ecereInstance1;
11929 });
11930 return 0x1;
11931 }
11932 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11933 {
11934 if(!prop->dataType)
11935 ProcessPropertyType(prop);
11936 exp->expType = prop->dataType;
11937 if(prop->dataType)
11938 prop->dataType->refCount++;
11939 return 0x1;
11940 }
11941 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11942 {
11943 if(!member->dataType)
11944 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11945 exp->expType = member->dataType;
11946 if(member->dataType)
11947 member->dataType->refCount++;
11948 return 0x1;
11949 }
11950 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11951 {
11952 if(!classProp->dataType)
11953 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11954 if(classProp->constant)
11955 {
11956 FreeExpContents(exp);
11957 exp->isConstant = 0x1;
11958 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
11959 {
11960 exp->type = 3;
11961 exp->constant = QMkString((char *)classProp->Get(_class));
11962 }
11963 else
11964 {
11965 char constant[256];
11966
11967 exp->type = 2;
11968 sprintf(constant, "%d", (int)classProp->Get(_class));
11969 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11970 }
11971 }
11972 else
11973 {
11974 }
11975 exp->expType = classProp->dataType;
11976 if(classProp->dataType)
11977 classProp->dataType->refCount++;
11978 return 0x1;
11979 }
11980 return 0x0;
11981 }
11982
11983 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
11984 {
11985 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
11986 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
11987 struct __ecereNameSpace__ecere__com__NameSpace * child;
11988
11989 if(!data)
11990 {
11991 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)))
11992 {
11993 data = ScanGlobalData(child, name);
11994 if(data)
11995 break;
11996 }
11997 }
11998 return data;
11999 }
12000
12001 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
12002
12003 extern char *  strncpy(char * , const char * , size_t n);
12004
12005 static struct GlobalData * FindGlobalData(char * name)
12006 {
12007 int start = 0, c;
12008 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
12009
12010 nameSpace = globalData;
12011 for(c = 0; name[c]; c++)
12012 {
12013 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
12014 {
12015 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
12016 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
12017
12018 strncpy(spaceName, name + start, c - start);
12019 spaceName[c - start] = '\0';
12020 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
12021 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
12022 if(!newSpace)
12023 return (((void *)0));
12024 nameSpace = newSpace;
12025 if(name[c] == ':')
12026 c++;
12027 start = c + 1;
12028 }
12029 }
12030 if(c - start)
12031 {
12032 return ScanGlobalData(nameSpace, name + start);
12033 }
12034 return (((void *)0));
12035 }
12036
12037 static int definedExpStackPos;
12038
12039 static void * definedExpStack[512];
12040
12041 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
12042 {
12043 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
12044
12045 FreeExpContents(checkedExp);
12046 FreeType(checkedExp->expType);
12047 FreeType(checkedExp->destType);
12048 *checkedExp = *newExp;
12049 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12050 checkedExp->prev = prev;
12051 checkedExp->next = next;
12052 }
12053
12054 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
12055
12056 extern int printf(char * , ...);
12057
12058 void __ecereMethod_Expression_Clear();
12059
12060 void ApplyAnyObjectLogic(struct Expression * e)
12061 {
12062 struct Type * destType = e->destType;
12063
12064 if(destType && (destType->classObjectType == 3))
12065 {
12066 if(e && e->expType)
12067 {
12068 struct Type * type = e->expType;
12069 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
12070
12071 if(type->kind == 8 && type->_class && type->_class->registered)
12072 {
12073 _class = type->_class->registered;
12074 }
12075 else if(type->kind == 19)
12076 {
12077 _class = FindClass("ecere::com::Class")->registered;
12078 }
12079 else
12080 {
12081 char string[1024] = "";
12082 struct Symbol * classSym;
12083
12084 PrintTypeNoConst(type, string, 0x0, 0x1);
12085 classSym = FindClass(string);
12086 if(classSym)
12087 _class = classSym->registered;
12088 }
12089 if((_class && (_class->type == 4 || _class->type == 3 || _class->type == 2 || _class->type == 1000) && strcmp(_class->fullName, "class") && strcmp(_class->fullName, "uintptr") && strcmp(_class->fullName, "intptr")) || (!e->expType->classObjectType && (((type->kind != 13 && type->kind != 22 && type->kind != 19 && (type->kind != 8 || !type->_class || !type->_class->registered || type->_class->registered->type == 1))) || destType->byReference)))
12090 {
12091 if(!_class || strcmp(_class->fullName, "char *"))
12092 {
12093 struct Expression * checkedExp = e, * newExp;
12094
12095 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12096 {
12097 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12098 {
12099 if(checkedExp->type == 25)
12100 {
12101 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12102 }
12103 else
12104 checkedExp = (*checkedExp->list).last;
12105 }
12106 else if(checkedExp->type == 11)
12107 checkedExp = checkedExp->cast.exp;
12108 }
12109 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
12110 {
12111 newExp = checkedExp->op.exp2;
12112 checkedExp->op.exp2 = (((void *)0));
12113 FreeExpContents(checkedExp);
12114 if(e->expType && e->expType->passAsTemplate)
12115 {
12116 char size[100];
12117
12118 ComputeTypeSize(e->expType);
12119 sprintf(size, "%d", e->expType->size);
12120 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))))));
12121 }
12122 ReplaceExpContents(checkedExp, newExp);
12123 e->byReference = 0x1;
12124 }
12125 else if(!e->byReference || (_class && _class->type == 5))
12126 {
12127 struct Expression * checkedExp, * newExp;
12128
12129 {
12130 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;
12131
12132 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
12133 {
12134 struct Context * context = PushContext();
12135 struct Declarator * decl;
12136 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12137 char typeString[1024];
12138 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12139
12140 typeString[0] = '\0';
12141 *newExp = *e;
12142 newExp->prev = (((void *)0));
12143 newExp->next = (((void *)0));
12144 newExp->expType = (((void *)0));
12145 PrintTypeNoConst(e->expType, typeString, 0x0, 0x1);
12146 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12147 newExp->destType = ProcessType(specs, decl);
12148 curContext = context;
12149 if(curCompound)
12150 {
12151 char name[100];
12152 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
12153
12154 e->type = 25;
12155 sprintf(name, "__internalValue%03X", internalValueCounter++);
12156 if(!curCompound->compound.declarations)
12157 curCompound->compound.declarations = MkList();
12158 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
12159 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
12160 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
12161 e->compound = MkCompoundStmt((((void *)0)), stmts);
12162 }
12163 else
12164 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
12165 {
12166 struct Type * type = e->destType;
12167
12168 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12169 CopyTypeInto(e->destType, type);
12170 e->destType->refCount = 1;
12171 e->destType->classObjectType = 0;
12172 FreeType(type);
12173 }
12174 e->compound->compound.context = context;
12175 PopContext(context);
12176 curContext = context->parent;
12177 }
12178 }
12179 checkedExp = e;
12180 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12181 {
12182 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12183 {
12184 if(checkedExp->type == 25)
12185 {
12186 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12187 }
12188 else
12189 checkedExp = (*checkedExp->list).last;
12190 }
12191 else if(checkedExp->type == 11)
12192 checkedExp = checkedExp->cast.exp;
12193 }
12194 {
12195 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12196
12197 *operand = *checkedExp;
12198 checkedExp->destType = (((void *)0));
12199 checkedExp->expType = (((void *)0));
12200 __ecereMethod_Expression_Clear(checkedExp);
12201 checkedExp->type = 4;
12202 checkedExp->op.op = '&';
12203 checkedExp->op.exp1 = (((void *)0));
12204 checkedExp->op.exp2 = operand;
12205 }
12206 }
12207 }
12208 }
12209 }
12210 }
12211 {
12212 }
12213 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))))
12214 {
12215 if(e->expType->classObjectType && destType && destType->classObjectType)
12216 {
12217 return ;
12218 }
12219 else
12220 {
12221 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12222
12223 *thisExp = *e;
12224 thisExp->prev = (((void *)0));
12225 thisExp->next = (((void *)0));
12226 __ecereMethod_Expression_Clear(e);
12227 e->type = 5;
12228 e->list = MkListOne(MkExpOp((((void *)0)), '*', thisExp->type == 0 ? thisExp : MkExpBrackets(MkListOne(thisExp))));
12229 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
12230 ((struct Expression *)(*e->list).first)->byReference = 0x1;
12231 {
12232 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12233 CopyTypeInto(e->expType, thisExp->expType);
12234 e->expType->byReference = 0x0;
12235 e->expType->refCount = 1;
12236 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))
12237 {
12238 e->expType->classObjectType = 0;
12239 }
12240 }
12241 }
12242 }
12243 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
12244 {
12245 if(destType->kind == 14)
12246 {
12247 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unspecified type\n", (((void *)0))));
12248 }
12249 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
12250 {
12251 unsigned int byReference = e->expType->byReference;
12252 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12253 struct Declarator * decl;
12254 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12255 char typeString[1024];
12256 struct Type * type;
12257 int backupClassObjectType;
12258 unsigned int backupByReference;
12259
12260 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
12261 type = e->expType;
12262 else
12263 type = destType;
12264 backupClassObjectType = type->classObjectType;
12265 backupByReference = type->byReference;
12266 type->classObjectType = 0;
12267 type->byReference = 0x0;
12268 typeString[0] = '\0';
12269 PrintType(type, typeString, 0x0, 0x1);
12270 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12271 type->classObjectType = backupClassObjectType;
12272 type->byReference = backupByReference;
12273 *thisExp = *e;
12274 thisExp->prev = (((void *)0));
12275 thisExp->next = (((void *)0));
12276 __ecereMethod_Expression_Clear(e);
12277 if((type->kind == 8 && type->_class && type->_class->registered && (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 != 22 && type->kind != 12 && type->kind != 8) || (!destType->byReference && byReference && (destType->kind != 13 || type->kind != 13)))
12278 {
12279 e->type = 4;
12280 e->op.op = '*';
12281 e->op.exp1 = (((void *)0));
12282 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
12283 }
12284 else
12285 {
12286 e->type = 11;
12287 e->cast.typeName = MkTypeName(specs, decl);
12288 e->cast.exp = thisExp;
12289 e->byReference = 0x1;
12290 }
12291 e->expType = type;
12292 e->destType = destType;
12293 type->refCount++;
12294 destType->refCount++;
12295 }
12296 }
12297 }
12298
12299 extern char *  strstr(const char * , const char * );
12300
12301 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
12302
12303 struct __ecereNameSpace__ecere__com__DefinedExpression
12304 {
12305 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
12306 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
12307 char *  name;
12308 char *  value;
12309 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
12310 } __attribute__ ((gcc_struct));
12311
12312 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12313
12314 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12315
12316 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
12317
12318 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
12319
12320 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
12321
12322 extern struct Expression * CopyExpression(struct Expression * exp);
12323
12324 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
12325
12326 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
12327
12328 static void ProcessStatement(struct Statement * stmt);
12329
12330 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
12331
12332 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
12333
12334 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
12335
12336 extern char *  sourceFile;
12337
12338 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
12339
12340 void ProcessExpressionType(struct Expression * exp)
12341 {
12342 unsigned int unresolved = 0x0;
12343 struct Location oldyylloc = yylloc;
12344 unsigned int notByReference = 0x0;
12345
12346 if(!exp || exp->expType)
12347 return ;
12348 yylloc = exp->loc;
12349 switch(exp->type)
12350 {
12351 case 0:
12352 {
12353 struct Identifier * id = exp->identifier;
12354
12355 if(!id)
12356 return ;
12357 if(id->_class && id->_class->name)
12358 {
12359 id->classSym = id->_class->symbol;
12360 }
12361 if(strstr(id->string, "__ecereClass") == id->string)
12362 {
12363 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
12364 break;
12365 }
12366 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
12367 {
12368 ReplaceClassMembers(exp, thisClass);
12369 if(exp->type != 0)
12370 {
12371 ProcessExpressionType(exp);
12372 break;
12373 }
12374 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
12375 break;
12376 }
12377 else
12378 {
12379 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12380
12381 if(!symbol)
12382 {
12383 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
12384 break;
12385 else
12386 {
12387 if(thisClass)
12388 {
12389 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
12390 if(exp->type != 0)
12391 {
12392 ProcessExpressionType(exp);
12393 break;
12394 }
12395 }
12396 else if(currentClass && !id->_class)
12397 {
12398 if(ResolveIdWithClass(exp, currentClass, 0x1))
12399 break;
12400 }
12401 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12402 }
12403 }
12404 if(symbol)
12405 {
12406 struct Type * type = symbol->type;
12407 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
12408
12409 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
12410 {
12411 struct Context * context = SetupTemplatesContext(_class);
12412
12413 type = ReplaceThisClassType(_class);
12414 FinishTemplatesContext(context);
12415 if(type)
12416 type->refCount = 0;
12417 }
12418 FreeSpecifier(id->_class);
12419 id->_class = (((void *)0));
12420 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12421 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
12422 id->classSym = (((void *)0));
12423 exp->expType = type;
12424 if(type)
12425 type->refCount++;
12426 if(type && (type->kind == 15 || (_class && _class->type == 4)))
12427 exp->isConstant = 0x1;
12428 if(symbol->isParam || !strcmp(id->string, "this"))
12429 {
12430 if(_class && _class->type == 1 && !type->declaredWithStruct)
12431 exp->byReference = 0x1;
12432 }
12433 if(symbol->isIterator)
12434 {
12435 if(symbol->isIterator == 3)
12436 {
12437 exp->type = 5;
12438 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
12439 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
12440 exp->expType = (((void *)0));
12441 ProcessExpressionType(exp);
12442 }
12443 else if(symbol->isIterator != 4)
12444 {
12445 exp->type = 8;
12446 exp->member.exp = MkExpIdentifier(exp->identifier);
12447 exp->member.exp->expType = exp->expType;
12448 exp->member.member = MkIdentifier("data");
12449 exp->expType = (((void *)0));
12450 ProcessExpressionType(exp);
12451 }
12452 }
12453 break;
12454 }
12455 else
12456 {
12457 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
12458
12459 if(thisNameSpace && !(id->_class && !id->_class->name))
12460 {
12461 char name[1024];
12462
12463 strcpy(name, thisNameSpace);
12464 strcat(name, "::");
12465 strcat(name, id->string);
12466 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
12467 }
12468 if(!definedExp)
12469 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
12470 if(definedExp)
12471 {
12472 int c;
12473
12474 for(c = 0; c < definedExpStackPos; c++)
12475 if(definedExpStack[c] == definedExp)
12476 break;
12477 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
12478 {
12479 struct Location backupYylloc = yylloc;
12480
12481 definedExpStack[definedExpStackPos++] = definedExp;
12482 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
12483 ((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));
12484 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
12485 echoOn = 0x0;
12486 parsedExpression = (((void *)0));
12487 resetScanner();
12488 expression_yyparse();
12489 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
12490 yylloc = backupYylloc;
12491 if(parsedExpression)
12492 {
12493 FreeIdentifier(id);
12494 exp->type = 5;
12495 exp->list = MkListOne(parsedExpression);
12496 parsedExpression->loc = yylloc;
12497 ProcessExpressionType(exp);
12498 definedExpStackPos--;
12499 return ;
12500 }
12501 definedExpStackPos--;
12502 }
12503 else
12504 {
12505 if(inCompiler)
12506 {
12507 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
12508 }
12509 }
12510 }
12511 else
12512 {
12513 struct GlobalData * data = (((void *)0));
12514
12515 if(thisNameSpace && !(id->_class && !id->_class->name))
12516 {
12517 char name[1024];
12518
12519 strcpy(name, thisNameSpace);
12520 strcat(name, "::");
12521 strcat(name, id->string);
12522 data = FindGlobalData(name);
12523 }
12524 if(!data)
12525 data = FindGlobalData(id->string);
12526 if(data)
12527 {
12528 DeclareGlobalData(data);
12529 exp->expType = data->dataType;
12530 if(data->dataType)
12531 data->dataType->refCount++;
12532 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12533 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12534 FreeSpecifier(id->_class);
12535 id->_class = (((void *)0));
12536 break;
12537 }
12538 else
12539 {
12540 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
12541
12542 if(thisNameSpace && !(id->_class && !id->_class->name))
12543 {
12544 char name[1024];
12545
12546 strcpy(name, thisNameSpace);
12547 strcat(name, "::");
12548 strcat(name, id->string);
12549 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12550 }
12551 if(!function)
12552 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12553 if(function)
12554 {
12555 char name[1024];
12556
12557 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12558 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12559 name[0] = (char)0;
12560 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12561 strcpy(name, "__ecereFunction_");
12562 FullClassNameCat(name, id->string, 0x0);
12563 if(DeclareFunction(function, name))
12564 {
12565 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12566 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12567 }
12568 exp->expType = function->dataType;
12569 if(function->dataType)
12570 function->dataType->refCount++;
12571 FreeSpecifier(id->_class);
12572 id->_class = (((void *)0));
12573 break;
12574 }
12575 }
12576 }
12577 }
12578 }
12579 unresolved = 0x1;
12580 break;
12581 }
12582 case 1:
12583 {
12584 struct __ecereNameSpace__ecere__com__Class * _class;
12585
12586 if(!exp->instance->_class)
12587 {
12588 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12589 {
12590 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12591 }
12592 }
12593 ProcessInstantiationType(exp->instance);
12594 exp->isConstant = exp->instance->isConstant;
12595 if(exp->instance->_class)
12596 {
12597 exp->expType = MkClassType(exp->instance->_class->name);
12598 }
12599 break;
12600 }
12601 case 2:
12602 {
12603 if(!exp->expType)
12604 {
12605 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12606
12607 exp->expType = type;
12608 if(exp->constant[0] == '\'')
12609 {
12610 if((int)((unsigned char *)exp->constant)[1] > 127)
12611 {
12612 int nb;
12613 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12614
12615 if(nb < 2)
12616 ch = exp->constant[1];
12617 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12618 exp->constant = PrintUInt(ch);
12619 type->kind = 8;
12620 type->_class = FindClass("unichar");
12621 type->isSigned = 0x0;
12622 }
12623 else
12624 {
12625 type->kind = 1;
12626 type->isSigned = 0x1;
12627 }
12628 }
12629 else if(strchr(exp->constant, '.'))
12630 {
12631 char ch = exp->constant[strlen(exp->constant) - 1];
12632
12633 if(ch == 'f')
12634 type->kind = 6;
12635 else
12636 type->kind = 7;
12637 type->isSigned = 0x1;
12638 }
12639 else
12640 {
12641 if(exp->constant[0] == '0' && exp->constant[1])
12642 type->isSigned = 0x0;
12643 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12644 type->isSigned = 0x0;
12645 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12646 type->isSigned = 0x0;
12647 else
12648 type->isSigned = 0x1;
12649 type->kind = 3;
12650 }
12651 exp->isConstant = 0x1;
12652 if(exp->destType && exp->destType->kind == 7)
12653 type->kind = 7;
12654 else if(exp->destType && exp->destType->kind == 6)
12655 type->kind = 6;
12656 else if(exp->destType && exp->destType->kind == 4)
12657 type->kind = 4;
12658 }
12659 break;
12660 }
12661 case 3:
12662 {
12663 exp->isConstant = 0x1;
12664 exp->expType = __extension__ ({
12665 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12666
12667 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
12668 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12669
12670 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 1, __ecereInstance1->constant = 0x1, __ecereInstance1;
12671 }), __ecereInstance2;
12672 });
12673 break;
12674 }
12675 case 13:
12676 case 28:
12677 ProcessExpressionType(exp->_new.size);
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->_new.typeName->qualifiers, exp->_new.typeName->declarator), __ecereInstance1;
12682 });
12683 DeclareType(exp->expType->type, 0x0, 0x0);
12684 break;
12685 case 14:
12686 case 29:
12687 ProcessExpressionType(exp->_renew.size);
12688 ProcessExpressionType(exp->_renew.exp);
12689 exp->expType = __extension__ ({
12690 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12691
12692 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), __ecereInstance1;
12693 });
12694 DeclareType(exp->expType->type, 0x0, 0x0);
12695 break;
12696 case 4:
12697 {
12698 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12699 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12700 unsigned int useDestType = 0x0, useSideType = 0x0;
12701 struct Location oldyylloc = yylloc;
12702 unsigned int useSideUnit = 0x0;
12703 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
12704
12705 switch(exp->op.op)
12706 {
12707 case '=':
12708 case MUL_ASSIGN:
12709 case DIV_ASSIGN:
12710 case MOD_ASSIGN:
12711 case ADD_ASSIGN:
12712 case SUB_ASSIGN:
12713 case LEFT_ASSIGN:
12714 case RIGHT_ASSIGN:
12715 case AND_ASSIGN:
12716 case XOR_ASSIGN:
12717 case OR_ASSIGN:
12718 assign = 0x1;
12719 break;
12720 case '!':
12721 break;
12722 case AND_OP:
12723 case OR_OP:
12724 boolOps = 0x1;
12725 boolResult = 0x1;
12726 break;
12727 case EQ_OP:
12728 case '<':
12729 case '>':
12730 case LE_OP:
12731 case GE_OP:
12732 case NE_OP:
12733 boolResult = 0x1;
12734 useSideType = 0x1;
12735 break;
12736 case '+':
12737 case '-':
12738 useSideUnit = 0x1;
12739 case '|':
12740 case '&':
12741 case '^':
12742 case '/':
12743 case '%':
12744 case '*':
12745 if(exp->op.op != '*' || exp->op.exp1)
12746 {
12747 useSideType = 0x1;
12748 useDestType = 0x1;
12749 }
12750 break;
12751 }
12752 if(exp->op.op == '&')
12753 {
12754 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12755 {
12756 struct Identifier * id = exp->op.exp2->identifier;
12757 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12758
12759 if(symbol && symbol->isIterator == 2)
12760 {
12761 exp->type = 8;
12762 exp->member.exp = exp->op.exp2;
12763 exp->member.member = MkIdentifier("key");
12764 exp->expType = (((void *)0));
12765 exp->op.exp2->expType = symbol->type;
12766 symbol->type->refCount++;
12767 ProcessExpressionType(exp);
12768 FreeType(dummy);
12769 break;
12770 }
12771 }
12772 }
12773 if(exp->op.exp1)
12774 {
12775 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))
12776 {
12777 if(exp->op.exp1->destType)
12778 FreeType(exp->op.exp1->destType);
12779 exp->op.exp1->destType = exp->destType;
12780 if(exp->destType)
12781 exp->destType->refCount++;
12782 }
12783 else if(!assign)
12784 {
12785 if(exp->op.exp1->destType)
12786 FreeType(exp->op.exp1->destType);
12787 exp->op.exp1->destType = dummy;
12788 dummy->refCount++;
12789 }
12790 if(exp->op.exp1->destType && exp->op.op != '=')
12791 exp->op.exp1->destType->count++;
12792 ProcessExpressionType(exp->op.exp1);
12793 if(exp->op.exp1->destType && exp->op.op != '=')
12794 exp->op.exp1->destType->count--;
12795 if(exp->op.exp1->destType == dummy)
12796 {
12797 FreeType(dummy);
12798 exp->op.exp1->destType = (((void *)0));
12799 }
12800 type1 = exp->op.exp1->expType;
12801 }
12802 if(exp->op.exp2)
12803 {
12804 char expString[10240];
12805
12806 expString[0] = '\0';
12807 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12808 {
12809 if(exp->op.exp1)
12810 {
12811 exp->op.exp2->destType = exp->op.exp1->expType;
12812 if(exp->op.exp1->expType)
12813 exp->op.exp1->expType->refCount++;
12814 }
12815 else
12816 {
12817 exp->op.exp2->destType = exp->destType;
12818 if(exp->destType)
12819 exp->destType->refCount++;
12820 }
12821 if(type1)
12822 type1->refCount++;
12823 exp->expType = type1;
12824 }
12825 else if(assign)
12826 {
12827 if(inCompiler)
12828 PrintExpression(exp->op.exp2, expString);
12829 if(type1 && type1->kind == 13)
12830 {
12831 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)
12832 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12833 else if(exp->op.op == '=')
12834 {
12835 if(exp->op.exp2->destType)
12836 FreeType(exp->op.exp2->destType);
12837 exp->op.exp2->destType = type1;
12838 if(type1)
12839 type1->refCount++;
12840 }
12841 }
12842 else
12843 {
12844 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)
12845 ;
12846 else
12847 {
12848 if(exp->op.exp2->destType)
12849 FreeType(exp->op.exp2->destType);
12850 exp->op.exp2->destType = type1;
12851 if(type1)
12852 type1->refCount++;
12853 }
12854 }
12855 if(type1)
12856 type1->refCount++;
12857 exp->expType = type1;
12858 }
12859 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)))
12860 {
12861 if(exp->op.exp2->destType)
12862 FreeType(exp->op.exp2->destType);
12863 exp->op.exp2->destType = exp->destType;
12864 if(exp->destType)
12865 exp->destType->refCount++;
12866 }
12867 else
12868 {
12869 if(exp->op.exp2->destType)
12870 FreeType(exp->op.exp2->destType);
12871 exp->op.exp2->destType = dummy;
12872 dummy->refCount++;
12873 }
12874 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12875 {
12876 FreeType(exp->op.exp2->destType);
12877 exp->op.exp2->destType = type1;
12878 type1->refCount++;
12879 }
12880 if(exp->op.exp2->destType && exp->op.op != '=')
12881 exp->op.exp2->destType->count++;
12882 ProcessExpressionType(exp->op.exp2);
12883 if(exp->op.exp2->destType && exp->op.op != '=')
12884 exp->op.exp2->destType->count--;
12885 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12886 {
12887 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)
12888 {
12889 if(exp->op.op != '=' && type1->type->kind == 0)
12890 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12891 }
12892 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)))
12893 {
12894 if(exp->op.op == ADD_ASSIGN)
12895 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12896 }
12897 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))
12898 {
12899 if(exp->op.op == ADD_ASSIGN)
12900 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12901 }
12902 else if(inCompiler)
12903 {
12904 char type1String[1024];
12905 char type2String[1024];
12906
12907 type1String[0] = '\0';
12908 type2String[0] = '\0';
12909 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12910 PrintType(type1, type2String, 0x0, 0x1);
12911 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12912 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12913 }
12914 }
12915 if(exp->op.exp2->destType == dummy)
12916 {
12917 FreeType(dummy);
12918 exp->op.exp2->destType = (((void *)0));
12919 }
12920 type2 = exp->op.exp2->expType;
12921 }
12922 dummy->kind = 0;
12923 if(exp->op.op == SIZEOF)
12924 {
12925 exp->expType = __extension__ ({
12926 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12927
12928 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
12929 });
12930 exp->isConstant = 0x1;
12931 }
12932 else if(exp->op.op == '*' && !exp->op.exp1)
12933 {
12934 exp->expType = Dereference(type2);
12935 if(type2 && type2->kind == 8)
12936 notByReference = 0x1;
12937 }
12938 else if(exp->op.op == '&' && !exp->op.exp1)
12939 exp->expType = Reference(type2);
12940 else if(!assign)
12941 {
12942 if(boolOps)
12943 {
12944 if(exp->op.exp1)
12945 {
12946 if(exp->op.exp1->destType)
12947 FreeType(exp->op.exp1->destType);
12948 exp->op.exp1->destType = MkClassType("bool");
12949 exp->op.exp1->destType->truth = 0x1;
12950 if(!exp->op.exp1->expType)
12951 ProcessExpressionType(exp->op.exp1);
12952 else
12953 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12954 FreeType(exp->op.exp1->expType);
12955 exp->op.exp1->expType = MkClassType("bool");
12956 exp->op.exp1->expType->truth = 0x1;
12957 }
12958 if(exp->op.exp2)
12959 {
12960 if(exp->op.exp2->destType)
12961 FreeType(exp->op.exp2->destType);
12962 exp->op.exp2->destType = MkClassType("bool");
12963 exp->op.exp2->destType->truth = 0x1;
12964 if(!exp->op.exp2->expType)
12965 ProcessExpressionType(exp->op.exp2);
12966 else
12967 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12968 FreeType(exp->op.exp2->expType);
12969 exp->op.exp2->expType = MkClassType("bool");
12970 exp->op.exp2->expType->truth = 0x1;
12971 }
12972 }
12973 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")))))
12974 {
12975 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
12976 {
12977 if(exp->op.exp2->destType)
12978 FreeType(exp->op.exp2->destType);
12979 exp->op.exp2->destType = type1;
12980 type1->refCount++;
12981 if(exp->op.exp1->destType)
12982 FreeType(exp->op.exp1->destType);
12983 exp->op.exp1->destType = type2;
12984 type2->refCount++;
12985 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)
12986 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);
12987 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
12988 {
12989 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12990
12991 if(argExp)
12992 {
12993 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12994
12995 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
12996 ProcessExpressionType(exp->op.exp1);
12997 if(type2->kind != 13)
12998 {
12999 ProcessExpressionType(classExp);
13000 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"))))))));
13001 if(!exp->op.exp2->expType)
13002 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
13003 ProcessExpressionType(exp->op.exp2);
13004 }
13005 }
13006 }
13007 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)))
13008 {
13009 if(type1->kind != 8 && type1->type->kind == 0)
13010 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
13011 exp->expType = type1;
13012 if(type1)
13013 type1->refCount++;
13014 }
13015 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)))
13016 {
13017 if(type2->kind != 8 && type2->type->kind == 0)
13018 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
13019 exp->expType = type2;
13020 if(type2)
13021 type2->refCount++;
13022 }
13023 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))
13024 {
13025 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
13026 }
13027 else
13028 {
13029 unsigned int success = 0x0;
13030
13031 if(type1->kind == 13 && type2->kind == 13)
13032 {
13033 if(exp->op.op == '+')
13034 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
13035 else if(exp->op.op == '-')
13036 {
13037 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
13038 {
13039 exp->expType = __extension__ ({
13040 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13041
13042 __ecereInstance1->kind = 3, __ecereInstance1->refCount = 1, __ecereInstance1;
13043 });
13044 success = 0x1;
13045 if(type1->type->kind == 20)
13046 {
13047 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
13048
13049 if(argExp)
13050 {
13051 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
13052
13053 ProcessExpressionType(classExp);
13054 exp->type = 5;
13055 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")))))));
13056 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
13057 FreeType(dummy);
13058 return ;
13059 }
13060 }
13061 }
13062 }
13063 }
13064 if(!success && exp->op.exp1->type == 2)
13065 {
13066 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13067 {
13068 if(exp->expType)
13069 FreeType(exp->expType);
13070 exp->expType = exp->op.exp1->destType;
13071 if(exp->op.exp1->destType)
13072 exp->op.exp1->destType->refCount++;
13073 success = 0x1;
13074 }
13075 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13076 {
13077 if(exp->expType)
13078 FreeType(exp->expType);
13079 exp->expType = exp->op.exp2->destType;
13080 if(exp->op.exp2->destType)
13081 exp->op.exp2->destType->refCount++;
13082 success = 0x1;
13083 }
13084 }
13085 else if(!success)
13086 {
13087 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13088 {
13089 if(exp->expType)
13090 FreeType(exp->expType);
13091 exp->expType = exp->op.exp2->destType;
13092 if(exp->op.exp2->destType)
13093 exp->op.exp2->destType->refCount++;
13094 success = 0x1;
13095 }
13096 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13097 {
13098 if(exp->expType)
13099 FreeType(exp->expType);
13100 exp->expType = exp->op.exp1->destType;
13101 if(exp->op.exp1->destType)
13102 exp->op.exp1->destType->refCount++;
13103 success = 0x1;
13104 }
13105 }
13106 if(!success)
13107 {
13108 char expString1[10240];
13109 char expString2[10240];
13110 char type1[1024];
13111 char type2[1024];
13112
13113 expString1[0] = '\0';
13114 expString2[0] = '\0';
13115 type1[0] = '\0';
13116 type2[0] = '\0';
13117 if(inCompiler)
13118 {
13119 PrintExpression(exp->op.exp1, expString1);
13120 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13121 PrintExpression(exp->op.exp2, expString2);
13122 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13123 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
13124 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
13125 }
13126 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
13127 }
13128 }
13129 }
13130 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13131 {
13132 if(exp->op.exp1->destType)
13133 FreeType(exp->op.exp1->destType);
13134 exp->op.exp1->destType = type2->_class->registered->dataType;
13135 if(type2->_class->registered->dataType)
13136 type2->_class->registered->dataType->refCount++;
13137 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13138 exp->expType = type2;
13139 if(type2)
13140 type2->refCount++;
13141 }
13142 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13143 {
13144 if(exp->op.exp2->destType)
13145 FreeType(exp->op.exp2->destType);
13146 exp->op.exp2->destType = type1->_class->registered->dataType;
13147 if(type1->_class->registered->dataType)
13148 type1->_class->registered->dataType->refCount++;
13149 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13150 exp->expType = type1;
13151 if(type1)
13152 type1->refCount++;
13153 }
13154 else if(type1)
13155 {
13156 unsigned int valid = 0x0;
13157
13158 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
13159 {
13160 if(exp->op.exp2->destType)
13161 FreeType(exp->op.exp2->destType);
13162 if(!type1->_class->registered->dataType)
13163 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
13164 exp->op.exp2->destType = type1->_class->registered->dataType;
13165 exp->op.exp2->destType->refCount++;
13166 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13167 type2 = exp->op.exp2->destType;
13168 exp->expType = type2;
13169 type2->refCount++;
13170 }
13171 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
13172 {
13173 if(exp->op.exp1->destType)
13174 FreeType(exp->op.exp1->destType);
13175 if(!type2->_class->registered->dataType)
13176 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
13177 exp->op.exp1->destType = type2->_class->registered->dataType;
13178 exp->op.exp1->destType->refCount++;
13179 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13180 type1 = exp->op.exp1->destType;
13181 exp->expType = type1;
13182 type1->refCount++;
13183 }
13184 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
13185 {
13186 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
13187 {
13188 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
13189 {
13190 if(exp->expType)
13191 FreeType(exp->expType);
13192 exp->expType = exp->op.exp1->expType;
13193 if(exp->op.exp2->expType)
13194 exp->op.exp1->expType->refCount++;
13195 valid = 0x1;
13196 }
13197 }
13198 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
13199 {
13200 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
13201 {
13202 if(exp->expType)
13203 FreeType(exp->expType);
13204 exp->expType = exp->op.exp2->expType;
13205 if(exp->op.exp2->expType)
13206 exp->op.exp2->expType->refCount++;
13207 valid = 0x1;
13208 }
13209 }
13210 }
13211 if(!valid)
13212 {
13213 if(exp->op.exp2->destType)
13214 FreeType(exp->op.exp2->destType);
13215 exp->op.exp2->destType = type1;
13216 type1->refCount++;
13217 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13218 {
13219 if(exp->expType)
13220 FreeType(exp->expType);
13221 exp->expType = exp->op.exp2->destType;
13222 if(exp->op.exp2->destType)
13223 exp->op.exp2->destType->refCount++;
13224 }
13225 else if(type1 && type2)
13226 {
13227 char expString1[10240];
13228 char expString2[10240];
13229 char type1String[1024];
13230 char type2String[1024];
13231
13232 expString1[0] = '\0';
13233 expString2[0] = '\0';
13234 type1String[0] = '\0';
13235 type2String[0] = '\0';
13236 if(inCompiler)
13237 {
13238 PrintExpression(exp->op.exp1, expString1);
13239 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13240 PrintExpression(exp->op.exp2, expString2);
13241 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13242 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
13243 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
13244 }
13245 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
13246 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
13247 {
13248 exp->expType = exp->op.exp1->expType;
13249 if(exp->op.exp1->expType)
13250 exp->op.exp1->expType->refCount++;
13251 }
13252 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13253 {
13254 exp->expType = exp->op.exp2->expType;
13255 if(exp->op.exp2->expType)
13256 exp->op.exp2->expType->refCount++;
13257 }
13258 }
13259 }
13260 }
13261 else if(type2)
13262 {
13263 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13264 {
13265 struct Type * oldType = exp->op.exp1->expType;
13266
13267 exp->op.exp1->expType = (((void *)0));
13268 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13269 FreeType(oldType);
13270 else
13271 exp->op.exp1->expType = oldType;
13272 }
13273 if(exp->op.exp1->destType)
13274 FreeType(exp->op.exp1->destType);
13275 exp->op.exp1->destType = type2;
13276 type2->refCount++;
13277 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13278 {
13279 if(exp->expType)
13280 FreeType(exp->expType);
13281 exp->expType = exp->op.exp1->destType;
13282 if(exp->op.exp1->destType)
13283 exp->op.exp1->destType->refCount++;
13284 }
13285 }
13286 }
13287 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
13288 {
13289 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13290 {
13291 if(exp->op.exp1->destType)
13292 FreeType(exp->op.exp1->destType);
13293 exp->op.exp1->destType = type2->_class->registered->dataType;
13294 if(type2->_class->registered->dataType)
13295 type2->_class->registered->dataType->refCount++;
13296 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13297 }
13298 if(exp->op.op == '!')
13299 {
13300 exp->expType = MkClassType("bool");
13301 exp->expType->truth = 0x1;
13302 }
13303 else
13304 {
13305 exp->expType = type2;
13306 if(type2)
13307 type2->refCount++;
13308 }
13309 }
13310 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
13311 {
13312 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13313 {
13314 if(exp->op.exp2->destType)
13315 FreeType(exp->op.exp2->destType);
13316 exp->op.exp2->destType = type1->_class->registered->dataType;
13317 if(type1->_class->registered->dataType)
13318 type1->_class->registered->dataType->refCount++;
13319 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13320 }
13321 exp->expType = type1;
13322 if(type1)
13323 type1->refCount++;
13324 }
13325 }
13326 yylloc = exp->loc;
13327 if(exp->op.exp1 && !exp->op.exp1->expType)
13328 {
13329 char expString[10000];
13330
13331 expString[0] = '\0';
13332 if(inCompiler)
13333 {
13334 PrintExpression(exp->op.exp1, expString);
13335 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13336 }
13337 if(expString[0])
13338 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13339 }
13340 if(exp->op.exp2 && !exp->op.exp2->expType)
13341 {
13342 char expString[10240];
13343
13344 expString[0] = '\0';
13345 if(inCompiler)
13346 {
13347 PrintExpression(exp->op.exp2, expString);
13348 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13349 }
13350 if(expString[0])
13351 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13352 }
13353 if(boolResult)
13354 {
13355 FreeType(exp->expType);
13356 exp->expType = MkClassType("bool");
13357 exp->expType->truth = 0x1;
13358 }
13359 if(exp->op.op != SIZEOF)
13360 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
13361 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
13362 {
13363 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
13364 }
13365 yylloc = oldyylloc;
13366 FreeType(dummy);
13367 break;
13368 }
13369 case 5:
13370 case 34:
13371 {
13372 struct Expression * e;
13373
13374 exp->isConstant = 0x1;
13375 for(e = (*exp->list).first; e; e = e->next)
13376 {
13377 unsigned int inced = 0x0;
13378
13379 if(!e->next)
13380 {
13381 FreeType(e->destType);
13382 e->destType = exp->destType;
13383 if(e->destType)
13384 {
13385 exp->destType->refCount++;
13386 e->destType->count++;
13387 inced = 0x1;
13388 }
13389 }
13390 ProcessExpressionType(e);
13391 if(inced)
13392 exp->destType->count--;
13393 if(!exp->expType && !e->next)
13394 {
13395 exp->expType = e->expType;
13396 if(e->expType)
13397 e->expType->refCount++;
13398 }
13399 if(!e->isConstant)
13400 exp->isConstant = 0x0;
13401 }
13402 e = (*exp->list).first;
13403 if(!e->next && e->type == 8)
13404 {
13405 struct Expression * next = exp->next, * prev = exp->prev;
13406
13407 FreeType(exp->expType);
13408 FreeType(exp->destType);
13409 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
13410 *exp = *e;
13411 exp->prev = prev;
13412 exp->next = next;
13413 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
13414 ProcessExpressionType(exp);
13415 }
13416 break;
13417 }
13418 case 6:
13419 {
13420 struct Expression * e;
13421
13422 exp->isConstant = 0x1;
13423 ProcessExpressionType(exp->index.exp);
13424 if(!exp->index.exp->isConstant)
13425 exp->isConstant = 0x0;
13426 if(exp->index.exp->expType)
13427 {
13428 struct Type * source = exp->index.exp->expType;
13429
13430 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)
13431 {
13432 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
13433
13434 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
13435 if(exp->index.index && (*exp->index.index).last)
13436 {
13437 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
13438 }
13439 }
13440 }
13441 for(e = (*exp->index.index).first; e; e = e->next)
13442 {
13443 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
13444 {
13445 if(e->destType)
13446 FreeType(e->destType);
13447 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
13448 }
13449 ProcessExpressionType(e);
13450 if(!e->next)
13451 {
13452 }
13453 if(!e->isConstant)
13454 exp->isConstant = 0x0;
13455 }
13456 if(!exp->expType)
13457 exp->expType = Dereference(exp->index.exp->expType);
13458 if(exp->expType)
13459 DeclareType(exp->expType, 0x0, 0x0);
13460 break;
13461 }
13462 case 7:
13463 {
13464 struct Expression * e;
13465 struct Type * functionType;
13466 struct Type * methodType = (((void *)0));
13467 char name[1024];
13468
13469 name[0] = '\0';
13470 if(inCompiler)
13471 {
13472 PrintExpression(exp->call.exp, name);
13473 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
13474 {
13475 PrintExpression(exp->call.exp, name);
13476 }
13477 }
13478 if(exp->call.exp->type == 0)
13479 {
13480 struct Expression * idExp = exp->call.exp;
13481 struct Identifier * id = idExp->identifier;
13482
13483 if(!strcmp(id->string, "__builtin_frame_address"))
13484 {
13485 exp->expType = ProcessTypeString("void *", 0x1);
13486 if(exp->call.arguments && (*exp->call.arguments).first)
13487 ProcessExpressionType((*exp->call.arguments).first);
13488 break;
13489 }
13490 else if(!strcmp(id->string, "__ENDIAN_PAD"))
13491 {
13492 exp->expType = ProcessTypeString("int", 0x1);
13493 if(exp->call.arguments && (*exp->call.arguments).first)
13494 ProcessExpressionType((*exp->call.arguments).first);
13495 break;
13496 }
13497 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
13498 {
13499 struct Expression * a = (((void *)0));
13500 struct Expression * b = (((void *)0));
13501 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
13502
13503 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
13504 {
13505 a = (*exp->call.arguments).first;
13506 b = (*exp->call.arguments).last;
13507 tempExp1 = a;
13508 tempExp2 = b;
13509 }
13510 else if((*exp->call.arguments).count == 1)
13511 {
13512 a = (*exp->call.arguments).first;
13513 tempExp1 = a;
13514 }
13515 if(a)
13516 {
13517 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
13518 idExp->identifier = (((void *)0));
13519 FreeExpContents(exp);
13520 ProcessExpressionType(a);
13521 if(b)
13522 ProcessExpressionType(b);
13523 exp->type = 5;
13524 exp->list = MkList();
13525 if(a->expType && (!b || b->expType))
13526 {
13527 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
13528 {
13529 if(inCompiler)
13530 {
13531 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13532 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
13533 struct Declaration * decl;
13534 char temp1[1024], temp2[1024];
13535
13536 GetTypeSpecs(a->expType, specs);
13537 if(a && !a->isConstant && a->type != 0)
13538 {
13539 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
13540 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
13541 tempExp1 = QMkExpId(temp1);
13542 tempExp1->expType = a->expType;
13543 if(a->expType)
13544 a->expType->refCount++;
13545 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
13546 }
13547 if(b && !b->isConstant && b->type != 0)
13548 {
13549 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
13550 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
13551 tempExp2 = QMkExpId(temp2);
13552 tempExp2->expType = b->expType;
13553 if(b->expType)
13554 b->expType->refCount++;
13555 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
13556 }
13557 decl = MkDeclaration(specs, decls);
13558 if(!curCompound->compound.declarations)
13559 curCompound->compound.declarations = MkList();
13560 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
13561 }
13562 }
13563 }
13564 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13565 {
13566 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13567
13568 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13569 exp->expType = a->expType;
13570 if(a->expType)
13571 a->expType->refCount++;
13572 }
13573 else if(!strcmp(id->string, "Abs"))
13574 {
13575 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13576 exp->expType = a->expType;
13577 if(a->expType)
13578 a->expType->refCount++;
13579 }
13580 else if(!strcmp(id->string, "Sgn"))
13581 {
13582 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"))))));
13583 exp->expType = ProcessTypeString("int", 0x0);
13584 }
13585 FreeExpression(tempExp1);
13586 if(tempExp2)
13587 FreeExpression(tempExp2);
13588 FreeIdentifier(id);
13589 break;
13590 }
13591 }
13592 }
13593 {
13594 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
13595
13596 if(!exp->call.exp->destType)
13597 {
13598 exp->call.exp->destType = dummy;
13599 dummy->refCount++;
13600 }
13601 ProcessExpressionType(exp->call.exp);
13602 if(exp->call.exp->destType == dummy)
13603 {
13604 FreeType(dummy);
13605 exp->call.exp->destType = (((void *)0));
13606 }
13607 FreeType(dummy);
13608 }
13609 functionType = exp->call.exp->expType;
13610 if(functionType && functionType->kind == 16)
13611 {
13612 methodType = functionType;
13613 functionType = methodType->method->dataType;
13614 if(exp->call.exp->expType->usedClass)
13615 {
13616 char typeString[1024];
13617
13618 typeString[0] = '\0';
13619 {
13620 struct Symbol * back = functionType->thisClass;
13621
13622 functionType->thisClass = (((void *)0));
13623 PrintType(functionType, typeString, 0x1, 0x1);
13624 functionType->thisClass = back;
13625 }
13626 if(strstr(typeString, "thisclass"))
13627 {
13628 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13629 struct Declarator * decl;
13630
13631 {
13632 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13633
13634 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13635 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13636 thisClassParams = 0x0;
13637 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13638 {
13639 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13640
13641 thisClass = exp->call.exp->expType->usedClass;
13642 ProcessDeclarator(decl);
13643 thisClass = backupThisClass;
13644 }
13645 thisClassParams = 0x1;
13646 functionType = ProcessType(specs, decl);
13647 functionType->refCount = 0;
13648 FinishTemplatesContext(context);
13649 }
13650 FreeList(specs, FreeSpecifier);
13651 FreeDeclarator(decl);
13652 }
13653 }
13654 }
13655 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13656 {
13657 struct Type * type = functionType->type;
13658
13659 if(!functionType->refCount)
13660 {
13661 functionType->type = (((void *)0));
13662 FreeType(functionType);
13663 }
13664 functionType = type;
13665 }
13666 if(functionType && functionType->kind != 11)
13667 {
13668 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13669 }
13670 else if(functionType)
13671 {
13672 unsigned int emptyParams = 0x0, noParams = 0x0;
13673 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13674 struct Type * type = functionType->params.first;
13675 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13676 int extra = 0;
13677 struct Location oldyylloc = yylloc;
13678
13679 if(!type)
13680 emptyParams = 0x1;
13681 if(functionType->extraParam && e && functionType->thisClass)
13682 {
13683 e->destType = MkClassType(functionType->thisClass->string);
13684 e = e->next;
13685 }
13686 if(!functionType->staticMethod)
13687 {
13688 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13689 {
13690 type = MkClassType(memberExp->member.exp->expType->_class->string);
13691 if(e)
13692 {
13693 e->destType = type;
13694 e = e->next;
13695 type = functionType->params.first;
13696 }
13697 else
13698 type->refCount = 0;
13699 }
13700 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13701 {
13702 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13703 if(e)
13704 {
13705 e->destType = type;
13706 e = e->next;
13707 type = functionType->params.first;
13708 }
13709 else
13710 type->refCount = 0;
13711 }
13712 }
13713 if(type && type->kind == 0)
13714 {
13715 noParams = 0x1;
13716 if(!type->refCount)
13717 FreeType(type);
13718 type = (((void *)0));
13719 }
13720 for(; e; e = e->next)
13721 {
13722 if(!type && !emptyParams)
13723 {
13724 yylloc = e->loc;
13725 if(methodType && methodType->methodClass)
13726 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);
13727 else
13728 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);
13729 break;
13730 }
13731 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13732 {
13733 struct Type * templatedType = (((void *)0));
13734 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13735 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13736 int id = 0;
13737
13738 if(_class && _class->templateArgs)
13739 {
13740 struct __ecereNameSpace__ecere__com__Class * sClass;
13741
13742 for(sClass = _class; sClass; sClass = sClass->base)
13743 {
13744 if(sClass->templateClass)
13745 sClass = sClass->templateClass;
13746 id = 0;
13747 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13748 {
13749 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13750 {
13751 struct __ecereNameSpace__ecere__com__Class * nextClass;
13752
13753 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13754 {
13755 if(nextClass->templateClass)
13756 nextClass = nextClass->templateClass;
13757 id += nextClass->templateParams.count;
13758 }
13759 break;
13760 }
13761 id++;
13762 }
13763 if(curParam)
13764 break;
13765 }
13766 }
13767 if(curParam && _class->templateArgs[id].dataTypeString)
13768 {
13769 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13770
13771 {
13772 struct Context * context = SetupTemplatesContext(_class);
13773
13774 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13775 FinishTemplatesContext(context);
13776 }
13777 e->destType = templatedType;
13778 if(templatedType)
13779 {
13780 templatedType->passAsTemplate = 0x1;
13781 }
13782 }
13783 else
13784 {
13785 e->destType = type;
13786 if(type)
13787 type->refCount++;
13788 }
13789 }
13790 else
13791 {
13792 if(type && type->kind == 14 && type->prev && type->prev->kind == 8 && type->prev->classObjectType)
13793 {
13794 e->destType = type->prev;
13795 e->destType->refCount++;
13796 }
13797 else
13798 {
13799 e->destType = type;
13800 if(type)
13801 type->refCount++;
13802 }
13803 }
13804 if(type && type->kind != 14)
13805 {
13806 struct Type * next = type->next;
13807
13808 if(!type->refCount)
13809 FreeType(type);
13810 type = next;
13811 }
13812 }
13813 if(type && type->kind != 14)
13814 {
13815 if(methodType && methodType->methodClass)
13816 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);
13817 else
13818 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);
13819 }
13820 yylloc = oldyylloc;
13821 if(type && !type->refCount)
13822 FreeType(type);
13823 }
13824 else
13825 {
13826 functionType = __extension__ ({
13827 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13828
13829 __ecereInstance1->refCount = 0, __ecereInstance1->kind = 11, __ecereInstance1;
13830 });
13831 if(exp->call.exp->type == 0)
13832 {
13833 char * string = exp->call.exp->identifier->string;
13834
13835 if(inCompiler)
13836 {
13837 struct Symbol * symbol;
13838 struct Location oldyylloc = yylloc;
13839
13840 yylloc = exp->call.exp->identifier->loc;
13841 if(strstr(string, "__builtin_") == string)
13842 {
13843 if(exp->destType)
13844 {
13845 functionType->returnType = exp->destType;
13846 exp->destType->refCount++;
13847 }
13848 }
13849 else
13850 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13851 symbol = __extension__ ({
13852 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
13853
13854 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString(string), __ecereInstance1->type = ProcessTypeString("int()", 0x1), __ecereInstance1;
13855 });
13856 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13857 if(strstr(symbol->string, "::"))
13858 globalContext->hasNameSpace = 0x1;
13859 yylloc = oldyylloc;
13860 }
13861 }
13862 else if(exp->call.exp->type == 8)
13863 {
13864 }
13865 else
13866 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13867 if(!functionType->returnType)
13868 {
13869 functionType->returnType = __extension__ ({
13870 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13871
13872 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
13873 });
13874 }
13875 }
13876 if(functionType && functionType->kind == 11)
13877 {
13878 exp->expType = functionType->returnType;
13879 if(functionType->returnType)
13880 functionType->returnType->refCount++;
13881 if(!functionType->refCount)
13882 FreeType(functionType);
13883 }
13884 if(exp->call.arguments)
13885 {
13886 for(e = (*exp->call.arguments).first; e; e = e->next)
13887 {
13888 struct Type * destType = e->destType;
13889
13890 ProcessExpressionType(e);
13891 }
13892 }
13893 break;
13894 }
13895 case 8:
13896 {
13897 struct Type * type;
13898 struct Location oldyylloc = yylloc;
13899 unsigned int thisPtr = (exp->member.exp && exp->member.exp->type == 0 && !strcmp(exp->member.exp->identifier->string, "this"));
13900
13901 exp->thisPtr = thisPtr;
13902 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13903 {
13904 exp->member.member->classSym = exp->member.member->_class->symbol;
13905 }
13906 ProcessExpressionType(exp->member.exp);
13907 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)
13908 {
13909 exp->isConstant = 0x0;
13910 }
13911 else
13912 exp->isConstant = exp->member.exp->isConstant;
13913 type = exp->member.exp->expType;
13914 yylloc = exp->loc;
13915 if(type && (type->kind == 20))
13916 {
13917 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13918 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13919
13920 if(_class)
13921 {
13922 for(param = _class->templateParams.first; param; param = param->next)
13923 {
13924 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
13925 break;
13926 }
13927 }
13928 if(param && param->defaultArg.member)
13929 {
13930 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
13931
13932 if(argExp)
13933 {
13934 struct Expression * expMember = exp->member.exp;
13935 struct Declarator * decl;
13936 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13937 char thisClassTypeString[1024];
13938
13939 FreeIdentifier(exp->member.member);
13940 ProcessExpressionType(argExp);
13941 {
13942 char * colon = strstr(param->defaultArg.memberString, "::");
13943
13944 if(colon)
13945 {
13946 char className[1024];
13947 struct __ecereNameSpace__ecere__com__Class * sClass;
13948
13949 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
13950 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
13951 }
13952 else
13953 strcpy(thisClassTypeString, _class->fullName);
13954 }
13955 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
13956 exp->expType = ProcessType(specs, decl);
13957 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
13958 {
13959 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13960 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13961 int c;
13962 int paramCount = 0;
13963 int lastParam = -1;
13964 char templateString[1024];
13965 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13966
13967 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13968 for(cClass = expClass; cClass; cClass = cClass->base)
13969 {
13970 int p = 0;
13971
13972 for(param = cClass->templateParams.first; param; param = param->next)
13973 {
13974 int id = p;
13975 struct __ecereNameSpace__ecere__com__Class * sClass;
13976 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13977
13978 for(sClass = cClass->base; sClass; sClass = sClass->base)
13979 id += sClass->templateParams.count;
13980 arg = expClass->templateArgs[id];
13981 for(sClass = _class; sClass; sClass = sClass->base)
13982 {
13983 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
13984 int p = 0;
13985 struct __ecereNameSpace__ecere__com__Class * nextClass;
13986
13987 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13988 p += nextClass->templateParams.count;
13989 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
13990 {
13991 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
13992 {
13993 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13994 {
13995 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
13996 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
13997 break;
13998 }
13999 }
14000 }
14001 }
14002 {
14003 char argument[256];
14004
14005 argument[0] = '\0';
14006 switch(param->type)
14007 {
14008 case 2:
14009 {
14010 char expString[1024];
14011 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14012 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14013 struct Expression * exp;
14014 char * string = PrintHexUInt64(arg.expression.ui64);
14015
14016 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14017 ProcessExpressionType(exp);
14018 ComputeExpression(exp);
14019 expString[0] = '\0';
14020 PrintExpression(exp, expString);
14021 strcat(argument, expString);
14022 FreeExpression(exp);
14023 break;
14024 }
14025 case 1:
14026 {
14027 strcat(argument, arg.member->name);
14028 break;
14029 }
14030 case 0:
14031 {
14032 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14033 {
14034 if(!strcmp(arg.dataTypeString, "thisclass"))
14035 strcat(argument, thisClassTypeString);
14036 else
14037 strcat(argument, arg.dataTypeString);
14038 }
14039 break;
14040 }
14041 }
14042 if(argument[0])
14043 {
14044 if(paramCount)
14045 strcat(templateString, ", ");
14046 if(lastParam != p - 1)
14047 {
14048 strcat(templateString, param->name);
14049 strcat(templateString, " = ");
14050 }
14051 strcat(templateString, argument);
14052 paramCount++;
14053 lastParam = p;
14054 }
14055 p++;
14056 }
14057 }
14058 }
14059 {
14060 int len = strlen(templateString);
14061
14062 if(templateString[len - 1] == '>')
14063 templateString[len++] = ' ';
14064 templateString[len++] = '>';
14065 templateString[len++] = '\0';
14066 }
14067 {
14068 struct Context * context = SetupTemplatesContext(_class);
14069
14070 FreeType(exp->expType);
14071 exp->expType = ProcessTypeString(templateString, 0x0);
14072 FinishTemplatesContext(context);
14073 }
14074 }
14075 exp->type = 5;
14076 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")))))))));
14077 }
14078 }
14079 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
14080 {
14081 type = ProcessTemplateParameterType(type->templateParameter);
14082 }
14083 }
14084 if(type && (type->kind == 20))
14085 ;
14086 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 || (type->kind == 13 && type->type->kind == 1)))
14087 {
14088 struct Identifier * id = exp->member.member;
14089 int typeKind = type->kind;
14090 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));
14091
14092 if(typeKind == 19 && exp->member.exp->type == 26)
14093 {
14094 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
14095 typeKind = 8;
14096 }
14097 if(id)
14098 {
14099 if(typeKind == 3 || typeKind == 15)
14100 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
14101 else if(!_class)
14102 {
14103 if(type->kind == 8 && type->_class && type->_class->registered)
14104 {
14105 _class = type->_class->registered;
14106 }
14107 else if((type->kind == 12 || type->kind == 13) && type->type && type->type->kind == 1)
14108 {
14109 _class = FindClass("char *")->registered;
14110 }
14111 else if(type->kind == 13)
14112 {
14113 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "uintptr");
14114 FreeType(exp->expType);
14115 exp->expType = ProcessTypeString("uintptr", 0x0);
14116 exp->byReference = 0x1;
14117 }
14118 else
14119 {
14120 char string[1024] = "";
14121 struct Symbol * classSym;
14122
14123 PrintTypeNoConst(type, string, 0x0, 0x1);
14124 classSym = FindClass(string);
14125 if(classSym)
14126 _class = classSym->registered;
14127 }
14128 }
14129 }
14130 if(_class && id)
14131 {
14132 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
14133 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
14134 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
14135 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
14136 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
14137
14138 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
14139 exp->member.memberType = 1;
14140 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
14141 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
14142 if(typeKind != 19)
14143 {
14144 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
14145 {
14146 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
14147 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
14148 {
14149 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14150 if(prop)
14151 member = (((void *)0));
14152 }
14153 if(!member && !prop)
14154 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14155 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
14156 exp->member.thisPtr = 0x1;
14157 }
14158 else
14159 {
14160 if(!id->classSym)
14161 {
14162 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
14163 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
14164 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
14165 }
14166 if(!prop && !member)
14167 {
14168 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
14169 if(!method)
14170 {
14171 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14172 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
14173 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
14174 }
14175 }
14176 if(member && prop)
14177 {
14178 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
14179 prop = (((void *)0));
14180 else
14181 member = (((void *)0));
14182 }
14183 }
14184 }
14185 if(!prop && !member && !method)
14186 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
14187 if(!prop && !member && !method)
14188 {
14189 if(typeKind == 19)
14190 {
14191 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
14192 if(classProp)
14193 {
14194 exp->member.memberType = 5;
14195 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
14196 }
14197 else
14198 {
14199 char structName[1024];
14200 struct Identifier * id = exp->member.member;
14201 struct Expression * classExp = exp->member.exp;
14202
14203 type->refCount++;
14204 FreeType(classExp->expType);
14205 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
14206 strcpy(structName, "__ecereClassData_");
14207 FullClassNameCat(structName, type->_class->string, 0x0);
14208 exp->type = 9;
14209 exp->member.member = id;
14210 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"))))))));
14211 FreeType(type);
14212 ProcessExpressionType(exp);
14213 return ;
14214 }
14215 }
14216 else
14217 {
14218 struct Symbol * classSym = FindClass(id->string);
14219
14220 if(classSym)
14221 {
14222 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
14223
14224 if(convertClass)
14225 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
14226 }
14227 }
14228 }
14229 if(prop)
14230 {
14231 exp->member.memberType = 1;
14232 if(!prop->dataType)
14233 ProcessPropertyType(prop);
14234 exp->expType = prop->dataType;
14235 if(prop->dataType)
14236 prop->dataType->refCount++;
14237 }
14238 else if(member)
14239 {
14240 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14241 {
14242 FreeExpContents(exp);
14243 exp->type = 0;
14244 exp->identifier = MkIdentifier("class");
14245 ProcessExpressionType(exp);
14246 return ;
14247 }
14248 exp->member.memberType = 3;
14249 DeclareStruct(_class->fullName, 0x0);
14250 if(!member->dataType)
14251 {
14252 struct Context * context = SetupTemplatesContext(_class);
14253
14254 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
14255 FinishTemplatesContext(context);
14256 }
14257 exp->expType = member->dataType;
14258 if(member->dataType)
14259 member->dataType->refCount++;
14260 }
14261 else if(revConvert)
14262 {
14263 exp->member.memberType = 4;
14264 exp->expType = MkClassType(revConvert->_class->fullName);
14265 }
14266 else if(method)
14267 {
14268 {
14269 exp->member.memberType = 2;
14270 }
14271 if(!method->dataType)
14272 ProcessMethodType(method);
14273 exp->expType = __extension__ ({
14274 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14275
14276 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1;
14277 });
14278 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
14279 exp->expType->usedClass = _class;
14280 }
14281 else if(!classProp)
14282 {
14283 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14284 {
14285 FreeExpContents(exp);
14286 exp->type = 0;
14287 exp->identifier = MkIdentifier("class");
14288 ProcessExpressionType(exp);
14289 return ;
14290 }
14291 yylloc = exp->member.member->loc;
14292 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
14293 if(inCompiler)
14294 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
14295 }
14296 if(_class && exp->expType)
14297 {
14298 struct __ecereNameSpace__ecere__com__Class * tClass;
14299
14300 tClass = _class;
14301 while(tClass && !tClass->templateClass)
14302 tClass = tClass->base;
14303 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
14304 {
14305 int id = 0;
14306 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14307 struct __ecereNameSpace__ecere__com__Class * sClass;
14308
14309 for(sClass = tClass; sClass; sClass = sClass->base)
14310 {
14311 id = 0;
14312 if(sClass->templateClass)
14313 sClass = sClass->templateClass;
14314 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14315 {
14316 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
14317 {
14318 for(sClass = sClass->base; sClass; sClass = sClass->base)
14319 id += sClass->templateParams.count;
14320 break;
14321 }
14322 id++;
14323 }
14324 if(curParam)
14325 break;
14326 }
14327 if(curParam && tClass->templateArgs[id].dataTypeString)
14328 {
14329 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14330 struct Context * context = SetupTemplatesContext(tClass);
14331
14332 FreeType(exp->expType);
14333 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
14334 if(exp->expType)
14335 {
14336 if(exp->expType->kind == 21)
14337 {
14338 FreeType(exp->expType);
14339 exp->expType = ReplaceThisClassType(_class);
14340 }
14341 if(tClass->templateClass)
14342 exp->expType->passAsTemplate = 0x1;
14343 if(!exp->destType)
14344 {
14345 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
14346 if(exp->destType->kind == 21)
14347 {
14348 FreeType(exp->destType);
14349 exp->destType = ReplaceThisClassType(_class);
14350 }
14351 }
14352 }
14353 FinishTemplatesContext(context);
14354 }
14355 }
14356 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
14357 {
14358 int id = 0;
14359 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14360 struct __ecereNameSpace__ecere__com__Class * sClass;
14361
14362 for(sClass = tClass; sClass; sClass = sClass->base)
14363 {
14364 id = 0;
14365 if(sClass->templateClass)
14366 sClass = sClass->templateClass;
14367 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14368 {
14369 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
14370 {
14371 for(sClass = sClass->base; sClass; sClass = sClass->base)
14372 id += sClass->templateParams.count;
14373 break;
14374 }
14375 id++;
14376 }
14377 if(curParam)
14378 break;
14379 }
14380 if(curParam)
14381 {
14382 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14383 struct Context * context = SetupTemplatesContext(tClass);
14384 struct Type * basicType;
14385
14386 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
14387 if(basicType)
14388 {
14389 if(basicType->kind == 21)
14390 {
14391 FreeType(basicType);
14392 basicType = ReplaceThisClassType(_class);
14393 }
14394 FreeType(exp->expType);
14395 exp->expType = __extension__ ({
14396 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14397
14398 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = basicType, __ecereInstance1;
14399 });
14400 if(!exp->destType)
14401 {
14402 exp->destType = exp->expType;
14403 exp->destType->refCount++;
14404 }
14405 {
14406 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14407 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14408 struct Declarator * decl;
14409
14410 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
14411 *newExp = *exp;
14412 if(exp->destType)
14413 exp->destType->refCount++;
14414 if(exp->expType)
14415 exp->expType->refCount++;
14416 exp->type = 11;
14417 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
14418 exp->cast.exp = newExp;
14419 }
14420 }
14421 FinishTemplatesContext(context);
14422 }
14423 }
14424 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
14425 {
14426 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
14427
14428 if(expClass)
14429 {
14430 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
14431 int c;
14432 int p = 0;
14433 int paramCount = 0;
14434 int lastParam = -1;
14435 char templateString[1024];
14436 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
14437
14438 sprintf(templateString, "%s<", expClass->templateClass->fullName);
14439 while(cClass != expClass)
14440 {
14441 struct __ecereNameSpace__ecere__com__Class * sClass;
14442
14443 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
14444 ;
14445 cClass = sClass;
14446 for(param = cClass->templateParams.first; param; param = param->next)
14447 {
14448 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
14449 int c;
14450 int cp = 0;
14451 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
14452 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
14453
14454 while(cClassCur != tClass && !paramCur)
14455 {
14456 struct __ecereNameSpace__ecere__com__Class * sClassCur;
14457
14458 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
14459 ;
14460 cClassCur = sClassCur;
14461 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
14462 {
14463 if(!strcmp(paramCur->name, param->name))
14464 {
14465 break;
14466 }
14467 cp++;
14468 }
14469 }
14470 if(paramCur && paramCur->type == 0)
14471 arg = tClass->templateArgs[cp];
14472 else
14473 arg = expClass->templateArgs[p];
14474 {
14475 char argument[256];
14476
14477 argument[0] = '\0';
14478 switch(param->type)
14479 {
14480 case 2:
14481 {
14482 char expString[1024];
14483 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14484 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14485 struct Expression * exp;
14486 char * string = PrintHexUInt64(arg.expression.ui64);
14487
14488 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14489 ProcessExpressionType(exp);
14490 ComputeExpression(exp);
14491 expString[0] = '\0';
14492 PrintExpression(exp, expString);
14493 strcat(argument, expString);
14494 FreeExpression(exp);
14495 break;
14496 }
14497 case 1:
14498 {
14499 strcat(argument, arg.member->name);
14500 break;
14501 }
14502 case 0:
14503 {
14504 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14505 strcat(argument, arg.dataTypeString);
14506 break;
14507 }
14508 }
14509 if(argument[0])
14510 {
14511 if(paramCount)
14512 strcat(templateString, ", ");
14513 if(lastParam != p - 1)
14514 {
14515 strcat(templateString, param->name);
14516 strcat(templateString, " = ");
14517 }
14518 strcat(templateString, argument);
14519 paramCount++;
14520 lastParam = p;
14521 }
14522 }
14523 p++;
14524 }
14525 }
14526 {
14527 int len = strlen(templateString);
14528
14529 if(templateString[len - 1] == '>')
14530 templateString[len++] = ' ';
14531 templateString[len++] = '>';
14532 templateString[len++] = '\0';
14533 }
14534 FreeType(exp->expType);
14535 {
14536 struct Context * context = SetupTemplatesContext(tClass);
14537
14538 exp->expType = ProcessTypeString(templateString, 0x0);
14539 FinishTemplatesContext(context);
14540 }
14541 }
14542 }
14543 }
14544 }
14545 else
14546 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)");
14547 }
14548 else if(type && (type->kind == 9 || type->kind == 10))
14549 {
14550 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
14551
14552 if(memberType)
14553 {
14554 exp->expType = memberType;
14555 if(memberType)
14556 memberType->refCount++;
14557 }
14558 }
14559 else
14560 {
14561 char expString[10240];
14562
14563 expString[0] = '\0';
14564 if(inCompiler)
14565 {
14566 PrintExpression(exp, expString);
14567 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14568 }
14569 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
14570 }
14571 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
14572 {
14573 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
14574 {
14575 struct Identifier * id = exp->member.member;
14576 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));
14577
14578 if(_class)
14579 {
14580 FreeType(exp->expType);
14581 exp->expType = ReplaceThisClassType(_class);
14582 }
14583 }
14584 }
14585 yylloc = oldyylloc;
14586 break;
14587 }
14588 case 9:
14589 {
14590 struct Type * destType = exp->destType;
14591
14592 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
14593 {
14594 exp->member.member->classSym = exp->member.member->_class->symbol;
14595 }
14596 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
14597 exp->type = 8;
14598 if(destType)
14599 destType->count++;
14600 ProcessExpressionType(exp);
14601 if(destType)
14602 destType->count--;
14603 break;
14604 }
14605 case 15:
14606 {
14607 struct Symbol * classSym = exp->_class->symbol;
14608
14609 if(classSym && classSym->registered)
14610 {
14611 if(classSym->registered->type == 5)
14612 {
14613 char name[1024];
14614
14615 name[0] = '\0';
14616 DeclareStruct(classSym->string, 0x0);
14617 FreeSpecifier(exp->_class);
14618 exp->type = 10;
14619 FullClassNameCat(name, classSym->string, 0x0);
14620 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
14621 }
14622 else
14623 {
14624 if(classSym->registered->fixed)
14625 {
14626 FreeSpecifier(exp->_class);
14627 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
14628 exp->type = 2;
14629 }
14630 else
14631 {
14632 char className[1024];
14633
14634 strcpy(className, "__ecereClass_");
14635 FullClassNameCat(className, classSym->string, 0x1);
14636 MangleClassName(className);
14637 DeclareClass(classSym, className);
14638 FreeExpContents(exp);
14639 exp->type = 9;
14640 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14641 exp->member.member = MkIdentifier("structSize");
14642 }
14643 }
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 break;
14651 }
14652 case 10:
14653 {
14654 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
14655
14656 exp->expType = __extension__ ({
14657 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14658
14659 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
14660 });
14661 exp->isConstant = 0x1;
14662 DeclareType(type, 0x0, 0x0);
14663 FreeType(type);
14664 break;
14665 }
14666 case 11:
14667 {
14668 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14669
14670 type->count = 1;
14671 FreeType(exp->cast.exp->destType);
14672 exp->cast.exp->destType = type;
14673 type->refCount++;
14674 ProcessExpressionType(exp->cast.exp);
14675 type->count = 0;
14676 exp->expType = type;
14677 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14678 {
14679 void * prev = exp->prev, * next = exp->next;
14680 struct Type * expType = exp->cast.exp->destType;
14681 struct Expression * castExp = exp->cast.exp;
14682 struct Type * destType = exp->destType;
14683
14684 if(expType)
14685 expType->refCount++;
14686 FreeType(exp->expType);
14687 FreeTypeName(exp->cast.typeName);
14688 *exp = *castExp;
14689 FreeType(exp->expType);
14690 FreeType(exp->destType);
14691 exp->expType = expType;
14692 exp->destType = destType;
14693 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14694 exp->prev = prev;
14695 exp->next = next;
14696 }
14697 else
14698 {
14699 exp->isConstant = exp->cast.exp->isConstant;
14700 }
14701 break;
14702 }
14703 case 35:
14704 {
14705 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14706
14707 exp->expType = type;
14708 break;
14709 }
14710 case 36:
14711 {
14712 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14713
14714 ProcessExpressionType(exp->vaArg.exp);
14715 exp->expType = type;
14716 break;
14717 }
14718 case 12:
14719 {
14720 struct Expression * e;
14721
14722 exp->isConstant = 0x1;
14723 FreeType(exp->cond.cond->destType);
14724 exp->cond.cond->destType = MkClassType("bool");
14725 exp->cond.cond->destType->truth = 0x1;
14726 ProcessExpressionType(exp->cond.cond);
14727 if(!exp->cond.cond->isConstant)
14728 exp->isConstant = 0x0;
14729 for(e = (*exp->cond.exp).first; e; e = e->next)
14730 {
14731 if(!e->next)
14732 {
14733 FreeType(e->destType);
14734 e->destType = exp->destType;
14735 if(e->destType)
14736 e->destType->refCount++;
14737 }
14738 ProcessExpressionType(e);
14739 if(!e->next)
14740 {
14741 exp->expType = e->expType;
14742 if(e->expType)
14743 e->expType->refCount++;
14744 }
14745 if(!e->isConstant)
14746 exp->isConstant = 0x0;
14747 }
14748 FreeType(exp->cond.elseExp->destType);
14749 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14750 if(exp->cond.elseExp->destType)
14751 exp->cond.elseExp->destType->refCount++;
14752 ProcessExpressionType(exp->cond.elseExp);
14753 if(!exp->cond.elseExp->isConstant)
14754 exp->isConstant = 0x0;
14755 break;
14756 }
14757 case 25:
14758 {
14759 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14760 {
14761 struct Statement * last = (*exp->compound->compound.statements).last;
14762
14763 if(last->type == 3 && last->expressions && (*last->expressions).last)
14764 {
14765 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14766 if(exp->destType)
14767 exp->destType->refCount++;
14768 }
14769 ProcessStatement(exp->compound);
14770 exp->expType = (last->expressions && (*last->expressions).last) ? ((struct Expression *)(*last->expressions).last)->expType : (((void *)0));
14771 if(exp->expType)
14772 exp->expType->refCount++;
14773 }
14774 break;
14775 }
14776 case 26:
14777 {
14778 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14779
14780 if(spec && spec->type == 1)
14781 {
14782 exp->expType = MkClassType(spec->name);
14783 exp->expType->kind = 19;
14784 exp->byReference = 0x1;
14785 }
14786 else
14787 {
14788 exp->expType = MkClassType("ecere::com::Class");
14789 exp->byReference = 0x1;
14790 }
14791 break;
14792 }
14793 case 27:
14794 {
14795 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14796
14797 if(_class)
14798 {
14799 struct Identifier * id = exp->classData.id;
14800 char structName[1024];
14801 struct Expression * classExp;
14802
14803 strcpy(structName, "__ecereClassData_");
14804 FullClassNameCat(structName, _class->fullName, 0x0);
14805 exp->type = 9;
14806 exp->member.member = id;
14807 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14808 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14809 else
14810 classExp = MkExpIdentifier(MkIdentifier("class"));
14811 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"))))))));
14812 ProcessExpressionType(exp);
14813 return ;
14814 }
14815 break;
14816 }
14817 case 37:
14818 {
14819 struct Type * type = (((void *)0));
14820 char * typeString = (((void *)0));
14821 char typeStringBuf[1024];
14822
14823 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))
14824 {
14825 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14826
14827 typeString = templateClass->templateArgs[2].dataTypeString;
14828 }
14829 else if(exp->list)
14830 {
14831 struct Expression * e;
14832
14833 for(e = (*exp->list).first; e; e = e->next)
14834 {
14835 ProcessExpressionType(e);
14836 if(e->expType)
14837 {
14838 if(!type)
14839 {
14840 type = e->expType;
14841 type->refCount++;
14842 }
14843 else
14844 {
14845 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14846 {
14847 FreeType(type);
14848 type = e->expType;
14849 e->expType = (((void *)0));
14850 e = (*exp->list).first;
14851 ProcessExpressionType(e);
14852 if(e->expType)
14853 {
14854 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14855 {
14856 FreeType(e->expType);
14857 e->expType = (((void *)0));
14858 FreeType(type);
14859 type = (((void *)0));
14860 break;
14861 }
14862 }
14863 }
14864 }
14865 if(e->expType)
14866 {
14867 FreeType(e->expType);
14868 e->expType = (((void *)0));
14869 }
14870 }
14871 }
14872 if(type)
14873 {
14874 typeStringBuf[0] = '\0';
14875 PrintTypeNoConst(type, typeStringBuf, 0x0, 0x1);
14876 typeString = typeStringBuf;
14877 FreeType(type);
14878 type = (((void *)0));
14879 }
14880 }
14881 if(typeString)
14882 {
14883 char templateString[1024];
14884 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14885 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14886 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14887 struct Expression * expExt;
14888 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14889
14890 sprintf(templateString, "Container<%s>", typeString);
14891 if(exp->list)
14892 {
14893 struct Expression * e;
14894
14895 type = ProcessTypeString(typeString, 0x0);
14896 while(e = (*exp->list).first)
14897 {
14898 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14899 e->destType = type;
14900 type->refCount++;
14901 ProcessExpressionType(e);
14902 ListAdd(initializers, MkInitializerAssignment(e));
14903 }
14904 FreeType(type);
14905 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14906 }
14907 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
14908 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
14909 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14910 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
14911 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14912 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
14913 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14914 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
14915 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14916 ListAdd(structInitializers, MkInitializerAssignment(__extension__ ({
14917 struct Expression * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14918
14919 __ecereInstance1->type = 2, __ecereInstance1->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, (void *)0), __ecereInstance1;
14920 })));
14921 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14922 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
14923 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14924 exp->expType = ProcessTypeString(templateString, 0x0);
14925 exp->type = 5;
14926 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
14927 ProcessExpressionType(expExt);
14928 }
14929 else
14930 {
14931 exp->expType = ProcessTypeString("Container", 0x0);
14932 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
14933 }
14934 break;
14935 }
14936 }
14937 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
14938 {
14939 FreeType(exp->expType);
14940 exp->expType = ReplaceThisClassType(thisClass);
14941 }
14942 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
14943 {
14944 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
14945
14946 if(symbol)
14947 {
14948 if(exp->expType->kind != 15)
14949 {
14950 struct Type * member;
14951 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
14952
14953 FreeType(exp->expType);
14954 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14955 exp->expType->kind = symbol->type->kind;
14956 exp->expType->refCount++;
14957 exp->expType->enumName = enumName;
14958 exp->expType->members = symbol->type->members;
14959 for(member = symbol->type->members.first; member; member = member->next)
14960 member->refCount++;
14961 }
14962 else
14963 {
14964 struct __ecereNameSpace__ecere__sys__NamedLink * member;
14965
14966 for(member = symbol->type->members.first; member; member = member->next)
14967 {
14968 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(structSize_NamedLink), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
14969
14970 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
14971 }
14972 }
14973 }
14974 }
14975 yylloc = exp->loc;
14976 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
14977 ;
14978 else if(exp->destType && !exp->destType->keepCast)
14979 {
14980 if(!CheckExpressionType(exp, exp->destType, 0x0))
14981 {
14982 if(!exp->destType->count || unresolved)
14983 {
14984 if(!exp->expType)
14985 {
14986 yylloc = exp->loc;
14987 if(exp->destType->kind != 14)
14988 {
14989 char type2[1024];
14990
14991 type2[0] = '\0';
14992 if(inCompiler)
14993 {
14994 char expString[10240];
14995
14996 expString[0] = '\0';
14997 PrintType(exp->destType, type2, 0x0, 0x1);
14998 if(inCompiler)
14999 {
15000 PrintExpression(exp, expString);
15001 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15002 }
15003 if(unresolved)
15004 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
15005 else if(exp->type != 16)
15006 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
15007 }
15008 }
15009 else
15010 {
15011 char expString[10240];
15012
15013 expString[0] = '\0';
15014 if(inCompiler)
15015 {
15016 PrintExpression(exp, expString);
15017 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15018 }
15019 if(unresolved)
15020 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
15021 else if(exp->type != 16)
15022 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
15023 }
15024 }
15025 else
15026 {
15027 char type1[1024];
15028 char type2[1024];
15029
15030 type1[0] = '\0';
15031 type2[0] = '\0';
15032 if(inCompiler)
15033 {
15034 PrintType(exp->expType, type1, 0x0, 0x1);
15035 PrintType(exp->destType, type2, 0x0, 0x1);
15036 }
15037 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)))
15038 ;
15039 else
15040 {
15041 char expString[10240];
15042
15043 expString[0] = '\0';
15044 if(inCompiler)
15045 {
15046 PrintExpression(exp, expString);
15047 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15048 }
15049 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
15050 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
15051 FreeType(exp->expType);
15052 exp->destType->refCount++;
15053 exp->expType = exp->destType;
15054 }
15055 }
15056 }
15057 }
15058 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
15059 {
15060 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
15061 char typeString[1024];
15062 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15063 struct Declarator * decl;
15064
15065 typeString[0] = '\0';
15066 *newExp = *exp;
15067 if(exp->expType)
15068 exp->expType->refCount++;
15069 if(exp->expType)
15070 exp->expType->refCount++;
15071 exp->type = 11;
15072 newExp->destType = exp->expType;
15073 PrintType(exp->expType, typeString, 0x0, 0x0);
15074 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
15075 exp->cast.typeName = MkTypeName(specs, decl);
15076 exp->cast.exp = newExp;
15077 }
15078 }
15079 else if(unresolved)
15080 {
15081 if(exp->identifier->_class && exp->identifier->_class->name)
15082 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
15083 else if(exp->identifier->string && exp->identifier->string[0])
15084 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
15085 }
15086 else if(!exp->expType && exp->type != 16)
15087 {
15088 char expString[10240];
15089
15090 expString[0] = '\0';
15091 if(inCompiler)
15092 {
15093 PrintExpression(exp, expString);
15094 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15095 }
15096 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
15097 }
15098 if(inCompiler)
15099 ApplyAnyObjectLogic(exp);
15100 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)))
15101 {
15102 exp->byReference = 0x1;
15103 }
15104 yylloc = oldyylloc;
15105 }
15106
15107 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)
15108 {
15109 if(*curMember)
15110 {
15111 *curMember = (*curMember)->next;
15112 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
15113 {
15114 *curMember = subMemberStack[--(*subMemberStackPos)];
15115 *curMember = (*curMember)->next;
15116 }
15117 while((*curMember) && (*curMember)->isProperty)
15118 *curMember = (*curMember)->next;
15119 if(subMemberStackPos)
15120 {
15121 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
15122 {
15123 subMemberStack[(*subMemberStackPos)++] = *curMember;
15124 *curMember = (*curMember)->members.first;
15125 while(*curMember && (*curMember)->isProperty)
15126 *curMember = (*curMember)->next;
15127 }
15128 }
15129 }
15130 while(!*curMember)
15131 {
15132 if(!*curMember)
15133 {
15134 if(subMemberStackPos && *subMemberStackPos)
15135 {
15136 *curMember = subMemberStack[--(*subMemberStackPos)];
15137 *curMember = (*curMember)->next;
15138 }
15139 else
15140 {
15141 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
15142
15143 if(*curClass == _class)
15144 break;
15145 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
15146 ;
15147 *curMember = (*curClass)->membersAndProperties.first;
15148 }
15149 while((*curMember) && (*curMember)->isProperty)
15150 *curMember = (*curMember)->next;
15151 if(subMemberStackPos)
15152 {
15153 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
15154 {
15155 subMemberStack[(*subMemberStackPos)++] = *curMember;
15156 *curMember = (*curMember)->members.first;
15157 while(*curMember && (*curMember)->isProperty)
15158 *curMember = (*curMember)->next;
15159 }
15160 }
15161 }
15162 }
15163 }
15164
15165 static void ProcessInitializer(struct Initializer * init, struct Type * type)
15166 {
15167 switch(init->type)
15168 {
15169 case 0:
15170 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
15171 {
15172 if(init->exp && !init->exp->destType)
15173 {
15174 FreeType(init->exp->destType);
15175 init->exp->destType = type;
15176 if(type)
15177 type->refCount++;
15178 }
15179 if(init->exp)
15180 {
15181 ProcessExpressionType(init->exp);
15182 init->isConstant = init->exp->isConstant;
15183 }
15184 break;
15185 }
15186 else
15187 {
15188 struct Expression * exp = init->exp;
15189 struct Instantiation * inst = exp->instance;
15190 struct MembersInit * members;
15191
15192 init->type = 1;
15193 init->list = MkList();
15194 if(inst->members)
15195 {
15196 for(members = (*inst->members).first; members; members = members->next)
15197 {
15198 if(members->type == 0)
15199 {
15200 struct MemberInit * member;
15201
15202 for(member = (*members->dataMembers).first; member; member = member->next)
15203 {
15204 ListAdd(init->list, member->initializer);
15205 member->initializer = (((void *)0));
15206 }
15207 }
15208 }
15209 }
15210 FreeExpression(exp);
15211 }
15212 case 1:
15213 {
15214 struct Initializer * i;
15215 struct Type * initializerType = (((void *)0));
15216 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
15217 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
15218 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
15219 int subMemberStackPos = 0;
15220
15221 if(type && type->kind == 12)
15222 initializerType = Dereference(type);
15223 else if(type && (type->kind == 9 || type->kind == 10))
15224 initializerType = type->members.first;
15225 for(i = (*init->list).first; i; i = i->next)
15226 {
15227 if(type && type->kind == 8 && type->_class && type->_class->registered)
15228 {
15229 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
15230 if(curMember)
15231 {
15232 if(!curMember->dataType)
15233 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
15234 initializerType = curMember->dataType;
15235 }
15236 }
15237 ProcessInitializer(i, initializerType);
15238 if(initializerType && type && (type->kind == 9 || type->kind == 10))
15239 initializerType = initializerType->next;
15240 if(!i->isConstant)
15241 init->isConstant = 0x0;
15242 }
15243 if(type && type->kind == 12)
15244 FreeType(initializerType);
15245 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
15246 {
15247 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
15248 }
15249 break;
15250 }
15251 }
15252 }
15253
15254 extern struct Symbol * FindType(struct Context * ctx, char *  name);
15255
15256 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
15257
15258 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
15259 {
15260 switch(spec->type)
15261 {
15262 case 0:
15263 {
15264 if(spec->specifier == THISCLASS)
15265 {
15266 if(thisClass)
15267 {
15268 spec->type = 1;
15269 spec->name = ReplaceThisClass(thisClass);
15270 spec->symbol = FindClass(spec->name);
15271 ProcessSpecifier(spec, declareStruct);
15272 }
15273 }
15274 break;
15275 }
15276 case 1:
15277 {
15278 struct Symbol * symbol = FindType(curContext, spec->name);
15279
15280 if(symbol)
15281 DeclareType(symbol->type, 0x1, 0x1);
15282 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
15283 DeclareStruct(spec->name, 0x0);
15284 break;
15285 }
15286 case 2:
15287 {
15288 struct Enumerator * e;
15289
15290 if(spec->list)
15291 {
15292 for(e = (*spec->list).first; e; e = e->next)
15293 {
15294 if(e->exp)
15295 ProcessExpressionType(e->exp);
15296 }
15297 }
15298 break;
15299 }
15300 case 3:
15301 case 4:
15302 {
15303 if(spec->definitions)
15304 {
15305 struct ClassDef * def;
15306 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
15307
15308 ProcessClass(spec->definitions, symbol);
15309 }
15310 break;
15311 }
15312 }
15313 }
15314
15315 static void ProcessDeclarator(struct Declarator * decl)
15316 {
15317 switch(decl->type)
15318 {
15319 case 1:
15320 if(decl->identifier->classSym)
15321 {
15322 FreeSpecifier(decl->identifier->_class);
15323 decl->identifier->_class = (((void *)0));
15324 }
15325 break;
15326 case 3:
15327 if(decl->array.exp)
15328 ProcessExpressionType(decl->array.exp);
15329 case 0:
15330 case 2:
15331 case 4:
15332 case 5:
15333 case 6:
15334 case 7:
15335 if(decl->declarator)
15336 ProcessDeclarator(decl->declarator);
15337 if(decl->type == 4)
15338 {
15339 struct Identifier * id = GetDeclId(decl);
15340
15341 if(id && id->_class)
15342 {
15343 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
15344
15345 if(!decl->function.parameters)
15346 decl->function.parameters = MkList();
15347 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
15348 id->_class = (((void *)0));
15349 }
15350 if(decl->function.parameters)
15351 {
15352 struct TypeName * param;
15353
15354 for(param = (*decl->function.parameters).first; param; param = param->next)
15355 {
15356 if(param->qualifiers && (*param->qualifiers).first)
15357 {
15358 struct Specifier * spec = (*param->qualifiers).first;
15359
15360 if(spec && spec->specifier == TYPED_OBJECT)
15361 {
15362 struct Declarator * d = param->declarator;
15363 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);
15364
15365 FreeList(param->qualifiers, FreeSpecifier);
15366 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
15367 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
15368 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
15369 param = newParam;
15370 }
15371 else if(spec && spec->specifier == ANY_OBJECT)
15372 {
15373 struct Declarator * d = param->declarator;
15374
15375 FreeList(param->qualifiers, FreeSpecifier);
15376 param->qualifiers = MkListOne(MkSpecifier(VOID));
15377 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
15378 }
15379 else if(spec->specifier == THISCLASS)
15380 {
15381 if(thisClass)
15382 {
15383 spec->type = 1;
15384 spec->name = ReplaceThisClass(thisClass);
15385 spec->symbol = FindClass(spec->name);
15386 ProcessSpecifier(spec, 0x0);
15387 }
15388 }
15389 }
15390 if(param->declarator)
15391 ProcessDeclarator(param->declarator);
15392 }
15393 }
15394 }
15395 break;
15396 }
15397 }
15398
15399 extern struct Identifier * CopyIdentifier(struct Identifier * id);
15400
15401 extern void FreeInitDeclarator(struct InitDeclarator * decl);
15402
15403 static void ProcessDeclaration(struct Declaration * decl)
15404 {
15405 yylloc = decl->loc;
15406 switch(decl->type)
15407 {
15408 case 1:
15409 {
15410 unsigned int declareStruct = 0x0;
15411
15412 if(decl->declarators)
15413 {
15414 struct InitDeclarator * d;
15415
15416 for(d = (*decl->declarators).first; d; d = d->next)
15417 {
15418 struct Type * type, * subType;
15419
15420 ProcessDeclarator(d->declarator);
15421 type = ProcessType(decl->specifiers, d->declarator);
15422 if(d->initializer)
15423 {
15424 ProcessInitializer(d->initializer, type);
15425 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
15426 {
15427 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
15428 {
15429 struct Instantiation * inst = d->initializer->exp->instance;
15430
15431 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
15432 d->initializer->exp->instance = (((void *)0));
15433 if(decl->specifiers)
15434 FreeList(decl->specifiers, FreeSpecifier);
15435 FreeList(decl->declarators, FreeInitDeclarator);
15436 d = (((void *)0));
15437 decl->type = 2;
15438 decl->inst = inst;
15439 }
15440 }
15441 }
15442 for(subType = type; subType; )
15443 {
15444 if(subType->kind == 8)
15445 {
15446 declareStruct = 0x1;
15447 break;
15448 }
15449 else if(subType->kind == 13)
15450 break;
15451 else if(subType->kind == 12)
15452 subType = subType->arrayType;
15453 else
15454 break;
15455 }
15456 FreeType(type);
15457 if(!d)
15458 break;
15459 }
15460 }
15461 if(decl->specifiers)
15462 {
15463 struct Specifier * s;
15464
15465 for(s = (*decl->specifiers).first; s; s = s->next)
15466 {
15467 ProcessSpecifier(s, declareStruct);
15468 }
15469 }
15470 break;
15471 }
15472 case 2:
15473 {
15474 ProcessInstantiationType(decl->inst);
15475 break;
15476 }
15477 case 0:
15478 {
15479 struct Specifier * spec;
15480 struct Declarator * d;
15481 unsigned int declareStruct = 0x0;
15482
15483 if(decl->declarators)
15484 {
15485 for(d = (*decl->declarators).first; d; d = d->next)
15486 {
15487 struct Type * type = ProcessType(decl->specifiers, d->declarator);
15488 struct Type * subType;
15489
15490 ProcessDeclarator(d);
15491 for(subType = type; subType; )
15492 {
15493 if(subType->kind == 8)
15494 {
15495 declareStruct = 0x1;
15496 break;
15497 }
15498 else if(subType->kind == 13)
15499 break;
15500 else if(subType->kind == 12)
15501 subType = subType->arrayType;
15502 else
15503 break;
15504 }
15505 FreeType(type);
15506 }
15507 }
15508 if(decl->specifiers)
15509 {
15510 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
15511 ProcessSpecifier(spec, declareStruct);
15512 }
15513 break;
15514 }
15515 }
15516 }
15517
15518 static struct FunctionDefinition * curFunction;
15519
15520 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
15521 {
15522 char propName[1024], propNameM[1024];
15523 char getName[1024], setName[1024];
15524 struct __ecereNameSpace__ecere__sys__OldList * args;
15525
15526 DeclareProperty(prop, setName, getName);
15527 strcpy(propName, "__ecereProp_");
15528 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15529 strcat(propName, "_");
15530 FullClassNameCat(propName, prop->name, 0x1);
15531 MangleClassName(propName);
15532 strcpy(propNameM, "__ecerePropM_");
15533 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
15534 strcat(propNameM, "_");
15535 FullClassNameCat(propNameM, prop->name, 0x1);
15536 MangleClassName(propNameM);
15537 if(prop->isWatchable)
15538 {
15539 args = MkList();
15540 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15541 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15542 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15543 args = MkList();
15544 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15545 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15546 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15547 }
15548 {
15549 args = MkList();
15550 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15551 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15552 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15553 args = MkList();
15554 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15555 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15556 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15557 }
15558 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15559 curFunction->propSet->fireWatchersDone = 0x1;
15560 }
15561
15562 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
15563
15564 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
15565
15566 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
15567
15568 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
15569
15570 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
15571
15572 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
15573
15574 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
15575
15576 extern void FreePropertyWatch(struct PropertyWatch * watcher);
15577
15578 static void ProcessStatement(struct Statement * stmt)
15579 {
15580 yylloc = stmt->loc;
15581 switch(stmt->type)
15582 {
15583 case 0:
15584 ProcessStatement(stmt->labeled.stmt);
15585 break;
15586 case 1:
15587 if(stmt->caseStmt.exp)
15588 {
15589 FreeType(stmt->caseStmt.exp->destType);
15590 stmt->caseStmt.exp->destType = curSwitchType;
15591 if(curSwitchType)
15592 curSwitchType->refCount++;
15593 ProcessExpressionType(stmt->caseStmt.exp);
15594 ComputeExpression(stmt->caseStmt.exp);
15595 }
15596 if(stmt->caseStmt.stmt)
15597 ProcessStatement(stmt->caseStmt.stmt);
15598 break;
15599 case 2:
15600 {
15601 if(stmt->compound.context)
15602 {
15603 struct Declaration * decl;
15604 struct Statement * s;
15605 struct Statement * prevCompound = curCompound;
15606 struct Context * prevContext = curContext;
15607
15608 if(!stmt->compound.isSwitch)
15609 {
15610 curCompound = stmt;
15611 curContext = stmt->compound.context;
15612 }
15613 if(stmt->compound.declarations)
15614 {
15615 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
15616 ProcessDeclaration(decl);
15617 }
15618 if(stmt->compound.statements)
15619 {
15620 for(s = (*stmt->compound.statements).first; s; s = s->next)
15621 ProcessStatement(s);
15622 }
15623 curContext = prevContext;
15624 curCompound = prevCompound;
15625 }
15626 break;
15627 }
15628 case 3:
15629 {
15630 struct Expression * exp;
15631
15632 if(stmt->expressions)
15633 {
15634 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15635 ProcessExpressionType(exp);
15636 }
15637 break;
15638 }
15639 case 4:
15640 {
15641 struct Expression * exp;
15642
15643 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15644 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15645 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15646 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15647 {
15648 ProcessExpressionType(exp);
15649 }
15650 if(stmt->ifStmt.stmt)
15651 ProcessStatement(stmt->ifStmt.stmt);
15652 if(stmt->ifStmt.elseStmt)
15653 ProcessStatement(stmt->ifStmt.elseStmt);
15654 break;
15655 }
15656 case 5:
15657 {
15658 struct Type * oldSwitchType = curSwitchType;
15659
15660 if(stmt->switchStmt.exp)
15661 {
15662 struct Expression * exp;
15663
15664 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15665 {
15666 if(!exp->next)
15667 {
15668 ProcessExpressionType(exp);
15669 }
15670 if(!exp->next)
15671 curSwitchType = exp->expType;
15672 }
15673 }
15674 ProcessStatement(stmt->switchStmt.stmt);
15675 curSwitchType = oldSwitchType;
15676 break;
15677 }
15678 case 6:
15679 {
15680 if(stmt->whileStmt.exp)
15681 {
15682 struct Expression * exp;
15683
15684 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15685 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15686 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15687 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15688 {
15689 ProcessExpressionType(exp);
15690 }
15691 }
15692 if(stmt->whileStmt.stmt)
15693 ProcessStatement(stmt->whileStmt.stmt);
15694 break;
15695 }
15696 case 7:
15697 {
15698 if(stmt->doWhile.exp)
15699 {
15700 struct Expression * exp;
15701
15702 if((*stmt->doWhile.exp).last)
15703 {
15704 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15705 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15706 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15707 }
15708 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15709 {
15710 ProcessExpressionType(exp);
15711 }
15712 }
15713 if(stmt->doWhile.stmt)
15714 ProcessStatement(stmt->doWhile.stmt);
15715 break;
15716 }
15717 case 8:
15718 {
15719 struct Expression * exp;
15720
15721 if(stmt->forStmt.init)
15722 ProcessStatement(stmt->forStmt.init);
15723 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15724 {
15725 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15726 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15727 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15728 }
15729 if(stmt->forStmt.check)
15730 ProcessStatement(stmt->forStmt.check);
15731 if(stmt->forStmt.increment)
15732 {
15733 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15734 ProcessExpressionType(exp);
15735 }
15736 if(stmt->forStmt.stmt)
15737 ProcessStatement(stmt->forStmt.stmt);
15738 break;
15739 }
15740 case 18:
15741 {
15742 struct Identifier * id = stmt->forEachStmt.id;
15743 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15744 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15745 struct Statement * block = stmt->forEachStmt.stmt;
15746 char iteratorType[1024];
15747 struct Type * source;
15748 struct Expression * e;
15749 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));
15750 struct Expression * arrayExp;
15751 char * typeString = (((void *)0));
15752 int builtinCount = 0;
15753
15754 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15755 {
15756 if(!e->next)
15757 {
15758 FreeType(e->destType);
15759 e->destType = ProcessTypeString("Container", 0x0);
15760 }
15761 if(!isBuiltin || e->next)
15762 ProcessExpressionType(e);
15763 }
15764 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15765 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15766 {
15767 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15768 struct Symbol * symbol;
15769 struct Expression * expIt = (((void *)0));
15770 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15771 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15772 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15773 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15774
15775 stmt->type = 2;
15776 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15777 stmt->compound.context->parent = curContext;
15778 curContext = stmt->compound.context;
15779 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15780 {
15781 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15782 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15783
15784 isCustomAVLTree = 0x1;
15785 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15786 isAVLTree = 0x1;
15787 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15788 isMap = 0x1;
15789 }
15790 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15791 isArray = 0x1;
15792 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15793 {
15794 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15795
15796 isLinkList = 0x1;
15797 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15798 }
15799 if(isArray)
15800 {
15801 struct Declarator * decl;
15802 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15803
15804 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15805 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15806 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15807 }
15808 else if(isBuiltin)
15809 {
15810 struct Type * type = (((void *)0));
15811 char typeStringBuf[1024];
15812
15813 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15814 if(((struct Expression *)(*exp).last)->type == 11)
15815 {
15816 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15817
15818 if(typeName)
15819 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15820 }
15821 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)
15822 {
15823 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15824
15825 typeString = templateClass->templateArgs[2].dataTypeString;
15826 }
15827 else if(arrayExp->list)
15828 {
15829 struct Expression * e;
15830
15831 for(e = (*arrayExp->list).first; e; e = e->next)
15832 {
15833 ProcessExpressionType(e);
15834 if(e->expType)
15835 {
15836 if(!type)
15837 {
15838 type = e->expType;
15839 type->refCount++;
15840 }
15841 else
15842 {
15843 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15844 {
15845 FreeType(type);
15846 type = e->expType;
15847 e->expType = (((void *)0));
15848 e = (*arrayExp->list).first;
15849 ProcessExpressionType(e);
15850 if(e->expType)
15851 {
15852 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15853 {
15854 FreeType(e->expType);
15855 e->expType = (((void *)0));
15856 FreeType(type);
15857 type = (((void *)0));
15858 break;
15859 }
15860 }
15861 }
15862 }
15863 if(e->expType)
15864 {
15865 FreeType(e->expType);
15866 e->expType = (((void *)0));
15867 }
15868 }
15869 }
15870 if(type)
15871 {
15872 typeStringBuf[0] = '\0';
15873 PrintType(type, typeStringBuf, 0x0, 0x1);
15874 typeString = typeStringBuf;
15875 FreeType(type);
15876 }
15877 }
15878 if(typeString)
15879 {
15880 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15881 struct Declarator * decl;
15882 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15883
15884 if(arrayExp->list)
15885 {
15886 struct Expression * e;
15887
15888 builtinCount = (*arrayExp->list).count;
15889 type = ProcessTypeString(typeString, 0x0);
15890 while(e = (*arrayExp->list).first)
15891 {
15892 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15893 e->destType = type;
15894 type->refCount++;
15895 ProcessExpressionType(e);
15896 ListAdd(initializers, MkInitializerAssignment(e));
15897 }
15898 FreeType(type);
15899 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15900 }
15901 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15902 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15903 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(PlugDeclarator(decl, MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), (((void *)0)))), MkInitializerList(initializers)))));
15904 FreeList(exp, FreeExpression);
15905 }
15906 else
15907 {
15908 arrayExp->expType = ProcessTypeString("Container", 0x0);
15909 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15910 }
15911 }
15912 else if(isLinkList && !isList)
15913 {
15914 struct Declarator * decl;
15915 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15916
15917 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15918 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15919 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15920 }
15921 else if(_class->templateArgs)
15922 {
15923 if(isMap)
15924 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15925 else
15926 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
15927 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
15928 }
15929 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
15930 if(block && block->type == 2 && block->compound.context)
15931 {
15932 block->compound.context->parent = stmt->compound.context;
15933 }
15934 if(filter)
15935 {
15936 block = MkIfStmt(filter, block, (((void *)0)));
15937 }
15938 if(isArray)
15939 {
15940 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));
15941 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15942 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15943 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15944 }
15945 else if(isBuiltin)
15946 {
15947 char count[128];
15948
15949 sprintf(count, "%d", builtinCount);
15950 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));
15951 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15952 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15953 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15954 }
15955 else if(isLinkList && !isList)
15956 {
15957 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
15958 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
15959
15960 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
15961 {
15962 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));
15963 }
15964 else
15965 {
15966 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15967 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
15968
15969 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));
15970 }
15971 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15972 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15973 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15974 }
15975 else
15976 {
15977 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
15978 }
15979 ProcessExpressionType(expIt);
15980 if((*stmt->compound.declarations).first)
15981 ProcessDeclaration((*stmt->compound.declarations).first);
15982 if(symbol)
15983 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
15984 ProcessStatement(stmt);
15985 curContext = stmt->compound.context->parent;
15986 break;
15987 }
15988 else
15989 {
15990 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
15991 }
15992 break;
15993 }
15994 case 9:
15995 break;
15996 case 10:
15997 break;
15998 case 11:
15999 break;
16000 case 12:
16001 {
16002 struct Expression * exp;
16003
16004 if(stmt->expressions)
16005 {
16006 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
16007 {
16008 if(!exp->next)
16009 {
16010 if(curFunction && !curFunction->type)
16011 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
16012 FreeType(exp->destType);
16013 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
16014 if(exp->destType)
16015 exp->destType->refCount++;
16016 }
16017 ProcessExpressionType(exp);
16018 }
16019 }
16020 break;
16021 }
16022 case 14:
16023 {
16024 ProcessDeclaration(stmt->decl);
16025 break;
16026 }
16027 case 13:
16028 {
16029 struct AsmField * field;
16030
16031 if(stmt->asmStmt.inputFields)
16032 {
16033 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
16034 if(field->expression)
16035 ProcessExpressionType(field->expression);
16036 }
16037 if(stmt->asmStmt.outputFields)
16038 {
16039 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
16040 if(field->expression)
16041 ProcessExpressionType(field->expression);
16042 }
16043 if(stmt->asmStmt.clobberedFields)
16044 {
16045 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
16046 {
16047 if(field->expression)
16048 ProcessExpressionType(field->expression);
16049 }
16050 }
16051 break;
16052 }
16053 case 17:
16054 {
16055 struct PropertyWatch * propWatch;
16056 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16057 struct Expression * object = stmt->_watch.object;
16058 struct Expression * watcher = stmt->_watch.watcher;
16059
16060 if(watcher)
16061 ProcessExpressionType(watcher);
16062 if(object)
16063 ProcessExpressionType(object);
16064 if(inCompiler)
16065 {
16066 if(watcher || thisClass)
16067 {
16068 struct External * external = curExternal;
16069 struct Context * context = curContext;
16070
16071 stmt->type = 3;
16072 stmt->expressions = MkList();
16073 curExternal = external->prev;
16074 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
16075 {
16076 struct ClassFunction * func;
16077 char watcherName[1024];
16078 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
16079 struct External * createdExternal;
16080 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
16081
16082 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
16083 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
16084 if(propWatch->deleteWatch)
16085 strcat(watcherName, "_delete");
16086 else
16087 {
16088 struct Identifier * propID;
16089
16090 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
16091 {
16092 strcat(watcherName, "_");
16093 strcat(watcherName, propID->string);
16094 }
16095 }
16096 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
16097 {
16098 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
16099 ProcessClassFunctionBody(func, propWatch->compound);
16100 propWatch->compound = (((void *)0));
16101 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
16102 createdExternal->symbol->idCode = external->symbol->idCode;
16103 curExternal = createdExternal;
16104 ProcessFunction(createdExternal->function);
16105 {
16106 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
16107
16108 externalDecl->declaration = decl;
16109 if(decl->symbol && !decl->symbol->pointerExternal)
16110 decl->symbol->pointerExternal = externalDecl;
16111 }
16112 if(propWatch->deleteWatch)
16113 {
16114 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16115
16116 ListAdd(args, CopyExpression(object));
16117 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16118 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
16119 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
16120 }
16121 else
16122 {
16123 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
16124 struct Identifier * propID;
16125
16126 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
16127 {
16128 char propName[1024];
16129 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16130
16131 if(prop)
16132 {
16133 char getName[1024], setName[1024];
16134 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16135
16136 DeclareProperty(prop, setName, getName);
16137 strcpy(propName, "__ecereProp_");
16138 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16139 strcat(propName, "_");
16140 FullClassNameCat(propName, prop->name, 0x1);
16141 ListAdd(args, CopyExpression(object));
16142 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16143 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16144 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
16145 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
16146 }
16147 else
16148 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16149 }
16150 }
16151 }
16152 else
16153 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
16154 }
16155 curExternal = external;
16156 curContext = context;
16157 if(watcher)
16158 FreeExpression(watcher);
16159 if(object)
16160 FreeExpression(object);
16161 FreeList(watches, FreePropertyWatch);
16162 }
16163 else
16164 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
16165 }
16166 else
16167 {
16168 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
16169 {
16170 ProcessStatement(propWatch->compound);
16171 }
16172 }
16173 break;
16174 }
16175 case 15:
16176 {
16177 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16178 struct Expression * object = stmt->_watch.object;
16179 struct __ecereNameSpace__ecere__com__Class * _class;
16180
16181 if(object)
16182 ProcessExpressionType(object);
16183 if(inCompiler)
16184 {
16185 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
16186 if(_class)
16187 {
16188 struct Identifier * propID;
16189
16190 stmt->type = 3;
16191 stmt->expressions = MkList();
16192 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
16193 {
16194 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
16195 }
16196 else if(!watches)
16197 {
16198 }
16199 if(watches)
16200 {
16201 for(propID = (*watches).first; propID; propID = propID->next)
16202 {
16203 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16204
16205 if(prop)
16206 {
16207 CreateFireWatcher(prop, object, stmt);
16208 }
16209 else
16210 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
16211 }
16212 }
16213 else
16214 {
16215 struct __ecereNameSpace__ecere__com__Property * prop;
16216 struct __ecereNameSpace__ecere__com__Class * base;
16217
16218 for(base = _class; base; base = base->base)
16219 {
16220 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
16221 {
16222 if(prop->isProperty && prop->isWatchable)
16223 {
16224 CreateFireWatcher(prop, object, stmt);
16225 }
16226 }
16227 }
16228 }
16229 if(object)
16230 FreeExpression(object);
16231 FreeList(watches, FreeIdentifier);
16232 }
16233 else
16234 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16235 }
16236 break;
16237 }
16238 case 16:
16239 {
16240 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16241 struct Expression * object = stmt->_watch.object;
16242 struct Expression * watcher = stmt->_watch.watcher;
16243 struct __ecereNameSpace__ecere__com__Class * _class;
16244
16245 if(object)
16246 ProcessExpressionType(object);
16247 if(watcher)
16248 ProcessExpressionType(watcher);
16249 if(inCompiler)
16250 {
16251 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
16252 if(watcher || thisClass)
16253 {
16254 if(_class)
16255 {
16256 struct Identifier * propID;
16257
16258 stmt->type = 3;
16259 stmt->expressions = MkList();
16260 if(!watches)
16261 {
16262 struct __ecereNameSpace__ecere__sys__OldList * args;
16263
16264 args = MkList();
16265 ListAdd(args, CopyExpression(object));
16266 ListAdd(args, MkExpConstant("0"));
16267 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16268 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16269 }
16270 else
16271 {
16272 for(propID = (*watches).first; propID; propID = propID->next)
16273 {
16274 char propName[1024];
16275 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16276
16277 if(prop)
16278 {
16279 char getName[1024], setName[1024];
16280 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16281
16282 DeclareProperty(prop, setName, getName);
16283 strcpy(propName, "__ecereProp_");
16284 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16285 strcat(propName, "_");
16286 FullClassNameCat(propName, prop->name, 0x1);
16287 MangleClassName(propName);
16288 ListAdd(args, CopyExpression(object));
16289 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16290 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16291 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16292 }
16293 else
16294 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16295 }
16296 }
16297 if(object)
16298 FreeExpression(object);
16299 if(watcher)
16300 FreeExpression(watcher);
16301 FreeList(watches, FreeIdentifier);
16302 }
16303 else
16304 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16305 }
16306 else
16307 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
16308 }
16309 break;
16310 }
16311 }
16312 }
16313
16314 extern struct Expression * QBrackets(struct Expression * exp);
16315
16316 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
16317
16318 extern struct Declarator * QMkPtrDecl(char *  id);
16319
16320 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
16321
16322 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
16323
16324 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
16325
16326 static void ProcessFunction(struct FunctionDefinition * function)
16327 {
16328 struct Identifier * id = GetDeclId(function->declarator);
16329 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
16330 struct Type * type = symbol ? symbol->type : (((void *)0));
16331 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
16332 struct Context * oldTopContext = topContext;
16333
16334 yylloc = function->loc;
16335 if(type && type->thisClass)
16336 {
16337 struct Symbol * classSym = type->thisClass;
16338 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
16339 char className[1024];
16340 char structName[1024];
16341 struct Declarator * funcDecl;
16342 struct Symbol * thisSymbol;
16343 unsigned int typedObject = 0x0;
16344
16345 if(_class && !_class->base)
16346 {
16347 _class = currentClass;
16348 if(_class && !_class->symbol)
16349 _class->symbol = FindClass(_class->fullName);
16350 classSym = _class ? _class->symbol : (((void *)0));
16351 typedObject = 0x1;
16352 }
16353 thisClass = _class;
16354 if(inCompiler && _class)
16355 {
16356 if(type->kind == 11)
16357 {
16358 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
16359 {
16360 struct Type * param = symbol->type->params.first;
16361
16362 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
16363 FreeType(param);
16364 }
16365 if(type->classObjectType != 1)
16366 {
16367 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
16368 symbol->type->staticMethod = 0x1;
16369 symbol->type->thisClass = (((void *)0));
16370 symbol->type->extraParam = 0x0;
16371 }
16372 }
16373 strcpy(className, "__ecereClass_");
16374 FullClassNameCat(className, _class->fullName, 0x1);
16375 MangleClassName(className);
16376 structName[0] = (char)0;
16377 FullClassNameCat(structName, _class->fullName, 0x0);
16378 funcDecl = GetFuncDecl(function->declarator);
16379 if(funcDecl)
16380 {
16381 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16382 {
16383 struct TypeName * param = (*funcDecl->function.parameters).first;
16384
16385 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16386 {
16387 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16388 FreeTypeName(param);
16389 }
16390 }
16391 if(!function->propertyNoThis)
16392 {
16393 struct TypeName * thisParam;
16394
16395 if(type->classObjectType != 1)
16396 {
16397 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16398 if(!funcDecl->function.parameters)
16399 funcDecl->function.parameters = MkList();
16400 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16401 }
16402 if(typedObject)
16403 {
16404 if(type->classObjectType != 1)
16405 {
16406 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
16407 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
16408 }
16409 thisParam = __extension__ ({
16410 struct TypeName * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName);
16411
16412 __ecereInstance1->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), __ecereInstance1->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), __ecereInstance1;
16413 });
16414 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16415 }
16416 }
16417 }
16418 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16419 {
16420 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16421
16422 funcDecl = GetFuncDecl(initDecl->declarator);
16423 if(funcDecl)
16424 {
16425 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16426 {
16427 struct TypeName * param = (*funcDecl->function.parameters).first;
16428
16429 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16430 {
16431 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16432 FreeTypeName(param);
16433 }
16434 }
16435 if(type->classObjectType != 1)
16436 {
16437 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
16438 {
16439 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16440
16441 if(!funcDecl->function.parameters)
16442 funcDecl->function.parameters = MkList();
16443 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16444 }
16445 }
16446 }
16447 }
16448 }
16449 if(function->body)
16450 {
16451 if(type->classObjectType != 1)
16452 {
16453 thisSymbol = __extension__ ({
16454 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
16455
16456 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("this"), __ecereInstance1->type = classSym ? MkClassType(classSym->string) : (((void *)0)), __ecereInstance1;
16457 });
16458 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16459 if(typedObject && thisSymbol->type)
16460 {
16461 thisSymbol->type->classObjectType = 2;
16462 thisSymbol->type->byReference = type->byReference;
16463 }
16464 }
16465 }
16466 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
16467 {
16468 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
16469
16470 {
16471 struct __ecereNameSpace__ecere__com__Class * base;
16472
16473 for(base = _class; base && base->type != 1000; base = base->next)
16474 {
16475 for(member = base->membersAndProperties.first; member; member = member->next)
16476 if(!member->isProperty)
16477 break;
16478 if(member)
16479 break;
16480 }
16481 }
16482 for(member = _class->membersAndProperties.first; member; member = member->next)
16483 if(!member->isProperty)
16484 break;
16485 if(member)
16486 {
16487 char pointerName[1024];
16488 struct Declaration * decl;
16489 struct Initializer * initializer;
16490 struct Expression * exp, * bytePtr;
16491
16492 strcpy(pointerName, "__ecerePointer_");
16493 FullClassNameCat(pointerName, _class->fullName, 0x0);
16494 {
16495 char className[1024];
16496
16497 strcpy(className, "__ecereClass_");
16498 FullClassNameCat(className, classSym->string, 0x1);
16499 MangleClassName(className);
16500 DeclareClass(classSym, className);
16501 }
16502 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
16503 if(_class->fixed)
16504 {
16505 char string[256];
16506
16507 sprintf(string, "%d", _class->offset);
16508 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
16509 }
16510 else
16511 {
16512 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
16513 }
16514 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
16515 exp->expType = __extension__ ({
16516 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16517
16518 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
16519 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16520
16521 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 0, __ecereInstance1;
16522 }), __ecereInstance2;
16523 });
16524 if(function->body)
16525 {
16526 yylloc = function->body->loc;
16527 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
16528 {
16529 struct Context * prevContext = curContext;
16530
16531 curContext = function->body->compound.context;
16532 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
16533 curContext = prevContext;
16534 }
16535 decl->symbol = (((void *)0));
16536 if(!function->body->compound.declarations)
16537 function->body->compound.declarations = MkList();
16538 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
16539 }
16540 }
16541 }
16542 }
16543 else
16544 thisClass = (((void *)0));
16545 if(id)
16546 {
16547 FreeSpecifier(id->_class);
16548 id->_class = (((void *)0));
16549 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16550 {
16551 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16552
16553 id = GetDeclId(initDecl->declarator);
16554 FreeSpecifier(id->_class);
16555 id->_class = (((void *)0));
16556 }
16557 }
16558 if(function->body)
16559 topContext = function->body->compound.context;
16560 {
16561 struct FunctionDefinition * oldFunction = curFunction;
16562
16563 curFunction = function;
16564 if(function->body)
16565 ProcessStatement(function->body);
16566 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
16567 {
16568 struct Statement * prevCompound = curCompound;
16569 struct Context * prevContext = curContext;
16570 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
16571
16572 if(!function->body->compound.statements)
16573 function->body->compound.statements = MkList();
16574 ListAdd(function->body->compound.statements, fireWatchers);
16575 curCompound = function->body;
16576 curContext = function->body->compound.context;
16577 ProcessStatement(fireWatchers);
16578 curContext = prevContext;
16579 curCompound = prevCompound;
16580 }
16581 curFunction = oldFunction;
16582 }
16583 if(function->declarator)
16584 {
16585 ProcessDeclarator(function->declarator);
16586 }
16587 topContext = oldTopContext;
16588 thisClass = oldThisClass;
16589 }
16590
16591 extern void FreeSymbol(struct Symbol * symbol);
16592
16593 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
16594
16595 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
16596 {
16597 struct ClassDef * def;
16598 struct External * external = curExternal;
16599 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
16600
16601 for(def = definitions->first; def; def = def->next)
16602 {
16603 if(def->type == 0)
16604 {
16605 if(def->function->declarator)
16606 curExternal = def->function->declarator->symbol->pointerExternal;
16607 else
16608 curExternal = external;
16609 ProcessFunction((struct FunctionDefinition *)def->function);
16610 }
16611 else if(def->type == 2)
16612 {
16613 if(def->decl->type == 2)
16614 {
16615 thisClass = regClass;
16616 ProcessInstantiationType(def->decl->inst);
16617 thisClass = (((void *)0));
16618 }
16619 else
16620 {
16621 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
16622
16623 if(regClass)
16624 thisClass = regClass;
16625 ProcessDeclaration(def->decl);
16626 thisClass = backThisClass;
16627 }
16628 }
16629 else if(def->type == 1 && def->defProperties)
16630 {
16631 struct MemberInit * defProperty;
16632 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);
16633
16634 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16635 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
16636 {
16637 thisClass = regClass;
16638 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
16639 thisClass = (((void *)0));
16640 }
16641 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16642 FreeSymbol(thisSymbol);
16643 }
16644 else if(def->type == 3 && def->propertyDef)
16645 {
16646 struct PropertyDef * prop = def->propertyDef;
16647
16648 thisClass = regClass;
16649 if(prop->setStmt)
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->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16656 }
16657 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16658 ProcessStatement(prop->setStmt);
16659 }
16660 if(prop->getStmt)
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->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16667 }
16668 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16669 ProcessStatement(prop->getStmt);
16670 }
16671 if(prop->issetStmt)
16672 {
16673 if(regClass)
16674 {
16675 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16676
16677 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16678 }
16679 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16680 ProcessStatement(prop->issetStmt);
16681 }
16682 thisClass = (((void *)0));
16683 }
16684 else if(def->type == 4 && def->propertyWatch)
16685 {
16686 struct PropertyWatch * propertyWatch = def->propertyWatch;
16687
16688 thisClass = regClass;
16689 if(propertyWatch->compound)
16690 {
16691 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);
16692
16693 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16694 curExternal = (((void *)0));
16695 ProcessStatement(propertyWatch->compound);
16696 }
16697 thisClass = (((void *)0));
16698 }
16699 }
16700 }
16701
16702 void DeclareFunctionUtil(char * s)
16703 {
16704 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
16705
16706 if(function)
16707 {
16708 char name[1024];
16709
16710 name[0] = (char)0;
16711 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
16712 strcpy(name, "__ecereFunction_");
16713 FullClassNameCat(name, s, 0x0);
16714 DeclareFunction(function, name);
16715 }
16716 }
16717
16718 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16719
16720 void ComputeDataTypes()
16721 {
16722 struct External * external;
16723 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16724 struct External * after = (((void *)0));
16725
16726 currentClass = (((void *)0));
16727 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16728 for(external = (*ast).first; external; external = external->next)
16729 {
16730 if(external->type == 1)
16731 {
16732 struct Declaration * decl = external->declaration;
16733
16734 if(decl)
16735 {
16736 struct __ecereNameSpace__ecere__sys__OldList * decls = decl->declarators;
16737
16738 if(decls)
16739 {
16740 struct InitDeclarator * initDecl = (*decls).first;
16741
16742 if(initDecl)
16743 {
16744 struct Declarator * declarator = initDecl->declarator;
16745
16746 if(declarator && declarator->type == 1)
16747 {
16748 struct Identifier * id = declarator->identifier;
16749
16750 if(id && id->string)
16751 {
16752 if(!strcmp(id->string, "uintptr_t") || !strcmp(id->string, "intptr_t") || !strcmp(id->string, "size_t") || !strcmp(id->string, "ssize_t"))
16753 {
16754 external->symbol->id = -1001, external->symbol->idCode = -1001;
16755 after = external;
16756 }
16757 }
16758 }
16759 }
16760 }
16761 }
16762 }
16763 }
16764 temp->symbol = __extension__ ({
16765 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
16766
16767 __ecereInstance1->id = -1000, __ecereInstance1->idCode = -1000, __ecereInstance1;
16768 });
16769 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), after, temp);
16770 curExternal = temp;
16771 DeclareFunctionUtil("eSystem_New");
16772 DeclareFunctionUtil("eSystem_New0");
16773 DeclareFunctionUtil("eSystem_Renew");
16774 DeclareFunctionUtil("eSystem_Renew0");
16775 DeclareFunctionUtil("eClass_GetProperty");
16776 DeclareStruct("ecere::com::Class", 0x0);
16777 DeclareStruct("ecere::com::Instance", 0x0);
16778 DeclareStruct("ecere::com::Property", 0x0);
16779 DeclareStruct("ecere::com::DataMember", 0x0);
16780 DeclareStruct("ecere::com::Method", 0x0);
16781 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16782 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16783 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16784 for(external = (*ast).first; external; external = external->next)
16785 {
16786 afterExternal = curExternal = external;
16787 if(external->type == 0)
16788 {
16789 currentClass = external->function->_class;
16790 ProcessFunction(external->function);
16791 }
16792 else if(external->type == 1)
16793 {
16794 currentClass = (((void *)0));
16795 ProcessDeclaration(external->declaration);
16796 }
16797 else if(external->type == 2)
16798 {
16799 struct ClassDefinition * _class = external->_class;
16800
16801 currentClass = external->symbol->registered;
16802 if(_class->definitions)
16803 {
16804 ProcessClass(_class->definitions, _class->symbol);
16805 }
16806 if(inCompiler)
16807 {
16808 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16809 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16810 }
16811 }
16812 else if(external->type == 4)
16813 {
16814 thisNameSpace = external->id->string;
16815 }
16816 }
16817 currentClass = (((void *)0));
16818 thisNameSpace = (((void *)0));
16819 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16820 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16821 }
16822
16823 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);
16824
16825 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);
16826
16827 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16828 {
16829 struct __ecereNameSpace__ecere__com__Class * class;
16830
16831 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16832 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16833 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16834 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16835 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16836 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16837 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16838 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16839 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16840 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16841 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16842 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16843 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16844 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16845 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16846 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16847 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16848 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16849 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16850 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16851 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16852 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16853 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
16854 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
16855 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntSize", "bool GetIntSize(Expression exp, intsize * value2)", GetIntSize, module, 1);
16856 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntSize", "bool GetUIntSize(Expression exp, uintsize * value2)", GetUIntSize, module, 1);
16857 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16858 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16859 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16860 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16861 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16862 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16863 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16864 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16865 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16866 __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);
16867 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16868 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16869 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16870 __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);
16871 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16872 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16873 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16874 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16875 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16876 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16877 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16878 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16879 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16880 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16881 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16882 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16883 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16884 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
16885 __ecereClass_Conversion = class;
16886 __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);
16887 __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);
16888 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16889 __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);
16890 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16891 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16892 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16893 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16894 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16895 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16896 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16897 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16898 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16899 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16900 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintTypeNoConst", "void PrintTypeNoConst(Type type, char * string, bool printName, bool fullName)", PrintTypeNoConst, module, 1);
16901 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16902 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16903 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16904 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16905 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16906 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
16907 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16908 }
16909
16910 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16911 {
16912
16913 }
16914