compiler: More compatible handling of stdint.h inclusion
[sdk] / compiler / bootstrap / libec / bootstrap / pass15.c
1 #if defined(__GNUC__)
2 typedef long long int64;
3 typedef unsigned long long uint64;
4 #ifndef _WIN32
5 #define __declspec(x)
6 #endif
7 #elif defined(__TINYC__)
8 #include <stdarg.h>
9 #define __builtin_va_list va_list
10 #define __builtin_va_start va_start
11 #define __builtin_va_end va_end
12 #ifdef _WIN32
13 #define strcasecmp stricmp
14 #define strncasecmp strnicmp
15 #define __declspec(x) __attribute__((x))
16 #else
17 #define __declspec(x)
18 #endif
19 typedef long long int64;
20 typedef unsigned long long uint64;
21 #else
22 typedef __int64 int64;
23 typedef unsigned __int64 uint64;
24 #endif
25 #ifdef __BIG_ENDIAN__
26 #define __ENDIAN_PAD(x) (8 - (x))
27 #else
28 #define __ENDIAN_PAD(x) 0
29 #endif
30 #include <stdint.h>
31 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
32
33 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
34
35 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
36
37 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
38
39 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
40
41 struct __ecereNameSpace__ecere__sys__BTNode;
42
43 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;
44
45 struct __ecereNameSpace__ecere__sys__BinaryTree
46 {
47 struct __ecereNameSpace__ecere__sys__BTNode * root;
48 int count;
49 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
50 void (*  FreeKey)(void *  key);
51 } __attribute__ ((gcc_struct));
52
53 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;
54
55 struct __ecereNameSpace__ecere__sys__OldList
56 {
57 void *  first;
58 void *  last;
59 int count;
60 unsigned int offset;
61 unsigned int circ;
62 } __attribute__ ((gcc_struct));
63
64 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;
65
66 struct __ecereNameSpace__ecere__com__Method
67 {
68 char *  name;
69 struct __ecereNameSpace__ecere__com__Method * parent;
70 struct __ecereNameSpace__ecere__com__Method * left;
71 struct __ecereNameSpace__ecere__com__Method * right;
72 int depth;
73 int (*  function)();
74 int vid;
75 int type;
76 struct __ecereNameSpace__ecere__com__Class * _class;
77 void *  symbol;
78 char *  dataTypeString;
79 struct Type * dataType;
80 int memberAccess;
81 } __attribute__ ((gcc_struct));
82
83 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;
84
85 struct __ecereNameSpace__ecere__com__Property
86 {
87 struct __ecereNameSpace__ecere__com__Property * prev;
88 struct __ecereNameSpace__ecere__com__Property * next;
89 char *  name;
90 unsigned int isProperty;
91 int memberAccess;
92 int id;
93 struct __ecereNameSpace__ecere__com__Class * _class;
94 char *  dataTypeString;
95 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
96 struct Type * dataType;
97 void (*  Set)(void * , int);
98 int (*  Get)(void * );
99 unsigned int (*  IsSet)(void * );
100 void *  data;
101 void *  symbol;
102 int vid;
103 unsigned int conversion;
104 unsigned int watcherOffset;
105 char *  category;
106 unsigned int compiled;
107 unsigned int selfWatchable;
108 unsigned int isWatchable;
109 } __attribute__ ((gcc_struct));
110
111 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
112
113 struct CodePosition
114 {
115 int line;
116 int charPos;
117 int pos;
118 unsigned int included;
119 } __attribute__ ((gcc_struct));
120
121 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
122
123 struct Location
124 {
125 struct CodePosition start;
126 struct CodePosition end;
127 } __attribute__ ((gcc_struct));
128
129 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attrib;
130
131 struct Attrib;
132
133 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ExtDecl;
134
135 struct ExtDecl
136 {
137 struct Location loc;
138 int type;
139 union
140 {
141 char * s;
142 struct Attrib * attr;
143 } __attribute__ ((gcc_struct));
144 } __attribute__ ((gcc_struct));
145
146 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
147
148 struct ClassDefinition
149 {
150 struct ClassDefinition * prev;
151 struct ClassDefinition * next;
152 struct Location loc;
153 struct Specifier * _class;
154 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
155 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
156 struct Symbol * symbol;
157 struct Location blockStart;
158 struct Location nameLoc;
159 int endid;
160 int declMode;
161 unsigned int deleteWatchable;
162 } __attribute__ ((gcc_struct));
163
164 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
165
166 struct Context
167 {
168 struct Context * parent;
169 struct __ecereNameSpace__ecere__sys__BinaryTree types;
170 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
171 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
172 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
173 int nextID;
174 int simpleID;
175 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
176 struct ClassDefinition * classDef;
177 unsigned int templateTypesOnly;
178 unsigned int hasNameSpace;
179 } __attribute__ ((gcc_struct));
180
181 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
182
183 struct Instantiation
184 {
185 struct Instantiation * prev;
186 struct Instantiation * next;
187 struct Location loc;
188 struct Specifier * _class;
189 struct Expression * exp;
190 struct __ecereNameSpace__ecere__sys__OldList *  members;
191 struct Symbol * symbol;
192 unsigned int fullSet;
193 unsigned int isConstant;
194 unsigned char *  data;
195 struct Location nameLoc;
196 struct Location insideLoc;
197 unsigned int built;
198 } __attribute__ ((gcc_struct));
199
200 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
201
202 struct Declaration
203 {
204 struct Declaration * prev;
205 struct Declaration * next;
206 struct Location loc;
207 int type;
208 union
209 {
210 struct
211 {
212 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
213 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
214 } __attribute__ ((gcc_struct));
215 struct Instantiation * inst;
216 struct
217 {
218 struct Identifier * id;
219 struct Expression * exp;
220 } __attribute__ ((gcc_struct));
221 } __attribute__ ((gcc_struct));
222 struct Specifier * extStorage;
223 struct Symbol * symbol;
224 int declMode;
225 } __attribute__ ((gcc_struct));
226
227 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
228
229 struct Statement
230 {
231 struct Statement * prev;
232 struct Statement * next;
233 struct Location loc;
234 int type;
235 union
236 {
237 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
238 struct
239 {
240 struct Identifier * id;
241 struct Statement * stmt;
242 } __attribute__ ((gcc_struct)) labeled;
243 struct
244 {
245 struct Expression * exp;
246 struct Statement * stmt;
247 } __attribute__ ((gcc_struct)) caseStmt;
248 struct
249 {
250 struct __ecereNameSpace__ecere__sys__OldList * declarations;
251 struct __ecereNameSpace__ecere__sys__OldList * statements;
252 struct Context * context;
253 unsigned int isSwitch;
254 } __attribute__ ((gcc_struct)) compound;
255 struct
256 {
257 struct __ecereNameSpace__ecere__sys__OldList * exp;
258 struct Statement * stmt;
259 struct Statement * elseStmt;
260 } __attribute__ ((gcc_struct)) ifStmt;
261 struct
262 {
263 struct __ecereNameSpace__ecere__sys__OldList * exp;
264 struct Statement * stmt;
265 } __attribute__ ((gcc_struct)) switchStmt;
266 struct
267 {
268 struct __ecereNameSpace__ecere__sys__OldList * exp;
269 struct Statement * stmt;
270 } __attribute__ ((gcc_struct)) whileStmt;
271 struct
272 {
273 struct __ecereNameSpace__ecere__sys__OldList * exp;
274 struct Statement * stmt;
275 } __attribute__ ((gcc_struct)) doWhile;
276 struct
277 {
278 struct Statement * init;
279 struct Statement * check;
280 struct __ecereNameSpace__ecere__sys__OldList * increment;
281 struct Statement * stmt;
282 } __attribute__ ((gcc_struct)) forStmt;
283 struct
284 {
285 struct Identifier * id;
286 } __attribute__ ((gcc_struct)) gotoStmt;
287 struct
288 {
289 struct Specifier * spec;
290 char * statements;
291 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
292 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
293 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
294 } __attribute__ ((gcc_struct)) asmStmt;
295 struct
296 {
297 struct Expression * watcher;
298 struct Expression * object;
299 struct __ecereNameSpace__ecere__sys__OldList * watches;
300 } __attribute__ ((gcc_struct)) _watch;
301 struct
302 {
303 struct Identifier * id;
304 struct __ecereNameSpace__ecere__sys__OldList * exp;
305 struct __ecereNameSpace__ecere__sys__OldList * filter;
306 struct Statement * stmt;
307 } __attribute__ ((gcc_struct)) forEachStmt;
308 struct Declaration * decl;
309 } __attribute__ ((gcc_struct));
310 } __attribute__ ((gcc_struct));
311
312 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
313
314 struct TypeName
315 {
316 struct TypeName * prev;
317 struct TypeName * next;
318 struct Location loc;
319 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
320 struct Declarator * declarator;
321 int classObjectType;
322 struct Expression * bitCount;
323 } __attribute__ ((gcc_struct));
324
325 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
326
327 struct Initializer
328 {
329 struct Initializer * prev;
330 struct Initializer * next;
331 struct Location loc;
332 int type;
333 union
334 {
335 struct Expression * exp;
336 struct __ecereNameSpace__ecere__sys__OldList *  list;
337 } __attribute__ ((gcc_struct));
338 unsigned int isConstant;
339 } __attribute__ ((gcc_struct));
340
341 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
342
343 struct __ecereNameSpace__ecere__com__DataValue
344 {
345 union
346 {
347 char c;
348 unsigned char uc;
349 short s;
350 unsigned short us;
351 int i;
352 unsigned int ui;
353 void *  p;
354 float f;
355 double d;
356 long long i64;
357 uint64 ui64;
358 } __attribute__ ((gcc_struct));
359 } __attribute__ ((gcc_struct));
360
361 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
362
363 struct Expression
364 {
365 struct Expression * prev;
366 struct Expression * next;
367 struct Location loc;
368 int type;
369 union
370 {
371 struct
372 {
373 char *  constant;
374 struct Identifier * identifier;
375 } __attribute__ ((gcc_struct));
376 struct Statement * compound;
377 struct Instantiation * instance;
378 char *  string;
379 struct __ecereNameSpace__ecere__sys__OldList *  list;
380 struct
381 {
382 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
383 struct Declarator * decl;
384 } __attribute__ ((gcc_struct)) _classExp;
385 struct
386 {
387 struct Identifier * id;
388 } __attribute__ ((gcc_struct)) classData;
389 struct
390 {
391 struct Expression * exp;
392 struct __ecereNameSpace__ecere__sys__OldList * arguments;
393 struct Location argLoc;
394 } __attribute__ ((gcc_struct)) call;
395 struct
396 {
397 struct Expression * exp;
398 struct __ecereNameSpace__ecere__sys__OldList * index;
399 } __attribute__ ((gcc_struct)) index;
400 struct
401 {
402 struct Expression * exp;
403 struct Identifier * member;
404 int memberType;
405 unsigned int thisPtr;
406 } __attribute__ ((gcc_struct)) member;
407 struct
408 {
409 int op;
410 struct Expression * exp1;
411 struct Expression * exp2;
412 } __attribute__ ((gcc_struct)) op;
413 struct TypeName * typeName;
414 struct Specifier * _class;
415 struct
416 {
417 struct TypeName * typeName;
418 struct Expression * exp;
419 } __attribute__ ((gcc_struct)) cast;
420 struct
421 {
422 struct Expression * cond;
423 struct __ecereNameSpace__ecere__sys__OldList * exp;
424 struct Expression * elseExp;
425 } __attribute__ ((gcc_struct)) cond;
426 struct
427 {
428 struct TypeName * typeName;
429 struct Expression * size;
430 } __attribute__ ((gcc_struct)) _new;
431 struct
432 {
433 struct TypeName * typeName;
434 struct Expression * size;
435 struct Expression * exp;
436 } __attribute__ ((gcc_struct)) _renew;
437 struct
438 {
439 char * table;
440 struct Identifier * id;
441 } __attribute__ ((gcc_struct)) db;
442 struct
443 {
444 struct Expression * ds;
445 struct Expression * name;
446 } __attribute__ ((gcc_struct)) dbopen;
447 struct
448 {
449 struct TypeName * typeName;
450 struct Initializer * initializer;
451 } __attribute__ ((gcc_struct)) initializer;
452 struct
453 {
454 struct Expression * exp;
455 struct TypeName * typeName;
456 } __attribute__ ((gcc_struct)) vaArg;
457 } __attribute__ ((gcc_struct));
458 unsigned int debugValue;
459 struct __ecereNameSpace__ecere__com__DataValue val;
460 uint64 address;
461 unsigned int hasAddress;
462 struct Type * expType;
463 struct Type * destType;
464 unsigned int usage;
465 int tempCount;
466 unsigned int byReference;
467 unsigned int isConstant;
468 unsigned int addedThis;
469 unsigned int needCast;
470 unsigned int thisPtr;
471 } __attribute__ ((gcc_struct));
472
473 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
474
475 struct TemplateDatatype
476 {
477 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
478 struct Declarator * decl;
479 } __attribute__ ((gcc_struct));
480
481 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
482
483 struct TemplateArgument;
484
485 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
486
487 struct TemplateParameter
488 {
489 struct TemplateParameter * prev;
490 struct TemplateParameter * next;
491 struct Location loc;
492 int type;
493 struct Identifier * identifier;
494 union
495 {
496 struct TemplateDatatype * dataType;
497 int memberType;
498 } __attribute__ ((gcc_struct));
499 struct TemplateArgument * defaultArgument;
500 char *  dataTypeString;
501 struct Type * baseType;
502 } __attribute__ ((gcc_struct));
503
504 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
505
506 struct Specifier
507 {
508 struct Specifier * prev;
509 struct Specifier * next;
510 struct Location loc;
511 int type;
512 union
513 {
514 int specifier;
515 struct
516 {
517 struct ExtDecl * extDecl;
518 char *  name;
519 struct Symbol * symbol;
520 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
521 } __attribute__ ((gcc_struct));
522 struct
523 {
524 struct Identifier * id;
525 struct __ecereNameSpace__ecere__sys__OldList *  list;
526 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
527 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
528 unsigned int addNameSpace;
529 struct Context * ctx;
530 struct ExtDecl * extDeclStruct;
531 } __attribute__ ((gcc_struct));
532 struct Expression * expression;
533 struct Specifier * _class;
534 struct TemplateParameter * templateParameter;
535 } __attribute__ ((gcc_struct));
536 } __attribute__ ((gcc_struct));
537
538 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
539
540 struct Identifier
541 {
542 struct Identifier * prev;
543 struct Identifier * next;
544 struct Location loc;
545 struct Symbol * classSym;
546 struct Specifier * _class;
547 char *  string;
548 struct Identifier * badID;
549 } __attribute__ ((gcc_struct));
550
551 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
552
553 struct Pointer;
554
555 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
556
557 struct Declarator
558 {
559 struct Declarator * prev;
560 struct Declarator * next;
561 struct Location loc;
562 int type;
563 struct Symbol * symbol;
564 struct Declarator * declarator;
565 union
566 {
567 struct Identifier * identifier;
568 struct
569 {
570 struct Expression * exp;
571 struct Expression * posExp;
572 struct Attrib * attrib;
573 } __attribute__ ((gcc_struct)) structDecl;
574 struct
575 {
576 struct Expression * exp;
577 struct Specifier * enumClass;
578 } __attribute__ ((gcc_struct)) array;
579 struct
580 {
581 struct __ecereNameSpace__ecere__sys__OldList * parameters;
582 } __attribute__ ((gcc_struct)) function;
583 struct
584 {
585 struct Pointer * pointer;
586 } __attribute__ ((gcc_struct)) pointer;
587 struct
588 {
589 struct ExtDecl * extended;
590 } __attribute__ ((gcc_struct)) extended;
591 } __attribute__ ((gcc_struct));
592 } __attribute__ ((gcc_struct));
593
594 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
595
596 struct FunctionDefinition
597 {
598 struct FunctionDefinition * prev;
599 struct FunctionDefinition * next;
600 struct Location loc;
601 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
602 struct Declarator * declarator;
603 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
604 struct Statement * body;
605 struct __ecereNameSpace__ecere__com__Class * _class;
606 struct __ecereNameSpace__ecere__sys__OldList attached;
607 int declMode;
608 struct Type * type;
609 struct Symbol * propSet;
610 int tempCount;
611 unsigned int propertyNoThis;
612 } __attribute__ ((gcc_struct));
613
614 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
615
616 struct DBTableDef;
617
618 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
619
620 struct External
621 {
622 struct External * prev;
623 struct External * next;
624 struct Location loc;
625 int type;
626 struct Symbol * symbol;
627 union
628 {
629 struct FunctionDefinition * function;
630 struct ClassDefinition * _class;
631 struct Declaration * declaration;
632 char *  importString;
633 struct Identifier * id;
634 struct DBTableDef * table;
635 } __attribute__ ((gcc_struct));
636 int importType;
637 } __attribute__ ((gcc_struct));
638
639 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
640
641 struct ModuleImport
642 {
643 struct ModuleImport * prev;
644 struct ModuleImport * next;
645 char *  name;
646 struct __ecereNameSpace__ecere__sys__OldList classes;
647 struct __ecereNameSpace__ecere__sys__OldList functions;
648 int importType;
649 int importAccess;
650 } __attribute__ ((gcc_struct));
651
652 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
653
654 struct ClassImport
655 {
656 struct ClassImport * prev;
657 struct ClassImport * next;
658 char *  name;
659 struct __ecereNameSpace__ecere__sys__OldList methods;
660 struct __ecereNameSpace__ecere__sys__OldList properties;
661 unsigned int itself;
662 unsigned int isRemote;
663 } __attribute__ ((gcc_struct));
664
665 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
666
667 struct Symbol
668 {
669 char *  string;
670 struct Symbol * parent;
671 struct Symbol * left;
672 struct Symbol * right;
673 int depth;
674 struct Type * type;
675 union
676 {
677 struct __ecereNameSpace__ecere__com__Method * method;
678 struct __ecereNameSpace__ecere__com__Property * _property;
679 struct __ecereNameSpace__ecere__com__Class * registered;
680 } __attribute__ ((gcc_struct));
681 int id;
682 int idCode;
683 union
684 {
685 struct
686 {
687 struct External * pointerExternal;
688 struct External * structExternal;
689 } __attribute__ ((gcc_struct));
690 struct
691 {
692 struct External * externalGet;
693 struct External * externalSet;
694 struct External * externalPtr;
695 struct External * externalIsSet;
696 } __attribute__ ((gcc_struct));
697 struct
698 {
699 struct External * methodExternal;
700 struct External * methodCodeExternal;
701 } __attribute__ ((gcc_struct));
702 } __attribute__ ((gcc_struct));
703 unsigned int imported;
704 unsigned int declaredStructSym;
705 struct __ecereNameSpace__ecere__com__Class * _class;
706 unsigned int declaredStruct;
707 unsigned int needConstructor;
708 unsigned int needDestructor;
709 char *  constructorName;
710 char *  structName;
711 char *  className;
712 char *  destructorName;
713 struct ModuleImport * module;
714 struct ClassImport * _import;
715 struct Location nameLoc;
716 unsigned int isParam;
717 unsigned int isRemote;
718 unsigned int isStruct;
719 unsigned int fireWatchersDone;
720 int declaring;
721 unsigned int classData;
722 unsigned int isStatic;
723 char *  shortName;
724 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
725 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
726 struct Context * ctx;
727 int isIterator;
728 struct Expression * propCategory;
729 } __attribute__ ((gcc_struct));
730
731 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
732
733 struct Type
734 {
735 struct Type * prev;
736 struct Type * next;
737 int refCount;
738 union
739 {
740 struct Symbol * _class;
741 struct
742 {
743 struct __ecereNameSpace__ecere__sys__OldList members;
744 char *  enumName;
745 } __attribute__ ((gcc_struct));
746 struct
747 {
748 struct Type * returnType;
749 struct __ecereNameSpace__ecere__sys__OldList params;
750 struct Symbol * thisClass;
751 unsigned int staticMethod;
752 struct TemplateParameter * thisClassTemplate;
753 } __attribute__ ((gcc_struct));
754 struct
755 {
756 struct __ecereNameSpace__ecere__com__Method * method;
757 struct __ecereNameSpace__ecere__com__Class * methodClass;
758 struct __ecereNameSpace__ecere__com__Class * usedClass;
759 } __attribute__ ((gcc_struct));
760 struct
761 {
762 struct Type * arrayType;
763 int arraySize;
764 struct Expression * arraySizeExp;
765 unsigned int freeExp;
766 struct Symbol * enumClass;
767 } __attribute__ ((gcc_struct));
768 struct Type * type;
769 struct TemplateParameter * templateParameter;
770 } __attribute__ ((gcc_struct));
771 unsigned int isSigned;
772 int kind;
773 unsigned int constant;
774 unsigned int size;
775 char *  name;
776 char *  typeName;
777 unsigned int count;
778 unsigned int truth;
779 int classObjectType;
780 unsigned int byReference;
781 unsigned int extraParam;
782 int alignment;
783 unsigned int directClassAccess;
784 unsigned int computing;
785 unsigned int dllExport;
786 unsigned int offset;
787 unsigned int keepCast;
788 unsigned int passAsTemplate;
789 int bitFieldCount;
790 } __attribute__ ((gcc_struct));
791
792 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
793
794 struct __ecereNameSpace__ecere__com__Class
795 {
796 struct __ecereNameSpace__ecere__com__Class * prev;
797 struct __ecereNameSpace__ecere__com__Class * next;
798 char *  name;
799 int offset;
800 int structSize;
801 int (* *  _vTbl)();
802 int vTblSize;
803 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
804 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
805 int offsetClass;
806 int sizeClass;
807 struct __ecereNameSpace__ecere__com__Class * base;
808 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
809 struct __ecereNameSpace__ecere__sys__BinaryTree members;
810 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
811 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
812 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
813 struct __ecereNameSpace__ecere__sys__OldList derivatives;
814 int memberID;
815 int startMemberID;
816 int type;
817 struct __ecereNameSpace__ecere__com__Instance * module;
818 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
819 char *  dataTypeString;
820 struct Type * dataType;
821 int typeSize;
822 int defaultAlignment;
823 void (*  Initialize)();
824 int memberOffset;
825 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
826 char *  designerClass;
827 unsigned int noExpansion;
828 char *  defaultProperty;
829 unsigned int comRedefinition;
830 int count;
831 unsigned int isRemote;
832 unsigned int internalDecl;
833 void *  data;
834 unsigned int computeSize;
835 int structAlignment;
836 int destructionWatchOffset;
837 unsigned int fixed;
838 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
839 int inheritanceAccess;
840 char *  fullName;
841 void *  symbol;
842 struct __ecereNameSpace__ecere__sys__OldList conversions;
843 struct __ecereNameSpace__ecere__sys__OldList templateParams;
844 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
845 struct __ecereNameSpace__ecere__com__Class * templateClass;
846 struct __ecereNameSpace__ecere__sys__OldList templatized;
847 int numParams;
848 } __attribute__ ((gcc_struct));
849
850 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
851
852 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
853
854 struct __ecereNameSpace__ecere__com__Instance
855 {
856 int (* *  _vTbl)();
857 struct __ecereNameSpace__ecere__com__Class * _class;
858 int _refCount;
859 } __attribute__ ((gcc_struct));
860
861 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
862
863 struct __ecereNameSpace__ecere__com__DataMember
864 {
865 struct __ecereNameSpace__ecere__com__DataMember * prev;
866 struct __ecereNameSpace__ecere__com__DataMember * next;
867 char *  name;
868 unsigned int isProperty;
869 int memberAccess;
870 int id;
871 struct __ecereNameSpace__ecere__com__Class * _class;
872 char *  dataTypeString;
873 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
874 struct Type * dataType;
875 int type;
876 int offset;
877 int memberID;
878 struct __ecereNameSpace__ecere__sys__OldList members;
879 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
880 int memberOffset;
881 int structAlignment;
882 } __attribute__ ((gcc_struct));
883
884 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
885
886 struct __ecereNameSpace__ecere__com__SerialBuffer
887 {
888 unsigned char *  _buffer;
889 unsigned int count;
890 unsigned int _size;
891 unsigned int pos;
892 } __attribute__ ((gcc_struct));
893
894 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
895
896 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
897 {
898 union
899 {
900 struct
901 {
902 char *  dataTypeString;
903 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
904 } __attribute__ ((gcc_struct));
905 struct __ecereNameSpace__ecere__com__DataValue expression;
906 struct
907 {
908 char *  memberString;
909 union
910 {
911 struct __ecereNameSpace__ecere__com__DataMember * member;
912 struct __ecereNameSpace__ecere__com__Property * prop;
913 struct __ecereNameSpace__ecere__com__Method * method;
914 } __attribute__ ((gcc_struct));
915 } __attribute__ ((gcc_struct));
916 } __attribute__ ((gcc_struct));
917 } __attribute__ ((gcc_struct));
918
919 typedef uintptr_t size_t;
920
921 void exit(int status);
922
923 void * calloc(size_t nmemb, size_t size);
924
925 void free(void * ptr);
926
927 void * malloc(size_t size);
928
929 void * realloc(void * ptr, size_t size);
930
931 long int strtol(const char * nptr, char ** endptr, int base);
932
933 long long int strtoll(const char * nptr, char ** endptr, int base);
934
935 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
936
937 enum yytokentype
938 {
939 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
940 };
941
942 typedef union YYSTYPE
943 {
944 int specifierType;
945 int i;
946 int declMode;
947 struct Identifier * id;
948 struct Expression * exp;
949 struct Specifier * specifier;
950 struct __ecereNameSpace__ecere__sys__OldList * list;
951 struct Enumerator * enumerator;
952 struct Declarator * declarator;
953 struct Pointer * pointer;
954 struct Initializer * initializer;
955 struct InitDeclarator * initDeclarator;
956 struct TypeName * typeName;
957 struct Declaration * declaration;
958 struct Statement * stmt;
959 struct FunctionDefinition * function;
960 struct External * external;
961 struct Context * context;
962 struct AsmField * asmField;
963 struct Attrib * attrib;
964 struct ExtDecl * extDecl;
965 struct Attribute * attribute;
966 struct Instantiation * instance;
967 struct MembersInit * membersInit;
968 struct MemberInit * memberInit;
969 struct ClassFunction * classFunction;
970 struct ClassDefinition * _class;
971 struct ClassDef * classDef;
972 struct PropertyDef * prop;
973 char * string;
974 struct Symbol * symbol;
975 struct PropertyWatch * propertyWatch;
976 struct TemplateParameter * templateParameter;
977 struct TemplateArgument * templateArgument;
978 struct TemplateDatatype * templateDatatype;
979 struct DBTableEntry * dbtableEntry;
980 struct DBIndexItem * dbindexItem;
981 struct DBTableDef * dbtableDef;
982 } __attribute__ ((gcc_struct)) YYSTYPE;
983
984 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
985
986 struct Enumerator
987 {
988 struct Enumerator * prev;
989 struct Enumerator * next;
990 struct Location loc;
991 struct Identifier * id;
992 struct Expression * exp;
993 } __attribute__ ((gcc_struct));
994
995 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
996
997 struct InitDeclarator
998 {
999 struct InitDeclarator * prev;
1000 struct InitDeclarator * next;
1001 struct Location loc;
1002 struct Declarator * declarator;
1003 struct Initializer * initializer;
1004 } __attribute__ ((gcc_struct));
1005
1006 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
1007
1008 struct AsmField
1009 {
1010 struct AsmField * prev;
1011 struct AsmField * next;
1012 struct Location loc;
1013 char *  command;
1014 struct Expression * expression;
1015 } __attribute__ ((gcc_struct));
1016
1017 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
1018
1019 struct Attribute;
1020
1021 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
1022
1023 struct ClassFunction
1024 {
1025 struct ClassFunction * prev;
1026 struct ClassFunction * next;
1027 struct Location loc;
1028 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1029 struct Declarator * declarator;
1030 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1031 struct Statement * body;
1032 struct __ecereNameSpace__ecere__com__Class * _class;
1033 struct __ecereNameSpace__ecere__sys__OldList attached;
1034 int declMode;
1035 struct Type * type;
1036 struct Symbol * propSet;
1037 unsigned int isVirtual;
1038 unsigned int isConstructor;
1039 unsigned int isDestructor;
1040 unsigned int dontMangle;
1041 int id;
1042 int idCode;
1043 } __attribute__ ((gcc_struct));
1044
1045 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1046
1047 struct MembersInit
1048 {
1049 struct MembersInit * prev;
1050 struct MembersInit * next;
1051 struct Location loc;
1052 int type;
1053 union
1054 {
1055 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1056 struct ClassFunction * function;
1057 } __attribute__ ((gcc_struct));
1058 } __attribute__ ((gcc_struct));
1059
1060 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1061
1062 struct MemberInit
1063 {
1064 struct MemberInit * prev;
1065 struct MemberInit * next;
1066 struct Location loc;
1067 struct Location realLoc;
1068 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1069 struct Initializer * initializer;
1070 unsigned int used;
1071 unsigned int variable;
1072 unsigned int takeOutExp;
1073 } __attribute__ ((gcc_struct));
1074
1075 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1076
1077 struct PropertyDef
1078 {
1079 struct PropertyDef * prev;
1080 struct PropertyDef * next;
1081 struct Location loc;
1082 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1083 struct Declarator * declarator;
1084 struct Identifier * id;
1085 struct Statement * getStmt;
1086 struct Statement * setStmt;
1087 struct Statement * issetStmt;
1088 struct Symbol * symbol;
1089 unsigned int conversion;
1090 unsigned int isWatchable;
1091 struct Expression * category;
1092 } __attribute__ ((gcc_struct));
1093
1094 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1095
1096 struct PropertyWatch
1097 {
1098 struct PropertyWatch * prev;
1099 struct PropertyWatch * next;
1100 struct Location loc;
1101 struct Statement * compound;
1102 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1103 unsigned int deleteWatch;
1104 } __attribute__ ((gcc_struct));
1105
1106 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1107
1108 struct ClassDef
1109 {
1110 struct ClassDef * prev;
1111 struct ClassDef * next;
1112 struct Location loc;
1113 int type;
1114 union
1115 {
1116 struct Declaration * decl;
1117 struct ClassFunction * function;
1118 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1119 struct PropertyDef * propertyDef;
1120 struct PropertyWatch * propertyWatch;
1121 char *  designer;
1122 struct Identifier * defaultProperty;
1123 struct
1124 {
1125 struct Identifier * id;
1126 struct Initializer * initializer;
1127 } __attribute__ ((gcc_struct));
1128 } __attribute__ ((gcc_struct));
1129 int memberAccess;
1130 void *  object;
1131 } __attribute__ ((gcc_struct));
1132
1133 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1134
1135 struct DBTableEntry;
1136
1137 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1138
1139 struct DBIndexItem;
1140
1141 extern YYSTYPE yylval;
1142
1143 extern struct Location yylloc;
1144
1145 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1146
1147 extern int returnCode;
1148
1149 extern struct Expression * parsedExpression;
1150
1151 extern unsigned int yydebug;
1152
1153 void SetYydebug(unsigned int b)
1154 {
1155 yydebug = b;
1156 }
1157
1158 extern unsigned int echoOn;
1159
1160 void resetScanner();
1161
1162 int propWatcherID;
1163
1164 int expression_yyparse();
1165
1166 static struct Statement * curCompound;
1167
1168 struct External * curExternal, * afterExternal;
1169
1170 static struct Type * curSwitchType;
1171
1172 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1173
1174 struct __ecereNameSpace__ecere__com__Class * thisClass;
1175
1176 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1177 {
1178 thisClass = c;
1179 }
1180
1181 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1182 {
1183 return thisClass;
1184 }
1185
1186 static char * thisNameSpace;
1187
1188 struct __ecereNameSpace__ecere__com__Class * containerClass;
1189
1190 unsigned int thisClassParams = 0x1;
1191
1192 unsigned int internalValueCounter;
1193
1194 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1195
1196 extern int strlen(const char * );
1197
1198 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1199
1200 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1201
1202 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1203
1204 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1205
1206 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1207
1208 void PrintExpression(struct Expression * exp, char * string)
1209 {
1210 {
1211 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1212 int count;
1213
1214 if(exp)
1215 OutputExpression(exp, f);
1216 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1217 count = strlen(string);
1218 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);
1219 string[count] = '\0';
1220 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1221 }
1222 }
1223
1224 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1225
1226 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1227
1228 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1229 {
1230 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1231 {
1232 if(!param->baseType)
1233 {
1234 if(param->dataTypeString)
1235 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1236 else
1237 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1238 }
1239 return param->baseType;
1240 }
1241 return (((void *)0));
1242 }
1243
1244 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1245 {
1246 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1247 return 0x1;
1248 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1249 {
1250 return 0x0;
1251 }
1252 if(type1->kind == type2->kind)
1253 {
1254 switch(type1->kind)
1255 {
1256 case 1:
1257 case 2:
1258 case 3:
1259 case 4:
1260 case 22:
1261 if(type1->passAsTemplate && !type2->passAsTemplate)
1262 return 0x1;
1263 return type1->isSigned != type2->isSigned;
1264 case 8:
1265 return type1->_class != type2->_class;
1266 case 13:
1267 return NeedCast(type1->type, type2->type);
1268 default:
1269 return 0x1;
1270 }
1271 }
1272 return 0x1;
1273 }
1274
1275 extern int strcmp(const char * , const char * );
1276
1277 extern struct Context * curContext;
1278
1279 extern struct Context * topContext;
1280
1281 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1282
1283 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);
1284
1285 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1286
1287 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);
1288
1289 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);
1290
1291 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1292
1293 struct __ecereNameSpace__ecere__com__ClassProperty
1294 {
1295 char *  name;
1296 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1297 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1298 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1299 int depth;
1300 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, long long);
1301 long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1302 char *  dataTypeString;
1303 struct Type * dataType;
1304 unsigned int constant;
1305 } __attribute__ ((gcc_struct));
1306
1307 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1308
1309 extern struct Expression * QMkExpId(char *  id);
1310
1311 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1312
1313 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1314 {
1315 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1316 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1317 char *  name;
1318 int type;
1319 union
1320 {
1321 char *  dataTypeString;
1322 int memberType;
1323 } __attribute__ ((gcc_struct));
1324 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1325 void *  param;
1326 } __attribute__ ((gcc_struct));
1327
1328 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1329
1330 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1331
1332 extern void FreeIdentifier(struct Identifier * id);
1333
1334 void ProcessExpressionType(struct Expression * exp);
1335
1336 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1337
1338 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1339
1340 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1341
1342 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1343
1344 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1345
1346 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1347
1348 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1349
1350 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1351
1352 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1353 {
1354 if(exp->type == 0 && exp->identifier)
1355 {
1356 struct Identifier * id = exp->identifier;
1357 struct Context * ctx;
1358 struct Symbol * symbol = (((void *)0));
1359
1360 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1361 {
1362 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1363 {
1364 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1365 if(symbol)
1366 break;
1367 }
1368 }
1369 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1370 {
1371 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1372 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1373 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1374 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
1375
1376 if(!prop)
1377 {
1378 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1379 }
1380 if(!prop && !method)
1381 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1382 if(!prop && !method && !member)
1383 {
1384 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1385 }
1386 if(prop || method || member || classProp)
1387 {
1388 exp->type = 8;
1389 exp->member.member = id;
1390 exp->member.memberType = 0;
1391 exp->member.exp = QMkExpId("this");
1392 exp->addedThis = 0x1;
1393 }
1394 else if(_class && _class->templateParams.first)
1395 {
1396 struct __ecereNameSpace__ecere__com__Class * sClass;
1397
1398 for(sClass = _class; sClass; sClass = sClass->base)
1399 {
1400 if(sClass->templateParams.first)
1401 {
1402 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1403
1404 for(param = sClass->templateParams.first; param; param = param->next)
1405 {
1406 if(param->type == 2 && !strcmp(param->name, id->string))
1407 {
1408 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1409
1410 if(argExp)
1411 {
1412 struct Declarator * decl;
1413 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1414
1415 FreeIdentifier(exp->member.member);
1416 ProcessExpressionType(argExp);
1417 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1418 exp->expType = ProcessType(specs, decl);
1419 exp->type = 5;
1420 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1421 }
1422 }
1423 }
1424 }
1425 }
1426 }
1427 }
1428 }
1429 }
1430
1431 extern int sprintf(char * , char * , ...);
1432
1433 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1434
1435 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1436
1437 char * PrintInt(long long result)
1438 {
1439 char temp[100];
1440
1441 if(result > (((long long)0x7fffffffffffffffLL)))
1442 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1443 else
1444 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1445 return __ecereNameSpace__ecere__sys__CopyString(temp);
1446 }
1447
1448 char * PrintUInt(uint64 result)
1449 {
1450 char temp[100];
1451
1452 if(result > (0xffffffff))
1453 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1454 else if(result > (((int)0x7fffffff)))
1455 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1456 else
1457 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1458 return __ecereNameSpace__ecere__sys__CopyString(temp);
1459 }
1460
1461 char * PrintInt64(long long result)
1462 {
1463 char temp[100];
1464
1465 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1466 return __ecereNameSpace__ecere__sys__CopyString(temp);
1467 }
1468
1469 char * PrintUInt64(uint64 result)
1470 {
1471 char temp[100];
1472
1473 if(result > (((long long)0x7fffffffffffffffLL)))
1474 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1475 else
1476 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1477 return __ecereNameSpace__ecere__sys__CopyString(temp);
1478 }
1479
1480 char * PrintHexUInt(uint64 result)
1481 {
1482 char temp[100];
1483
1484 if(result > (0xffffffff))
1485 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1486 else
1487 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1488 return __ecereNameSpace__ecere__sys__CopyString(temp);
1489 }
1490
1491 char * PrintHexUInt64(uint64 result)
1492 {
1493 char temp[100];
1494
1495 if(result > (0xffffffff))
1496 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1497 else
1498 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1499 return __ecereNameSpace__ecere__sys__CopyString(temp);
1500 }
1501
1502 char * PrintShort(short result)
1503 {
1504 char temp[100];
1505
1506 sprintf(temp, "%d", (unsigned short)result);
1507 return __ecereNameSpace__ecere__sys__CopyString(temp);
1508 }
1509
1510 char * PrintUShort(unsigned short result)
1511 {
1512 char temp[100];
1513
1514 if(result > (unsigned short)32767)
1515 sprintf(temp, "0x%X", (int)result);
1516 else
1517 sprintf(temp, "%d", result);
1518 return __ecereNameSpace__ecere__sys__CopyString(temp);
1519 }
1520
1521 extern int isprint(int c);
1522
1523 char * PrintChar(char result)
1524 {
1525 char temp[100];
1526
1527 if(result > (char)0 && isprint(result))
1528 sprintf(temp, "'%c'", result);
1529 else if(result < (char)0)
1530 sprintf(temp, "%d", result);
1531 else
1532 sprintf(temp, "0x%X", (unsigned char)result);
1533 return __ecereNameSpace__ecere__sys__CopyString(temp);
1534 }
1535
1536 char * PrintUChar(unsigned char result)
1537 {
1538 char temp[100];
1539
1540 sprintf(temp, "0x%X", result);
1541 return __ecereNameSpace__ecere__sys__CopyString(temp);
1542 }
1543
1544 char * PrintFloat(float result)
1545 {
1546 char temp[350];
1547
1548 sprintf(temp, "%.16ff", result);
1549 return __ecereNameSpace__ecere__sys__CopyString(temp);
1550 }
1551
1552 char * PrintDouble(double result)
1553 {
1554 char temp[350];
1555
1556 sprintf(temp, "%.16f", result);
1557 return __ecereNameSpace__ecere__sys__CopyString(temp);
1558 }
1559
1560 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1561
1562 struct OpTable
1563 {
1564 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1565 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1566 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1567 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1568 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1569 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1570 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1571 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1572 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1573 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1574 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1575 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1576 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1577 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1578 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1579 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1580 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1581 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1582 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1583 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1584 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1585 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1586 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1587 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1588 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1589 unsigned int (*  Not)(struct Expression *, struct Operand *);
1590 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1591 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1592 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1593 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1594 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1595 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1596 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1597 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1598 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1599 } __attribute__ ((gcc_struct));
1600
1601 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1602
1603 struct Operand
1604 {
1605 int kind;
1606 struct Type * type;
1607 unsigned int ptrSize;
1608 union
1609 {
1610 char c;
1611 unsigned char uc;
1612 short s;
1613 unsigned short us;
1614 int i;
1615 unsigned int ui;
1616 float f;
1617 double d;
1618 long long i64;
1619 uint64 ui64;
1620 } __attribute__ ((gcc_struct));
1621 struct OpTable ops;
1622 } __attribute__ ((gcc_struct));
1623
1624 struct Operand GetOperand(struct Expression * exp);
1625
1626 unsigned int GetInt(struct Expression * exp, int * value2)
1627 {
1628 struct Operand op2 = GetOperand(exp);
1629
1630 if(op2.kind == 3 && op2.type->isSigned)
1631 *value2 = op2.i;
1632 else if(op2.kind == 3)
1633 *value2 = (int)op2.ui;
1634 if(op2.kind == 4 && op2.type->isSigned)
1635 *value2 = (int)op2.i64;
1636 else if(op2.kind == 4)
1637 *value2 = (int)op2.ui64;
1638 else if(op2.kind == 22 && op2.type->isSigned)
1639 *value2 = (int)op2.i64;
1640 else if(op2.kind == 22)
1641 *value2 = (int)op2.ui64;
1642 else if(op2.kind == 2 && op2.type->isSigned)
1643 *value2 = (int)op2.s;
1644 else if(op2.kind == 2)
1645 *value2 = (int)op2.us;
1646 else if(op2.kind == 1 && op2.type->isSigned)
1647 *value2 = (int)op2.c;
1648 else if(op2.kind == 1)
1649 *value2 = (int)op2.uc;
1650 else if(op2.kind == 6)
1651 *value2 = (int)op2.f;
1652 else if(op2.kind == 7)
1653 *value2 = (int)op2.d;
1654 else if(op2.kind == 13)
1655 *value2 = (int)op2.ui64;
1656 else
1657 return 0x0;
1658 return 0x1;
1659 }
1660
1661 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1662 {
1663 struct Operand op2 = GetOperand(exp);
1664
1665 if(op2.kind == 3 && op2.type->isSigned)
1666 *value2 = (unsigned int)op2.i;
1667 else if(op2.kind == 3)
1668 *value2 = op2.ui;
1669 if(op2.kind == 4 && op2.type->isSigned)
1670 *value2 = (unsigned int)op2.i64;
1671 else if(op2.kind == 4)
1672 *value2 = (unsigned int)op2.ui64;
1673 else if(op2.kind == 22 && op2.type->isSigned)
1674 *value2 = (unsigned int)op2.i64;
1675 else if(op2.kind == 22)
1676 *value2 = (unsigned int)op2.ui64;
1677 else if(op2.kind == 2 && op2.type->isSigned)
1678 *value2 = (unsigned int)op2.s;
1679 else if(op2.kind == 2)
1680 *value2 = (unsigned int)op2.us;
1681 else if(op2.kind == 1 && op2.type->isSigned)
1682 *value2 = (unsigned int)op2.c;
1683 else if(op2.kind == 1)
1684 *value2 = (unsigned int)op2.uc;
1685 else if(op2.kind == 6)
1686 *value2 = (unsigned int)op2.f;
1687 else if(op2.kind == 7)
1688 *value2 = (unsigned int)op2.d;
1689 else if(op2.kind == 13)
1690 *value2 = (unsigned int)op2.ui64;
1691 else
1692 return 0x0;
1693 return 0x1;
1694 }
1695
1696 unsigned int GetInt64(struct Expression * exp, long long * value2)
1697 {
1698 struct Operand op2 = GetOperand(exp);
1699
1700 if(op2.kind == 3 && op2.type->isSigned)
1701 *value2 = (long long)op2.i;
1702 else if(op2.kind == 3)
1703 *value2 = (long long)op2.ui;
1704 if(op2.kind == 4 && op2.type->isSigned)
1705 *value2 = op2.i64;
1706 else if(op2.kind == 4)
1707 *value2 = (long long)op2.ui64;
1708 else if(op2.kind == 22 && op2.type->isSigned)
1709 *value2 = op2.i64;
1710 else if(op2.kind == 22)
1711 *value2 = (long long)op2.ui64;
1712 else if(op2.kind == 2 && op2.type->isSigned)
1713 *value2 = (long long)op2.s;
1714 else if(op2.kind == 2)
1715 *value2 = (long long)op2.us;
1716 else if(op2.kind == 1 && op2.type->isSigned)
1717 *value2 = (long long)op2.c;
1718 else if(op2.kind == 1)
1719 *value2 = (long long)op2.uc;
1720 else if(op2.kind == 6)
1721 *value2 = (long long)op2.f;
1722 else if(op2.kind == 7)
1723 *value2 = (long long)op2.d;
1724 else if(op2.kind == 13)
1725 *value2 = (long long)op2.ui64;
1726 else
1727 return 0x0;
1728 return 0x1;
1729 }
1730
1731 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1732 {
1733 struct Operand op2 = GetOperand(exp);
1734
1735 if(op2.kind == 3 && op2.type->isSigned)
1736 *value2 = (uint64)op2.i;
1737 else if(op2.kind == 3)
1738 *value2 = (uint64)op2.ui;
1739 if(op2.kind == 4 && op2.type->isSigned)
1740 *value2 = (uint64)op2.i64;
1741 else if(op2.kind == 4)
1742 *value2 = op2.ui64;
1743 else if(op2.kind == 22 && op2.type->isSigned)
1744 *value2 = (uint64)op2.i64;
1745 else if(op2.kind == 22)
1746 *value2 = op2.ui64;
1747 else if(op2.kind == 2 && op2.type->isSigned)
1748 *value2 = (uint64)op2.s;
1749 else if(op2.kind == 2)
1750 *value2 = (uint64)op2.us;
1751 else if(op2.kind == 1 && op2.type->isSigned)
1752 *value2 = (uint64)op2.c;
1753 else if(op2.kind == 1)
1754 *value2 = (uint64)op2.uc;
1755 else if(op2.kind == 6)
1756 *value2 = (uint64)op2.f;
1757 else if(op2.kind == 7)
1758 *value2 = (uint64)op2.d;
1759 else if(op2.kind == 13)
1760 *value2 = op2.ui64;
1761 else
1762 return 0x0;
1763 return 0x1;
1764 }
1765
1766 unsigned int GetIntPtr(struct Expression * exp, intptr_t * value2)
1767 {
1768 struct Operand op2 = GetOperand(exp);
1769
1770 if(op2.kind == 3 && op2.type->isSigned)
1771 *value2 = (intptr_t)op2.i;
1772 else if(op2.kind == 3)
1773 *value2 = (intptr_t)op2.ui;
1774 if(op2.kind == 4 && op2.type->isSigned)
1775 *value2 = (intptr_t)op2.i64;
1776 else if(op2.kind == 4)
1777 *value2 = (intptr_t)op2.ui64;
1778 else if(op2.kind == 22 && op2.type->isSigned)
1779 *value2 = (intptr_t)op2.i64;
1780 else if(op2.kind == 22)
1781 *value2 = (intptr_t)op2.ui64;
1782 else if(op2.kind == 2 && op2.type->isSigned)
1783 *value2 = (intptr_t)op2.s;
1784 else if(op2.kind == 2)
1785 *value2 = (intptr_t)op2.us;
1786 else if(op2.kind == 1 && op2.type->isSigned)
1787 *value2 = (intptr_t)op2.c;
1788 else if(op2.kind == 1)
1789 *value2 = (intptr_t)op2.uc;
1790 else if(op2.kind == 6)
1791 *value2 = (intptr_t)op2.f;
1792 else if(op2.kind == 7)
1793 *value2 = (intptr_t)op2.d;
1794 else if(op2.kind == 13)
1795 *value2 = (intptr_t)op2.ui64;
1796 else
1797 return 0x0;
1798 return 0x1;
1799 }
1800
1801 unsigned int GetUIntPtr(struct Expression * exp, uintptr_t * value2)
1802 {
1803 struct Operand op2 = GetOperand(exp);
1804
1805 if(op2.kind == 3 && op2.type->isSigned)
1806 *value2 = (uintptr_t)op2.i;
1807 else if(op2.kind == 3)
1808 *value2 = (uintptr_t)op2.ui;
1809 if(op2.kind == 4 && op2.type->isSigned)
1810 *value2 = (uintptr_t)op2.i64;
1811 else if(op2.kind == 4)
1812 *value2 = (uintptr_t)op2.ui64;
1813 else if(op2.kind == 22 && op2.type->isSigned)
1814 *value2 = (uintptr_t)op2.i64;
1815 else if(op2.kind == 22)
1816 *value2 = (uintptr_t)op2.ui64;
1817 else if(op2.kind == 2 && op2.type->isSigned)
1818 *value2 = (uintptr_t)op2.s;
1819 else if(op2.kind == 2)
1820 *value2 = (uintptr_t)op2.us;
1821 else if(op2.kind == 1 && op2.type->isSigned)
1822 *value2 = (uintptr_t)op2.c;
1823 else if(op2.kind == 1)
1824 *value2 = (uintptr_t)op2.uc;
1825 else if(op2.kind == 6)
1826 *value2 = (uintptr_t)op2.f;
1827 else if(op2.kind == 7)
1828 *value2 = (uintptr_t)op2.d;
1829 else if(op2.kind == 13)
1830 *value2 = (uintptr_t)op2.ui64;
1831 else
1832 return 0x0;
1833 return 0x1;
1834 }
1835
1836 unsigned int GetShort(struct Expression * exp, short * value2)
1837 {
1838 struct Operand op2 = GetOperand(exp);
1839
1840 if(op2.kind == 3 && op2.type->isSigned)
1841 *value2 = (short)op2.i;
1842 else if(op2.kind == 3)
1843 *value2 = (short)op2.ui;
1844 if(op2.kind == 4 && op2.type->isSigned)
1845 *value2 = (short)op2.i64;
1846 else if(op2.kind == 4)
1847 *value2 = (short)op2.ui64;
1848 else if(op2.kind == 22 && op2.type->isSigned)
1849 *value2 = (short)op2.i64;
1850 else if(op2.kind == 22)
1851 *value2 = (short)op2.ui64;
1852 else if(op2.kind == 2 && op2.type->isSigned)
1853 *value2 = op2.s;
1854 else if(op2.kind == 2)
1855 *value2 = (short)op2.us;
1856 else if(op2.kind == 1 && op2.type->isSigned)
1857 *value2 = (short)op2.c;
1858 else if(op2.kind == 1)
1859 *value2 = (short)op2.uc;
1860 else if(op2.kind == 6)
1861 *value2 = (short)op2.f;
1862 else if(op2.kind == 7)
1863 *value2 = (short)op2.d;
1864 else if(op2.kind == 13)
1865 *value2 = (short)op2.ui64;
1866 else
1867 return 0x0;
1868 return 0x1;
1869 }
1870
1871 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
1872 {
1873 struct Operand op2 = GetOperand(exp);
1874
1875 if(op2.kind == 3 && op2.type->isSigned)
1876 *value2 = (unsigned short)op2.i;
1877 else if(op2.kind == 3)
1878 *value2 = (unsigned short)op2.ui;
1879 if(op2.kind == 4 && op2.type->isSigned)
1880 *value2 = (unsigned short)op2.i64;
1881 else if(op2.kind == 4)
1882 *value2 = (unsigned short)op2.ui64;
1883 else if(op2.kind == 22 && op2.type->isSigned)
1884 *value2 = (unsigned short)op2.i64;
1885 else if(op2.kind == 22)
1886 *value2 = (unsigned short)op2.ui64;
1887 else if(op2.kind == 2 && op2.type->isSigned)
1888 *value2 = (unsigned short)op2.s;
1889 else if(op2.kind == 2)
1890 *value2 = op2.us;
1891 else if(op2.kind == 1 && op2.type->isSigned)
1892 *value2 = (unsigned short)op2.c;
1893 else if(op2.kind == 1)
1894 *value2 = (unsigned short)op2.uc;
1895 else if(op2.kind == 6)
1896 *value2 = (unsigned short)op2.f;
1897 else if(op2.kind == 7)
1898 *value2 = (unsigned short)op2.d;
1899 else if(op2.kind == 13)
1900 *value2 = (unsigned short)op2.ui64;
1901 else
1902 return 0x0;
1903 return 0x1;
1904 }
1905
1906 unsigned int GetChar(struct Expression * exp, char * value2)
1907 {
1908 struct Operand op2 = GetOperand(exp);
1909
1910 if(op2.kind == 3 && op2.type->isSigned)
1911 *value2 = (char)op2.i;
1912 else if(op2.kind == 3)
1913 *value2 = (char)op2.ui;
1914 if(op2.kind == 4 && op2.type->isSigned)
1915 *value2 = (char)op2.i64;
1916 else if(op2.kind == 4)
1917 *value2 = (char)op2.ui64;
1918 else if(op2.kind == 22 && op2.type->isSigned)
1919 *value2 = (char)op2.i64;
1920 else if(op2.kind == 22)
1921 *value2 = (char)op2.ui64;
1922 else if(op2.kind == 2 && op2.type->isSigned)
1923 *value2 = (char)op2.s;
1924 else if(op2.kind == 2)
1925 *value2 = (char)op2.us;
1926 else if(op2.kind == 1 && op2.type->isSigned)
1927 *value2 = op2.c;
1928 else if(op2.kind == 1)
1929 *value2 = (char)op2.uc;
1930 else if(op2.kind == 6)
1931 *value2 = (char)op2.f;
1932 else if(op2.kind == 7)
1933 *value2 = (char)op2.d;
1934 else if(op2.kind == 13)
1935 *value2 = (char)op2.ui64;
1936 else
1937 return 0x0;
1938 return 0x1;
1939 }
1940
1941 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
1942 {
1943 struct Operand op2 = GetOperand(exp);
1944
1945 if(op2.kind == 3 && op2.type->isSigned)
1946 *value2 = (unsigned char)op2.i;
1947 else if(op2.kind == 3)
1948 *value2 = (unsigned char)op2.ui;
1949 if(op2.kind == 4 && op2.type->isSigned)
1950 *value2 = (unsigned char)op2.i64;
1951 else if(op2.kind == 4)
1952 *value2 = (unsigned char)op2.ui64;
1953 else if(op2.kind == 22 && op2.type->isSigned)
1954 *value2 = (unsigned char)op2.i64;
1955 else if(op2.kind == 22)
1956 *value2 = (unsigned char)op2.ui64;
1957 else if(op2.kind == 2 && op2.type->isSigned)
1958 *value2 = (unsigned char)op2.s;
1959 else if(op2.kind == 2)
1960 *value2 = (unsigned char)op2.us;
1961 else if(op2.kind == 1 && op2.type->isSigned)
1962 *value2 = (unsigned char)op2.c;
1963 else if(op2.kind == 1)
1964 *value2 = op2.uc;
1965 else if(op2.kind == 6)
1966 *value2 = (unsigned char)op2.f;
1967 else if(op2.kind == 7)
1968 *value2 = (unsigned char)op2.d;
1969 else if(op2.kind == 13)
1970 *value2 = (unsigned char)op2.ui64;
1971 else
1972 return 0x0;
1973 return 0x1;
1974 }
1975
1976 unsigned int GetFloat(struct Expression * exp, float * value2)
1977 {
1978 struct Operand op2 = GetOperand(exp);
1979
1980 if(op2.kind == 3 && op2.type->isSigned)
1981 *value2 = (float)(float)op2.i;
1982 else if(op2.kind == 3)
1983 *value2 = (float)(float)op2.ui;
1984 if(op2.kind == 4 && op2.type->isSigned)
1985 *value2 = (float)(float)op2.i64;
1986 else if(op2.kind == 4)
1987 *value2 = (float)(float)op2.ui64;
1988 else if(op2.kind == 22 && op2.type->isSigned)
1989 *value2 = (float)(float)op2.i64;
1990 else if(op2.kind == 22)
1991 *value2 = (float)(float)op2.ui64;
1992 else if(op2.kind == 2 && op2.type->isSigned)
1993 *value2 = (float)(float)op2.s;
1994 else if(op2.kind == 2)
1995 *value2 = (float)(float)op2.us;
1996 else if(op2.kind == 1 && op2.type->isSigned)
1997 *value2 = (float)(float)op2.c;
1998 else if(op2.kind == 1)
1999 *value2 = (float)(float)op2.uc;
2000 else if(op2.kind == 6)
2001 *value2 = (float)op2.f;
2002 else if(op2.kind == 7)
2003 *value2 = (float)op2.d;
2004 else if(op2.kind == 13)
2005 *value2 = (float)(float)op2.ui64;
2006 else
2007 return 0x0;
2008 return 0x1;
2009 }
2010
2011 unsigned int GetDouble(struct Expression * exp, double * value2)
2012 {
2013 struct Operand op2 = GetOperand(exp);
2014
2015 if(op2.kind == 3 && op2.type->isSigned)
2016 *value2 = (double)(double)op2.i;
2017 else if(op2.kind == 3)
2018 *value2 = (double)(double)op2.ui;
2019 if(op2.kind == 4 && op2.type->isSigned)
2020 *value2 = (double)(double)op2.i64;
2021 else if(op2.kind == 4)
2022 *value2 = (double)(double)op2.ui64;
2023 else if(op2.kind == 22 && op2.type->isSigned)
2024 *value2 = (double)(double)op2.i64;
2025 else if(op2.kind == 22)
2026 *value2 = (double)(double)op2.ui64;
2027 else if(op2.kind == 2 && op2.type->isSigned)
2028 *value2 = (double)(double)op2.s;
2029 else if(op2.kind == 2)
2030 *value2 = (double)(double)op2.us;
2031 else if(op2.kind == 1 && op2.type->isSigned)
2032 *value2 = (double)(double)op2.c;
2033 else if(op2.kind == 1)
2034 *value2 = (double)(double)op2.uc;
2035 else if(op2.kind == 6)
2036 *value2 = (double)op2.f;
2037 else if(op2.kind == 7)
2038 *value2 = (double)op2.d;
2039 else if(op2.kind == 13)
2040 *value2 = (double)(double)op2.ui64;
2041 else
2042 return 0x0;
2043 return 0x1;
2044 }
2045
2046 void ComputeExpression(struct Expression * exp);
2047
2048 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2049
2050 extern int targetBits;
2051
2052 int ComputeTypeSize(struct Type * type);
2053
2054 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2055
2056 struct __ecereNameSpace__ecere__com__BitMember
2057 {
2058 struct __ecereNameSpace__ecere__com__BitMember * prev;
2059 struct __ecereNameSpace__ecere__com__BitMember * next;
2060 char *  name;
2061 unsigned int isProperty;
2062 int memberAccess;
2063 int id;
2064 struct __ecereNameSpace__ecere__com__Class * _class;
2065 char *  dataTypeString;
2066 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2067 struct Type * dataType;
2068 int type;
2069 int size;
2070 int pos;
2071 uint64 mask;
2072 } __attribute__ ((gcc_struct));
2073
2074 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2075
2076 struct __ecereNameSpace__ecere__sys__OldLink
2077 {
2078 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2079 struct __ecereNameSpace__ecere__sys__OldLink * next;
2080 void *  data;
2081 } __attribute__ ((gcc_struct));
2082
2083 void FinishTemplatesContext(struct Context * context);
2084
2085 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2086 {
2087 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2088 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2089
2090 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))
2091 {
2092 int c;
2093 int unionMemberOffset = 0;
2094 int bitFields = 0;
2095
2096 if(member)
2097 {
2098 member->memberOffset = 0;
2099 if(targetBits < sizeof(void *) * 8)
2100 member->structAlignment = 0;
2101 }
2102 else if(targetBits < sizeof(void *) * 8)
2103 _class->structAlignment = 0;
2104 if(!member && ((_class->type == 0 || _class->type == 5) || (_class->type == 1 && _class->memberOffset && _class->memberOffset > _class->base->structSize)))
2105 _class->memberOffset = (_class->base && _class->type == 1) ? _class->base->structSize : 0;
2106 if(!member && _class->destructionWatchOffset)
2107 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2108 {
2109 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2110
2111 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2112 {
2113 if(!dataMember->isProperty)
2114 {
2115 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2116 {
2117 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2118 }
2119 }
2120 }
2121 }
2122 {
2123 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2124
2125 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2126 {
2127 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2128 {
2129 if(!isMember && _class->type == 2 && dataMember->dataType)
2130 {
2131 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2132 uint64 mask = 0;
2133 int d;
2134
2135 ComputeTypeSize(dataMember->dataType);
2136 if(bitMember->pos == -1)
2137 bitMember->pos = _class->memberOffset;
2138 if(!bitMember->size)
2139 bitMember->size = dataMember->dataType->size * 8;
2140 _class->memberOffset = bitMember->pos + bitMember->size;
2141 for(d = 0; d < bitMember->size; d++)
2142 {
2143 if(d)
2144 mask <<= 1;
2145 mask |= 1;
2146 }
2147 bitMember->mask = mask << bitMember->pos;
2148 }
2149 else if(dataMember->type == 0 && dataMember->dataType)
2150 {
2151 int size;
2152 int alignment = 0;
2153
2154 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2155 ComputeTypeSize(dataMember->dataType);
2156 if(dataMember->dataType->bitFieldCount)
2157 {
2158 bitFields += dataMember->dataType->bitFieldCount;
2159 size = 0;
2160 }
2161 else
2162 {
2163 if(bitFields)
2164 {
2165 int size = (bitFields + 7) / 8;
2166
2167 if(isMember)
2168 {
2169 int __simpleStruct0;
2170
2171 if(alignment)
2172 {
2173 int __simpleStruct0;
2174
2175 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2176 if(member->memberOffset % alignment)
2177 member->memberOffset += alignment - (member->memberOffset % alignment);
2178 }
2179 dataMember->offset = member->memberOffset;
2180 if(member->type == 1)
2181 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2182 else
2183 {
2184 member->memberOffset += size;
2185 }
2186 }
2187 else
2188 {
2189 if(alignment)
2190 {
2191 int __simpleStruct0;
2192
2193 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2194 if(_class->memberOffset % alignment)
2195 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2196 }
2197 dataMember->offset = _class->memberOffset;
2198 _class->memberOffset += size;
2199 }
2200 bitFields = 0;
2201 }
2202 size = dataMember->dataType->size;
2203 alignment = dataMember->dataType->alignment;
2204 }
2205 if(isMember)
2206 {
2207 int __simpleStruct0;
2208
2209 if(alignment)
2210 {
2211 int __simpleStruct0;
2212
2213 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2214 if(member->memberOffset % alignment)
2215 member->memberOffset += alignment - (member->memberOffset % alignment);
2216 }
2217 dataMember->offset = member->memberOffset;
2218 if(member->type == 1)
2219 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2220 else
2221 {
2222 member->memberOffset += size;
2223 }
2224 }
2225 else
2226 {
2227 if(alignment)
2228 {
2229 int __simpleStruct0;
2230
2231 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2232 if(_class->memberOffset % alignment)
2233 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2234 }
2235 dataMember->offset = _class->memberOffset;
2236 _class->memberOffset += size;
2237 }
2238 }
2239 else
2240 {
2241 int alignment;
2242
2243 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2244 alignment = dataMember->structAlignment;
2245 if(isMember)
2246 {
2247 int __simpleStruct0;
2248
2249 if(alignment)
2250 {
2251 int __simpleStruct0;
2252
2253 if(member->memberOffset % alignment)
2254 member->memberOffset += alignment - (member->memberOffset % alignment);
2255 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2256 }
2257 dataMember->offset = member->memberOffset;
2258 if(member->type == 1)
2259 unionMemberOffset = (__simpleStruct0 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2260 else
2261 member->memberOffset += dataMember->memberOffset;
2262 }
2263 else
2264 {
2265 if(alignment)
2266 {
2267 int __simpleStruct0;
2268
2269 if(_class->memberOffset % alignment)
2270 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2271 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2272 }
2273 dataMember->offset = _class->memberOffset;
2274 _class->memberOffset += dataMember->memberOffset;
2275 }
2276 }
2277 }
2278 }
2279 if(bitFields)
2280 {
2281 int alignment = 0;
2282 int size = (bitFields + 7) / 8;
2283
2284 if(isMember)
2285 {
2286 int __simpleStruct0;
2287
2288 if(alignment)
2289 {
2290 int __simpleStruct0;
2291
2292 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2293 if(member->memberOffset % alignment)
2294 member->memberOffset += alignment - (member->memberOffset % alignment);
2295 }
2296 if(member->type == 1)
2297 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2298 else
2299 {
2300 member->memberOffset += size;
2301 }
2302 }
2303 else
2304 {
2305 if(alignment)
2306 {
2307 int __simpleStruct0;
2308
2309 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2310 if(_class->memberOffset % alignment)
2311 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2312 }
2313 _class->memberOffset += size;
2314 }
2315 bitFields = 0;
2316 }
2317 }
2318 if(member && member->type == 1)
2319 {
2320 member->memberOffset = unionMemberOffset;
2321 }
2322 if(!isMember)
2323 {
2324 if(_class->type != 2)
2325 {
2326 int extra = 0;
2327
2328 if(_class->structAlignment)
2329 {
2330 if(_class->memberOffset % _class->structAlignment)
2331 extra += _class->structAlignment - (_class->memberOffset % _class->structAlignment);
2332 }
2333 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset + extra;
2334 if(!member)
2335 {
2336 struct __ecereNameSpace__ecere__com__Property * prop;
2337
2338 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2339 {
2340 if(prop->isProperty && prop->isWatchable)
2341 {
2342 prop->watcherOffset = _class->structSize;
2343 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2344 }
2345 }
2346 }
2347 {
2348 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2349
2350 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2351 {
2352 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2353
2354 if(deriv->computeSize)
2355 {
2356 deriv->offset = _class->structSize;
2357 deriv->memberOffset = 0;
2358 deriv->structSize = deriv->offset;
2359 ComputeClassMembers(deriv, 0x0);
2360 }
2361 }
2362 }
2363 }
2364 }
2365 }
2366 if(context)
2367 FinishTemplatesContext(context);
2368 }
2369
2370 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2371
2372 struct __ecereNameSpace__ecere__com__NameSpace
2373 {
2374 char *  name;
2375 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2376 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2377 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2378 int depth;
2379 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2380 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2381 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2382 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2383 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2384 } __attribute__ ((gcc_struct));
2385
2386 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2387
2388 struct __ecereNameSpace__ecere__com__Module
2389 {
2390 struct __ecereNameSpace__ecere__com__Instance * application;
2391 struct __ecereNameSpace__ecere__sys__OldList classes;
2392 struct __ecereNameSpace__ecere__sys__OldList defines;
2393 struct __ecereNameSpace__ecere__sys__OldList functions;
2394 struct __ecereNameSpace__ecere__sys__OldList modules;
2395 struct __ecereNameSpace__ecere__com__Instance * prev;
2396 struct __ecereNameSpace__ecere__com__Instance * next;
2397 char *  name;
2398 void *  library;
2399 void *  Unload;
2400 int importType;
2401 int origImportType;
2402 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2403 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2404 } __attribute__ ((gcc_struct));
2405
2406 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2407 {
2408 struct __ecereNameSpace__ecere__com__Class * _class;
2409 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2410
2411 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->modules.first; subModule; subModule = subModule->next)
2412 ComputeModuleClasses(subModule->data);
2413 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->classes.first; _class; _class = _class->next)
2414 ComputeClassMembers(_class, 0x0);
2415 }
2416
2417 extern unsigned int inCompiler;
2418
2419 extern void Compiler_Error(char *  format, ...);
2420
2421 extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
2422
2423 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
2424
2425 int ComputeTypeSize(struct Type * type)
2426 {
2427 unsigned int size = type ? type->size : 0;
2428
2429 if(!size && type && !type->computing)
2430 {
2431 type->computing = 0x1;
2432 switch(type->kind)
2433 {
2434 case 1:
2435 type->alignment = size = sizeof(char);
2436 break;
2437 case 3:
2438 type->alignment = size = sizeof(int);
2439 break;
2440 case 4:
2441 type->alignment = size = sizeof(long long);
2442 break;
2443 case 22:
2444 type->alignment = size = targetBits / 8;
2445 break;
2446 case 5:
2447 type->alignment = size = sizeof(long);
2448 break;
2449 case 2:
2450 type->alignment = size = sizeof(short);
2451 break;
2452 case 6:
2453 type->alignment = size = sizeof(float);
2454 break;
2455 case 7:
2456 type->alignment = size = sizeof(double);
2457 break;
2458 case 8:
2459 {
2460 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2461
2462 if(_class && _class->type == 1)
2463 {
2464 ComputeClassMembers(_class, 0x0);
2465 type->alignment = _class->structAlignment;
2466 size = _class->structSize;
2467 if(type->alignment && size % type->alignment)
2468 size += type->alignment - (size % type->alignment);
2469 }
2470 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2471 {
2472 if(!_class->dataType)
2473 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2474 size = type->alignment = ComputeTypeSize(_class->dataType);
2475 }
2476 else
2477 size = type->alignment = targetBits / 8;
2478 break;
2479 }
2480 case 13:
2481 case 19:
2482 size = type->alignment = targetBits / 8;
2483 break;
2484 case 12:
2485 if(type->arraySizeExp)
2486 {
2487 ProcessExpressionType(type->arraySizeExp);
2488 ComputeExpression(type->arraySizeExp);
2489 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)))
2490 {
2491 struct Location oldLoc = yylloc;
2492 char expression[10240];
2493
2494 expression[0] = '\0';
2495 type->arraySizeExp->expType = (((void *)0));
2496 yylloc = type->arraySizeExp->loc;
2497 if(inCompiler)
2498 PrintExpression(type->arraySizeExp, expression);
2499 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Array size not constant int (%s)\n", (((void *)0))), expression);
2500 yylloc = oldLoc;
2501 }
2502 GetInt(type->arraySizeExp, &type->arraySize);
2503 }
2504 else if(type->enumClass)
2505 {
2506 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2507 {
2508 type->arraySize = (int)__ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2509 }
2510 else
2511 type->arraySize = 0;
2512 }
2513 else
2514 {
2515 type->arraySize = 0;
2516 }
2517 size = ComputeTypeSize(type->type) * type->arraySize;
2518 type->alignment = type->type->alignment;
2519 break;
2520 case 9:
2521 {
2522 struct Type * member;
2523
2524 for(member = type->members.first; member; member = member->next)
2525 {
2526 int __simpleStruct0, __simpleStruct1;
2527 unsigned int addSize = ComputeTypeSize(member);
2528
2529 member->offset = size;
2530 if(member->alignment && size % member->alignment)
2531 member->offset += member->alignment - (size % member->alignment);
2532 size = member->offset;
2533 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2534 size += addSize;
2535 }
2536 if(type->alignment && size % type->alignment)
2537 size += type->alignment - (size % type->alignment);
2538 break;
2539 }
2540 case 10:
2541 {
2542 struct Type * member;
2543
2544 for(member = type->members.first; member; member = member->next)
2545 {
2546 int __simpleStruct0, __simpleStruct1;
2547 unsigned int addSize = ComputeTypeSize(member);
2548
2549 member->offset = size;
2550 if(member->alignment && size % member->alignment)
2551 member->offset += member->alignment - (size % member->alignment);
2552 size = member->offset;
2553 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2554 size = ((size > addSize) ? size : addSize);
2555 }
2556 if(type->alignment && size % type->alignment)
2557 size += type->alignment - (size % type->alignment);
2558 break;
2559 }
2560 case 20:
2561 {
2562 struct TemplateParameter * param = type->templateParameter;
2563 struct Type * baseType = ProcessTemplateParameterType(param);
2564
2565 if(baseType)
2566 {
2567 size = ComputeTypeSize(baseType);
2568 type->alignment = baseType->alignment;
2569 }
2570 else
2571 type->alignment = size = sizeof(uint64);
2572 break;
2573 }
2574 case 15:
2575 {
2576 type->alignment = size = sizeof(enum
2577 {
2578 test
2579 });
2580 break;
2581 }
2582 case 21:
2583 {
2584 type->alignment = size = targetBits / 8;
2585 break;
2586 }
2587 }
2588 type->size = size;
2589 type->computing = 0x0;
2590 }
2591 return size;
2592 }
2593
2594 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2595
2596 extern struct Identifier * MkIdentifier(char *  string);
2597
2598 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2599
2600 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2601
2602 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2603
2604 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2605
2606 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2607
2608 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2609
2610 extern void FreeType(struct Type * type);
2611
2612 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2613
2614 extern struct Specifier * MkSpecifier(int specifier);
2615
2616 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2617
2618 extern struct Expression * MkExpConstant(char *  string);
2619
2620 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)
2621 {
2622 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2623 unsigned int totalSize = 0;
2624 unsigned int maxSize = 0;
2625 int alignment, size;
2626 struct __ecereNameSpace__ecere__com__DataMember * member;
2627 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2628
2629 if(addedPadding)
2630 *addedPadding = 0x0;
2631 if(!isMember && _class->base)
2632 {
2633 maxSize = _class->structSize;
2634 {
2635 if(_class->type == 1 || _class->type == 5)
2636 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass, (((void *)0)));
2637 else
2638 maxSize -= _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2639 }
2640 }
2641 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2642 {
2643 if(!member->isProperty)
2644 {
2645 switch(member->type)
2646 {
2647 case 0:
2648 {
2649 if(member->dataTypeString)
2650 {
2651 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2652 struct Declarator * decl;
2653
2654 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2655 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2656 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2657 if(!member->dataType)
2658 member->dataType = ProcessType(specs, decl);
2659 ReplaceThisClassSpecifiers(specs, topClass);
2660 {
2661 struct Type * type = ProcessType(specs, decl);
2662
2663 DeclareType(member->dataType, 0x0, 0x0);
2664 FreeType(type);
2665 }
2666 ComputeTypeSize(member->dataType);
2667 size = member->dataType->size;
2668 alignment = member->dataType->alignment;
2669 if(alignment)
2670 {
2671 if(totalSize % alignment)
2672 totalSize += alignment - (totalSize % alignment);
2673 }
2674 totalSize += size;
2675 }
2676 break;
2677 }
2678 case 1:
2679 case 2:
2680 {
2681 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2682
2683 size = 0;
2684 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass, (((void *)0)));
2685 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
2686 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
2687 alignment = member->structAlignment;
2688 if(alignment)
2689 {
2690 if(totalSize % alignment)
2691 totalSize += alignment - (totalSize % alignment);
2692 }
2693 totalSize += size;
2694 break;
2695 }
2696 }
2697 }
2698 }
2699 if(retSize)
2700 {
2701 unsigned int __simpleStruct0;
2702
2703 if(topMember && topMember->type == 1)
2704 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
2705 else
2706 *retSize += totalSize;
2707 }
2708 else if(totalSize < maxSize && _class->type != 1000)
2709 {
2710 int autoPadding = 0;
2711
2712 if(!isMember && _class->structAlignment && totalSize % _class->structAlignment)
2713 autoPadding = _class->structAlignment - (totalSize % _class->structAlignment);
2714 if(totalSize + autoPadding < maxSize)
2715 {
2716 char sizeString[50];
2717
2718 sprintf(sizeString, "%d", maxSize - totalSize);
2719 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
2720 if(addedPadding)
2721 *addedPadding = 0x1;
2722 }
2723 }
2724 if(context)
2725 FinishTemplatesContext(context);
2726 return topMember ? topMember->memberID : _class->memberID;
2727 }
2728
2729 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2730 {
2731 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2732 unsigned int totalSize = 0;
2733 struct __ecereNameSpace__ecere__com__DataMember * member;
2734 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2735
2736 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
2737 DeclareMembers(_class->base, 0x0);
2738 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2739 {
2740 if(!member->isProperty)
2741 {
2742 switch(member->type)
2743 {
2744 case 0:
2745 {
2746 if(!member->dataType && member->dataTypeString)
2747 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
2748 if(member->dataType)
2749 DeclareType(member->dataType, 0x0, 0x0);
2750 break;
2751 }
2752 case 1:
2753 case 2:
2754 {
2755 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
2756 break;
2757 }
2758 }
2759 }
2760 }
2761 if(context)
2762 FinishTemplatesContext(context);
2763 return topMember ? topMember->memberID : _class->memberID;
2764 }
2765
2766 extern struct Symbol * FindClass(char *  name);
2767
2768 extern char *  strchr(char * , int);
2769
2770 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
2771
2772 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (* )(void * ));
2773
2774 extern void FreeClassDef(struct ClassDef * def);
2775
2776 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
2777
2778 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
2779
2780 extern char *  strcpy(char * , const char * );
2781
2782 extern void MangleClassName(char *  className);
2783
2784 extern void DeclareClass(struct Symbol * classSym, char *  className);
2785
2786 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
2787
2788 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
2789
2790 void DeclareStruct(char * name, unsigned int skipNoHead)
2791 {
2792 struct External * external = (((void *)0));
2793 struct Symbol * classSym = FindClass(name);
2794
2795 if(!inCompiler || !classSym)
2796 return ;
2797 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
2798 return ;
2799 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
2800 {
2801 struct Declaration * decl;
2802 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2803 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
2804 char structName[1024];
2805
2806 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
2807 classSym->declaring++;
2808 if(strchr(classSym->string, '<'))
2809 {
2810 if(classSym->registered->templateClass)
2811 {
2812 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
2813 classSym->declaring--;
2814 }
2815 return ;
2816 }
2817 DeclareMembers(classSym->registered, 0x0);
2818 structName[0] = (char)0;
2819 FullClassNameCat(structName, name, 0x0);
2820 if(!skipNoHead)
2821 {
2822 unsigned int addedPadding = 0x0;
2823
2824 classSym->declaredStructSym = 0x1;
2825 declarations = MkList();
2826 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered, &addedPadding);
2827 if(!(*declarations).count || ((*declarations).count == 1 && addedPadding))
2828 {
2829 FreeList(declarations, FreeClassDef);
2830 declarations = (((void *)0));
2831 }
2832 }
2833 if(skipNoHead || declarations)
2834 {
2835 if(external && external->declaration)
2836 {
2837 ((struct Specifier *)(*external->declaration->specifiers).first)->definitions = declarations;
2838 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2839 {
2840 if(classSym->structExternal)
2841 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2842 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2843 classSym->id = curExternal->symbol->idCode;
2844 classSym->idCode = curExternal->symbol->idCode;
2845 }
2846 }
2847 else
2848 {
2849 if(!external)
2850 external = MkExternalDeclaration((((void *)0)));
2851 specifiers = MkList();
2852 declarators = MkList();
2853 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
2854 external->declaration = decl = MkDeclaration(specifiers, declarators);
2855 if(decl->symbol && !decl->symbol->pointerExternal)
2856 decl->symbol->pointerExternal = external;
2857 if(classSym->registered && classSym->registered->type == 1)
2858 {
2859 char className[1024];
2860
2861 strcpy(className, "__ecereClass_");
2862 FullClassNameCat(className, classSym->string, 0x1);
2863 MangleClassName(className);
2864 DeclareClass(classSym, className);
2865 external->symbol = classSym;
2866 classSym->pointerExternal = external;
2867 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
2868 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
2869 }
2870 else
2871 {
2872 char className[1024];
2873
2874 strcpy(className, "__ecereClass_");
2875 FullClassNameCat(className, classSym->string, 0x1);
2876 MangleClassName(className);
2877 classSym->structExternal = external;
2878 DeclareClass(classSym, className);
2879 external->symbol = classSym;
2880 }
2881 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
2882 }
2883 }
2884 classSym->declaring--;
2885 }
2886 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2887 {
2888 classSym->declaring++;
2889 {
2890 if(classSym->registered)
2891 DeclareMembers(classSym->registered, 0x0);
2892 }
2893 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
2894 {
2895 if(classSym->structExternal)
2896 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2897 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2898 classSym->id = curExternal->symbol->idCode;
2899 classSym->idCode = curExternal->symbol->idCode;
2900 }
2901 classSym->declaring--;
2902 }
2903 }
2904
2905 extern char *  strcat(char * , const char * );
2906
2907 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
2908
2909 extern struct ModuleImport * mainModule;
2910
2911 extern struct Specifier * MkSpecifierName(char *  name);
2912
2913 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
2914
2915 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
2916
2917 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
2918
2919 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
2920
2921 extern void FreeDeclarator(struct Declarator * decl);
2922
2923 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
2924
2925 struct PropertyImport
2926 {
2927 struct PropertyImport * prev;
2928 struct PropertyImport * next;
2929 char *  name;
2930 unsigned int isVirtual;
2931 unsigned int hasSet;
2932 unsigned int hasGet;
2933 } __attribute__ ((gcc_struct));
2934
2935 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
2936
2937 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
2938 {
2939 void * __ecereTemp1;
2940 struct Symbol * symbol = prop->symbol;
2941 char propName[1024];
2942
2943 strcpy(setName, "__ecereProp_");
2944 FullClassNameCat(setName, prop->_class->fullName, 0x0);
2945 strcat(setName, "_Set_");
2946 FullClassNameCat(setName, prop->name, 0x1);
2947 strcpy(getName, "__ecereProp_");
2948 FullClassNameCat(getName, prop->_class->fullName, 0x0);
2949 strcat(getName, "_Get_");
2950 FullClassNameCat(getName, prop->name, 0x1);
2951 strcpy(propName, "__ecereProp_");
2952 FullClassNameCat(propName, prop->_class->fullName, 0x0);
2953 strcat(propName, "_");
2954 FullClassNameCat(propName, prop->name, 0x1);
2955 MangleClassName(getName);
2956 MangleClassName(setName);
2957 MangleClassName(propName);
2958 if(prop->_class->type == 1)
2959 DeclareStruct(prop->_class->fullName, 0x0);
2960 if(!symbol || curExternal->symbol->idCode < symbol->id)
2961 {
2962 unsigned int imported = 0x0;
2963 unsigned int dllImport = 0x0;
2964
2965 if(!symbol || symbol->_import)
2966 {
2967 if(!symbol)
2968 {
2969 struct Symbol * classSym;
2970
2971 if(!prop->_class->symbol)
2972 prop->_class->symbol = FindClass(prop->_class->fullName);
2973 classSym = prop->_class->symbol;
2974 if(classSym && !classSym->_import)
2975 {
2976 struct ModuleImport * module;
2977
2978 if(prop->_class->module)
2979 module = FindModule(prop->_class->module);
2980 else
2981 module = mainModule;
2982 classSym->_import = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport), ((struct ClassImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), ((struct ClassImport *)__ecereTemp1)->isRemote = prop->_class->isRemote, ((struct ClassImport *)__ecereTemp1));
2983 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
2984 }
2985 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
2986 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport), ((struct PropertyImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), ((struct PropertyImport *)__ecereTemp1)->isVirtual = 0x0, ((struct PropertyImport *)__ecereTemp1)->hasSet = prop->Set ? 0x1 : 0x0, ((struct PropertyImport *)__ecereTemp1)->hasGet = prop->Get ? 0x1 : 0x0, ((struct PropertyImport *)__ecereTemp1));
2987 if(classSym)
2988 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
2989 }
2990 imported = 0x1;
2991 if(prop->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + 12)))->importType != 1)
2992 dllImport = 0x1;
2993 }
2994 if(!symbol->type)
2995 {
2996 struct Context * context = SetupTemplatesContext(prop->_class);
2997
2998 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
2999 FinishTemplatesContext(context);
3000 }
3001 if(prop->Get)
3002 {
3003 if(!symbol->externalGet || symbol->externalGet->type == 0)
3004 {
3005 struct Declaration * decl;
3006 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3007 struct Declarator * d;
3008 struct __ecereNameSpace__ecere__sys__OldList * params;
3009 struct Specifier * spec;
3010 struct External * external;
3011 struct Declarator * typeDecl;
3012 unsigned int simple = 0x0;
3013
3014 specifiers = MkList();
3015 declarators = MkList();
3016 params = MkList();
3017 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3018 d = MkDeclaratorIdentifier(MkIdentifier(getName));
3019 if(dllImport)
3020 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3021 {
3022 struct Context * context = SetupTemplatesContext(prop->_class);
3023
3024 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
3025 FinishTemplatesContext(context);
3026 }
3027 for(spec = (*specifiers).first; spec; spec = spec->next)
3028 {
3029 if(spec->type == 1)
3030 {
3031 if((!typeDecl || typeDecl->type == 1))
3032 {
3033 struct Symbol * classSym = spec->symbol;
3034
3035 symbol->_class = classSym->registered;
3036 if(classSym->registered && classSym->registered->type == 1)
3037 {
3038 DeclareStruct(spec->name, 0x0);
3039 simple = 0x1;
3040 }
3041 }
3042 }
3043 }
3044 if(!simple)
3045 d = PlugDeclarator(typeDecl, d);
3046 else
3047 {
3048 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3049 specifiers = MkList();
3050 }
3051 d = MkDeclaratorFunction(d, params);
3052 if(dllImport)
3053 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3054 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3055 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3056 if(simple)
3057 ListAdd(specifiers, MkSpecifier(VOID));
3058 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3059 decl = MkDeclaration(specifiers, declarators);
3060 external = MkExternalDeclaration(decl);
3061 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3062 external->symbol = symbol;
3063 symbol->externalGet = external;
3064 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3065 if(typeDecl)
3066 FreeDeclarator(typeDecl);
3067 }
3068 else
3069 {
3070 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3071 }
3072 }
3073 if(prop->Set)
3074 {
3075 if(!symbol->externalSet || symbol->externalSet->type == 0)
3076 {
3077 struct Declaration * decl;
3078 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3079 struct Declarator * d;
3080 struct __ecereNameSpace__ecere__sys__OldList * params;
3081 struct Specifier * spec;
3082 struct External * external;
3083 struct Declarator * typeDecl;
3084
3085 declarators = MkList();
3086 params = MkList();
3087 if(!prop->conversion || prop->_class->type == 1)
3088 {
3089 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3090 }
3091 specifiers = MkList();
3092 {
3093 struct Context * context = SetupTemplatesContext(prop->_class);
3094
3095 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3096 FinishTemplatesContext(context);
3097 }
3098 ListAdd(params, MkTypeName(specifiers, d));
3099 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3100 if(dllImport)
3101 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3102 d = MkDeclaratorFunction(d, params);
3103 for(spec = (*specifiers).first; spec; spec = spec->next)
3104 {
3105 if(spec->type == 1)
3106 {
3107 if((!typeDecl || typeDecl->type == 1))
3108 {
3109 struct Symbol * classSym = spec->symbol;
3110
3111 symbol->_class = classSym->registered;
3112 if(classSym->registered && classSym->registered->type == 1)
3113 DeclareStruct(spec->name, 0x0);
3114 }
3115 }
3116 }
3117 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3118 specifiers = MkList();
3119 if(dllImport)
3120 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3121 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3122 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3123 if(!prop->conversion || prop->_class->type == 1)
3124 ListAdd(specifiers, MkSpecifier(VOID));
3125 else
3126 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3127 decl = MkDeclaration(specifiers, declarators);
3128 external = MkExternalDeclaration(decl);
3129 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3130 external->symbol = symbol;
3131 symbol->externalSet = external;
3132 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3133 }
3134 else
3135 {
3136 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3137 }
3138 }
3139 if(!symbol->externalPtr)
3140 {
3141 struct Declaration * decl;
3142 struct External * external;
3143 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3144
3145 if(imported)
3146 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3147 else
3148 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3149 ListAdd(specifiers, MkSpecifierName("Property"));
3150 {
3151 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3152
3153 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3154 if(!imported)
3155 {
3156 strcpy(propName, "__ecerePropM_");
3157 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3158 strcat(propName, "_");
3159 FullClassNameCat(propName, prop->name, 0x1);
3160 MangleClassName(propName);
3161 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3162 }
3163 decl = MkDeclaration(specifiers, list);
3164 }
3165 external = MkExternalDeclaration(decl);
3166 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3167 external->symbol = symbol;
3168 symbol->externalPtr = external;
3169 }
3170 else
3171 {
3172 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3173 }
3174 symbol->id = curExternal->symbol->idCode;
3175 }
3176 }
3177
3178 struct Type * Dereference(struct Type * source)
3179 {
3180 void * __ecereTemp1;
3181 struct Type * type = (((void *)0));
3182
3183 if(source)
3184 {
3185 if(source->kind == 13 || source->kind == 12)
3186 {
3187 type = source->type;
3188 source->type->refCount++;
3189 }
3190 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3191 {
3192 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 1, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
3193 }
3194 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3195 {
3196 type = source;
3197 source->refCount++;
3198 }
3199 else
3200 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot dereference type\n", (((void *)0))));
3201 }
3202 return type;
3203 }
3204
3205 static struct Type * Reference(struct Type * source)
3206 {
3207 void * __ecereTemp1;
3208 struct Type * type = (((void *)0));
3209
3210 if(source)
3211 {
3212 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = source, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
3213 source->refCount++;
3214 }
3215 return type;
3216 }
3217
3218 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);
3219
3220 extern void *  memcpy(void * , const void * , unsigned int size);
3221
3222 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3223
3224 extern void FreeExpression(struct Expression * exp);
3225
3226 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3227
3228 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);
3229
3230 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3231
3232 extern struct Type * MkClassType(char *  name);
3233
3234 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);
3235
3236 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)
3237 {
3238 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3239 unsigned int found = 0x0;
3240 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3241 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3242 unsigned int freeType = 0x0;
3243
3244 yylloc = member->loc;
3245 if(!ident)
3246 {
3247 if(curMember)
3248 {
3249 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3250 if(*curMember)
3251 {
3252 found = 0x1;
3253 dataMember = *curMember;
3254 }
3255 }
3256 }
3257 else
3258 {
3259 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3260 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3261 int _subMemberStackPos = 0;
3262
3263 if(!thisMember)
3264 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3265 if(thisMember)
3266 {
3267 dataMember = thisMember;
3268 if(curMember && thisMember->memberAccess == 1)
3269 {
3270 *curMember = thisMember;
3271 *curClass = thisMember->_class;
3272 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
3273 *subMemberStackPos = _subMemberStackPos;
3274 }
3275 found = 0x1;
3276 }
3277 else
3278 {
3279 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3280 if(method && method->type == 1)
3281 found = 0x1;
3282 else
3283 method = (((void *)0));
3284 }
3285 }
3286 if(found)
3287 {
3288 struct Type * type = (((void *)0));
3289
3290 if(dataMember)
3291 {
3292 if(!dataMember->dataType && dataMember->dataTypeString)
3293 {
3294 struct Context * context = SetupTemplatesContext(_class);
3295
3296 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3297 FinishTemplatesContext(context);
3298 }
3299 type = dataMember->dataType;
3300 }
3301 else if(method)
3302 {
3303 if(!method->dataType)
3304 ProcessMethodType(method);
3305 type = method->dataType;
3306 }
3307 if(ident && ident->next)
3308 {
3309 for(ident = ident->next; ident && type; ident = ident->next)
3310 {
3311 if(type->kind == 8)
3312 {
3313 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3314 if(!dataMember)
3315 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3316 if(dataMember)
3317 type = dataMember->dataType;
3318 }
3319 else if(type->kind == 9 || type->kind == 10)
3320 {
3321 struct Type * memberType;
3322
3323 for(memberType = type->members.first; memberType; memberType = memberType->next)
3324 {
3325 if(!strcmp(memberType->name, ident->string))
3326 {
3327 type = memberType;
3328 break;
3329 }
3330 }
3331 }
3332 }
3333 }
3334 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3335 {
3336 int id = 0;
3337 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3338 struct __ecereNameSpace__ecere__com__Class * sClass;
3339
3340 for(sClass = _class; sClass; sClass = sClass->base)
3341 {
3342 id = 0;
3343 if(sClass->templateClass)
3344 sClass = sClass->templateClass;
3345 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3346 {
3347 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3348 {
3349 for(sClass = sClass->base; sClass; sClass = sClass->base)
3350 {
3351 if(sClass->templateClass)
3352 sClass = sClass->templateClass;
3353 id += sClass->templateParams.count;
3354 }
3355 break;
3356 }
3357 id++;
3358 }
3359 if(curParam)
3360 break;
3361 }
3362 if(curParam)
3363 {
3364 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3365
3366 if(arg.dataTypeString)
3367 {
3368 type = ProcessTypeString(arg.dataTypeString, 0x0);
3369 freeType = 0x1;
3370 if(type && _class->templateClass)
3371 type->passAsTemplate = 0x1;
3372 if(type)
3373 {
3374 }
3375 }
3376 }
3377 }
3378 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3379 {
3380 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3381 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3382 int c;
3383 int paramCount = 0;
3384 int lastParam = -1;
3385 char templateString[1024];
3386 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3387
3388 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3389 for(cClass = expClass; cClass; cClass = cClass->base)
3390 {
3391 int p = 0;
3392
3393 if(cClass->templateClass)
3394 cClass = cClass->templateClass;
3395 for(param = cClass->templateParams.first; param; param = param->next)
3396 {
3397 int id = p;
3398 struct __ecereNameSpace__ecere__com__Class * sClass;
3399 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3400
3401 for(sClass = cClass->base; sClass; sClass = sClass->base)
3402 {
3403 if(sClass->templateClass)
3404 sClass = sClass->templateClass;
3405 id += sClass->templateParams.count;
3406 }
3407 arg = expClass->templateArgs[id];
3408 for(sClass = _class; sClass; sClass = sClass->base)
3409 {
3410 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3411 int p = 0;
3412 struct __ecereNameSpace__ecere__com__Class * nextClass;
3413
3414 if(sClass->templateClass)
3415 sClass = sClass->templateClass;
3416 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3417 {
3418 if(nextClass->templateClass)
3419 nextClass = nextClass->templateClass;
3420 p += nextClass->templateParams.count;
3421 }
3422 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3423 {
3424 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3425 {
3426 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3427 {
3428 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3429 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3430 break;
3431 }
3432 }
3433 }
3434 }
3435 {
3436 char argument[256];
3437
3438 argument[0] = '\0';
3439 switch(param->type)
3440 {
3441 case 2:
3442 {
3443 char expString[1024];
3444 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3445 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3446 struct Expression * exp;
3447 char * string = PrintHexUInt64(arg.expression.ui64);
3448
3449 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3450 ProcessExpressionType(exp);
3451 ComputeExpression(exp);
3452 expString[0] = '\0';
3453 PrintExpression(exp, expString);
3454 strcat(argument, expString);
3455 FreeExpression(exp);
3456 break;
3457 }
3458 case 1:
3459 {
3460 strcat(argument, arg.member->name);
3461 break;
3462 }
3463 case 0:
3464 {
3465 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3466 strcat(argument, arg.dataTypeString);
3467 break;
3468 }
3469 }
3470 if(argument[0])
3471 {
3472 if(paramCount)
3473 strcat(templateString, ", ");
3474 if(lastParam != p - 1)
3475 {
3476 strcat(templateString, param->name);
3477 strcat(templateString, " = ");
3478 }
3479 strcat(templateString, argument);
3480 paramCount++;
3481 lastParam = p;
3482 }
3483 p++;
3484 }
3485 }
3486 }
3487 {
3488 int len = strlen(templateString);
3489
3490 if(templateString[len - 1] == '<')
3491 len--;
3492 else
3493 {
3494 if(templateString[len - 1] == '>')
3495 templateString[len++] = ' ';
3496 templateString[len++] = '>';
3497 }
3498 templateString[len++] = '\0';
3499 }
3500 {
3501 struct Context * context = SetupTemplatesContext(_class);
3502
3503 if(freeType)
3504 FreeType(type);
3505 type = ProcessTypeString(templateString, 0x0);
3506 freeType = 0x1;
3507 FinishTemplatesContext(context);
3508 }
3509 }
3510 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3511 {
3512 ProcessExpressionType(member->initializer->exp);
3513 if(!member->initializer->exp->expType)
3514 {
3515 if(inCompiler)
3516 {
3517 char expString[10240];
3518
3519 expString[0] = '\0';
3520 PrintExpression(member->initializer->exp, expString);
3521 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3522 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3523 }
3524 }
3525 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3526 {
3527 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible instance method %s\n", (((void *)0))), ident->string);
3528 }
3529 }
3530 else if(member->initializer)
3531 {
3532 ProcessInitializer(member->initializer, type);
3533 }
3534 if(freeType)
3535 FreeType(type);
3536 }
3537 else
3538 {
3539 if(_class && _class->type == 3)
3540 {
3541 if(member->initializer)
3542 {
3543 struct Type * type = MkClassType(_class->fullName);
3544
3545 ProcessInitializer(member->initializer, type);
3546 FreeType(type);
3547 }
3548 }
3549 else
3550 {
3551 if(member->initializer)
3552 {
3553 ProcessInitializer(member->initializer, (((void *)0)));
3554 }
3555 if(ident)
3556 {
3557 if(method)
3558 {
3559 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3560 }
3561 else if(_class)
3562 {
3563 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3564 if(inCompiler)
3565 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3566 }
3567 }
3568 else if(_class)
3569 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3570 }
3571 }
3572 }
3573
3574 extern struct Identifier * GetDeclId(struct Declarator * decl);
3575
3576 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);
3577
3578 extern void FreeSpecifier(struct Specifier * spec);
3579
3580 static void ProcessFunction(struct FunctionDefinition * function);
3581
3582 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (* )(void * ));
3583
3584 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3585
3586 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3587
3588 extern void FreeClassFunction(struct ClassFunction * func);
3589
3590 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3591
3592 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3593
3594 void ProcessInstantiationType(struct Instantiation * inst)
3595 {
3596 yylloc = inst->loc;
3597 if(inst->_class)
3598 {
3599 struct MembersInit * members;
3600 struct Symbol * classSym;
3601 struct __ecereNameSpace__ecere__com__Class * _class;
3602
3603 classSym = inst->_class->symbol;
3604 _class = classSym ? classSym->registered : (((void *)0));
3605 if(!_class || _class->type != 5)
3606 DeclareStruct(inst->_class->name, 0x0);
3607 afterExternal = afterExternal ? afterExternal : curExternal;
3608 if(inst->exp)
3609 ProcessExpressionType(inst->exp);
3610 inst->isConstant = 0x1;
3611 if(inst->members)
3612 {
3613 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3614 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3615 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3616 int subMemberStackPos = 0;
3617
3618 for(members = (*inst->members).first; members; members = members->next)
3619 {
3620 switch(members->type)
3621 {
3622 case 1:
3623 {
3624 char name[1024];
3625 static unsigned int instMethodID = 0;
3626 struct External * external = curExternal;
3627 struct Context * context = curContext;
3628 struct Declarator * declarator = members->function->declarator;
3629 struct Identifier * nameID = GetDeclId(declarator);
3630 char * unmangled = nameID ? nameID->string : (((void *)0));
3631 struct Expression * exp;
3632 struct External * createdExternal = (((void *)0));
3633
3634 if(inCompiler)
3635 {
3636 char number[16];
3637
3638 strcpy(name, "__ecereInstMeth_");
3639 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3640 strcat(name, "_");
3641 strcat(name, nameID->string);
3642 strcat(name, "_");
3643 sprintf(number, "_%08d", instMethodID++);
3644 strcat(name, number);
3645 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3646 }
3647 if(declarator)
3648 {
3649 struct Symbol * symbol = declarator->symbol;
3650 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3651
3652 if(method && method->type == 1)
3653 {
3654 symbol->method = method;
3655 ProcessMethodType(method);
3656 if(!symbol->type->thisClass)
3657 {
3658 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3659 {
3660 if(!currentClass->symbol)
3661 currentClass->symbol = FindClass(currentClass->fullName);
3662 symbol->type->thisClass = currentClass->symbol;
3663 }
3664 else
3665 {
3666 if(!_class->symbol)
3667 _class->symbol = FindClass(_class->fullName);
3668 symbol->type->thisClass = _class->symbol;
3669 }
3670 }
3671 DeclareType(symbol->type, 0x1, 0x1);
3672 }
3673 else if(classSym)
3674 {
3675 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
3676 }
3677 }
3678 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
3679 if(nameID)
3680 {
3681 FreeSpecifier(nameID->_class);
3682 nameID->_class = (((void *)0));
3683 }
3684 if(inCompiler)
3685 {
3686 struct Type * type = declarator->symbol->type;
3687 struct External * oldExternal = curExternal;
3688
3689 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
3690 {
3691 struct External * externalDecl;
3692
3693 externalDecl = MkExternalDeclaration((((void *)0)));
3694 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
3695 if(createdExternal->function)
3696 {
3697 ProcessFunction(createdExternal->function);
3698 {
3699 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
3700
3701 externalDecl->declaration = decl;
3702 if(decl->symbol && !decl->symbol->pointerExternal)
3703 decl->symbol->pointerExternal = externalDecl;
3704 declarator->symbol->pointerExternal = externalDecl;
3705 }
3706 }
3707 }
3708 }
3709 else if(declarator)
3710 {
3711 curExternal = declarator->symbol->pointerExternal;
3712 ProcessFunction((struct FunctionDefinition *)members->function);
3713 }
3714 curExternal = external;
3715 curContext = context;
3716 if(inCompiler)
3717 {
3718 FreeClassFunction(members->function);
3719 exp = QMkExpId(name);
3720 members->type = 0;
3721 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
3722 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
3723 }
3724 break;
3725 }
3726 case 0:
3727 {
3728 if(members->dataMembers && classSym)
3729 {
3730 struct MemberInit * member;
3731 struct Location oldyyloc = yylloc;
3732
3733 for(member = (*members->dataMembers).first; member; member = member->next)
3734 {
3735 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
3736 if(member->initializer && !member->initializer->isConstant)
3737 inst->isConstant = 0x0;
3738 }
3739 yylloc = oldyyloc;
3740 }
3741 break;
3742 }
3743 }
3744 }
3745 }
3746 }
3747 }
3748
3749 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
3750 {
3751 if(inCompiler)
3752 {
3753 if(type->kind == 11)
3754 {
3755 struct Type * param;
3756
3757 if(declareParams)
3758 {
3759 for(param = type->params.first; param; param = param->next)
3760 DeclareType(param, declarePointers, 0x1);
3761 }
3762 DeclareType(type->returnType, declarePointers, 0x1);
3763 }
3764 else if(type->kind == 13 && declarePointers)
3765 DeclareType(type->type, declarePointers, 0x0);
3766 else if(type->kind == 8)
3767 {
3768 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
3769 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
3770 }
3771 else if(type->kind == 9 || type->kind == 10)
3772 {
3773 struct Type * member;
3774
3775 for(member = type->members.first; member; member = member->next)
3776 DeclareType(member, 0x0, 0x0);
3777 }
3778 else if(type->kind == 12)
3779 DeclareType(type->arrayType, declarePointers, 0x0);
3780 }
3781 }
3782
3783 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
3784
3785 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
3786 {
3787 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
3788 int id = 0;
3789 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3790 struct __ecereNameSpace__ecere__com__Class * sClass;
3791
3792 for(sClass = _class; sClass; sClass = sClass->base)
3793 {
3794 id = 0;
3795 if(sClass->templateClass)
3796 sClass = sClass->templateClass;
3797 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3798 {
3799 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
3800 {
3801 for(sClass = sClass->base; sClass; sClass = sClass->base)
3802 {
3803 if(sClass->templateClass)
3804 sClass = sClass->templateClass;
3805 id += sClass->templateParams.count;
3806 }
3807 break;
3808 }
3809 id++;
3810 }
3811 if(curParam)
3812 break;
3813 }
3814 if(curParam)
3815 {
3816 arg = &_class->templateArgs[id];
3817 if(arg && param->type == 0)
3818 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
3819 }
3820 return arg;
3821 }
3822
3823 extern struct Context * PushContext(void);
3824
3825 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
3826
3827 struct TemplatedType
3828 {
3829 uintptr_t key;
3830 struct __ecereNameSpace__ecere__sys__BTNode * parent;
3831 struct __ecereNameSpace__ecere__sys__BTNode * left;
3832 struct __ecereNameSpace__ecere__sys__BTNode * right;
3833 int depth;
3834 struct TemplateParameter * param;
3835 } __attribute__ ((gcc_struct));
3836
3837 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
3838
3839 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
3840 {
3841 void * __ecereTemp1;
3842 struct Context * context = PushContext();
3843
3844 context->templateTypesOnly = 0x1;
3845 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
3846 {
3847 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
3848
3849 for(; param; param = param->next)
3850 {
3851 if(param->type == 0 && param->identifier)
3852 {
3853 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (uintptr_t)param->identifier->string, type->param = param, type);
3854
3855 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
3856 }
3857 }
3858 }
3859 else if(_class)
3860 {
3861 struct __ecereNameSpace__ecere__com__Class * sClass;
3862
3863 for(sClass = _class; sClass; sClass = sClass->base)
3864 {
3865 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
3866
3867 for(p = sClass->templateParams.first; p; p = p->next)
3868 {
3869 if(p->type == 0)
3870 {
3871 struct TemplateParameter * param = p->param;
3872 struct TemplatedType * type;
3873
3874 if(!param)
3875 {
3876 p->param = param = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter), ((struct TemplateParameter *)__ecereTemp1)->identifier = MkIdentifier(p->name), ((struct TemplateParameter *)__ecereTemp1)->type = p->type, ((struct TemplateParameter *)__ecereTemp1)->dataTypeString = p->dataTypeString, ((struct TemplateParameter *)__ecereTemp1));
3877 }
3878 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), ((struct TemplatedType *)__ecereTemp1)->key = (uintptr_t)p->name, ((struct TemplatedType *)__ecereTemp1)->param = param, ((struct TemplatedType *)__ecereTemp1));
3879 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
3880 }
3881 }
3882 }
3883 }
3884 return context;
3885 }
3886
3887 extern void PopContext(struct Context * ctx);
3888
3889 extern void FreeContext(struct Context * context);
3890
3891 void FinishTemplatesContext(struct Context * context)
3892 {
3893 PopContext(context);
3894 FreeContext(context);
3895 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
3896 }
3897
3898 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
3899 {
3900 if(!method->dataType)
3901 {
3902 struct Context * context = SetupTemplatesContext(method->_class);
3903
3904 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
3905 FinishTemplatesContext(context);
3906 if(method->type != 1 && method->dataType)
3907 {
3908 if(!method->dataType->thisClass && !method->dataType->staticMethod)
3909 {
3910 if(!method->_class->symbol)
3911 method->_class->symbol = FindClass(method->_class->fullName);
3912 method->dataType->thisClass = method->_class->symbol;
3913 }
3914 }
3915 }
3916 }
3917
3918 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
3919 {
3920 if(!prop->dataType)
3921 {
3922 struct Context * context = SetupTemplatesContext(prop->_class);
3923
3924 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
3925 FinishTemplatesContext(context);
3926 }
3927 }
3928
3929 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
3930
3931 extern void FreeTypeName(struct TypeName * typeName);
3932
3933 static void ProcessDeclarator(struct Declarator * decl);
3934
3935 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
3936
3937 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
3938
3939 struct MethodImport
3940 {
3941 struct MethodImport * prev;
3942 struct MethodImport * next;
3943 char *  name;
3944 unsigned int isVirtual;
3945 } __attribute__ ((gcc_struct));
3946
3947 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3948
3949 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
3950 {
3951 void * __ecereTemp1;
3952 struct Symbol * symbol = method->symbol;
3953
3954 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
3955 {
3956 unsigned int imported = 0x0;
3957 unsigned int dllImport = 0x0;
3958
3959 if(!method->dataType)
3960 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
3961 if(!symbol || symbol->_import || method->type == 1)
3962 {
3963 if(!symbol || method->type == 1)
3964 {
3965 struct Symbol * classSym;
3966
3967 if(!method->_class->symbol)
3968 method->_class->symbol = FindClass(method->_class->fullName);
3969 classSym = method->_class->symbol;
3970 if(!classSym->_import)
3971 {
3972 struct ModuleImport * module;
3973
3974 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + 12)))->name)
3975 module = FindModule(method->_class->module);
3976 else
3977 module = mainModule;
3978 classSym->_import = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport), ((struct ClassImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), ((struct ClassImport *)__ecereTemp1)->isRemote = method->_class->isRemote, ((struct ClassImport *)__ecereTemp1));
3979 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3980 }
3981 if(!symbol)
3982 {
3983 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3984 }
3985 if(!symbol->_import)
3986 {
3987 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport), ((struct MethodImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(method->name), ((struct MethodImport *)__ecereTemp1)->isVirtual = method->type == 1, ((struct MethodImport *)__ecereTemp1));
3988 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
3989 }
3990 if(!symbol)
3991 {
3992 symbol->type = method->dataType;
3993 if(symbol->type)
3994 symbol->type->refCount++;
3995 }
3996 }
3997 if(!method->dataType->dllExport)
3998 {
3999 imported = 0x1;
4000 if(method->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + 12)))->importType != 1)
4001 dllImport = 0x1;
4002 }
4003 }
4004 if(method->type != 1 && method->dataType)
4005 DeclareType(method->dataType, 0x1, 0x1);
4006 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4007 {
4008 struct Declaration * decl;
4009 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4010 struct Declarator * d;
4011 struct Declarator * funcDecl;
4012 struct External * external;
4013
4014 specifiers = MkList();
4015 declarators = MkList();
4016 if(dllImport)
4017 ListAdd(specifiers, MkSpecifier(EXTERN));
4018 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
4019 ListAdd(specifiers, MkSpecifier(STATIC));
4020 if(method->type == 1)
4021 {
4022 ListAdd(specifiers, MkSpecifier(INT));
4023 d = MkDeclaratorIdentifier(MkIdentifier(name));
4024 }
4025 else
4026 {
4027 d = MkDeclaratorIdentifier(MkIdentifier(name));
4028 if(dllImport)
4029 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4030 {
4031 struct Context * context = SetupTemplatesContext(method->_class);
4032
4033 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
4034 FinishTemplatesContext(context);
4035 }
4036 funcDecl = GetFuncDecl(d);
4037 if(dllImport)
4038 {
4039 struct Specifier * spec, * next;
4040
4041 for(spec = (*specifiers).first; spec; spec = next)
4042 {
4043 next = spec->next;
4044 if(spec->type == 5)
4045 {
4046 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4047 FreeSpecifier(spec);
4048 }
4049 }
4050 }
4051 if(method->dataType && !method->dataType->staticMethod)
4052 {
4053 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4054 {
4055 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4056 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")));
4057 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4058 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4059
4060 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4061 {
4062 struct TypeName * param = (*funcDecl->function.parameters).first;
4063
4064 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4065 FreeTypeName(param);
4066 }
4067 if(!funcDecl->function.parameters)
4068 funcDecl->function.parameters = MkList();
4069 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4070 }
4071 }
4072 }
4073 ProcessDeclarator(d);
4074 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4075 decl = MkDeclaration(specifiers, declarators);
4076 ReplaceThisClassSpecifiers(specifiers, method->_class);
4077 if(symbol->pointerExternal)
4078 {
4079 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4080
4081 {
4082 *functionSymbol = *symbol;
4083 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4084 if(functionSymbol->type)
4085 functionSymbol->type->refCount++;
4086 }
4087 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4088 symbol->pointerExternal->symbol = functionSymbol;
4089 }
4090 external = MkExternalDeclaration(decl);
4091 if(curExternal)
4092 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4093 external->symbol = symbol;
4094 symbol->pointerExternal = external;
4095 }
4096 else if(ast)
4097 {
4098 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4099 }
4100 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4101 }
4102 }
4103
4104 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4105 {
4106 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4107 {
4108 unsigned int first = 0x1;
4109 int p = 0;
4110 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4111 int lastParam = -1;
4112 char className[1024];
4113
4114 strcpy(className, _class->fullName);
4115 for(param = _class->templateParams.first; param; param = param->next)
4116 {
4117 {
4118 if(first)
4119 strcat(className, "<");
4120 if(!first)
4121 strcat(className, ", ");
4122 if(lastParam + 1 != p)
4123 {
4124 strcat(className, param->name);
4125 strcat(className, " = ");
4126 }
4127 strcat(className, param->name);
4128 first = 0x0;
4129 lastParam = p;
4130 }
4131 p++;
4132 }
4133 if(!first)
4134 {
4135 int len = strlen(className);
4136
4137 if(className[len - 1] == '>')
4138 className[len++] = ' ';
4139 className[len++] = '>';
4140 className[len++] = '\0';
4141 }
4142 return __ecereNameSpace__ecere__sys__CopyString(className);
4143 }
4144 else
4145 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4146 }
4147
4148 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4149 {
4150 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4151 {
4152 unsigned int first = 0x1;
4153 int p = 0;
4154 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4155 int lastParam = -1;
4156 char className[1024];
4157
4158 strcpy(className, _class->fullName);
4159 for(param = _class->templateParams.first; param; param = param->next)
4160 {
4161 {
4162 if(first)
4163 strcat(className, "<");
4164 if(!first)
4165 strcat(className, ", ");
4166 if(lastParam + 1 != p)
4167 {
4168 strcat(className, param->name);
4169 strcat(className, " = ");
4170 }
4171 strcat(className, param->name);
4172 first = 0x0;
4173 lastParam = p;
4174 }
4175 p++;
4176 }
4177 if(!first)
4178 {
4179 int len = strlen(className);
4180
4181 if(className[len - 1] == '>')
4182 className[len++] = ' ';
4183 className[len++] = '>';
4184 className[len++] = '\0';
4185 }
4186 return MkClassType(className);
4187 }
4188 else
4189 {
4190 return MkClassType(_class->fullName);
4191 }
4192 }
4193
4194 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4195 {
4196 if(specs != (((void *)0)) && _class)
4197 {
4198 struct Specifier * spec;
4199
4200 for(spec = specs->first; spec; spec = spec->next)
4201 {
4202 if(spec->type == 0 && spec->specifier == THISCLASS)
4203 {
4204 spec->type = 1;
4205 spec->name = ReplaceThisClass(_class);
4206 spec->symbol = FindClass(spec->name);
4207 }
4208 }
4209 }
4210 }
4211
4212 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4213
4214 struct __ecereNameSpace__ecere__com__GlobalFunction
4215 {
4216 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4217 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4218 char *  name;
4219 int (*  function)();
4220 struct __ecereNameSpace__ecere__com__Instance * module;
4221 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4222 char *  dataTypeString;
4223 struct Type * dataType;
4224 void *  symbol;
4225 } __attribute__ ((gcc_struct));
4226
4227 extern struct Context * globalContext;
4228
4229 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4230
4231 struct FunctionImport
4232 {
4233 struct FunctionImport * prev;
4234 struct FunctionImport * next;
4235 char *  name;
4236 } __attribute__ ((gcc_struct));
4237
4238 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4239 {
4240 void * __ecereTemp1;
4241 struct Symbol * symbol = function->symbol;
4242
4243 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4244 {
4245 unsigned int imported = 0x0;
4246 unsigned int dllImport = 0x0;
4247
4248 if(!function->dataType)
4249 {
4250 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4251 if(!function->dataType->thisClass)
4252 function->dataType->staticMethod = 0x1;
4253 }
4254 if(inCompiler)
4255 {
4256 if(!symbol)
4257 {
4258 struct ModuleImport * module = FindModule(function->module);
4259
4260 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4261 if(module->name)
4262 {
4263 if(!function->dataType->dllExport)
4264 {
4265 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport), ((struct FunctionImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(function->name), ((struct FunctionImport *)__ecereTemp1));
4266 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4267 }
4268 }
4269 {
4270 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4271 if(!symbol->type->thisClass)
4272 symbol->type->staticMethod = 0x1;
4273 }
4274 }
4275 imported = symbol->_import ? 0x1 : 0x0;
4276 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1)
4277 dllImport = 0x1;
4278 }
4279 DeclareType(function->dataType, 0x1, 0x1);
4280 if(inCompiler)
4281 {
4282 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4283 {
4284 struct Declaration * decl;
4285 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4286 struct Declarator * d;
4287 struct Declarator * funcDecl;
4288 struct External * external;
4289
4290 specifiers = MkList();
4291 declarators = MkList();
4292 ListAdd(specifiers, MkSpecifier(EXTERN));
4293 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4294 if(dllImport)
4295 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4296 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4297 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType == 1)
4298 {
4299 struct Specifier * spec;
4300
4301 for(spec = (*specifiers).first; spec; spec = spec->next)
4302 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4303 {
4304 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4305 FreeSpecifier(spec);
4306 break;
4307 }
4308 }
4309 funcDecl = GetFuncDecl(d);
4310 if(funcDecl && !funcDecl->function.parameters)
4311 {
4312 funcDecl->function.parameters = MkList();
4313 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4314 }
4315 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4316 {
4317 struct Context * oldCtx = curContext;
4318
4319 curContext = globalContext;
4320 decl = MkDeclaration(specifiers, declarators);
4321 curContext = oldCtx;
4322 }
4323 if(symbol->pointerExternal)
4324 {
4325 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4326
4327 {
4328 *functionSymbol = *symbol;
4329 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4330 if(functionSymbol->type)
4331 functionSymbol->type->refCount++;
4332 }
4333 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4334 symbol->pointerExternal->symbol = functionSymbol;
4335 }
4336 external = MkExternalDeclaration(decl);
4337 if(curExternal)
4338 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4339 external->symbol = symbol;
4340 symbol->pointerExternal = external;
4341 }
4342 else
4343 {
4344 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4345 }
4346 if(curExternal)
4347 symbol->id = curExternal->symbol->idCode;
4348 }
4349 }
4350 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1) ? 0x1 : 0x0;
4351 }
4352
4353 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4354
4355 struct GlobalData
4356 {
4357 uintptr_t key;
4358 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4359 struct __ecereNameSpace__ecere__sys__BTNode * left;
4360 struct __ecereNameSpace__ecere__sys__BTNode * right;
4361 int depth;
4362 struct __ecereNameSpace__ecere__com__Instance * module;
4363 char *  dataTypeString;
4364 struct Type * dataType;
4365 void *  symbol;
4366 char *  fullName;
4367 } __attribute__ ((gcc_struct));
4368
4369 void DeclareGlobalData(struct GlobalData * data)
4370 {
4371 struct Symbol * symbol = data->symbol;
4372
4373 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4374 {
4375 if(inCompiler)
4376 {
4377 if(!symbol)
4378 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4379 }
4380 if(!data->dataType)
4381 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4382 DeclareType(data->dataType, 0x1, 0x1);
4383 if(inCompiler)
4384 {
4385 if(!symbol->pointerExternal)
4386 {
4387 struct Declaration * decl;
4388 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4389 struct Declarator * d;
4390 struct External * external;
4391
4392 specifiers = MkList();
4393 declarators = MkList();
4394 ListAdd(specifiers, MkSpecifier(EXTERN));
4395 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4396 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4397 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4398 decl = MkDeclaration(specifiers, declarators);
4399 external = MkExternalDeclaration(decl);
4400 if(curExternal)
4401 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4402 external->symbol = symbol;
4403 symbol->pointerExternal = external;
4404 }
4405 else
4406 {
4407 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4408 }
4409 if(curExternal)
4410 symbol->id = curExternal->symbol->idCode;
4411 }
4412 }
4413 }
4414
4415 struct Conversion
4416 {
4417 struct Conversion * prev, * next;
4418 struct __ecereNameSpace__ecere__com__Property * convert;
4419 unsigned int isGet;
4420 struct Type * resultType;
4421 } __attribute__ ((gcc_struct));
4422
4423 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4424
4425 extern void Compiler_Warning(char *  format, ...);
4426
4427 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4428
4429 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)
4430 {
4431 if(source && dest)
4432 {
4433 if(source->kind == 20 && dest->kind != 20)
4434 {
4435 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4436
4437 if(type)
4438 source = type;
4439 }
4440 if(dest->kind == 20 && source->kind != 20)
4441 {
4442 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4443
4444 if(type)
4445 dest = type;
4446 }
4447 if((dest->classObjectType == 2 && source->classObjectType != 3) || (dest->classObjectType == 3 && source->classObjectType != 2))
4448 {
4449 return 0x1;
4450 }
4451 if(source->classObjectType == 3 && dest->classObjectType != 2)
4452 {
4453 return 0x1;
4454 }
4455 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4456 {
4457 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4458 return 0x1;
4459 }
4460 if(dest->kind == 14 && source->kind != 0)
4461 return 0x1;
4462 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))
4463 return 0x1;
4464 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))
4465 return 0x1;
4466 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4467 {
4468 if(source->_class->registered && source->_class->registered->type == 3)
4469 {
4470 if(conversions != (((void *)0)))
4471 {
4472 if(source->_class->registered == dest->_class->registered)
4473 return 0x1;
4474 }
4475 else
4476 {
4477 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4478
4479 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4480 ;
4481 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4482 ;
4483 if(sourceBase == destBase)
4484 return 0x1;
4485 }
4486 }
4487 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))
4488 return 0x1;
4489 else
4490 {
4491 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4 && source->_class && source->_class->registered && source->_class->registered->type != 4)
4492 {
4493 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4494 {
4495 return 0x1;
4496 }
4497 }
4498 }
4499 }
4500 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4501 return 0x1;
4502 if(doConversion)
4503 {
4504 if(source->kind == 8)
4505 {
4506 struct __ecereNameSpace__ecere__com__Class * _class;
4507
4508 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4509 {
4510 struct __ecereNameSpace__ecere__com__Property * convert;
4511
4512 for(convert = _class->conversions.first; convert; convert = convert->next)
4513 {
4514 if(convert->memberAccess == 1 || _class->module == privateModule)
4515 {
4516 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4517
4518 if(!convert->dataType)
4519 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4520 if(MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x0, 0x1, 0x0, 0x1))
4521 {
4522 if(!conversions && !convert->Get)
4523 return 0x1;
4524 else if(conversions != (((void *)0)))
4525 {
4526 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))
4527 return 0x1;
4528 else
4529 {
4530 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4531
4532 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4533 return 0x1;
4534 }
4535 }
4536 }
4537 }
4538 }
4539 }
4540 }
4541 if(dest->kind == 8)
4542 {
4543 struct __ecereNameSpace__ecere__com__Class * _class;
4544
4545 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4546 {
4547 struct __ecereNameSpace__ecere__com__Property * convert;
4548
4549 for(convert = _class->conversions.first; convert; convert = convert->next)
4550 {
4551 if(convert->memberAccess == 1 || _class->module == privateModule)
4552 {
4553 if(!convert->dataType)
4554 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4555 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4556 {
4557 if(!conversions && !convert->Set)
4558 return 0x1;
4559 else if(conversions != (((void *)0)))
4560 {
4561 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))
4562 return 0x1;
4563 else
4564 {
4565 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4566
4567 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4568 return 0x1;
4569 }
4570 }
4571 }
4572 }
4573 }
4574 }
4575 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4576 {
4577 if(!dest->_class->registered->dataType)
4578 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4579 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4580 {
4581 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4582 {
4583 return 0x1;
4584 }
4585 }
4586 }
4587 }
4588 if(source->kind == 8)
4589 {
4590 struct __ecereNameSpace__ecere__com__Class * _class;
4591
4592 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4593 {
4594 struct __ecereNameSpace__ecere__com__Property * convert;
4595
4596 for(convert = _class->conversions.first; convert; convert = convert->next)
4597 {
4598 if(convert->memberAccess == 1 || _class->module == privateModule)
4599 {
4600 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4601
4602 if(!convert->dataType)
4603 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4604 if(convert->dataType != source && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x1))
4605 {
4606 if(!conversions && !convert->Get)
4607 return 0x1;
4608 else if(conversions != (((void *)0)))
4609 {
4610 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))
4611 return 0x1;
4612 else
4613 {
4614 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4615
4616 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4617 return 0x1;
4618 }
4619 }
4620 }
4621 }
4622 }
4623 }
4624 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4625 {
4626 if(!source->_class->registered->dataType)
4627 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4628 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4629 {
4630 return 0x1;
4631 }
4632 }
4633 }
4634 }
4635 if(source->kind == 8 || source->kind == 19)
4636 ;
4637 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
4638 return 0x1;
4639 else if(dest->kind == 7 && source->kind == 6)
4640 return 0x1;
4641 else if(dest->kind == 2 && source->kind == 1)
4642 return 0x1;
4643 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1))
4644 return 0x1;
4645 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 3))
4646 return 0x1;
4647 else if(dest->kind == 22 && (source->kind == 2 || source->kind == 1 || source->kind == 3))
4648 return 0x1;
4649 else if(source->kind == 15 && (dest->kind == 3 || dest->kind == 2 || dest->kind == 1 || dest->kind == 5 || dest->kind == 4 || dest->kind == 22))
4650 return 0x1;
4651 else if(dest->kind == 15 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 5 || source->kind == 4 || source->kind == 22))
4652 return 0x1;
4653 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)))
4654 {
4655 struct Type * paramSource, * paramDest;
4656
4657 if(dest->kind == 16)
4658 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
4659 if(source->kind == 16)
4660 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
4661 if(dest->kind == 13 && dest->type->kind == 11)
4662 dest = dest->type;
4663 if(source->kind == 13 && source->type->kind == 11)
4664 source = source->type;
4665 if(dest->kind == 16)
4666 dest = dest->method->dataType;
4667 if(source->kind == 16)
4668 source = source->method->dataType;
4669 paramSource = source->params.first;
4670 if(paramSource && paramSource->kind == 0)
4671 paramSource = (((void *)0));
4672 paramDest = dest->params.first;
4673 if(paramDest && paramDest->kind == 0)
4674 paramDest = (((void *)0));
4675 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
4676 {
4677 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))))
4678 {
4679 if(paramDest && paramDest->kind == 8)
4680 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
4681 else
4682 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class should not take an object\n", (((void *)0))));
4683 return 0x0;
4684 }
4685 paramDest = paramDest->next;
4686 }
4687 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
4688 {
4689 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
4690 {
4691 if(dest->thisClass)
4692 {
4693 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
4694 {
4695 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4696 return 0x0;
4697 }
4698 }
4699 else
4700 {
4701 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
4702 {
4703 if(owningClassDest)
4704 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
4705 else
4706 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "overriding class expected to be derived from method class\n", (((void *)0))));
4707 return 0x0;
4708 }
4709 }
4710 paramSource = paramSource->next;
4711 }
4712 else
4713 {
4714 if(dest->thisClass)
4715 {
4716 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
4717 {
4718 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4719 return 0x0;
4720 }
4721 }
4722 else
4723 {
4724 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
4725 {
4726 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
4727 return 0x0;
4728 }
4729 }
4730 }
4731 }
4732 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4733 {
4734 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible return type for function\n", (((void *)0))));
4735 return 0x0;
4736 }
4737 for(; paramDest; paramDest = paramDest->next)
4738 {
4739 if(!paramSource)
4740 {
4741 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough parameters\n", (((void *)0))));
4742 return 0x0;
4743 }
4744 {
4745 struct Type * paramDestType = paramDest;
4746 struct Type * paramSourceType = paramSource;
4747 struct Type * type = paramDestType;
4748
4749 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
4750 {
4751 int id = 0;
4752 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4753 struct __ecereNameSpace__ecere__com__Class * sClass;
4754
4755 for(sClass = owningClassSource; sClass; sClass = sClass->base)
4756 {
4757 id = 0;
4758 if(sClass->templateClass)
4759 sClass = sClass->templateClass;
4760 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4761 {
4762 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
4763 {
4764 for(sClass = sClass->base; sClass; sClass = sClass->base)
4765 {
4766 if(sClass->templateClass)
4767 sClass = sClass->templateClass;
4768 id += sClass->templateParams.count;
4769 }
4770 break;
4771 }
4772 id++;
4773 }
4774 if(curParam)
4775 break;
4776 }
4777 if(curParam)
4778 {
4779 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
4780
4781 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
4782 }
4783 }
4784 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)))
4785 {
4786 char type[1024];
4787
4788 type[0] = (char)0;
4789 PrintType(paramDest, type, 0x0, 0x1);
4790 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
4791 if(paramDestType != paramDest)
4792 FreeType(paramDestType);
4793 return 0x0;
4794 }
4795 if(paramDestType != paramDest)
4796 FreeType(paramDestType);
4797 }
4798 paramSource = paramSource->next;
4799 }
4800 if(paramSource)
4801 {
4802 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many parameters\n", (((void *)0))));
4803 return 0x0;
4804 }
4805 return 0x1;
4806 }
4807 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
4808 {
4809 return 0x1;
4810 }
4811 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
4812 {
4813 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4814 return 0x1;
4815 }
4816 }
4817 return 0x0;
4818 }
4819
4820 static void FreeConvert(struct Conversion * convert)
4821 {
4822 if(convert->resultType)
4823 FreeType(convert->resultType);
4824 }
4825
4826 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
4827
4828 struct __ecereNameSpace__ecere__com__BTNamedLink
4829 {
4830 char *  name;
4831 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
4832 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
4833 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
4834 int depth;
4835 void *  data;
4836 } __attribute__ ((gcc_struct));
4837
4838 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
4839
4840 struct __ecereNameSpace__ecere__com__EnumClassData
4841 {
4842 struct __ecereNameSpace__ecere__sys__OldList values;
4843 int largest;
4844 } __attribute__ ((gcc_struct));
4845
4846 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
4847
4848 struct __ecereNameSpace__ecere__sys__NamedLink
4849 {
4850 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
4851 struct __ecereNameSpace__ecere__sys__NamedLink * next;
4852 char *  name;
4853 void *  data;
4854 } __attribute__ ((gcc_struct));
4855
4856 extern void FreeExpContents(struct Expression * exp);
4857
4858 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
4859
4860 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
4861
4862 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
4863
4864 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
4865
4866 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
4867
4868 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
4869 {
4870 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
4871
4872 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)))
4873 {
4874 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
4875
4876 if(_class->type == 4)
4877 {
4878 struct __ecereNameSpace__ecere__sys__OldList converts = 
4879 {
4880 0, 0, 0, 0, 0
4881 };
4882 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
4883
4884 type->kind = 8;
4885 if(!_class->symbol)
4886 _class->symbol = FindClass(_class->fullName);
4887 type->_class = _class->symbol;
4888 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
4889 {
4890 struct __ecereNameSpace__ecere__sys__NamedLink * value;
4891 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
4892
4893 if(enumClass)
4894 {
4895 struct __ecereNameSpace__ecere__com__Class * baseClass;
4896
4897 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
4898 {
4899 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
4900
4901 for(value = e->values.first; value; value = value->next)
4902 {
4903 if(!strcmp(value->name, string))
4904 break;
4905 }
4906 if(value)
4907 {
4908 FreeExpContents(sourceExp);
4909 FreeType(sourceExp->expType);
4910 sourceExp->isConstant = 0x1;
4911 sourceExp->expType = MkClassType(baseClass->fullName);
4912 {
4913 char constant[256];
4914
4915 sourceExp->type = 2;
4916 if(!strcmp(baseClass->dataTypeString, "int"))
4917 sprintf(constant, "%d", value->data);
4918 else
4919 sprintf(constant, "0x%X", value->data);
4920 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
4921 }
4922 while(converts.first)
4923 {
4924 struct Conversion * convert = converts.first;
4925
4926 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
4927 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
4928 }
4929 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
4930 return 0x1;
4931 }
4932 }
4933 }
4934 }
4935 if(converts.first)
4936 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
4937 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
4938 }
4939 }
4940 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)))
4941 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
4942 return 0x1;
4943 return 0x0;
4944 }
4945
4946 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
4947
4948 struct __ecereNameSpace__ecere__com__SubModule
4949 {
4950 struct __ecereNameSpace__ecere__com__SubModule * prev;
4951 struct __ecereNameSpace__ecere__com__SubModule * next;
4952 struct __ecereNameSpace__ecere__com__Instance * module;
4953 int importMode;
4954 } __attribute__ ((gcc_struct));
4955
4956 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
4957 {
4958 struct __ecereNameSpace__ecere__com__SubModule * subModule;
4959
4960 if(searchFor == searchIn)
4961 return 0x1;
4962 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + 12)))->modules.first; subModule; subModule = subModule->next)
4963 {
4964 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + 12)))->application)
4965 {
4966 if(ModuleVisibility(subModule->module, searchFor))
4967 return 0x1;
4968 }
4969 }
4970 return 0x0;
4971 }
4972
4973 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
4974
4975 struct __ecereNameSpace__ecere__com__Application
4976 {
4977 int argc;
4978 char * *  argv;
4979 int exitCode;
4980 unsigned int isGUIApp;
4981 struct __ecereNameSpace__ecere__sys__OldList allModules;
4982 char *  parsedCommand;
4983 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
4984 } __attribute__ ((gcc_struct));
4985
4986 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
4987 {
4988 struct __ecereNameSpace__ecere__com__Instance * module;
4989
4990 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 300)))->systemNameSpace, sourceExp, dest, string, conversions))
4991 return 0x1;
4992 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 12)))->privateNameSpace, sourceExp, dest, string, conversions))
4993 return 0x1;
4994 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 12)))->publicNameSpace, sourceExp, dest, string, conversions))
4995 return 0x1;
4996 for(module = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 300)))->allModules.first; module; module = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->next)
4997 {
4998 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->publicNameSpace, sourceExp, dest, string, conversions))
4999 return 0x1;
5000 }
5001 return 0x0;
5002 }
5003
5004 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
5005
5006 void ReadString(char *  output, char *  string);
5007
5008 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
5009
5010 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
5011
5012 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
5013
5014 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
5015 {
5016 void * __ecereTemp1;
5017 struct Type * source = sourceExp->expType;
5018 struct Type * realDest = dest;
5019
5020 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5021 return 0x1;
5022 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5023 {
5024 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5025 {
5026 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5027
5028 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5029 ;
5030 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5031 ;
5032 if(sourceBase == destBase)
5033 return 0x1;
5034 }
5035 }
5036 if(source)
5037 {
5038 struct __ecereNameSpace__ecere__sys__OldList * specs;
5039 unsigned int flag = 0x0;
5040 long long value = (((int)0x7fffffff));
5041
5042 source->refCount++;
5043 dest->refCount++;
5044 if(sourceExp->type == 2)
5045 {
5046 if(source->isSigned)
5047 value = strtoll(sourceExp->constant, (((void *)0)), 0);
5048 else
5049 value = strtoull(sourceExp->constant, (((void *)0)), 0);
5050 }
5051 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
5052 {
5053 if(source->isSigned)
5054 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
5055 else
5056 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
5057 }
5058 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5059 {
5060 FreeType(source);
5061 source = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->isSigned = 0x0, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
5062 }
5063 if(dest->kind == 8)
5064 {
5065 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5066
5067 if(_class && _class->type == 3)
5068 {
5069 if(source->kind != 8)
5070 {
5071 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5072 struct Type * tempDest, * tempSource;
5073
5074 for(; _class->base->type != 1000; _class = _class->base)
5075 ;
5076 tempSource = dest;
5077 tempDest = tempType;
5078 tempType->kind = 8;
5079 if(!_class->symbol)
5080 _class->symbol = FindClass(_class->fullName);
5081 tempType->_class = _class->symbol;
5082 tempType->truth = dest->truth;
5083 if(tempType->_class)
5084 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5085 FreeType(sourceExp->expType);
5086 sourceExp->expType = dest;
5087 dest->refCount++;
5088 flag = 0x1;
5089 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5090 }
5091 }
5092 if(_class && _class->type == 2 && source->kind != 8)
5093 {
5094 if(!dest->_class->registered->dataType)
5095 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5096 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5097 {
5098 FreeType(source);
5099 FreeType(sourceExp->expType);
5100 source = sourceExp->expType = MkClassType(dest->_class->string);
5101 source->refCount++;
5102 }
5103 }
5104 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5105 {
5106 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5107 struct Declarator * decl;
5108 char string[1024];
5109
5110 ReadString(string, sourceExp->string);
5111 decl = SpecDeclFromString(string, specs, (((void *)0)));
5112 FreeExpContents(sourceExp);
5113 FreeType(sourceExp->expType);
5114 sourceExp->type = 26;
5115 sourceExp->_classExp.specifiers = specs;
5116 sourceExp->_classExp.decl = decl;
5117 sourceExp->expType = dest;
5118 dest->refCount++;
5119 FreeType(source);
5120 FreeType(dest);
5121 return 0x1;
5122 }
5123 }
5124 else if(source->kind == 8)
5125 {
5126 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5127
5128 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5129 {
5130 if(dest->kind != 8)
5131 {
5132 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5133 struct Type * tempDest, * tempSource;
5134
5135 if(!source->_class->registered->dataType)
5136 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5137 for(; _class->base->type != 1000; _class = _class->base)
5138 ;
5139 tempDest = source;
5140 tempSource = tempType;
5141 tempType->kind = 8;
5142 tempType->_class = FindClass(_class->fullName);
5143 tempType->truth = source->truth;
5144 tempType->classObjectType = source->classObjectType;
5145 if(tempType->_class)
5146 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5147 if(conversions->last)
5148 {
5149 ((struct Conversion *)conversions->last)->resultType = dest;
5150 dest->refCount++;
5151 }
5152 FreeType(sourceExp->expType);
5153 sourceExp->expType = MkClassType(_class->fullName);
5154 sourceExp->expType->truth = source->truth;
5155 sourceExp->expType->classObjectType = source->classObjectType;
5156 if(!sourceExp->destType)
5157 {
5158 FreeType(sourceExp->destType);
5159 sourceExp->destType = sourceExp->expType;
5160 if(sourceExp->expType)
5161 sourceExp->expType->refCount++;
5162 }
5163 if(!_class->dataType)
5164 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5165 FreeType(dest);
5166 dest = MkClassType(source->_class->string);
5167 dest->truth = source->truth;
5168 dest->classObjectType = source->classObjectType;
5169 FreeType(source);
5170 source = _class->dataType;
5171 source->refCount++;
5172 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5173 }
5174 }
5175 }
5176 if(!flag)
5177 {
5178 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5179 {
5180 FreeType(source);
5181 FreeType(dest);
5182 return 0x1;
5183 }
5184 }
5185 if(dest->kind == 8)
5186 {
5187 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5188
5189 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5190 {
5191 if(_class->type == 0 || _class->type == 5)
5192 {
5193 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5194
5195 *newExp = *sourceExp;
5196 if(sourceExp->destType)
5197 sourceExp->destType->refCount++;
5198 if(sourceExp->expType)
5199 sourceExp->expType->refCount++;
5200 sourceExp->type = 11;
5201 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5202 sourceExp->cast.exp = newExp;
5203 FreeType(sourceExp->expType);
5204 sourceExp->expType = (((void *)0));
5205 ProcessExpressionType(sourceExp);
5206 if(!inCompiler)
5207 {
5208 FreeType(sourceExp->expType);
5209 sourceExp->expType = dest;
5210 }
5211 FreeType(source);
5212 if(inCompiler)
5213 FreeType(dest);
5214 return 0x1;
5215 }
5216 if(!_class->dataType)
5217 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5218 FreeType(dest);
5219 dest = _class->dataType;
5220 dest->refCount++;
5221 }
5222 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5223 {
5224 specs = MkListOne(MkSpecifier(DOUBLE));
5225 }
5226 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 7))
5227 {
5228 specs = MkListOne(MkSpecifier(FLOAT));
5229 }
5230 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5231 {
5232 specs = MkList();
5233 if(!dest->isSigned)
5234 ListAdd(specs, MkSpecifier(UNSIGNED));
5235 ListAdd(specs, MkSpecifier(INT64));
5236 }
5237 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5238 {
5239 specs = MkList();
5240 if(!dest->isSigned)
5241 ListAdd(specs, MkSpecifier(UNSIGNED));
5242 ListAdd(specs, MkSpecifier(INT));
5243 }
5244 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5245 {
5246 specs = MkList();
5247 if(!dest->isSigned)
5248 ListAdd(specs, MkSpecifier(UNSIGNED));
5249 ListAdd(specs, MkSpecifier(SHORT));
5250 }
5251 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5252 {
5253 specs = MkList();
5254 if(!dest->isSigned)
5255 ListAdd(specs, MkSpecifier(UNSIGNED));
5256 ListAdd(specs, MkSpecifier(CHAR));
5257 }
5258 else
5259 {
5260 FreeType(source);
5261 FreeType(dest);
5262 return 0x0;
5263 }
5264 }
5265 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))
5266 {
5267 specs = MkListOne(MkSpecifier(DOUBLE));
5268 }
5269 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5270 {
5271 specs = MkListOne(MkSpecifier(FLOAT));
5272 }
5273 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)))
5274 {
5275 specs = MkList();
5276 if(!dest->isSigned)
5277 ListAdd(specs, MkSpecifier(UNSIGNED));
5278 ListAdd(specs, MkSpecifier(CHAR));
5279 }
5280 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)))))
5281 {
5282 specs = MkList();
5283 if(!dest->isSigned)
5284 ListAdd(specs, MkSpecifier(UNSIGNED));
5285 ListAdd(specs, MkSpecifier(SHORT));
5286 }
5287 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3))
5288 {
5289 specs = MkList();
5290 if(!dest->isSigned)
5291 ListAdd(specs, MkSpecifier(UNSIGNED));
5292 ListAdd(specs, MkSpecifier(INT));
5293 }
5294 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5295 {
5296 specs = MkList();
5297 if(!dest->isSigned)
5298 ListAdd(specs, MkSpecifier(UNSIGNED));
5299 ListAdd(specs, MkSpecifier(INT64));
5300 }
5301 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5302 {
5303 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5304 }
5305 else
5306 {
5307 FreeType(source);
5308 FreeType(dest);
5309 return 0x0;
5310 }
5311 if(!flag)
5312 {
5313 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5314
5315 *newExp = *sourceExp;
5316 newExp->prev = (((void *)0));
5317 newExp->next = (((void *)0));
5318 if(sourceExp->destType)
5319 sourceExp->destType->refCount++;
5320 if(sourceExp->expType)
5321 sourceExp->expType->refCount++;
5322 sourceExp->type = 11;
5323 if(realDest->kind == 8)
5324 {
5325 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5326 FreeList(specs, FreeSpecifier);
5327 }
5328 else
5329 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5330 if(newExp->type == 4)
5331 {
5332 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5333 }
5334 else
5335 sourceExp->cast.exp = newExp;
5336 FreeType(sourceExp->expType);
5337 sourceExp->expType = (((void *)0));
5338 ProcessExpressionType(sourceExp);
5339 }
5340 else
5341 FreeList(specs, FreeSpecifier);
5342 FreeType(dest);
5343 FreeType(source);
5344 return 0x1;
5345 }
5346 else
5347 {
5348 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5349 sourceExp = (*sourceExp->list).last;
5350 if(sourceExp->type == 0)
5351 {
5352 struct Identifier * id = sourceExp->identifier;
5353
5354 if(dest->kind == 8)
5355 {
5356 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5357 {
5358 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5359 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5360
5361 if(enumClass)
5362 {
5363 for(; _class && _class->type == 4; _class = _class->base)
5364 {
5365 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5366 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5367
5368 for(value = e->values.first; value; value = value->next)
5369 {
5370 if(!strcmp(value->name, id->string))
5371 break;
5372 }
5373 if(value)
5374 {
5375 FreeExpContents(sourceExp);
5376 FreeType(sourceExp->expType);
5377 sourceExp->isConstant = 0x1;
5378 sourceExp->expType = MkClassType(_class->fullName);
5379 {
5380 char constant[256];
5381
5382 sourceExp->type = 2;
5383 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5384 sprintf(constant, "%d", value->data);
5385 else
5386 sprintf(constant, "0x%X", value->data);
5387 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5388 }
5389 return 0x1;
5390 }
5391 }
5392 }
5393 }
5394 }
5395 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5396 return 0x1;
5397 }
5398 }
5399 return 0x0;
5400 }
5401
5402 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5403 {
5404 int value2 = op2->i;
5405
5406 exp->type = 2;
5407 exp->string = PrintInt(op1->i + value2);
5408 if(!exp->expType)
5409 {
5410 exp->expType = op1->type;
5411 if(op1->type)
5412 op1->type->refCount++;
5413 }
5414 return 0x1;
5415 }
5416
5417 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5418 {
5419 unsigned int value2 = op2->ui;
5420
5421 exp->type = 2;
5422 exp->string = PrintUInt(op1->ui + value2);
5423 if(!exp->expType)
5424 {
5425 exp->expType = op1->type;
5426 if(op1->type)
5427 op1->type->refCount++;
5428 }
5429 return 0x1;
5430 }
5431
5432 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5433 {
5434 short value2 = op2->s;
5435
5436 exp->type = 2;
5437 exp->string = PrintShort(op1->s + value2);
5438 if(!exp->expType)
5439 {
5440 exp->expType = op1->type;
5441 if(op1->type)
5442 op1->type->refCount++;
5443 }
5444 return 0x1;
5445 }
5446
5447 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5448 {
5449 unsigned short value2 = op2->us;
5450
5451 exp->type = 2;
5452 exp->string = PrintUShort(op1->us + value2);
5453 if(!exp->expType)
5454 {
5455 exp->expType = op1->type;
5456 if(op1->type)
5457 op1->type->refCount++;
5458 }
5459 return 0x1;
5460 }
5461
5462 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5463 {
5464 char value2 = op2->c;
5465
5466 exp->type = 2;
5467 exp->string = PrintChar(op1->c + value2);
5468 if(!exp->expType)
5469 {
5470 exp->expType = op1->type;
5471 if(op1->type)
5472 op1->type->refCount++;
5473 }
5474 return 0x1;
5475 }
5476
5477 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5478 {
5479 unsigned char value2 = op2->uc;
5480
5481 exp->type = 2;
5482 exp->string = PrintUChar(op1->uc + value2);
5483 if(!exp->expType)
5484 {
5485 exp->expType = op1->type;
5486 if(op1->type)
5487 op1->type->refCount++;
5488 }
5489 return 0x1;
5490 }
5491
5492 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5493 {
5494 float value2 = op2->f;
5495
5496 exp->type = 2;
5497 exp->string = PrintFloat(op1->f + value2);
5498 if(!exp->expType)
5499 {
5500 exp->expType = op1->type;
5501 if(op1->type)
5502 op1->type->refCount++;
5503 }
5504 return 0x1;
5505 }
5506
5507 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5508 {
5509 double value2 = op2->d;
5510
5511 exp->type = 2;
5512 exp->string = PrintDouble(op1->d + value2);
5513 if(!exp->expType)
5514 {
5515 exp->expType = op1->type;
5516 if(op1->type)
5517 op1->type->refCount++;
5518 }
5519 return 0x1;
5520 }
5521
5522 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5523 {
5524 int value2 = op2->i;
5525
5526 exp->type = 2;
5527 exp->string = PrintInt(op1->i - value2);
5528 if(!exp->expType)
5529 {
5530 exp->expType = op1->type;
5531 if(op1->type)
5532 op1->type->refCount++;
5533 }
5534 return 0x1;
5535 }
5536
5537 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5538 {
5539 unsigned int value2 = op2->ui;
5540
5541 exp->type = 2;
5542 exp->string = PrintUInt(op1->ui - value2);
5543 if(!exp->expType)
5544 {
5545 exp->expType = op1->type;
5546 if(op1->type)
5547 op1->type->refCount++;
5548 }
5549 return 0x1;
5550 }
5551
5552 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5553 {
5554 short value2 = op2->s;
5555
5556 exp->type = 2;
5557 exp->string = PrintShort(op1->s - value2);
5558 if(!exp->expType)
5559 {
5560 exp->expType = op1->type;
5561 if(op1->type)
5562 op1->type->refCount++;
5563 }
5564 return 0x1;
5565 }
5566
5567 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5568 {
5569 unsigned short value2 = op2->us;
5570
5571 exp->type = 2;
5572 exp->string = PrintUShort(op1->us - value2);
5573 if(!exp->expType)
5574 {
5575 exp->expType = op1->type;
5576 if(op1->type)
5577 op1->type->refCount++;
5578 }
5579 return 0x1;
5580 }
5581
5582 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5583 {
5584 char value2 = op2->c;
5585
5586 exp->type = 2;
5587 exp->string = PrintChar(op1->c - value2);
5588 if(!exp->expType)
5589 {
5590 exp->expType = op1->type;
5591 if(op1->type)
5592 op1->type->refCount++;
5593 }
5594 return 0x1;
5595 }
5596
5597 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5598 {
5599 unsigned char value2 = op2->uc;
5600
5601 exp->type = 2;
5602 exp->string = PrintUChar(op1->uc - value2);
5603 if(!exp->expType)
5604 {
5605 exp->expType = op1->type;
5606 if(op1->type)
5607 op1->type->refCount++;
5608 }
5609 return 0x1;
5610 }
5611
5612 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5613 {
5614 float value2 = op2->f;
5615
5616 exp->type = 2;
5617 exp->string = PrintFloat(op1->f - value2);
5618 if(!exp->expType)
5619 {
5620 exp->expType = op1->type;
5621 if(op1->type)
5622 op1->type->refCount++;
5623 }
5624 return 0x1;
5625 }
5626
5627 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5628 {
5629 double value2 = op2->d;
5630
5631 exp->type = 2;
5632 exp->string = PrintDouble(op1->d - value2);
5633 if(!exp->expType)
5634 {
5635 exp->expType = op1->type;
5636 if(op1->type)
5637 op1->type->refCount++;
5638 }
5639 return 0x1;
5640 }
5641
5642 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5643 {
5644 int value2 = op2->i;
5645
5646 exp->type = 2;
5647 exp->string = PrintInt(op1->i * value2);
5648 if(!exp->expType)
5649 {
5650 exp->expType = op1->type;
5651 if(op1->type)
5652 op1->type->refCount++;
5653 }
5654 return 0x1;
5655 }
5656
5657 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5658 {
5659 unsigned int value2 = op2->ui;
5660
5661 exp->type = 2;
5662 exp->string = PrintUInt(op1->ui * value2);
5663 if(!exp->expType)
5664 {
5665 exp->expType = op1->type;
5666 if(op1->type)
5667 op1->type->refCount++;
5668 }
5669 return 0x1;
5670 }
5671
5672 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5673 {
5674 short value2 = op2->s;
5675
5676 exp->type = 2;
5677 exp->string = PrintShort(op1->s * value2);
5678 if(!exp->expType)
5679 {
5680 exp->expType = op1->type;
5681 if(op1->type)
5682 op1->type->refCount++;
5683 }
5684 return 0x1;
5685 }
5686
5687 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5688 {
5689 unsigned short value2 = op2->us;
5690
5691 exp->type = 2;
5692 exp->string = PrintUShort(op1->us * value2);
5693 if(!exp->expType)
5694 {
5695 exp->expType = op1->type;
5696 if(op1->type)
5697 op1->type->refCount++;
5698 }
5699 return 0x1;
5700 }
5701
5702 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5703 {
5704 char value2 = op2->c;
5705
5706 exp->type = 2;
5707 exp->string = PrintChar(op1->c * value2);
5708 if(!exp->expType)
5709 {
5710 exp->expType = op1->type;
5711 if(op1->type)
5712 op1->type->refCount++;
5713 }
5714 return 0x1;
5715 }
5716
5717 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5718 {
5719 unsigned char value2 = op2->uc;
5720
5721 exp->type = 2;
5722 exp->string = PrintUChar(op1->uc * value2);
5723 if(!exp->expType)
5724 {
5725 exp->expType = op1->type;
5726 if(op1->type)
5727 op1->type->refCount++;
5728 }
5729 return 0x1;
5730 }
5731
5732 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5733 {
5734 float value2 = op2->f;
5735
5736 exp->type = 2;
5737 exp->string = PrintFloat(op1->f * value2);
5738 if(!exp->expType)
5739 {
5740 exp->expType = op1->type;
5741 if(op1->type)
5742 op1->type->refCount++;
5743 }
5744 return 0x1;
5745 }
5746
5747 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5748 {
5749 double value2 = op2->d;
5750
5751 exp->type = 2;
5752 exp->string = PrintDouble(op1->d * value2);
5753 if(!exp->expType)
5754 {
5755 exp->expType = op1->type;
5756 if(op1->type)
5757 op1->type->refCount++;
5758 }
5759 return 0x1;
5760 }
5761
5762 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5763 {
5764 int value2 = op2->i;
5765
5766 exp->type = 2;
5767 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
5768 if(!exp->expType)
5769 {
5770 exp->expType = op1->type;
5771 if(op1->type)
5772 op1->type->refCount++;
5773 }
5774 return 0x1;
5775 }
5776
5777 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5778 {
5779 unsigned int value2 = op2->ui;
5780
5781 exp->type = 2;
5782 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
5783 if(!exp->expType)
5784 {
5785 exp->expType = op1->type;
5786 if(op1->type)
5787 op1->type->refCount++;
5788 }
5789 return 0x1;
5790 }
5791
5792 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5793 {
5794 short value2 = op2->s;
5795
5796 exp->type = 2;
5797 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
5798 if(!exp->expType)
5799 {
5800 exp->expType = op1->type;
5801 if(op1->type)
5802 op1->type->refCount++;
5803 }
5804 return 0x1;
5805 }
5806
5807 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5808 {
5809 unsigned short value2 = op2->us;
5810
5811 exp->type = 2;
5812 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
5813 if(!exp->expType)
5814 {
5815 exp->expType = op1->type;
5816 if(op1->type)
5817 op1->type->refCount++;
5818 }
5819 return 0x1;
5820 }
5821
5822 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5823 {
5824 char value2 = op2->c;
5825
5826 exp->type = 2;
5827 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
5828 if(!exp->expType)
5829 {
5830 exp->expType = op1->type;
5831 if(op1->type)
5832 op1->type->refCount++;
5833 }
5834 return 0x1;
5835 }
5836
5837 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5838 {
5839 unsigned char value2 = op2->uc;
5840
5841 exp->type = 2;
5842 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
5843 if(!exp->expType)
5844 {
5845 exp->expType = op1->type;
5846 if(op1->type)
5847 op1->type->refCount++;
5848 }
5849 return 0x1;
5850 }
5851
5852 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5853 {
5854 float value2 = op2->f;
5855
5856 exp->type = 2;
5857 exp->string = PrintFloat(value2 ? (op1->f / value2) : (float)0);
5858 if(!exp->expType)
5859 {
5860 exp->expType = op1->type;
5861 if(op1->type)
5862 op1->type->refCount++;
5863 }
5864 return 0x1;
5865 }
5866
5867 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5868 {
5869 double value2 = op2->d;
5870
5871 exp->type = 2;
5872 exp->string = PrintDouble(value2 ? (op1->d / value2) : (double)0);
5873 if(!exp->expType)
5874 {
5875 exp->expType = op1->type;
5876 if(op1->type)
5877 op1->type->refCount++;
5878 }
5879 return 0x1;
5880 }
5881
5882 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5883 {
5884 int value2 = op2->i;
5885
5886 exp->type = 2;
5887 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
5888 if(!exp->expType)
5889 {
5890 exp->expType = op1->type;
5891 if(op1->type)
5892 op1->type->refCount++;
5893 }
5894 return 0x1;
5895 }
5896
5897 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5898 {
5899 unsigned int value2 = op2->ui;
5900
5901 exp->type = 2;
5902 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
5903 if(!exp->expType)
5904 {
5905 exp->expType = op1->type;
5906 if(op1->type)
5907 op1->type->refCount++;
5908 }
5909 return 0x1;
5910 }
5911
5912 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5913 {
5914 short value2 = op2->s;
5915
5916 exp->type = 2;
5917 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
5918 if(!exp->expType)
5919 {
5920 exp->expType = op1->type;
5921 if(op1->type)
5922 op1->type->refCount++;
5923 }
5924 return 0x1;
5925 }
5926
5927 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5928 {
5929 unsigned short value2 = op2->us;
5930
5931 exp->type = 2;
5932 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
5933 if(!exp->expType)
5934 {
5935 exp->expType = op1->type;
5936 if(op1->type)
5937 op1->type->refCount++;
5938 }
5939 return 0x1;
5940 }
5941
5942 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5943 {
5944 char value2 = op2->c;
5945
5946 exp->type = 2;
5947 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
5948 if(!exp->expType)
5949 {
5950 exp->expType = op1->type;
5951 if(op1->type)
5952 op1->type->refCount++;
5953 }
5954 return 0x1;
5955 }
5956
5957 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5958 {
5959 unsigned char value2 = op2->uc;
5960
5961 exp->type = 2;
5962 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
5963 if(!exp->expType)
5964 {
5965 exp->expType = op1->type;
5966 if(op1->type)
5967 op1->type->refCount++;
5968 }
5969 return 0x1;
5970 }
5971
5972 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
5973 {
5974 exp->type = 2;
5975 exp->string = PrintInt(-op1->i);
5976 if(!exp->expType)
5977 {
5978 exp->expType = op1->type;
5979 if(op1->type)
5980 op1->type->refCount++;
5981 }
5982 return 0x1;
5983 }
5984
5985 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
5986 {
5987 exp->type = 2;
5988 exp->string = PrintUInt(-op1->ui);
5989 if(!exp->expType)
5990 {
5991 exp->expType = op1->type;
5992 if(op1->type)
5993 op1->type->refCount++;
5994 }
5995 return 0x1;
5996 }
5997
5998 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
5999 {
6000 exp->type = 2;
6001 exp->string = PrintShort(-op1->s);
6002 if(!exp->expType)
6003 {
6004 exp->expType = op1->type;
6005 if(op1->type)
6006 op1->type->refCount++;
6007 }
6008 return 0x1;
6009 }
6010
6011 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
6012 {
6013 exp->type = 2;
6014 exp->string = PrintUShort(-op1->us);
6015 if(!exp->expType)
6016 {
6017 exp->expType = op1->type;
6018 if(op1->type)
6019 op1->type->refCount++;
6020 }
6021 return 0x1;
6022 }
6023
6024 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
6025 {
6026 exp->type = 2;
6027 exp->string = PrintChar(-op1->c);
6028 if(!exp->expType)
6029 {
6030 exp->expType = op1->type;
6031 if(op1->type)
6032 op1->type->refCount++;
6033 }
6034 return 0x1;
6035 }
6036
6037 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
6038 {
6039 exp->type = 2;
6040 exp->string = PrintUChar(-op1->uc);
6041 if(!exp->expType)
6042 {
6043 exp->expType = op1->type;
6044 if(op1->type)
6045 op1->type->refCount++;
6046 }
6047 return 0x1;
6048 }
6049
6050 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
6051 {
6052 exp->type = 2;
6053 exp->string = PrintFloat(-op1->f);
6054 if(!exp->expType)
6055 {
6056 exp->expType = op1->type;
6057 if(op1->type)
6058 op1->type->refCount++;
6059 }
6060 return 0x1;
6061 }
6062
6063 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6064 {
6065 exp->type = 2;
6066 exp->string = PrintDouble(-op1->d);
6067 if(!exp->expType)
6068 {
6069 exp->expType = op1->type;
6070 if(op1->type)
6071 op1->type->refCount++;
6072 }
6073 return 0x1;
6074 }
6075
6076 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6077 {
6078 exp->type = 2;
6079 exp->string = PrintInt(++op1->i);
6080 if(!exp->expType)
6081 {
6082 exp->expType = op1->type;
6083 if(op1->type)
6084 op1->type->refCount++;
6085 }
6086 return 0x1;
6087 }
6088
6089 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6090 {
6091 exp->type = 2;
6092 exp->string = PrintUInt(++op1->ui);
6093 if(!exp->expType)
6094 {
6095 exp->expType = op1->type;
6096 if(op1->type)
6097 op1->type->refCount++;
6098 }
6099 return 0x1;
6100 }
6101
6102 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6103 {
6104 exp->type = 2;
6105 exp->string = PrintShort(++op1->s);
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 UShortInc(struct Expression * exp, struct Operand * op1)
6116 {
6117 exp->type = 2;
6118 exp->string = PrintUShort(++op1->us);
6119 if(!exp->expType)
6120 {
6121 exp->expType = op1->type;
6122 if(op1->type)
6123 op1->type->refCount++;
6124 }
6125 return 0x1;
6126 }
6127
6128 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6129 {
6130 exp->type = 2;
6131 exp->string = PrintChar(++op1->c);
6132 if(!exp->expType)
6133 {
6134 exp->expType = op1->type;
6135 if(op1->type)
6136 op1->type->refCount++;
6137 }
6138 return 0x1;
6139 }
6140
6141 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6142 {
6143 exp->type = 2;
6144 exp->string = PrintUChar(++op1->uc);
6145 if(!exp->expType)
6146 {
6147 exp->expType = op1->type;
6148 if(op1->type)
6149 op1->type->refCount++;
6150 }
6151 return 0x1;
6152 }
6153
6154 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6155 {
6156 exp->type = 2;
6157 exp->string = PrintFloat(++op1->f);
6158 if(!exp->expType)
6159 {
6160 exp->expType = op1->type;
6161 if(op1->type)
6162 op1->type->refCount++;
6163 }
6164 return 0x1;
6165 }
6166
6167 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6168 {
6169 exp->type = 2;
6170 exp->string = PrintDouble(++op1->d);
6171 if(!exp->expType)
6172 {
6173 exp->expType = op1->type;
6174 if(op1->type)
6175 op1->type->refCount++;
6176 }
6177 return 0x1;
6178 }
6179
6180 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6181 {
6182 exp->type = 2;
6183 exp->string = PrintInt(--op1->i);
6184 if(!exp->expType)
6185 {
6186 exp->expType = op1->type;
6187 if(op1->type)
6188 op1->type->refCount++;
6189 }
6190 return 0x1;
6191 }
6192
6193 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6194 {
6195 exp->type = 2;
6196 exp->string = PrintUInt(--op1->ui);
6197 if(!exp->expType)
6198 {
6199 exp->expType = op1->type;
6200 if(op1->type)
6201 op1->type->refCount++;
6202 }
6203 return 0x1;
6204 }
6205
6206 static unsigned int ShortDec(struct Expression * exp, struct Operand * op1)
6207 {
6208 exp->type = 2;
6209 exp->string = PrintShort(--op1->s);
6210 if(!exp->expType)
6211 {
6212 exp->expType = op1->type;
6213 if(op1->type)
6214 op1->type->refCount++;
6215 }
6216 return 0x1;
6217 }
6218
6219 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6220 {
6221 exp->type = 2;
6222 exp->string = PrintUShort(--op1->us);
6223 if(!exp->expType)
6224 {
6225 exp->expType = op1->type;
6226 if(op1->type)
6227 op1->type->refCount++;
6228 }
6229 return 0x1;
6230 }
6231
6232 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6233 {
6234 exp->type = 2;
6235 exp->string = PrintChar(--op1->c);
6236 if(!exp->expType)
6237 {
6238 exp->expType = op1->type;
6239 if(op1->type)
6240 op1->type->refCount++;
6241 }
6242 return 0x1;
6243 }
6244
6245 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6246 {
6247 exp->type = 2;
6248 exp->string = PrintUChar(--op1->uc);
6249 if(!exp->expType)
6250 {
6251 exp->expType = op1->type;
6252 if(op1->type)
6253 op1->type->refCount++;
6254 }
6255 return 0x1;
6256 }
6257
6258 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6259 {
6260 exp->type = 2;
6261 exp->string = PrintFloat(--op1->f);
6262 if(!exp->expType)
6263 {
6264 exp->expType = op1->type;
6265 if(op1->type)
6266 op1->type->refCount++;
6267 }
6268 return 0x1;
6269 }
6270
6271 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6272 {
6273 exp->type = 2;
6274 exp->string = PrintDouble(--op1->d);
6275 if(!exp->expType)
6276 {
6277 exp->expType = op1->type;
6278 if(op1->type)
6279 op1->type->refCount++;
6280 }
6281 return 0x1;
6282 }
6283
6284 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6285 {
6286 int value2 = op2->i;
6287
6288 exp->type = 2;
6289 exp->string = PrintInt(op1->i = value2);
6290 if(!exp->expType)
6291 {
6292 exp->expType = op1->type;
6293 if(op1->type)
6294 op1->type->refCount++;
6295 }
6296 return 0x1;
6297 }
6298
6299 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6300 {
6301 unsigned int value2 = op2->ui;
6302
6303 exp->type = 2;
6304 exp->string = PrintUInt(op1->ui = value2);
6305 if(!exp->expType)
6306 {
6307 exp->expType = op1->type;
6308 if(op1->type)
6309 op1->type->refCount++;
6310 }
6311 return 0x1;
6312 }
6313
6314 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6315 {
6316 short value2 = op2->s;
6317
6318 exp->type = 2;
6319 exp->string = PrintShort(op1->s = value2);
6320 if(!exp->expType)
6321 {
6322 exp->expType = op1->type;
6323 if(op1->type)
6324 op1->type->refCount++;
6325 }
6326 return 0x1;
6327 }
6328
6329 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6330 {
6331 unsigned short value2 = op2->us;
6332
6333 exp->type = 2;
6334 exp->string = PrintUShort(op1->us = value2);
6335 if(!exp->expType)
6336 {
6337 exp->expType = op1->type;
6338 if(op1->type)
6339 op1->type->refCount++;
6340 }
6341 return 0x1;
6342 }
6343
6344 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6345 {
6346 char value2 = op2->c;
6347
6348 exp->type = 2;
6349 exp->string = PrintChar(op1->c = value2);
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 UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6360 {
6361 unsigned char value2 = op2->uc;
6362
6363 exp->type = 2;
6364 exp->string = PrintUChar(op1->uc = value2);
6365 if(!exp->expType)
6366 {
6367 exp->expType = op1->type;
6368 if(op1->type)
6369 op1->type->refCount++;
6370 }
6371 return 0x1;
6372 }
6373
6374 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6375 {
6376 float value2 = op2->f;
6377
6378 exp->type = 2;
6379 exp->string = PrintFloat(op1->f = value2);
6380 if(!exp->expType)
6381 {
6382 exp->expType = op1->type;
6383 if(op1->type)
6384 op1->type->refCount++;
6385 }
6386 return 0x1;
6387 }
6388
6389 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6390 {
6391 double value2 = op2->d;
6392
6393 exp->type = 2;
6394 exp->string = PrintDouble(op1->d = value2);
6395 if(!exp->expType)
6396 {
6397 exp->expType = op1->type;
6398 if(op1->type)
6399 op1->type->refCount++;
6400 }
6401 return 0x1;
6402 }
6403
6404 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6405 {
6406 int value2 = op2->i;
6407
6408 exp->type = 2;
6409 exp->string = PrintInt(op1->i += value2);
6410 if(!exp->expType)
6411 {
6412 exp->expType = op1->type;
6413 if(op1->type)
6414 op1->type->refCount++;
6415 }
6416 return 0x1;
6417 }
6418
6419 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6420 {
6421 unsigned int value2 = op2->ui;
6422
6423 exp->type = 2;
6424 exp->string = PrintUInt(op1->ui += value2);
6425 if(!exp->expType)
6426 {
6427 exp->expType = op1->type;
6428 if(op1->type)
6429 op1->type->refCount++;
6430 }
6431 return 0x1;
6432 }
6433
6434 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6435 {
6436 short value2 = op2->s;
6437
6438 exp->type = 2;
6439 exp->string = PrintShort(op1->s += value2);
6440 if(!exp->expType)
6441 {
6442 exp->expType = op1->type;
6443 if(op1->type)
6444 op1->type->refCount++;
6445 }
6446 return 0x1;
6447 }
6448
6449 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6450 {
6451 unsigned short value2 = op2->us;
6452
6453 exp->type = 2;
6454 exp->string = PrintUShort(op1->us += value2);
6455 if(!exp->expType)
6456 {
6457 exp->expType = op1->type;
6458 if(op1->type)
6459 op1->type->refCount++;
6460 }
6461 return 0x1;
6462 }
6463
6464 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6465 {
6466 char value2 = op2->c;
6467
6468 exp->type = 2;
6469 exp->string = PrintChar(op1->c += value2);
6470 if(!exp->expType)
6471 {
6472 exp->expType = op1->type;
6473 if(op1->type)
6474 op1->type->refCount++;
6475 }
6476 return 0x1;
6477 }
6478
6479 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6480 {
6481 unsigned char value2 = op2->uc;
6482
6483 exp->type = 2;
6484 exp->string = PrintUChar(op1->uc += value2);
6485 if(!exp->expType)
6486 {
6487 exp->expType = op1->type;
6488 if(op1->type)
6489 op1->type->refCount++;
6490 }
6491 return 0x1;
6492 }
6493
6494 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6495 {
6496 float value2 = op2->f;
6497
6498 exp->type = 2;
6499 exp->string = PrintFloat(op1->f += value2);
6500 if(!exp->expType)
6501 {
6502 exp->expType = op1->type;
6503 if(op1->type)
6504 op1->type->refCount++;
6505 }
6506 return 0x1;
6507 }
6508
6509 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6510 {
6511 double value2 = op2->d;
6512
6513 exp->type = 2;
6514 exp->string = PrintDouble(op1->d += value2);
6515 if(!exp->expType)
6516 {
6517 exp->expType = op1->type;
6518 if(op1->type)
6519 op1->type->refCount++;
6520 }
6521 return 0x1;
6522 }
6523
6524 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6525 {
6526 int value2 = op2->i;
6527
6528 exp->type = 2;
6529 exp->string = PrintInt(op1->i -= value2);
6530 if(!exp->expType)
6531 {
6532 exp->expType = op1->type;
6533 if(op1->type)
6534 op1->type->refCount++;
6535 }
6536 return 0x1;
6537 }
6538
6539 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6540 {
6541 unsigned int value2 = op2->ui;
6542
6543 exp->type = 2;
6544 exp->string = PrintUInt(op1->ui -= value2);
6545 if(!exp->expType)
6546 {
6547 exp->expType = op1->type;
6548 if(op1->type)
6549 op1->type->refCount++;
6550 }
6551 return 0x1;
6552 }
6553
6554 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6555 {
6556 short value2 = op2->s;
6557
6558 exp->type = 2;
6559 exp->string = PrintShort(op1->s -= value2);
6560 if(!exp->expType)
6561 {
6562 exp->expType = op1->type;
6563 if(op1->type)
6564 op1->type->refCount++;
6565 }
6566 return 0x1;
6567 }
6568
6569 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6570 {
6571 unsigned short value2 = op2->us;
6572
6573 exp->type = 2;
6574 exp->string = PrintUShort(op1->us -= value2);
6575 if(!exp->expType)
6576 {
6577 exp->expType = op1->type;
6578 if(op1->type)
6579 op1->type->refCount++;
6580 }
6581 return 0x1;
6582 }
6583
6584 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6585 {
6586 char value2 = op2->c;
6587
6588 exp->type = 2;
6589 exp->string = PrintChar(op1->c -= value2);
6590 if(!exp->expType)
6591 {
6592 exp->expType = op1->type;
6593 if(op1->type)
6594 op1->type->refCount++;
6595 }
6596 return 0x1;
6597 }
6598
6599 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6600 {
6601 unsigned char value2 = op2->uc;
6602
6603 exp->type = 2;
6604 exp->string = PrintUChar(op1->uc -= value2);
6605 if(!exp->expType)
6606 {
6607 exp->expType = op1->type;
6608 if(op1->type)
6609 op1->type->refCount++;
6610 }
6611 return 0x1;
6612 }
6613
6614 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6615 {
6616 float value2 = op2->f;
6617
6618 exp->type = 2;
6619 exp->string = PrintFloat(op1->f -= value2);
6620 if(!exp->expType)
6621 {
6622 exp->expType = op1->type;
6623 if(op1->type)
6624 op1->type->refCount++;
6625 }
6626 return 0x1;
6627 }
6628
6629 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6630 {
6631 double value2 = op2->d;
6632
6633 exp->type = 2;
6634 exp->string = PrintDouble(op1->d -= value2);
6635 if(!exp->expType)
6636 {
6637 exp->expType = op1->type;
6638 if(op1->type)
6639 op1->type->refCount++;
6640 }
6641 return 0x1;
6642 }
6643
6644 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6645 {
6646 int value2 = op2->i;
6647
6648 exp->type = 2;
6649 exp->string = PrintInt(op1->i *= value2);
6650 if(!exp->expType)
6651 {
6652 exp->expType = op1->type;
6653 if(op1->type)
6654 op1->type->refCount++;
6655 }
6656 return 0x1;
6657 }
6658
6659 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6660 {
6661 unsigned int value2 = op2->ui;
6662
6663 exp->type = 2;
6664 exp->string = PrintUInt(op1->ui *= value2);
6665 if(!exp->expType)
6666 {
6667 exp->expType = op1->type;
6668 if(op1->type)
6669 op1->type->refCount++;
6670 }
6671 return 0x1;
6672 }
6673
6674 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6675 {
6676 short value2 = op2->s;
6677
6678 exp->type = 2;
6679 exp->string = PrintShort(op1->s *= value2);
6680 if(!exp->expType)
6681 {
6682 exp->expType = op1->type;
6683 if(op1->type)
6684 op1->type->refCount++;
6685 }
6686 return 0x1;
6687 }
6688
6689 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6690 {
6691 unsigned short value2 = op2->us;
6692
6693 exp->type = 2;
6694 exp->string = PrintUShort(op1->us *= value2);
6695 if(!exp->expType)
6696 {
6697 exp->expType = op1->type;
6698 if(op1->type)
6699 op1->type->refCount++;
6700 }
6701 return 0x1;
6702 }
6703
6704 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6705 {
6706 char value2 = op2->c;
6707
6708 exp->type = 2;
6709 exp->string = PrintChar(op1->c *= value2);
6710 if(!exp->expType)
6711 {
6712 exp->expType = op1->type;
6713 if(op1->type)
6714 op1->type->refCount++;
6715 }
6716 return 0x1;
6717 }
6718
6719 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6720 {
6721 unsigned char value2 = op2->uc;
6722
6723 exp->type = 2;
6724 exp->string = PrintUChar(op1->uc *= value2);
6725 if(!exp->expType)
6726 {
6727 exp->expType = op1->type;
6728 if(op1->type)
6729 op1->type->refCount++;
6730 }
6731 return 0x1;
6732 }
6733
6734 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6735 {
6736 float value2 = op2->f;
6737
6738 exp->type = 2;
6739 exp->string = PrintFloat(op1->f *= value2);
6740 if(!exp->expType)
6741 {
6742 exp->expType = op1->type;
6743 if(op1->type)
6744 op1->type->refCount++;
6745 }
6746 return 0x1;
6747 }
6748
6749 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6750 {
6751 double value2 = op2->d;
6752
6753 exp->type = 2;
6754 exp->string = PrintDouble(op1->d *= value2);
6755 if(!exp->expType)
6756 {
6757 exp->expType = op1->type;
6758 if(op1->type)
6759 op1->type->refCount++;
6760 }
6761 return 0x1;
6762 }
6763
6764 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6765 {
6766 int value2 = op2->i;
6767
6768 exp->type = 2;
6769 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
6770 if(!exp->expType)
6771 {
6772 exp->expType = op1->type;
6773 if(op1->type)
6774 op1->type->refCount++;
6775 }
6776 return 0x1;
6777 }
6778
6779 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6780 {
6781 unsigned int value2 = op2->ui;
6782
6783 exp->type = 2;
6784 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
6785 if(!exp->expType)
6786 {
6787 exp->expType = op1->type;
6788 if(op1->type)
6789 op1->type->refCount++;
6790 }
6791 return 0x1;
6792 }
6793
6794 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6795 {
6796 short value2 = op2->s;
6797
6798 exp->type = 2;
6799 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
6800 if(!exp->expType)
6801 {
6802 exp->expType = op1->type;
6803 if(op1->type)
6804 op1->type->refCount++;
6805 }
6806 return 0x1;
6807 }
6808
6809 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6810 {
6811 unsigned short value2 = op2->us;
6812
6813 exp->type = 2;
6814 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
6815 if(!exp->expType)
6816 {
6817 exp->expType = op1->type;
6818 if(op1->type)
6819 op1->type->refCount++;
6820 }
6821 return 0x1;
6822 }
6823
6824 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6825 {
6826 char value2 = op2->c;
6827
6828 exp->type = 2;
6829 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
6830 if(!exp->expType)
6831 {
6832 exp->expType = op1->type;
6833 if(op1->type)
6834 op1->type->refCount++;
6835 }
6836 return 0x1;
6837 }
6838
6839 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6840 {
6841 unsigned char value2 = op2->uc;
6842
6843 exp->type = 2;
6844 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
6845 if(!exp->expType)
6846 {
6847 exp->expType = op1->type;
6848 if(op1->type)
6849 op1->type->refCount++;
6850 }
6851 return 0x1;
6852 }
6853
6854 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6855 {
6856 float value2 = op2->f;
6857
6858 exp->type = 2;
6859 exp->string = PrintFloat(value2 ? (op1->f /= value2) : (float)0);
6860 if(!exp->expType)
6861 {
6862 exp->expType = op1->type;
6863 if(op1->type)
6864 op1->type->refCount++;
6865 }
6866 return 0x1;
6867 }
6868
6869 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6870 {
6871 double value2 = op2->d;
6872
6873 exp->type = 2;
6874 exp->string = PrintDouble(value2 ? (op1->d /= value2) : (double)0);
6875 if(!exp->expType)
6876 {
6877 exp->expType = op1->type;
6878 if(op1->type)
6879 op1->type->refCount++;
6880 }
6881 return 0x1;
6882 }
6883
6884 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6885 {
6886 int value2 = op2->i;
6887
6888 exp->type = 2;
6889 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
6890 if(!exp->expType)
6891 {
6892 exp->expType = op1->type;
6893 if(op1->type)
6894 op1->type->refCount++;
6895 }
6896 return 0x1;
6897 }
6898
6899 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6900 {
6901 unsigned int value2 = op2->ui;
6902
6903 exp->type = 2;
6904 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
6905 if(!exp->expType)
6906 {
6907 exp->expType = op1->type;
6908 if(op1->type)
6909 op1->type->refCount++;
6910 }
6911 return 0x1;
6912 }
6913
6914 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6915 {
6916 short value2 = op2->s;
6917
6918 exp->type = 2;
6919 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
6920 if(!exp->expType)
6921 {
6922 exp->expType = op1->type;
6923 if(op1->type)
6924 op1->type->refCount++;
6925 }
6926 return 0x1;
6927 }
6928
6929 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6930 {
6931 unsigned short value2 = op2->us;
6932
6933 exp->type = 2;
6934 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
6935 if(!exp->expType)
6936 {
6937 exp->expType = op1->type;
6938 if(op1->type)
6939 op1->type->refCount++;
6940 }
6941 return 0x1;
6942 }
6943
6944 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6945 {
6946 char value2 = op2->c;
6947
6948 exp->type = 2;
6949 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
6950 if(!exp->expType)
6951 {
6952 exp->expType = op1->type;
6953 if(op1->type)
6954 op1->type->refCount++;
6955 }
6956 return 0x1;
6957 }
6958
6959 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6960 {
6961 unsigned char value2 = op2->uc;
6962
6963 exp->type = 2;
6964 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
6965 if(!exp->expType)
6966 {
6967 exp->expType = op1->type;
6968 if(op1->type)
6969 op1->type->refCount++;
6970 }
6971 return 0x1;
6972 }
6973
6974 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6975 {
6976 int value2 = op2->i;
6977
6978 exp->type = 2;
6979 exp->string = PrintInt(op1->i & value2);
6980 if(!exp->expType)
6981 {
6982 exp->expType = op1->type;
6983 if(op1->type)
6984 op1->type->refCount++;
6985 }
6986 return 0x1;
6987 }
6988
6989 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6990 {
6991 unsigned int value2 = op2->ui;
6992
6993 exp->type = 2;
6994 exp->string = PrintUInt(op1->ui & value2);
6995 if(!exp->expType)
6996 {
6997 exp->expType = op1->type;
6998 if(op1->type)
6999 op1->type->refCount++;
7000 }
7001 return 0x1;
7002 }
7003
7004 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7005 {
7006 short value2 = op2->s;
7007
7008 exp->type = 2;
7009 exp->string = PrintShort(op1->s & value2);
7010 if(!exp->expType)
7011 {
7012 exp->expType = op1->type;
7013 if(op1->type)
7014 op1->type->refCount++;
7015 }
7016 return 0x1;
7017 }
7018
7019 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7020 {
7021 unsigned short value2 = op2->us;
7022
7023 exp->type = 2;
7024 exp->string = PrintUShort(op1->us & value2);
7025 if(!exp->expType)
7026 {
7027 exp->expType = op1->type;
7028 if(op1->type)
7029 op1->type->refCount++;
7030 }
7031 return 0x1;
7032 }
7033
7034 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7035 {
7036 char value2 = op2->c;
7037
7038 exp->type = 2;
7039 exp->string = PrintChar(op1->c & value2);
7040 if(!exp->expType)
7041 {
7042 exp->expType = op1->type;
7043 if(op1->type)
7044 op1->type->refCount++;
7045 }
7046 return 0x1;
7047 }
7048
7049 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7050 {
7051 unsigned char value2 = op2->uc;
7052
7053 exp->type = 2;
7054 exp->string = PrintUChar(op1->uc & value2);
7055 if(!exp->expType)
7056 {
7057 exp->expType = op1->type;
7058 if(op1->type)
7059 op1->type->refCount++;
7060 }
7061 return 0x1;
7062 }
7063
7064 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7065 {
7066 int value2 = op2->i;
7067
7068 exp->type = 2;
7069 exp->string = PrintInt(op1->i | value2);
7070 if(!exp->expType)
7071 {
7072 exp->expType = op1->type;
7073 if(op1->type)
7074 op1->type->refCount++;
7075 }
7076 return 0x1;
7077 }
7078
7079 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7080 {
7081 unsigned int value2 = op2->ui;
7082
7083 exp->type = 2;
7084 exp->string = PrintUInt(op1->ui | value2);
7085 if(!exp->expType)
7086 {
7087 exp->expType = op1->type;
7088 if(op1->type)
7089 op1->type->refCount++;
7090 }
7091 return 0x1;
7092 }
7093
7094 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7095 {
7096 short value2 = op2->s;
7097
7098 exp->type = 2;
7099 exp->string = PrintShort(op1->s | value2);
7100 if(!exp->expType)
7101 {
7102 exp->expType = op1->type;
7103 if(op1->type)
7104 op1->type->refCount++;
7105 }
7106 return 0x1;
7107 }
7108
7109 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7110 {
7111 unsigned short value2 = op2->us;
7112
7113 exp->type = 2;
7114 exp->string = PrintUShort(op1->us | value2);
7115 if(!exp->expType)
7116 {
7117 exp->expType = op1->type;
7118 if(op1->type)
7119 op1->type->refCount++;
7120 }
7121 return 0x1;
7122 }
7123
7124 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7125 {
7126 char value2 = op2->c;
7127
7128 exp->type = 2;
7129 exp->string = PrintChar(op1->c | value2);
7130 if(!exp->expType)
7131 {
7132 exp->expType = op1->type;
7133 if(op1->type)
7134 op1->type->refCount++;
7135 }
7136 return 0x1;
7137 }
7138
7139 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7140 {
7141 unsigned char value2 = op2->uc;
7142
7143 exp->type = 2;
7144 exp->string = PrintUChar(op1->uc | value2);
7145 if(!exp->expType)
7146 {
7147 exp->expType = op1->type;
7148 if(op1->type)
7149 op1->type->refCount++;
7150 }
7151 return 0x1;
7152 }
7153
7154 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7155 {
7156 int value2 = op2->i;
7157
7158 exp->type = 2;
7159 exp->string = PrintInt(op1->i ^ value2);
7160 if(!exp->expType)
7161 {
7162 exp->expType = op1->type;
7163 if(op1->type)
7164 op1->type->refCount++;
7165 }
7166 return 0x1;
7167 }
7168
7169 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7170 {
7171 unsigned int value2 = op2->ui;
7172
7173 exp->type = 2;
7174 exp->string = PrintUInt(op1->ui ^ value2);
7175 if(!exp->expType)
7176 {
7177 exp->expType = op1->type;
7178 if(op1->type)
7179 op1->type->refCount++;
7180 }
7181 return 0x1;
7182 }
7183
7184 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7185 {
7186 short value2 = op2->s;
7187
7188 exp->type = 2;
7189 exp->string = PrintShort(op1->s ^ value2);
7190 if(!exp->expType)
7191 {
7192 exp->expType = op1->type;
7193 if(op1->type)
7194 op1->type->refCount++;
7195 }
7196 return 0x1;
7197 }
7198
7199 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7200 {
7201 unsigned short value2 = op2->us;
7202
7203 exp->type = 2;
7204 exp->string = PrintUShort(op1->us ^ value2);
7205 if(!exp->expType)
7206 {
7207 exp->expType = op1->type;
7208 if(op1->type)
7209 op1->type->refCount++;
7210 }
7211 return 0x1;
7212 }
7213
7214 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7215 {
7216 char value2 = op2->c;
7217
7218 exp->type = 2;
7219 exp->string = PrintChar(op1->c ^ value2);
7220 if(!exp->expType)
7221 {
7222 exp->expType = op1->type;
7223 if(op1->type)
7224 op1->type->refCount++;
7225 }
7226 return 0x1;
7227 }
7228
7229 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7230 {
7231 unsigned char value2 = op2->uc;
7232
7233 exp->type = 2;
7234 exp->string = PrintUChar(op1->uc ^ value2);
7235 if(!exp->expType)
7236 {
7237 exp->expType = op1->type;
7238 if(op1->type)
7239 op1->type->refCount++;
7240 }
7241 return 0x1;
7242 }
7243
7244 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7245 {
7246 int value2 = op2->i;
7247
7248 exp->type = 2;
7249 exp->string = PrintInt(op1->i << value2);
7250 if(!exp->expType)
7251 {
7252 exp->expType = op1->type;
7253 if(op1->type)
7254 op1->type->refCount++;
7255 }
7256 return 0x1;
7257 }
7258
7259 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7260 {
7261 unsigned int value2 = op2->ui;
7262
7263 exp->type = 2;
7264 exp->string = PrintUInt(op1->ui << value2);
7265 if(!exp->expType)
7266 {
7267 exp->expType = op1->type;
7268 if(op1->type)
7269 op1->type->refCount++;
7270 }
7271 return 0x1;
7272 }
7273
7274 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7275 {
7276 short value2 = op2->s;
7277
7278 exp->type = 2;
7279 exp->string = PrintShort(op1->s << value2);
7280 if(!exp->expType)
7281 {
7282 exp->expType = op1->type;
7283 if(op1->type)
7284 op1->type->refCount++;
7285 }
7286 return 0x1;
7287 }
7288
7289 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7290 {
7291 unsigned short value2 = op2->us;
7292
7293 exp->type = 2;
7294 exp->string = PrintUShort(op1->us << value2);
7295 if(!exp->expType)
7296 {
7297 exp->expType = op1->type;
7298 if(op1->type)
7299 op1->type->refCount++;
7300 }
7301 return 0x1;
7302 }
7303
7304 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7305 {
7306 char value2 = op2->c;
7307
7308 exp->type = 2;
7309 exp->string = PrintChar(op1->c << value2);
7310 if(!exp->expType)
7311 {
7312 exp->expType = op1->type;
7313 if(op1->type)
7314 op1->type->refCount++;
7315 }
7316 return 0x1;
7317 }
7318
7319 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7320 {
7321 unsigned char value2 = op2->uc;
7322
7323 exp->type = 2;
7324 exp->string = PrintUChar(op1->uc << value2);
7325 if(!exp->expType)
7326 {
7327 exp->expType = op1->type;
7328 if(op1->type)
7329 op1->type->refCount++;
7330 }
7331 return 0x1;
7332 }
7333
7334 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7335 {
7336 int value2 = op2->i;
7337
7338 exp->type = 2;
7339 exp->string = PrintInt(op1->i >> value2);
7340 if(!exp->expType)
7341 {
7342 exp->expType = op1->type;
7343 if(op1->type)
7344 op1->type->refCount++;
7345 }
7346 return 0x1;
7347 }
7348
7349 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7350 {
7351 unsigned int value2 = op2->ui;
7352
7353 exp->type = 2;
7354 exp->string = PrintUInt(op1->ui >> value2);
7355 if(!exp->expType)
7356 {
7357 exp->expType = op1->type;
7358 if(op1->type)
7359 op1->type->refCount++;
7360 }
7361 return 0x1;
7362 }
7363
7364 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7365 {
7366 short value2 = op2->s;
7367
7368 exp->type = 2;
7369 exp->string = PrintShort(op1->s >> value2);
7370 if(!exp->expType)
7371 {
7372 exp->expType = op1->type;
7373 if(op1->type)
7374 op1->type->refCount++;
7375 }
7376 return 0x1;
7377 }
7378
7379 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7380 {
7381 unsigned short value2 = op2->us;
7382
7383 exp->type = 2;
7384 exp->string = PrintUShort(op1->us >> value2);
7385 if(!exp->expType)
7386 {
7387 exp->expType = op1->type;
7388 if(op1->type)
7389 op1->type->refCount++;
7390 }
7391 return 0x1;
7392 }
7393
7394 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7395 {
7396 char value2 = op2->c;
7397
7398 exp->type = 2;
7399 exp->string = PrintChar(op1->c >> value2);
7400 if(!exp->expType)
7401 {
7402 exp->expType = op1->type;
7403 if(op1->type)
7404 op1->type->refCount++;
7405 }
7406 return 0x1;
7407 }
7408
7409 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7410 {
7411 unsigned char value2 = op2->uc;
7412
7413 exp->type = 2;
7414 exp->string = PrintUChar(op1->uc >> value2);
7415 if(!exp->expType)
7416 {
7417 exp->expType = op1->type;
7418 if(op1->type)
7419 op1->type->refCount++;
7420 }
7421 return 0x1;
7422 }
7423
7424 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
7425 {
7426 exp->type = 2;
7427 exp->string = PrintInt(~op1->i);
7428 if(!exp->expType)
7429 {
7430 exp->expType = op1->type;
7431 if(op1->type)
7432 op1->type->refCount++;
7433 }
7434 return 0x1;
7435 }
7436
7437 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
7438 {
7439 exp->type = 2;
7440 exp->string = PrintUInt(~op1->ui);
7441 if(!exp->expType)
7442 {
7443 exp->expType = op1->type;
7444 if(op1->type)
7445 op1->type->refCount++;
7446 }
7447 return 0x1;
7448 }
7449
7450 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
7451 {
7452 exp->type = 2;
7453 exp->string = PrintShort(~op1->s);
7454 if(!exp->expType)
7455 {
7456 exp->expType = op1->type;
7457 if(op1->type)
7458 op1->type->refCount++;
7459 }
7460 return 0x1;
7461 }
7462
7463 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
7464 {
7465 exp->type = 2;
7466 exp->string = PrintUShort(~op1->us);
7467 if(!exp->expType)
7468 {
7469 exp->expType = op1->type;
7470 if(op1->type)
7471 op1->type->refCount++;
7472 }
7473 return 0x1;
7474 }
7475
7476 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
7477 {
7478 exp->type = 2;
7479 exp->string = PrintChar(~op1->c);
7480 if(!exp->expType)
7481 {
7482 exp->expType = op1->type;
7483 if(op1->type)
7484 op1->type->refCount++;
7485 }
7486 return 0x1;
7487 }
7488
7489 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
7490 {
7491 exp->type = 2;
7492 exp->string = PrintUChar(~op1->uc);
7493 if(!exp->expType)
7494 {
7495 exp->expType = op1->type;
7496 if(op1->type)
7497 op1->type->refCount++;
7498 }
7499 return 0x1;
7500 }
7501
7502 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7503 {
7504 int value2 = op2->i;
7505
7506 exp->type = 2;
7507 exp->string = PrintInt(op1->i &= value2);
7508 if(!exp->expType)
7509 {
7510 exp->expType = op1->type;
7511 if(op1->type)
7512 op1->type->refCount++;
7513 }
7514 return 0x1;
7515 }
7516
7517 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7518 {
7519 unsigned int value2 = op2->ui;
7520
7521 exp->type = 2;
7522 exp->string = PrintUInt(op1->ui &= value2);
7523 if(!exp->expType)
7524 {
7525 exp->expType = op1->type;
7526 if(op1->type)
7527 op1->type->refCount++;
7528 }
7529 return 0x1;
7530 }
7531
7532 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7533 {
7534 short value2 = op2->s;
7535
7536 exp->type = 2;
7537 exp->string = PrintShort(op1->s &= value2);
7538 if(!exp->expType)
7539 {
7540 exp->expType = op1->type;
7541 if(op1->type)
7542 op1->type->refCount++;
7543 }
7544 return 0x1;
7545 }
7546
7547 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7548 {
7549 unsigned short value2 = op2->us;
7550
7551 exp->type = 2;
7552 exp->string = PrintUShort(op1->us &= value2);
7553 if(!exp->expType)
7554 {
7555 exp->expType = op1->type;
7556 if(op1->type)
7557 op1->type->refCount++;
7558 }
7559 return 0x1;
7560 }
7561
7562 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7563 {
7564 char value2 = op2->c;
7565
7566 exp->type = 2;
7567 exp->string = PrintChar(op1->c &= value2);
7568 if(!exp->expType)
7569 {
7570 exp->expType = op1->type;
7571 if(op1->type)
7572 op1->type->refCount++;
7573 }
7574 return 0x1;
7575 }
7576
7577 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7578 {
7579 unsigned char value2 = op2->uc;
7580
7581 exp->type = 2;
7582 exp->string = PrintUChar(op1->uc &= value2);
7583 if(!exp->expType)
7584 {
7585 exp->expType = op1->type;
7586 if(op1->type)
7587 op1->type->refCount++;
7588 }
7589 return 0x1;
7590 }
7591
7592 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7593 {
7594 int value2 = op2->i;
7595
7596 exp->type = 2;
7597 exp->string = PrintInt(op1->i |= value2);
7598 if(!exp->expType)
7599 {
7600 exp->expType = op1->type;
7601 if(op1->type)
7602 op1->type->refCount++;
7603 }
7604 return 0x1;
7605 }
7606
7607 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7608 {
7609 unsigned int value2 = op2->ui;
7610
7611 exp->type = 2;
7612 exp->string = PrintUInt(op1->ui |= value2);
7613 if(!exp->expType)
7614 {
7615 exp->expType = op1->type;
7616 if(op1->type)
7617 op1->type->refCount++;
7618 }
7619 return 0x1;
7620 }
7621
7622 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7623 {
7624 short value2 = op2->s;
7625
7626 exp->type = 2;
7627 exp->string = PrintShort(op1->s |= value2);
7628 if(!exp->expType)
7629 {
7630 exp->expType = op1->type;
7631 if(op1->type)
7632 op1->type->refCount++;
7633 }
7634 return 0x1;
7635 }
7636
7637 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7638 {
7639 unsigned short value2 = op2->us;
7640
7641 exp->type = 2;
7642 exp->string = PrintUShort(op1->us |= value2);
7643 if(!exp->expType)
7644 {
7645 exp->expType = op1->type;
7646 if(op1->type)
7647 op1->type->refCount++;
7648 }
7649 return 0x1;
7650 }
7651
7652 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7653 {
7654 char value2 = op2->c;
7655
7656 exp->type = 2;
7657 exp->string = PrintChar(op1->c |= value2);
7658 if(!exp->expType)
7659 {
7660 exp->expType = op1->type;
7661 if(op1->type)
7662 op1->type->refCount++;
7663 }
7664 return 0x1;
7665 }
7666
7667 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7668 {
7669 unsigned char value2 = op2->uc;
7670
7671 exp->type = 2;
7672 exp->string = PrintUChar(op1->uc |= value2);
7673 if(!exp->expType)
7674 {
7675 exp->expType = op1->type;
7676 if(op1->type)
7677 op1->type->refCount++;
7678 }
7679 return 0x1;
7680 }
7681
7682 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7683 {
7684 int value2 = op2->i;
7685
7686 exp->type = 2;
7687 exp->string = PrintInt(op1->i ^= value2);
7688 if(!exp->expType)
7689 {
7690 exp->expType = op1->type;
7691 if(op1->type)
7692 op1->type->refCount++;
7693 }
7694 return 0x1;
7695 }
7696
7697 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7698 {
7699 unsigned int value2 = op2->ui;
7700
7701 exp->type = 2;
7702 exp->string = PrintUInt(op1->ui ^= value2);
7703 if(!exp->expType)
7704 {
7705 exp->expType = op1->type;
7706 if(op1->type)
7707 op1->type->refCount++;
7708 }
7709 return 0x1;
7710 }
7711
7712 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7713 {
7714 short value2 = op2->s;
7715
7716 exp->type = 2;
7717 exp->string = PrintShort(op1->s ^= value2);
7718 if(!exp->expType)
7719 {
7720 exp->expType = op1->type;
7721 if(op1->type)
7722 op1->type->refCount++;
7723 }
7724 return 0x1;
7725 }
7726
7727 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7728 {
7729 unsigned short value2 = op2->us;
7730
7731 exp->type = 2;
7732 exp->string = PrintUShort(op1->us ^= value2);
7733 if(!exp->expType)
7734 {
7735 exp->expType = op1->type;
7736 if(op1->type)
7737 op1->type->refCount++;
7738 }
7739 return 0x1;
7740 }
7741
7742 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7743 {
7744 char value2 = op2->c;
7745
7746 exp->type = 2;
7747 exp->string = PrintChar(op1->c ^= value2);
7748 if(!exp->expType)
7749 {
7750 exp->expType = op1->type;
7751 if(op1->type)
7752 op1->type->refCount++;
7753 }
7754 return 0x1;
7755 }
7756
7757 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7758 {
7759 unsigned char value2 = op2->uc;
7760
7761 exp->type = 2;
7762 exp->string = PrintUChar(op1->uc ^= value2);
7763 if(!exp->expType)
7764 {
7765 exp->expType = op1->type;
7766 if(op1->type)
7767 op1->type->refCount++;
7768 }
7769 return 0x1;
7770 }
7771
7772 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7773 {
7774 int value2 = op2->i;
7775
7776 exp->type = 2;
7777 exp->string = PrintInt(op1->i <<= value2);
7778 if(!exp->expType)
7779 {
7780 exp->expType = op1->type;
7781 if(op1->type)
7782 op1->type->refCount++;
7783 }
7784 return 0x1;
7785 }
7786
7787 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7788 {
7789 unsigned int value2 = op2->ui;
7790
7791 exp->type = 2;
7792 exp->string = PrintUInt(op1->ui <<= value2);
7793 if(!exp->expType)
7794 {
7795 exp->expType = op1->type;
7796 if(op1->type)
7797 op1->type->refCount++;
7798 }
7799 return 0x1;
7800 }
7801
7802 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7803 {
7804 short value2 = op2->s;
7805
7806 exp->type = 2;
7807 exp->string = PrintShort(op1->s <<= value2);
7808 if(!exp->expType)
7809 {
7810 exp->expType = op1->type;
7811 if(op1->type)
7812 op1->type->refCount++;
7813 }
7814 return 0x1;
7815 }
7816
7817 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7818 {
7819 unsigned short value2 = op2->us;
7820
7821 exp->type = 2;
7822 exp->string = PrintUShort(op1->us <<= value2);
7823 if(!exp->expType)
7824 {
7825 exp->expType = op1->type;
7826 if(op1->type)
7827 op1->type->refCount++;
7828 }
7829 return 0x1;
7830 }
7831
7832 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7833 {
7834 char value2 = op2->c;
7835
7836 exp->type = 2;
7837 exp->string = PrintChar(op1->c <<= value2);
7838 if(!exp->expType)
7839 {
7840 exp->expType = op1->type;
7841 if(op1->type)
7842 op1->type->refCount++;
7843 }
7844 return 0x1;
7845 }
7846
7847 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7848 {
7849 unsigned char value2 = op2->uc;
7850
7851 exp->type = 2;
7852 exp->string = PrintUChar(op1->uc <<= value2);
7853 if(!exp->expType)
7854 {
7855 exp->expType = op1->type;
7856 if(op1->type)
7857 op1->type->refCount++;
7858 }
7859 return 0x1;
7860 }
7861
7862 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7863 {
7864 int value2 = op2->i;
7865
7866 exp->type = 2;
7867 exp->string = PrintInt(op1->i >>= value2);
7868 if(!exp->expType)
7869 {
7870 exp->expType = op1->type;
7871 if(op1->type)
7872 op1->type->refCount++;
7873 }
7874 return 0x1;
7875 }
7876
7877 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7878 {
7879 unsigned int value2 = op2->ui;
7880
7881 exp->type = 2;
7882 exp->string = PrintUInt(op1->ui >>= value2);
7883 if(!exp->expType)
7884 {
7885 exp->expType = op1->type;
7886 if(op1->type)
7887 op1->type->refCount++;
7888 }
7889 return 0x1;
7890 }
7891
7892 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7893 {
7894 short value2 = op2->s;
7895
7896 exp->type = 2;
7897 exp->string = PrintShort(op1->s >>= value2);
7898 if(!exp->expType)
7899 {
7900 exp->expType = op1->type;
7901 if(op1->type)
7902 op1->type->refCount++;
7903 }
7904 return 0x1;
7905 }
7906
7907 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7908 {
7909 unsigned short value2 = op2->us;
7910
7911 exp->type = 2;
7912 exp->string = PrintUShort(op1->us >>= value2);
7913 if(!exp->expType)
7914 {
7915 exp->expType = op1->type;
7916 if(op1->type)
7917 op1->type->refCount++;
7918 }
7919 return 0x1;
7920 }
7921
7922 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7923 {
7924 char value2 = op2->c;
7925
7926 exp->type = 2;
7927 exp->string = PrintChar(op1->c >>= value2);
7928 if(!exp->expType)
7929 {
7930 exp->expType = op1->type;
7931 if(op1->type)
7932 op1->type->refCount++;
7933 }
7934 return 0x1;
7935 }
7936
7937 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7938 {
7939 unsigned char value2 = op2->uc;
7940
7941 exp->type = 2;
7942 exp->string = PrintUChar(op1->uc >>= value2);
7943 if(!exp->expType)
7944 {
7945 exp->expType = op1->type;
7946 if(op1->type)
7947 op1->type->refCount++;
7948 }
7949 return 0x1;
7950 }
7951
7952 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
7953 {
7954 exp->type = 2;
7955 exp->string = PrintInt(!op1->i);
7956 if(!exp->expType)
7957 {
7958 exp->expType = op1->type;
7959 if(op1->type)
7960 op1->type->refCount++;
7961 }
7962 return 0x1;
7963 }
7964
7965 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
7966 {
7967 exp->type = 2;
7968 exp->string = PrintUInt(!op1->ui);
7969 if(!exp->expType)
7970 {
7971 exp->expType = op1->type;
7972 if(op1->type)
7973 op1->type->refCount++;
7974 }
7975 return 0x1;
7976 }
7977
7978 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
7979 {
7980 exp->type = 2;
7981 exp->string = PrintShort(!op1->s);
7982 if(!exp->expType)
7983 {
7984 exp->expType = op1->type;
7985 if(op1->type)
7986 op1->type->refCount++;
7987 }
7988 return 0x1;
7989 }
7990
7991 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
7992 {
7993 exp->type = 2;
7994 exp->string = PrintUShort(!op1->us);
7995 if(!exp->expType)
7996 {
7997 exp->expType = op1->type;
7998 if(op1->type)
7999 op1->type->refCount++;
8000 }
8001 return 0x1;
8002 }
8003
8004 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
8005 {
8006 exp->type = 2;
8007 exp->string = PrintChar(!op1->c);
8008 if(!exp->expType)
8009 {
8010 exp->expType = op1->type;
8011 if(op1->type)
8012 op1->type->refCount++;
8013 }
8014 return 0x1;
8015 }
8016
8017 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
8018 {
8019 exp->type = 2;
8020 exp->string = PrintUChar(!op1->uc);
8021 if(!exp->expType)
8022 {
8023 exp->expType = op1->type;
8024 if(op1->type)
8025 op1->type->refCount++;
8026 }
8027 return 0x1;
8028 }
8029
8030 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8031 {
8032 int value2 = op2->i;
8033
8034 exp->type = 2;
8035 exp->string = PrintInt(op1->i == value2);
8036 if(!exp->expType)
8037 {
8038 exp->expType = op1->type;
8039 if(op1->type)
8040 op1->type->refCount++;
8041 }
8042 return 0x1;
8043 }
8044
8045 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8046 {
8047 unsigned int value2 = op2->ui;
8048
8049 exp->type = 2;
8050 exp->string = PrintUInt(op1->ui == value2);
8051 if(!exp->expType)
8052 {
8053 exp->expType = op1->type;
8054 if(op1->type)
8055 op1->type->refCount++;
8056 }
8057 return 0x1;
8058 }
8059
8060 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8061 {
8062 short value2 = op2->s;
8063
8064 exp->type = 2;
8065 exp->string = PrintShort(op1->s == value2);
8066 if(!exp->expType)
8067 {
8068 exp->expType = op1->type;
8069 if(op1->type)
8070 op1->type->refCount++;
8071 }
8072 return 0x1;
8073 }
8074
8075 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8076 {
8077 unsigned short value2 = op2->us;
8078
8079 exp->type = 2;
8080 exp->string = PrintUShort(op1->us == value2);
8081 if(!exp->expType)
8082 {
8083 exp->expType = op1->type;
8084 if(op1->type)
8085 op1->type->refCount++;
8086 }
8087 return 0x1;
8088 }
8089
8090 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8091 {
8092 char value2 = op2->c;
8093
8094 exp->type = 2;
8095 exp->string = PrintChar(op1->c == value2);
8096 if(!exp->expType)
8097 {
8098 exp->expType = op1->type;
8099 if(op1->type)
8100 op1->type->refCount++;
8101 }
8102 return 0x1;
8103 }
8104
8105 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8106 {
8107 unsigned char value2 = op2->uc;
8108
8109 exp->type = 2;
8110 exp->string = PrintUChar(op1->uc == value2);
8111 if(!exp->expType)
8112 {
8113 exp->expType = op1->type;
8114 if(op1->type)
8115 op1->type->refCount++;
8116 }
8117 return 0x1;
8118 }
8119
8120 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8121 {
8122 float value2 = op2->f;
8123
8124 exp->type = 2;
8125 exp->string = PrintFloat(op1->f == value2);
8126 if(!exp->expType)
8127 {
8128 exp->expType = op1->type;
8129 if(op1->type)
8130 op1->type->refCount++;
8131 }
8132 return 0x1;
8133 }
8134
8135 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8136 {
8137 double value2 = op2->d;
8138
8139 exp->type = 2;
8140 exp->string = PrintDouble(op1->d == value2);
8141 if(!exp->expType)
8142 {
8143 exp->expType = op1->type;
8144 if(op1->type)
8145 op1->type->refCount++;
8146 }
8147 return 0x1;
8148 }
8149
8150 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8151 {
8152 int value2 = op2->i;
8153
8154 exp->type = 2;
8155 exp->string = PrintInt(op1->i != value2);
8156 if(!exp->expType)
8157 {
8158 exp->expType = op1->type;
8159 if(op1->type)
8160 op1->type->refCount++;
8161 }
8162 return 0x1;
8163 }
8164
8165 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8166 {
8167 unsigned int value2 = op2->ui;
8168
8169 exp->type = 2;
8170 exp->string = PrintUInt(op1->ui != value2);
8171 if(!exp->expType)
8172 {
8173 exp->expType = op1->type;
8174 if(op1->type)
8175 op1->type->refCount++;
8176 }
8177 return 0x1;
8178 }
8179
8180 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8181 {
8182 short value2 = op2->s;
8183
8184 exp->type = 2;
8185 exp->string = PrintShort(op1->s != value2);
8186 if(!exp->expType)
8187 {
8188 exp->expType = op1->type;
8189 if(op1->type)
8190 op1->type->refCount++;
8191 }
8192 return 0x1;
8193 }
8194
8195 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8196 {
8197 unsigned short value2 = op2->us;
8198
8199 exp->type = 2;
8200 exp->string = PrintUShort(op1->us != value2);
8201 if(!exp->expType)
8202 {
8203 exp->expType = op1->type;
8204 if(op1->type)
8205 op1->type->refCount++;
8206 }
8207 return 0x1;
8208 }
8209
8210 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8211 {
8212 char value2 = op2->c;
8213
8214 exp->type = 2;
8215 exp->string = PrintChar(op1->c != value2);
8216 if(!exp->expType)
8217 {
8218 exp->expType = op1->type;
8219 if(op1->type)
8220 op1->type->refCount++;
8221 }
8222 return 0x1;
8223 }
8224
8225 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8226 {
8227 unsigned char value2 = op2->uc;
8228
8229 exp->type = 2;
8230 exp->string = PrintUChar(op1->uc != value2);
8231 if(!exp->expType)
8232 {
8233 exp->expType = op1->type;
8234 if(op1->type)
8235 op1->type->refCount++;
8236 }
8237 return 0x1;
8238 }
8239
8240 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8241 {
8242 float value2 = op2->f;
8243
8244 exp->type = 2;
8245 exp->string = PrintFloat(op1->f != value2);
8246 if(!exp->expType)
8247 {
8248 exp->expType = op1->type;
8249 if(op1->type)
8250 op1->type->refCount++;
8251 }
8252 return 0x1;
8253 }
8254
8255 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8256 {
8257 double value2 = op2->d;
8258
8259 exp->type = 2;
8260 exp->string = PrintDouble(op1->d != value2);
8261 if(!exp->expType)
8262 {
8263 exp->expType = op1->type;
8264 if(op1->type)
8265 op1->type->refCount++;
8266 }
8267 return 0x1;
8268 }
8269
8270 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8271 {
8272 int value2 = op2->i;
8273
8274 exp->type = 2;
8275 exp->string = PrintInt(op1->i && value2);
8276 if(!exp->expType)
8277 {
8278 exp->expType = op1->type;
8279 if(op1->type)
8280 op1->type->refCount++;
8281 }
8282 return 0x1;
8283 }
8284
8285 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8286 {
8287 unsigned int value2 = op2->ui;
8288
8289 exp->type = 2;
8290 exp->string = PrintUInt(op1->ui && value2);
8291 if(!exp->expType)
8292 {
8293 exp->expType = op1->type;
8294 if(op1->type)
8295 op1->type->refCount++;
8296 }
8297 return 0x1;
8298 }
8299
8300 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8301 {
8302 short value2 = op2->s;
8303
8304 exp->type = 2;
8305 exp->string = PrintShort(op1->s && value2);
8306 if(!exp->expType)
8307 {
8308 exp->expType = op1->type;
8309 if(op1->type)
8310 op1->type->refCount++;
8311 }
8312 return 0x1;
8313 }
8314
8315 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8316 {
8317 unsigned short value2 = op2->us;
8318
8319 exp->type = 2;
8320 exp->string = PrintUShort(op1->us && value2);
8321 if(!exp->expType)
8322 {
8323 exp->expType = op1->type;
8324 if(op1->type)
8325 op1->type->refCount++;
8326 }
8327 return 0x1;
8328 }
8329
8330 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8331 {
8332 char value2 = op2->c;
8333
8334 exp->type = 2;
8335 exp->string = PrintChar(op1->c && value2);
8336 if(!exp->expType)
8337 {
8338 exp->expType = op1->type;
8339 if(op1->type)
8340 op1->type->refCount++;
8341 }
8342 return 0x1;
8343 }
8344
8345 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8346 {
8347 unsigned char value2 = op2->uc;
8348
8349 exp->type = 2;
8350 exp->string = PrintUChar(op1->uc && value2);
8351 if(!exp->expType)
8352 {
8353 exp->expType = op1->type;
8354 if(op1->type)
8355 op1->type->refCount++;
8356 }
8357 return 0x1;
8358 }
8359
8360 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8361 {
8362 float value2 = op2->f;
8363
8364 exp->type = 2;
8365 exp->string = PrintFloat(op1->f && value2);
8366 if(!exp->expType)
8367 {
8368 exp->expType = op1->type;
8369 if(op1->type)
8370 op1->type->refCount++;
8371 }
8372 return 0x1;
8373 }
8374
8375 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8376 {
8377 double value2 = op2->d;
8378
8379 exp->type = 2;
8380 exp->string = PrintDouble(op1->d && value2);
8381 if(!exp->expType)
8382 {
8383 exp->expType = op1->type;
8384 if(op1->type)
8385 op1->type->refCount++;
8386 }
8387 return 0x1;
8388 }
8389
8390 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8391 {
8392 int value2 = op2->i;
8393
8394 exp->type = 2;
8395 exp->string = PrintInt(op1->i || value2);
8396 if(!exp->expType)
8397 {
8398 exp->expType = op1->type;
8399 if(op1->type)
8400 op1->type->refCount++;
8401 }
8402 return 0x1;
8403 }
8404
8405 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8406 {
8407 unsigned int value2 = op2->ui;
8408
8409 exp->type = 2;
8410 exp->string = PrintUInt(op1->ui || value2);
8411 if(!exp->expType)
8412 {
8413 exp->expType = op1->type;
8414 if(op1->type)
8415 op1->type->refCount++;
8416 }
8417 return 0x1;
8418 }
8419
8420 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8421 {
8422 short value2 = op2->s;
8423
8424 exp->type = 2;
8425 exp->string = PrintShort(op1->s || value2);
8426 if(!exp->expType)
8427 {
8428 exp->expType = op1->type;
8429 if(op1->type)
8430 op1->type->refCount++;
8431 }
8432 return 0x1;
8433 }
8434
8435 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8436 {
8437 unsigned short value2 = op2->us;
8438
8439 exp->type = 2;
8440 exp->string = PrintUShort(op1->us || value2);
8441 if(!exp->expType)
8442 {
8443 exp->expType = op1->type;
8444 if(op1->type)
8445 op1->type->refCount++;
8446 }
8447 return 0x1;
8448 }
8449
8450 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8451 {
8452 char value2 = op2->c;
8453
8454 exp->type = 2;
8455 exp->string = PrintChar(op1->c || value2);
8456 if(!exp->expType)
8457 {
8458 exp->expType = op1->type;
8459 if(op1->type)
8460 op1->type->refCount++;
8461 }
8462 return 0x1;
8463 }
8464
8465 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8466 {
8467 unsigned char value2 = op2->uc;
8468
8469 exp->type = 2;
8470 exp->string = PrintUChar(op1->uc || value2);
8471 if(!exp->expType)
8472 {
8473 exp->expType = op1->type;
8474 if(op1->type)
8475 op1->type->refCount++;
8476 }
8477 return 0x1;
8478 }
8479
8480 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8481 {
8482 float value2 = op2->f;
8483
8484 exp->type = 2;
8485 exp->string = PrintFloat(op1->f || value2);
8486 if(!exp->expType)
8487 {
8488 exp->expType = op1->type;
8489 if(op1->type)
8490 op1->type->refCount++;
8491 }
8492 return 0x1;
8493 }
8494
8495 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8496 {
8497 double value2 = op2->d;
8498
8499 exp->type = 2;
8500 exp->string = PrintDouble(op1->d || value2);
8501 if(!exp->expType)
8502 {
8503 exp->expType = op1->type;
8504 if(op1->type)
8505 op1->type->refCount++;
8506 }
8507 return 0x1;
8508 }
8509
8510 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8511 {
8512 int value2 = op2->i;
8513
8514 exp->type = 2;
8515 exp->string = PrintInt(op1->i > value2);
8516 if(!exp->expType)
8517 {
8518 exp->expType = op1->type;
8519 if(op1->type)
8520 op1->type->refCount++;
8521 }
8522 return 0x1;
8523 }
8524
8525 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8526 {
8527 unsigned int value2 = op2->ui;
8528
8529 exp->type = 2;
8530 exp->string = PrintUInt(op1->ui > value2);
8531 if(!exp->expType)
8532 {
8533 exp->expType = op1->type;
8534 if(op1->type)
8535 op1->type->refCount++;
8536 }
8537 return 0x1;
8538 }
8539
8540 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8541 {
8542 short value2 = op2->s;
8543
8544 exp->type = 2;
8545 exp->string = PrintShort(op1->s > value2);
8546 if(!exp->expType)
8547 {
8548 exp->expType = op1->type;
8549 if(op1->type)
8550 op1->type->refCount++;
8551 }
8552 return 0x1;
8553 }
8554
8555 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8556 {
8557 unsigned short value2 = op2->us;
8558
8559 exp->type = 2;
8560 exp->string = PrintUShort(op1->us > value2);
8561 if(!exp->expType)
8562 {
8563 exp->expType = op1->type;
8564 if(op1->type)
8565 op1->type->refCount++;
8566 }
8567 return 0x1;
8568 }
8569
8570 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8571 {
8572 char value2 = op2->c;
8573
8574 exp->type = 2;
8575 exp->string = PrintChar(op1->c > value2);
8576 if(!exp->expType)
8577 {
8578 exp->expType = op1->type;
8579 if(op1->type)
8580 op1->type->refCount++;
8581 }
8582 return 0x1;
8583 }
8584
8585 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8586 {
8587 unsigned char value2 = op2->uc;
8588
8589 exp->type = 2;
8590 exp->string = PrintUChar(op1->uc > value2);
8591 if(!exp->expType)
8592 {
8593 exp->expType = op1->type;
8594 if(op1->type)
8595 op1->type->refCount++;
8596 }
8597 return 0x1;
8598 }
8599
8600 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8601 {
8602 float value2 = op2->f;
8603
8604 exp->type = 2;
8605 exp->string = PrintFloat(op1->f > value2);
8606 if(!exp->expType)
8607 {
8608 exp->expType = op1->type;
8609 if(op1->type)
8610 op1->type->refCount++;
8611 }
8612 return 0x1;
8613 }
8614
8615 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8616 {
8617 double value2 = op2->d;
8618
8619 exp->type = 2;
8620 exp->string = PrintDouble(op1->d > value2);
8621 if(!exp->expType)
8622 {
8623 exp->expType = op1->type;
8624 if(op1->type)
8625 op1->type->refCount++;
8626 }
8627 return 0x1;
8628 }
8629
8630 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8631 {
8632 int value2 = op2->i;
8633
8634 exp->type = 2;
8635 exp->string = PrintInt(op1->i < value2);
8636 if(!exp->expType)
8637 {
8638 exp->expType = op1->type;
8639 if(op1->type)
8640 op1->type->refCount++;
8641 }
8642 return 0x1;
8643 }
8644
8645 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8646 {
8647 unsigned int value2 = op2->ui;
8648
8649 exp->type = 2;
8650 exp->string = PrintUInt(op1->ui < value2);
8651 if(!exp->expType)
8652 {
8653 exp->expType = op1->type;
8654 if(op1->type)
8655 op1->type->refCount++;
8656 }
8657 return 0x1;
8658 }
8659
8660 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8661 {
8662 short value2 = op2->s;
8663
8664 exp->type = 2;
8665 exp->string = PrintShort(op1->s < value2);
8666 if(!exp->expType)
8667 {
8668 exp->expType = op1->type;
8669 if(op1->type)
8670 op1->type->refCount++;
8671 }
8672 return 0x1;
8673 }
8674
8675 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8676 {
8677 unsigned short value2 = op2->us;
8678
8679 exp->type = 2;
8680 exp->string = PrintUShort(op1->us < value2);
8681 if(!exp->expType)
8682 {
8683 exp->expType = op1->type;
8684 if(op1->type)
8685 op1->type->refCount++;
8686 }
8687 return 0x1;
8688 }
8689
8690 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8691 {
8692 char value2 = op2->c;
8693
8694 exp->type = 2;
8695 exp->string = PrintChar(op1->c < value2);
8696 if(!exp->expType)
8697 {
8698 exp->expType = op1->type;
8699 if(op1->type)
8700 op1->type->refCount++;
8701 }
8702 return 0x1;
8703 }
8704
8705 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8706 {
8707 unsigned char value2 = op2->uc;
8708
8709 exp->type = 2;
8710 exp->string = PrintUChar(op1->uc < value2);
8711 if(!exp->expType)
8712 {
8713 exp->expType = op1->type;
8714 if(op1->type)
8715 op1->type->refCount++;
8716 }
8717 return 0x1;
8718 }
8719
8720 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8721 {
8722 float value2 = op2->f;
8723
8724 exp->type = 2;
8725 exp->string = PrintFloat(op1->f < value2);
8726 if(!exp->expType)
8727 {
8728 exp->expType = op1->type;
8729 if(op1->type)
8730 op1->type->refCount++;
8731 }
8732 return 0x1;
8733 }
8734
8735 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8736 {
8737 double value2 = op2->d;
8738
8739 exp->type = 2;
8740 exp->string = PrintDouble(op1->d < value2);
8741 if(!exp->expType)
8742 {
8743 exp->expType = op1->type;
8744 if(op1->type)
8745 op1->type->refCount++;
8746 }
8747 return 0x1;
8748 }
8749
8750 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8751 {
8752 int value2 = op2->i;
8753
8754 exp->type = 2;
8755 exp->string = PrintInt(op1->i >= value2);
8756 if(!exp->expType)
8757 {
8758 exp->expType = op1->type;
8759 if(op1->type)
8760 op1->type->refCount++;
8761 }
8762 return 0x1;
8763 }
8764
8765 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8766 {
8767 unsigned int value2 = op2->ui;
8768
8769 exp->type = 2;
8770 exp->string = PrintUInt(op1->ui >= value2);
8771 if(!exp->expType)
8772 {
8773 exp->expType = op1->type;
8774 if(op1->type)
8775 op1->type->refCount++;
8776 }
8777 return 0x1;
8778 }
8779
8780 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8781 {
8782 short value2 = op2->s;
8783
8784 exp->type = 2;
8785 exp->string = PrintShort(op1->s >= value2);
8786 if(!exp->expType)
8787 {
8788 exp->expType = op1->type;
8789 if(op1->type)
8790 op1->type->refCount++;
8791 }
8792 return 0x1;
8793 }
8794
8795 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8796 {
8797 unsigned short value2 = op2->us;
8798
8799 exp->type = 2;
8800 exp->string = PrintUShort(op1->us >= value2);
8801 if(!exp->expType)
8802 {
8803 exp->expType = op1->type;
8804 if(op1->type)
8805 op1->type->refCount++;
8806 }
8807 return 0x1;
8808 }
8809
8810 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8811 {
8812 char value2 = op2->c;
8813
8814 exp->type = 2;
8815 exp->string = PrintChar(op1->c >= value2);
8816 if(!exp->expType)
8817 {
8818 exp->expType = op1->type;
8819 if(op1->type)
8820 op1->type->refCount++;
8821 }
8822 return 0x1;
8823 }
8824
8825 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8826 {
8827 unsigned char value2 = op2->uc;
8828
8829 exp->type = 2;
8830 exp->string = PrintUChar(op1->uc >= value2);
8831 if(!exp->expType)
8832 {
8833 exp->expType = op1->type;
8834 if(op1->type)
8835 op1->type->refCount++;
8836 }
8837 return 0x1;
8838 }
8839
8840 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8841 {
8842 float value2 = op2->f;
8843
8844 exp->type = 2;
8845 exp->string = PrintFloat(op1->f >= value2);
8846 if(!exp->expType)
8847 {
8848 exp->expType = op1->type;
8849 if(op1->type)
8850 op1->type->refCount++;
8851 }
8852 return 0x1;
8853 }
8854
8855 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8856 {
8857 double value2 = op2->d;
8858
8859 exp->type = 2;
8860 exp->string = PrintDouble(op1->d >= value2);
8861 if(!exp->expType)
8862 {
8863 exp->expType = op1->type;
8864 if(op1->type)
8865 op1->type->refCount++;
8866 }
8867 return 0x1;
8868 }
8869
8870 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8871 {
8872 int value2 = op2->i;
8873
8874 exp->type = 2;
8875 exp->string = PrintInt(op1->i <= value2);
8876 if(!exp->expType)
8877 {
8878 exp->expType = op1->type;
8879 if(op1->type)
8880 op1->type->refCount++;
8881 }
8882 return 0x1;
8883 }
8884
8885 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8886 {
8887 unsigned int value2 = op2->ui;
8888
8889 exp->type = 2;
8890 exp->string = PrintUInt(op1->ui <= value2);
8891 if(!exp->expType)
8892 {
8893 exp->expType = op1->type;
8894 if(op1->type)
8895 op1->type->refCount++;
8896 }
8897 return 0x1;
8898 }
8899
8900 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8901 {
8902 short value2 = op2->s;
8903
8904 exp->type = 2;
8905 exp->string = PrintShort(op1->s <= value2);
8906 if(!exp->expType)
8907 {
8908 exp->expType = op1->type;
8909 if(op1->type)
8910 op1->type->refCount++;
8911 }
8912 return 0x1;
8913 }
8914
8915 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8916 {
8917 unsigned short value2 = op2->us;
8918
8919 exp->type = 2;
8920 exp->string = PrintUShort(op1->us <= value2);
8921 if(!exp->expType)
8922 {
8923 exp->expType = op1->type;
8924 if(op1->type)
8925 op1->type->refCount++;
8926 }
8927 return 0x1;
8928 }
8929
8930 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8931 {
8932 char value2 = op2->c;
8933
8934 exp->type = 2;
8935 exp->string = PrintChar(op1->c <= value2);
8936 if(!exp->expType)
8937 {
8938 exp->expType = op1->type;
8939 if(op1->type)
8940 op1->type->refCount++;
8941 }
8942 return 0x1;
8943 }
8944
8945 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8946 {
8947 unsigned char value2 = op2->uc;
8948
8949 exp->type = 2;
8950 exp->string = PrintUChar(op1->uc <= value2);
8951 if(!exp->expType)
8952 {
8953 exp->expType = op1->type;
8954 if(op1->type)
8955 op1->type->refCount++;
8956 }
8957 return 0x1;
8958 }
8959
8960 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8961 {
8962 float value2 = op2->f;
8963
8964 exp->type = 2;
8965 exp->string = PrintFloat(op1->f <= value2);
8966 if(!exp->expType)
8967 {
8968 exp->expType = op1->type;
8969 if(op1->type)
8970 op1->type->refCount++;
8971 }
8972 return 0x1;
8973 }
8974
8975 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8976 {
8977 double value2 = op2->d;
8978
8979 exp->type = 2;
8980 exp->string = PrintDouble(op1->d <= value2);
8981 if(!exp->expType)
8982 {
8983 exp->expType = op1->type;
8984 if(op1->type)
8985 op1->type->refCount++;
8986 }
8987 return 0x1;
8988 }
8989
8990 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8991 {
8992 exp->type = 2;
8993 exp->string = PrintInt(op1->i ? op2->i : op3->i);
8994 if(!exp->expType)
8995 {
8996 exp->expType = op1->type;
8997 if(op1->type)
8998 op1->type->refCount++;
8999 }
9000 return 0x1;
9001 }
9002
9003 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9004 {
9005 exp->type = 2;
9006 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
9007 if(!exp->expType)
9008 {
9009 exp->expType = op1->type;
9010 if(op1->type)
9011 op1->type->refCount++;
9012 }
9013 return 0x1;
9014 }
9015
9016 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9017 {
9018 exp->type = 2;
9019 exp->string = PrintShort(op1->s ? op2->s : op3->s);
9020 if(!exp->expType)
9021 {
9022 exp->expType = op1->type;
9023 if(op1->type)
9024 op1->type->refCount++;
9025 }
9026 return 0x1;
9027 }
9028
9029 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9030 {
9031 exp->type = 2;
9032 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
9033 if(!exp->expType)
9034 {
9035 exp->expType = op1->type;
9036 if(op1->type)
9037 op1->type->refCount++;
9038 }
9039 return 0x1;
9040 }
9041
9042 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9043 {
9044 exp->type = 2;
9045 exp->string = PrintChar(op1->c ? op2->c : op3->c);
9046 if(!exp->expType)
9047 {
9048 exp->expType = op1->type;
9049 if(op1->type)
9050 op1->type->refCount++;
9051 }
9052 return 0x1;
9053 }
9054
9055 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9056 {
9057 exp->type = 2;
9058 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
9059 if(!exp->expType)
9060 {
9061 exp->expType = op1->type;
9062 if(op1->type)
9063 op1->type->refCount++;
9064 }
9065 return 0x1;
9066 }
9067
9068 static unsigned int FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9069 {
9070 exp->type = 2;
9071 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
9072 if(!exp->expType)
9073 {
9074 exp->expType = op1->type;
9075 if(op1->type)
9076 op1->type->refCount++;
9077 }
9078 return 0x1;
9079 }
9080
9081 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9082 {
9083 exp->type = 2;
9084 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
9085 if(!exp->expType)
9086 {
9087 exp->expType = op1->type;
9088 if(op1->type)
9089 op1->type->refCount++;
9090 }
9091 return 0x1;
9092 }
9093
9094 struct OpTable intOps = 
9095 {
9096 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
9097 };
9098
9099 struct OpTable uintOps = 
9100 {
9101 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
9102 };
9103
9104 struct OpTable shortOps = 
9105 {
9106 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
9107 };
9108
9109 struct OpTable ushortOps = 
9110 {
9111 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
9112 };
9113
9114 struct OpTable floatOps = 
9115 {
9116 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
9117 };
9118
9119 struct OpTable doubleOps = 
9120 {
9121 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
9122 };
9123
9124 struct OpTable charOps = 
9125 {
9126 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
9127 };
9128
9129 struct OpTable ucharOps = 
9130 {
9131 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
9132 };
9133
9134 void ReadString(char * output, char * string)
9135 {
9136 int len = strlen(string);
9137 int c, d = 0;
9138 unsigned int quoted = 0x0, escaped = 0x0;
9139
9140 for(c = 0; c < len; c++)
9141 {
9142 char ch = string[c];
9143
9144 if(escaped)
9145 {
9146 switch(ch)
9147 {
9148 case 'n':
9149 output[d] = '\n';
9150 break;
9151 case 't':
9152 output[d] = '\t';
9153 break;
9154 case 'a':
9155 output[d] = '\a';
9156 break;
9157 case 'b':
9158 output[d] = '\b';
9159 break;
9160 case 'f':
9161 output[d] = '\f';
9162 break;
9163 case 'r':
9164 output[d] = '\r';
9165 break;
9166 case 'v':
9167 output[d] = '\v';
9168 break;
9169 case '\\':
9170 output[d] = '\\';
9171 break;
9172 case '\"':
9173 output[d] = '\"';
9174 break;
9175 default:
9176 output[d++] = '\\';
9177 output[d] = ch;
9178 }
9179 d++;
9180 escaped = 0x0;
9181 }
9182 else
9183 {
9184 if(ch == '\"')
9185 quoted ^= 0x1;
9186 else if(quoted)
9187 {
9188 if(ch == '\\')
9189 escaped = 0x1;
9190 else
9191 output[d++] = ch;
9192 }
9193 }
9194 }
9195 output[d] = '\0';
9196 }
9197
9198 extern long long __ecereNameSpace__ecere__com___strtoi64(char *  string, char * *  endString, int base);
9199
9200 extern uint64 __ecereNameSpace__ecere__com___strtoui64(char *  string, char * *  endString, int base);
9201
9202 extern double strtod(char * , char * * );
9203
9204 struct Operand GetOperand(struct Expression * exp)
9205 {
9206 struct Operand op = 
9207 {
9208 0, 0, 0, 0, 
9209 {
9210 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
9211 }
9212 };
9213 struct Type * type = exp->expType;
9214
9215 if(type)
9216 {
9217 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9218 {
9219 if(!type->_class->registered->dataType)
9220 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9221 type = type->_class->registered->dataType;
9222 }
9223 op.kind = type->kind;
9224 op.type = exp->expType;
9225 if(exp->isConstant && exp->type == 2)
9226 {
9227 switch(op.kind)
9228 {
9229 case 1:
9230 {
9231 if(exp->constant[0] == '\'')
9232 op.c = exp->constant[1];
9233 else if(type->isSigned)
9234 {
9235 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9236 op.ops = charOps;
9237 }
9238 else
9239 {
9240 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9241 op.ops = ucharOps;
9242 }
9243 break;
9244 }
9245 case 2:
9246 if(type->isSigned)
9247 {
9248 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9249 op.ops = shortOps;
9250 }
9251 else
9252 {
9253 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9254 op.ops = ushortOps;
9255 }
9256 break;
9257 case 3:
9258 case 5:
9259 if(type->isSigned)
9260 {
9261 op.i = strtol(exp->constant, (((void *)0)), 0);
9262 op.ops = intOps;
9263 }
9264 else
9265 {
9266 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9267 op.ops = uintOps;
9268 }
9269 op.kind = 3;
9270 break;
9271 case 4:
9272 if(type->isSigned)
9273 {
9274 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9275 op.ops = intOps;
9276 }
9277 else
9278 {
9279 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9280 op.ops = uintOps;
9281 }
9282 op.kind = 3;
9283 break;
9284 case 22:
9285 if(type->isSigned)
9286 {
9287 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9288 op.ops = intOps;
9289 }
9290 else
9291 {
9292 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9293 op.ops = uintOps;
9294 }
9295 op.kind = 3;
9296 break;
9297 case 6:
9298 op.f = (float)strtod(exp->constant, (((void *)0)));
9299 op.ops = floatOps;
9300 break;
9301 case 7:
9302 op.d = (double)strtod(exp->constant, (((void *)0)));
9303 op.ops = doubleOps;
9304 break;
9305 case 12:
9306 case 13:
9307 case 8:
9308 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9309 op.kind = 13;
9310 op.ops = uintOps;
9311 break;
9312 }
9313 }
9314 }
9315 return op;
9316 }
9317
9318 int __ecereVMethodID_class_OnGetString;
9319
9320 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9321
9322 static void UnusedFunction()
9323 {
9324 int a;
9325
9326 ((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);
9327 }
9328
9329 extern int __ecereVMethodID_class_OnGetString;
9330
9331 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9332 {
9333 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9334
9335 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9336 {
9337 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9338 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9339 else
9340 {
9341 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9342 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9343 struct Type * type;
9344 void * ptr = inst->data + dataMember->offset + offset;
9345 char * result = (((void *)0));
9346
9347 exp->loc = member->loc = inst->loc;
9348 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9349 if(!dataMember->dataType)
9350 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9351 type = dataMember->dataType;
9352 if(type->kind == 8)
9353 {
9354 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9355
9356 if(_class->type == 4)
9357 {
9358 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9359
9360 if(enumClass)
9361 {
9362 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9363 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9364
9365 for(item = e->values.first; item; item = item->next)
9366 {
9367 if((int)item->data == *(int *)ptr)
9368 {
9369 result = item->name;
9370 break;
9371 }
9372 }
9373 if(result)
9374 {
9375 exp->identifier = MkIdentifier(result);
9376 exp->type = 0;
9377 exp->destType = MkClassType(_class->fullName);
9378 ProcessExpressionType(exp);
9379 }
9380 }
9381 }
9382 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9383 {
9384 if(!_class->dataType)
9385 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9386 type = _class->dataType;
9387 }
9388 }
9389 if(!result)
9390 {
9391 switch(type->kind)
9392 {
9393 case 6:
9394 {
9395 FreeExpContents(exp);
9396 exp->constant = PrintFloat(*(float *)ptr);
9397 exp->type = 2;
9398 break;
9399 }
9400 case 7:
9401 {
9402 FreeExpContents(exp);
9403 exp->constant = PrintDouble(*(double *)ptr);
9404 exp->type = 2;
9405 break;
9406 }
9407 case 3:
9408 {
9409 FreeExpContents(exp);
9410 exp->constant = PrintInt(*(int *)ptr);
9411 exp->type = 2;
9412 break;
9413 }
9414 case 4:
9415 {
9416 FreeExpContents(exp);
9417 exp->constant = PrintInt64(*(long long *)ptr);
9418 exp->type = 2;
9419 break;
9420 }
9421 case 22:
9422 {
9423 FreeExpContents(exp);
9424 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9425 exp->type = 2;
9426 break;
9427 }
9428 default:
9429 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9430 }
9431 }
9432 ListAdd(memberList, member);
9433 }
9434 if(parentDataMember->type == 1)
9435 break;
9436 }
9437 }
9438
9439 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9440
9441 void PopulateInstance(struct Instantiation * inst)
9442 {
9443 struct Symbol * classSym = inst->_class->symbol;
9444 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9445 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9446 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9447
9448 inst->members = MkListOne(MkMembersInitList(memberList));
9449 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9450 {
9451 if(!dataMember->isProperty)
9452 {
9453 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9454 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9455 else
9456 {
9457 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9458 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9459 struct Type * type;
9460 void * ptr = inst->data + dataMember->offset;
9461 char * result = (((void *)0));
9462
9463 exp->loc = member->loc = inst->loc;
9464 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9465 if(!dataMember->dataType)
9466 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9467 type = dataMember->dataType;
9468 if(type->kind == 8)
9469 {
9470 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9471
9472 if(_class->type == 4)
9473 {
9474 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9475
9476 if(enumClass)
9477 {
9478 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9479 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9480
9481 for(item = e->values.first; item; item = item->next)
9482 {
9483 if((int)item->data == *(int *)ptr)
9484 {
9485 result = item->name;
9486 break;
9487 }
9488 }
9489 }
9490 if(result)
9491 {
9492 exp->identifier = MkIdentifier(result);
9493 exp->type = 0;
9494 exp->destType = MkClassType(_class->fullName);
9495 ProcessExpressionType(exp);
9496 }
9497 }
9498 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9499 {
9500 if(!_class->dataType)
9501 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9502 type = _class->dataType;
9503 }
9504 }
9505 if(!result)
9506 {
9507 switch(type->kind)
9508 {
9509 case 6:
9510 {
9511 exp->constant = PrintFloat(*(float *)ptr);
9512 exp->type = 2;
9513 break;
9514 }
9515 case 7:
9516 {
9517 exp->constant = PrintDouble(*(double *)ptr);
9518 exp->type = 2;
9519 break;
9520 }
9521 case 3:
9522 {
9523 exp->constant = PrintInt(*(int *)ptr);
9524 exp->type = 2;
9525 break;
9526 }
9527 case 4:
9528 {
9529 exp->constant = PrintInt64(*(long long *)ptr);
9530 exp->type = 2;
9531 break;
9532 }
9533 case 22:
9534 {
9535 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9536 exp->type = 2;
9537 break;
9538 }
9539 default:
9540 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9541 }
9542 }
9543 ListAdd(memberList, member);
9544 }
9545 }
9546 }
9547 }
9548
9549 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);
9550
9551 extern void FreeInstance(struct Instantiation * inst);
9552
9553 void ComputeInstantiation(struct Expression * exp)
9554 {
9555 struct Instantiation * inst = exp->instance;
9556 struct MembersInit * members;
9557 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9558 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9559 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9560 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9561 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9562 int subMemberStackPos = 0;
9563 uint64 bits = 0;
9564
9565 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9566 {
9567 if(inst->data)
9568 return ;
9569 if(_class->type == 0 || _class->type == 5)
9570 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9571 else
9572 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9573 }
9574 if(inst->members)
9575 {
9576 for(members = (*inst->members).first; members; members = members->next)
9577 {
9578 switch(members->type)
9579 {
9580 case 0:
9581 {
9582 if(members->dataMembers)
9583 {
9584 struct MemberInit * member;
9585
9586 for(member = (*members->dataMembers).first; member; member = member->next)
9587 {
9588 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9589 unsigned int found = 0x0;
9590 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9591 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9592 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9593 unsigned int dataMemberOffset;
9594
9595 if(!ident)
9596 {
9597 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9598 if(curMember)
9599 {
9600 if(curMember->isProperty)
9601 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9602 else
9603 {
9604 dataMember = curMember;
9605 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9606 }
9607 found = 0x1;
9608 }
9609 }
9610 else
9611 {
9612 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9613 if(prop)
9614 {
9615 found = 0x1;
9616 if(prop->memberAccess == 1)
9617 {
9618 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9619 curClass = prop->_class;
9620 }
9621 }
9622 else
9623 {
9624 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9625 int _subMemberStackPos = 0;
9626
9627 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9628 if(dataMember)
9629 {
9630 found = 0x1;
9631 if(dataMember->memberAccess == 1)
9632 {
9633 curMember = dataMember;
9634 curClass = dataMember->_class;
9635 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
9636 subMemberStackPos = _subMemberStackPos;
9637 }
9638 }
9639 }
9640 }
9641 if(found && member->initializer && member->initializer->type == 0)
9642 {
9643 struct Expression * value = member->initializer->exp;
9644 struct Type * type = (((void *)0));
9645
9646 if(prop)
9647 {
9648 type = prop->dataType;
9649 }
9650 else if(dataMember)
9651 {
9652 if(!dataMember->dataType)
9653 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9654 type = dataMember->dataType;
9655 }
9656 if(ident && ident->next)
9657 {
9658 for(ident = ident->next; ident && type; ident = ident->next)
9659 {
9660 if(type->kind == 8)
9661 {
9662 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9663 if(prop)
9664 type = prop->dataType;
9665 else
9666 {
9667 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9668 if(dataMember)
9669 type = dataMember->dataType;
9670 }
9671 }
9672 else if(type->kind == 9 || type->kind == 10)
9673 {
9674 struct Type * memberType;
9675
9676 for(memberType = type->members.first; memberType; memberType = memberType->next)
9677 {
9678 if(!strcmp(memberType->name, ident->string))
9679 {
9680 type = memberType;
9681 break;
9682 }
9683 }
9684 }
9685 }
9686 }
9687 if(value)
9688 {
9689 FreeType(value->destType);
9690 value->destType = type;
9691 if(type)
9692 type->refCount++;
9693 ComputeExpression(value);
9694 }
9695 if(value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9696 {
9697 if(type->kind == 8)
9698 {
9699 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9700
9701 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9702 {
9703 if(!_class->dataType)
9704 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9705 type = _class->dataType;
9706 }
9707 }
9708 if(dataMember)
9709 {
9710 void * ptr = inst->data + dataMemberOffset;
9711
9712 if(value->type == 2)
9713 {
9714 switch(type->kind)
9715 {
9716 case 3:
9717 {
9718 GetInt(value, (int *)ptr);
9719 break;
9720 }
9721 case 4:
9722 {
9723 GetInt64(value, (long long *)ptr);
9724 break;
9725 }
9726 case 22:
9727 {
9728 GetIntPtr(value, (intptr_t *)ptr);
9729 break;
9730 }
9731 case 6:
9732 {
9733 GetFloat(value, (float *)ptr);
9734 break;
9735 }
9736 case 7:
9737 {
9738 GetDouble(value, (double *)ptr);
9739 break;
9740 }
9741 }
9742 }
9743 else if(value->type == 1)
9744 {
9745 if(type->kind == 8)
9746 {
9747 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9748
9749 if(_class->type == 1)
9750 {
9751 ComputeTypeSize(type);
9752 if(value->instance->data)
9753 memcpy(ptr, value->instance->data, type->size);
9754 }
9755 }
9756 }
9757 }
9758 else if(prop)
9759 {
9760 if(value->type == 1 && value->instance->data)
9761 {
9762 void (* Set)(void *, void *) = (void *)prop->Set;
9763
9764 Set(inst->data, value->instance->data);
9765 PopulateInstance(inst);
9766 }
9767 else if(value->type == 2)
9768 {
9769 switch(type->kind)
9770 {
9771 case 7:
9772 {
9773 void (* Set)(void *, double) = (void *)prop->Set;
9774
9775 Set(inst->data, strtod(value->constant, (((void *)0))));
9776 break;
9777 }
9778 case 6:
9779 {
9780 void (* Set)(void *, float) = (void *)prop->Set;
9781
9782 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
9783 break;
9784 }
9785 case 3:
9786 {
9787 void (* Set)(void *, int) = (void *)prop->Set;
9788
9789 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
9790 break;
9791 }
9792 case 4:
9793 {
9794 void (* Set)(void *, long long) = (void *)prop->Set;
9795
9796 Set(inst->data, __ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
9797 break;
9798 }
9799 case 22:
9800 {
9801 void (* Set)(void *, intptr_t) = (void *)prop->Set;
9802
9803 Set(inst->data, (intptr_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
9804 break;
9805 }
9806 }
9807 }
9808 else if(value->type == 3)
9809 {
9810 char temp[1024];
9811
9812 ReadString(temp, value->string);
9813 ((void (*)(void *, void *))(void *)prop->Set)(inst->data, temp);
9814 }
9815 }
9816 }
9817 else if(_class->type == 3)
9818 {
9819 if(prop)
9820 {
9821 if(value->type == 2)
9822 {
9823 if(type->kind == 8)
9824 {
9825 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9826
9827 if(_class->type == 3)
9828 {
9829 if(!_class->dataType)
9830 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9831 type = _class->dataType;
9832 }
9833 }
9834 switch(type->kind)
9835 {
9836 case 6:
9837 {
9838 float fValue;
9839 float (* Set)(float) = (void *)prop->Set;
9840
9841 GetFloat(member->initializer->exp, &fValue);
9842 exp->constant = PrintFloat(Set(fValue));
9843 exp->type = 2;
9844 break;
9845 }
9846 case 7:
9847 {
9848 double dValue;
9849 double (* Set)(double) = (void *)prop->Set;
9850
9851 GetDouble(member->initializer->exp, &dValue);
9852 exp->constant = PrintDouble(Set(dValue));
9853 exp->type = 2;
9854 break;
9855 }
9856 }
9857 }
9858 }
9859 }
9860 else if(_class->type == 2)
9861 {
9862 if(prop)
9863 {
9864 if(value->type == 1 && value->instance->data)
9865 {
9866 unsigned int (* Set)(void *) = (void *)prop->Set;
9867
9868 bits = Set(value->instance->data);
9869 }
9870 else if(value->type == 2)
9871 {
9872 }
9873 }
9874 else if(dataMember)
9875 {
9876 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
9877 struct Type * type;
9878 int part = 0;
9879
9880 GetInt(value, &part);
9881 bits = (bits & ~bitMember->mask);
9882 if(!bitMember->dataType)
9883 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
9884 type = bitMember->dataType;
9885 if(type->kind == 8 && type->_class && type->_class->registered)
9886 {
9887 if(!type->_class->registered->dataType)
9888 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9889 type = type->_class->registered->dataType;
9890 }
9891 switch(type->kind)
9892 {
9893 case 1:
9894 if(type->isSigned)
9895 bits |= ((char)part << bitMember->pos);
9896 else
9897 bits |= ((unsigned char)part << bitMember->pos);
9898 break;
9899 case 2:
9900 if(type->isSigned)
9901 bits |= ((short)part << bitMember->pos);
9902 else
9903 bits |= ((unsigned short)part << bitMember->pos);
9904 break;
9905 case 3:
9906 case 5:
9907 if(type->isSigned)
9908 bits |= (part << bitMember->pos);
9909 else
9910 bits |= ((unsigned int)part << bitMember->pos);
9911 break;
9912 case 4:
9913 if(type->isSigned)
9914 bits |= ((long long)part << bitMember->pos);
9915 else
9916 bits |= ((uint64)part << bitMember->pos);
9917 break;
9918 case 22:
9919 if(type->isSigned)
9920 bits |= ((intptr_t)part << bitMember->pos);
9921 else
9922 bits |= ((uintptr_t)part << bitMember->pos);
9923 break;
9924 }
9925 }
9926 }
9927 }
9928 else
9929 {
9930 if(_class && _class->type == 3)
9931 {
9932 ComputeExpression(member->initializer->exp);
9933 exp->constant = member->initializer->exp->constant;
9934 exp->type = 2;
9935 member->initializer->exp->constant = (((void *)0));
9936 }
9937 }
9938 }
9939 }
9940 break;
9941 }
9942 }
9943 }
9944 }
9945 if(_class && _class->type == 2)
9946 {
9947 exp->constant = PrintHexUInt(bits);
9948 exp->type = 2;
9949 }
9950 if(exp->type != 1)
9951 {
9952 FreeInstance(inst);
9953 }
9954 }
9955
9956 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
9957 {
9958 if(exp->op.op == SIZEOF)
9959 {
9960 FreeExpContents(exp);
9961 exp->type = 2;
9962 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
9963 }
9964 else
9965 {
9966 if(!exp->op.exp1)
9967 {
9968 switch(exp->op.op)
9969 {
9970 case '+':
9971 {
9972 struct Expression * exp2 = exp->op.exp2;
9973
9974 exp->op.exp2 = (((void *)0));
9975 FreeExpContents(exp);
9976 FreeType(exp->expType);
9977 FreeType(exp->destType);
9978 *exp = *exp2;
9979 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
9980 break;
9981 }
9982 case '-':
9983 if(op1->ops.Neg)
9984 {
9985 FreeExpContents(exp);
9986 op1->ops.Neg(exp, op1);
9987 }
9988 break;
9989 case '~':
9990 if(op1->ops.BitNot)
9991 {
9992 FreeExpContents(exp);
9993 op1->ops.BitNot(exp, op1);
9994 }
9995 break;
9996 case '!':
9997 if(op1->ops.Not)
9998 {
9999 FreeExpContents(exp);
10000 op1->ops.Not(exp, op1);
10001 }
10002 break;
10003 }
10004 }
10005 else
10006 {
10007 switch(exp->op.op)
10008 {
10009 case '+':
10010 if(op1->ops.Add)
10011 {
10012 FreeExpContents(exp);
10013 op1->ops.Add(exp, op1, op2);
10014 }
10015 break;
10016 case '-':
10017 if(op1->ops.Sub)
10018 {
10019 FreeExpContents(exp);
10020 op1->ops.Sub(exp, op1, op2);
10021 }
10022 break;
10023 case '*':
10024 if(op1->ops.Mul)
10025 {
10026 FreeExpContents(exp);
10027 op1->ops.Mul(exp, op1, op2);
10028 }
10029 break;
10030 case '/':
10031 if(op1->ops.Div)
10032 {
10033 FreeExpContents(exp);
10034 op1->ops.Div(exp, op1, op2);
10035 }
10036 break;
10037 case '%':
10038 if(op1->ops.Mod)
10039 {
10040 FreeExpContents(exp);
10041 op1->ops.Mod(exp, op1, op2);
10042 }
10043 break;
10044 case '&':
10045 if(exp->op.exp2)
10046 {
10047 if(op1->ops.BitAnd)
10048 {
10049 FreeExpContents(exp);
10050 op1->ops.BitAnd(exp, op1, op2);
10051 }
10052 }
10053 break;
10054 case '|':
10055 if(op1->ops.BitOr)
10056 {
10057 FreeExpContents(exp);
10058 op1->ops.BitOr(exp, op1, op2);
10059 }
10060 break;
10061 case '^':
10062 if(op1->ops.BitXor)
10063 {
10064 FreeExpContents(exp);
10065 op1->ops.BitXor(exp, op1, op2);
10066 }
10067 break;
10068 case LEFT_OP:
10069 if(op1->ops.LShift)
10070 {
10071 FreeExpContents(exp);
10072 op1->ops.LShift(exp, op1, op2);
10073 }
10074 break;
10075 case RIGHT_OP:
10076 if(op1->ops.RShift)
10077 {
10078 FreeExpContents(exp);
10079 op1->ops.RShift(exp, op1, op2);
10080 }
10081 break;
10082 case EQ_OP:
10083 if(op1->ops.Equ)
10084 {
10085 FreeExpContents(exp);
10086 op1->ops.Equ(exp, op1, op2);
10087 }
10088 break;
10089 case NE_OP:
10090 if(op1->ops.Nqu)
10091 {
10092 FreeExpContents(exp);
10093 op1->ops.Nqu(exp, op1, op2);
10094 }
10095 break;
10096 case AND_OP:
10097 if(op1->ops.And)
10098 {
10099 FreeExpContents(exp);
10100 op1->ops.And(exp, op1, op2);
10101 }
10102 break;
10103 case OR_OP:
10104 if(op1->ops.Or)
10105 {
10106 FreeExpContents(exp);
10107 op1->ops.Or(exp, op1, op2);
10108 }
10109 break;
10110 case '>':
10111 if(op1->ops.Grt)
10112 {
10113 FreeExpContents(exp);
10114 op1->ops.Grt(exp, op1, op2);
10115 }
10116 break;
10117 case '<':
10118 if(op1->ops.Sma)
10119 {
10120 FreeExpContents(exp);
10121 op1->ops.Sma(exp, op1, op2);
10122 }
10123 break;
10124 case GE_OP:
10125 if(op1->ops.GrtEqu)
10126 {
10127 FreeExpContents(exp);
10128 op1->ops.GrtEqu(exp, op1, op2);
10129 }
10130 break;
10131 case LE_OP:
10132 if(op1->ops.SmaEqu)
10133 {
10134 FreeExpContents(exp);
10135 op1->ops.SmaEqu(exp, op1, op2);
10136 }
10137 break;
10138 }
10139 }
10140 }
10141 }
10142
10143 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10144
10145 void ComputeExpression(struct Expression * exp)
10146 {
10147 char expString[10240];
10148
10149 expString[0] = '\0';
10150 switch(exp->type)
10151 {
10152 case 1:
10153 {
10154 ComputeInstantiation(exp);
10155 break;
10156 }
10157 case 4:
10158 {
10159 struct Expression * exp1, * exp2 = (((void *)0));
10160 struct Operand op1 = 
10161 {
10162 0, 0, 0, 0, 
10163 {
10164 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10165 }
10166 };
10167 struct Operand op2 = 
10168 {
10169 0, 0, 0, 0, 
10170 {
10171 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10172 }
10173 };
10174
10175 if(exp->op.exp2)
10176 ComputeExpression(exp->op.exp2);
10177 if(exp->op.exp1)
10178 {
10179 ComputeExpression(exp->op.exp1);
10180 exp1 = exp->op.exp1;
10181 exp2 = exp->op.exp2;
10182 op1 = GetOperand(exp1);
10183 if(op1.type)
10184 op1.type->refCount++;
10185 if(exp2)
10186 {
10187 op2 = GetOperand(exp2);
10188 if(op2.type)
10189 op2.type->refCount++;
10190 }
10191 }
10192 else
10193 {
10194 exp1 = exp->op.exp2;
10195 op1 = GetOperand(exp1);
10196 if(op1.type)
10197 op1.type->refCount++;
10198 }
10199 CallOperator(exp, exp1, exp2, &op1, &op2);
10200 if(op1.type)
10201 FreeType(op1.type);
10202 if(op2.type)
10203 FreeType(op2.type);
10204 break;
10205 }
10206 case 5:
10207 case 34:
10208 {
10209 struct Expression * e, * n;
10210
10211 for(e = (*exp->list).first; e; e = n)
10212 {
10213 n = e->next;
10214 if(!n)
10215 {
10216 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10217
10218 ComputeExpression(e);
10219 FreeType(exp->expType);
10220 FreeType(exp->destType);
10221 *exp = *e;
10222 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10223 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10224 }
10225 else
10226 {
10227 FreeExpression(e);
10228 }
10229 }
10230 break;
10231 }
10232 case 8:
10233 {
10234 struct Expression * memberExp = exp->member.exp;
10235 struct Identifier * memberID = exp->member.member;
10236 struct Type * type;
10237
10238 ComputeExpression(exp->member.exp);
10239 type = exp->member.exp->expType;
10240 if(type)
10241 {
10242 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)));
10243 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10244 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10245 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10246
10247 if(type->kind == 19 && exp->member.exp->type == 26)
10248 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10249 if(!_class)
10250 {
10251 char string[256];
10252 struct Symbol * classSym;
10253
10254 string[0] = '\0';
10255 PrintType(type, string, 0x0, 0x1);
10256 classSym = FindClass(string);
10257 _class = classSym ? classSym->registered : (((void *)0));
10258 }
10259 if(exp->member.member)
10260 {
10261 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10262 if(!prop)
10263 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10264 }
10265 if(!prop && !member && _class && exp->member.member)
10266 {
10267 struct Symbol * classSym = FindClass(exp->member.member->string);
10268
10269 convertTo = _class;
10270 _class = classSym ? classSym->registered : (((void *)0));
10271 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10272 }
10273 if(prop)
10274 {
10275 if(prop->compiled)
10276 {
10277 struct Type * type = prop->dataType;
10278
10279 if(_class->type == 3)
10280 {
10281 if(type->kind == 8)
10282 {
10283 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10284
10285 if(_class->type == 3)
10286 {
10287 if(!_class->dataType)
10288 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10289 type = _class->dataType;
10290 }
10291 }
10292 switch(type->kind)
10293 {
10294 case 6:
10295 {
10296 float value;
10297 float (* Get)(float) = (void *)prop->Get;
10298
10299 GetFloat(exp->member.exp, &value);
10300 exp->constant = PrintFloat(Get ? Get(value) : value);
10301 exp->type = 2;
10302 break;
10303 }
10304 case 7:
10305 {
10306 double value;
10307 double (* Get)(double);
10308
10309 GetDouble(exp->member.exp, &value);
10310 if(convertTo)
10311 Get = (void *)prop->Set;
10312 else
10313 Get = (void *)prop->Get;
10314 exp->constant = PrintDouble(Get ? Get(value) : value);
10315 exp->type = 2;
10316 break;
10317 }
10318 }
10319 }
10320 else
10321 {
10322 if(convertTo)
10323 {
10324 struct Expression * value = exp->member.exp;
10325 struct Type * type;
10326
10327 if(!prop->dataType)
10328 ProcessPropertyType(prop);
10329 type = prop->dataType;
10330 if(!type)
10331 {
10332 }
10333 else if(_class->type == 1)
10334 {
10335 switch(type->kind)
10336 {
10337 case 8:
10338 {
10339 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10340
10341 if(propertyClass->type == 1 && value->type == 1)
10342 {
10343 void (* Set)(void *, void *) = (void *)prop->Set;
10344
10345 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10346 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10347 exp->instance->_class = MkSpecifierName(_class->fullName);
10348 exp->instance->loc = exp->loc;
10349 exp->type = 1;
10350 Set(exp->instance->data, value->instance->data);
10351 PopulateInstance(exp->instance);
10352 }
10353 break;
10354 }
10355 case 3:
10356 {
10357 int intValue;
10358 void (* Set)(void *, int) = (void *)prop->Set;
10359
10360 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10361 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10362 exp->instance->_class = MkSpecifierName(_class->fullName);
10363 exp->instance->loc = exp->loc;
10364 exp->type = 1;
10365 GetInt(value, &intValue);
10366 Set(exp->instance->data, intValue);
10367 PopulateInstance(exp->instance);
10368 break;
10369 }
10370 case 4:
10371 {
10372 long long intValue;
10373 void (* Set)(void *, long long) = (void *)prop->Set;
10374
10375 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10376 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10377 exp->instance->_class = MkSpecifierName(_class->fullName);
10378 exp->instance->loc = exp->loc;
10379 exp->type = 1;
10380 GetInt64(value, &intValue);
10381 Set(exp->instance->data, intValue);
10382 PopulateInstance(exp->instance);
10383 break;
10384 }
10385 case 22:
10386 {
10387 intptr_t intValue;
10388 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10389
10390 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10391 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10392 exp->instance->_class = MkSpecifierName(_class->fullName);
10393 exp->instance->loc = exp->loc;
10394 exp->type = 1;
10395 GetIntPtr(value, &intValue);
10396 Set(exp->instance->data, intValue);
10397 PopulateInstance(exp->instance);
10398 break;
10399 }
10400 case 7:
10401 {
10402 double doubleValue;
10403 void (* Set)(void *, double) = (void *)prop->Set;
10404
10405 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10406 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10407 exp->instance->_class = MkSpecifierName(_class->fullName);
10408 exp->instance->loc = exp->loc;
10409 exp->type = 1;
10410 GetDouble(value, &doubleValue);
10411 Set(exp->instance->data, doubleValue);
10412 PopulateInstance(exp->instance);
10413 break;
10414 }
10415 }
10416 }
10417 else if(_class->type == 2)
10418 {
10419 switch(type->kind)
10420 {
10421 case 8:
10422 {
10423 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10424
10425 if(propertyClass->type == 1 && value->instance->data)
10426 {
10427 unsigned int (* Set)(void *) = (void *)prop->Set;
10428 unsigned int bits = Set(value->instance->data);
10429
10430 exp->constant = PrintHexUInt(bits);
10431 exp->type = 2;
10432 break;
10433 }
10434 else if(_class->type == 2)
10435 {
10436 unsigned int value;
10437 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10438 unsigned int bits;
10439
10440 GetUInt(exp->member.exp, &value);
10441 bits = Set(value);
10442 exp->constant = PrintHexUInt(bits);
10443 exp->type = 2;
10444 }
10445 }
10446 }
10447 }
10448 }
10449 else
10450 {
10451 if(_class->type == 2)
10452 {
10453 unsigned int value;
10454
10455 GetUInt(exp->member.exp, &value);
10456 switch(type->kind)
10457 {
10458 case 8:
10459 {
10460 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10461
10462 if(_class->type == 1)
10463 {
10464 void (* Get)(unsigned int, void *) = (void *)prop->Get;
10465
10466 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10467 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10468 exp->instance->_class = MkSpecifierName(_class->fullName);
10469 exp->instance->loc = exp->loc;
10470 exp->type = 1;
10471 Get(value, exp->instance->data);
10472 PopulateInstance(exp->instance);
10473 }
10474 else if(_class->type == 2)
10475 {
10476 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10477 uint64 bits = Get(value);
10478
10479 exp->constant = PrintHexUInt64(bits);
10480 exp->type = 2;
10481 }
10482 break;
10483 }
10484 }
10485 }
10486 else if(_class->type == 1)
10487 {
10488 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10489
10490 switch(type->kind)
10491 {
10492 case 8:
10493 {
10494 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10495
10496 if(_class->type == 1 && value)
10497 {
10498 void (* Get)(void *, void *) = (void *)prop->Get;
10499
10500 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10501 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10502 exp->instance->_class = MkSpecifierName(_class->fullName);
10503 exp->instance->loc = exp->loc;
10504 exp->type = 1;
10505 Get(value, exp->instance->data);
10506 PopulateInstance(exp->instance);
10507 }
10508 break;
10509 }
10510 }
10511 }
10512 }
10513 }
10514 }
10515 else
10516 {
10517 exp->isConstant = 0x0;
10518 }
10519 }
10520 else if(member)
10521 {
10522 }
10523 }
10524 if(exp->type != 8)
10525 {
10526 FreeExpression(memberExp);
10527 FreeIdentifier(memberID);
10528 }
10529 break;
10530 }
10531 case 10:
10532 {
10533 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10534
10535 FreeExpContents(exp);
10536 exp->constant = PrintUInt(ComputeTypeSize(type));
10537 exp->type = 2;
10538 FreeType(type);
10539 break;
10540 }
10541 case 15:
10542 {
10543 struct Symbol * classSym = exp->_class->symbol;
10544
10545 if(classSym && classSym->registered)
10546 {
10547 if(classSym->registered->fixed)
10548 {
10549 FreeSpecifier(exp->_class);
10550 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10551 exp->type = 2;
10552 }
10553 else
10554 {
10555 char className[1024];
10556
10557 strcpy(className, "__ecereClass_");
10558 FullClassNameCat(className, classSym->string, 0x1);
10559 MangleClassName(className);
10560 FreeExpContents(exp);
10561 exp->type = 9;
10562 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10563 exp->member.member = MkIdentifier("structSize");
10564 }
10565 }
10566 break;
10567 }
10568 case 11:
10569 {
10570 struct Type * type;
10571 struct Expression * e = exp;
10572
10573 if(exp->type == 11)
10574 {
10575 if(exp->cast.exp)
10576 ComputeExpression(exp->cast.exp);
10577 e = exp->cast.exp;
10578 }
10579 if(e && exp->expType)
10580 {
10581 type = exp->expType;
10582 if(type->kind == 8)
10583 {
10584 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10585
10586 if(_class && (_class->type == 3 || _class->type == 2))
10587 {
10588 if(!_class->dataType)
10589 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10590 type = _class->dataType;
10591 }
10592 }
10593 switch(type->kind)
10594 {
10595 case 1:
10596 if(type->isSigned)
10597 {
10598 char value;
10599
10600 GetChar(e, &value);
10601 FreeExpContents(exp);
10602 exp->constant = PrintChar(value);
10603 exp->type = 2;
10604 }
10605 else
10606 {
10607 unsigned char value;
10608
10609 GetUChar(e, &value);
10610 FreeExpContents(exp);
10611 exp->constant = PrintUChar(value);
10612 exp->type = 2;
10613 }
10614 break;
10615 case 2:
10616 if(type->isSigned)
10617 {
10618 short value;
10619
10620 GetShort(e, &value);
10621 FreeExpContents(exp);
10622 exp->constant = PrintShort(value);
10623 exp->type = 2;
10624 }
10625 else
10626 {
10627 unsigned short value;
10628
10629 GetUShort(e, &value);
10630 FreeExpContents(exp);
10631 exp->constant = PrintUShort(value);
10632 exp->type = 2;
10633 }
10634 break;
10635 case 3:
10636 if(type->isSigned)
10637 {
10638 int value;
10639
10640 GetInt(e, &value);
10641 FreeExpContents(exp);
10642 exp->constant = PrintInt(value);
10643 exp->type = 2;
10644 }
10645 else
10646 {
10647 unsigned int value;
10648
10649 GetUInt(e, &value);
10650 FreeExpContents(exp);
10651 exp->constant = PrintUInt(value);
10652 exp->type = 2;
10653 }
10654 break;
10655 case 4:
10656 if(type->isSigned)
10657 {
10658 long long value;
10659
10660 GetInt64(e, &value);
10661 FreeExpContents(exp);
10662 exp->constant = PrintInt64(value);
10663 exp->type = 2;
10664 }
10665 else
10666 {
10667 uint64 value;
10668
10669 GetUInt64(e, &value);
10670 FreeExpContents(exp);
10671 exp->constant = PrintUInt64(value);
10672 exp->type = 2;
10673 }
10674 break;
10675 case 22:
10676 if(type->isSigned)
10677 {
10678 intptr_t value;
10679
10680 GetIntPtr(e, &value);
10681 FreeExpContents(exp);
10682 exp->constant = PrintInt64((long long)value);
10683 exp->type = 2;
10684 }
10685 else
10686 {
10687 uintptr_t value;
10688
10689 GetUIntPtr(e, &value);
10690 FreeExpContents(exp);
10691 exp->constant = PrintUInt64((uint64)value);
10692 exp->type = 2;
10693 }
10694 break;
10695 case 6:
10696 {
10697 float value;
10698
10699 GetFloat(e, &value);
10700 FreeExpContents(exp);
10701 exp->constant = PrintFloat(value);
10702 exp->type = 2;
10703 break;
10704 }
10705 case 7:
10706 {
10707 double value;
10708
10709 GetDouble(e, &value);
10710 FreeExpContents(exp);
10711 exp->constant = PrintDouble(value);
10712 exp->type = 2;
10713 break;
10714 }
10715 }
10716 }
10717 break;
10718 }
10719 case 12:
10720 {
10721 struct Operand op1 = 
10722 {
10723 0, 0, 0, 0, 
10724 {
10725 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10726 }
10727 };
10728 struct Operand op2 = 
10729 {
10730 0, 0, 0, 0, 
10731 {
10732 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10733 }
10734 };
10735 struct Operand op3 = 
10736 {
10737 0, 0, 0, 0, 
10738 {
10739 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10740 }
10741 };
10742
10743 if(exp->cond.exp)
10744 ComputeExpression((*exp->cond.exp).last);
10745 if(exp->cond.elseExp)
10746 ComputeExpression(exp->cond.elseExp);
10747 if(exp->cond.cond)
10748 ComputeExpression(exp->cond.cond);
10749 op1 = GetOperand(exp->cond.cond);
10750 if(op1.type)
10751 op1.type->refCount++;
10752 op2 = GetOperand((*exp->cond.exp).last);
10753 if(op2.type)
10754 op2.type->refCount++;
10755 op3 = GetOperand(exp->cond.elseExp);
10756 if(op3.type)
10757 op3.type->refCount++;
10758 if(op1.ops.Cond)
10759 {
10760 FreeExpContents(exp);
10761 op1.ops.Cond(exp, &op1, &op2, &op3);
10762 }
10763 if(op1.type)
10764 FreeType(op1.type);
10765 if(op2.type)
10766 FreeType(op2.type);
10767 if(op3.type)
10768 FreeType(op3.type);
10769 break;
10770 }
10771 }
10772 }
10773
10774 void ApplyAnyObjectLogic(struct Expression * e);
10775
10776 extern void CopyTypeInto(struct Type * type, struct Type * src);
10777
10778 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
10779 {
10780 unsigned int result = 0x1;
10781
10782 if(destType)
10783 {
10784 struct __ecereNameSpace__ecere__sys__OldList converts = 
10785 {
10786 0, 0, 0, 0, 0
10787 };
10788 struct Conversion * convert;
10789
10790 if(destType->kind == 0)
10791 return 0x0;
10792 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
10793 result = 0x0;
10794 if(converts.count)
10795 {
10796 for(convert = converts.first; convert; convert = convert->next)
10797 {
10798 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
10799
10800 if(!empty)
10801 {
10802 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10803 int objectType = exp->expType ? exp->expType->classObjectType : 0;
10804
10805 *newExp = *exp;
10806 newExp->destType = (((void *)0));
10807 if(convert->isGet)
10808 {
10809 exp->type = 8;
10810 exp->addedThis = 0x1;
10811 exp->member.exp = newExp;
10812 FreeType(exp->member.exp->expType);
10813 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
10814 exp->member.exp->expType->classObjectType = objectType;
10815 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
10816 exp->member.memberType = 1;
10817 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
10818 exp->needCast = 0x1;
10819 if(exp->expType)
10820 exp->expType->refCount++;
10821 ApplyAnyObjectLogic(exp->member.exp);
10822 }
10823 else
10824 {
10825 {
10826 exp->type = 8;
10827 exp->addedThis = 0x1;
10828 exp->member.exp = newExp;
10829 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
10830 {
10831 newExp->byReference = 0x1;
10832 }
10833 FreeType(exp->member.exp->expType);
10834 exp->member.exp->expType = (((void *)0));
10835 if(convert->convert->dataType)
10836 {
10837 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
10838 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
10839 exp->member.exp->expType->refCount = 1;
10840 exp->member.exp->expType->classObjectType = objectType;
10841 ApplyAnyObjectLogic(exp->member.exp);
10842 }
10843 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
10844 exp->member.memberType = 4;
10845 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
10846 exp->needCast = 0x1;
10847 if(convert->resultType)
10848 convert->resultType->refCount++;
10849 }
10850 }
10851 }
10852 else
10853 {
10854 FreeType(exp->expType);
10855 if(convert->isGet)
10856 {
10857 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
10858 exp->needCast = 0x1;
10859 if(exp->expType)
10860 exp->expType->refCount++;
10861 }
10862 else
10863 {
10864 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
10865 exp->needCast = 0x1;
10866 if(convert->resultType)
10867 convert->resultType->refCount++;
10868 }
10869 }
10870 }
10871 if(exp->isConstant && inCompiler)
10872 ComputeExpression(exp);
10873 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
10874 }
10875 if(!result && exp->expType && converts.count)
10876 {
10877 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
10878 }
10879 if(!result && exp->expType && exp->destType)
10880 {
10881 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))
10882 result = 0x1;
10883 }
10884 }
10885 return result;
10886 }
10887
10888 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
10889
10890 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
10891
10892 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
10893
10894 void CheckTemplateTypes(struct Expression * exp)
10895 {
10896 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
10897 {
10898 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10899 struct Statement * compound;
10900 struct Context * context;
10901
10902 *newExp = *exp;
10903 if(exp->destType)
10904 exp->destType->refCount++;
10905 if(exp->expType)
10906 exp->expType->refCount++;
10907 newExp->prev = (((void *)0));
10908 newExp->next = (((void *)0));
10909 switch(exp->expType->kind)
10910 {
10911 case 7:
10912 if(exp->destType->classObjectType)
10913 {
10914 if(exp->destType)
10915 exp->destType->refCount--;
10916 if(exp->expType)
10917 exp->expType->refCount--;
10918 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
10919 }
10920 else
10921 {
10922 struct __ecereNameSpace__ecere__sys__OldList * specs;
10923 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
10924 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
10925
10926 context = PushContext();
10927 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
10928 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
10929 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
10930 exp->type = 25;
10931 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
10932 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
10933 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
10934 exp->compound->compound.context = context;
10935 PopContext(context);
10936 }
10937 break;
10938 default:
10939 exp->type = 11;
10940 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
10941 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
10942 break;
10943 }
10944 }
10945 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
10946 {
10947 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10948 struct Statement * compound;
10949 struct Context * context;
10950
10951 *newExp = *exp;
10952 if(exp->destType)
10953 exp->destType->refCount++;
10954 if(exp->expType)
10955 exp->expType->refCount++;
10956 newExp->prev = (((void *)0));
10957 newExp->next = (((void *)0));
10958 switch(exp->expType->kind)
10959 {
10960 case 7:
10961 if(exp->destType->classObjectType)
10962 {
10963 if(exp->destType)
10964 exp->destType->refCount--;
10965 if(exp->expType)
10966 exp->expType->refCount--;
10967 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
10968 }
10969 else
10970 {
10971 struct __ecereNameSpace__ecere__sys__OldList * specs;
10972 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
10973 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
10974
10975 context = PushContext();
10976 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
10977 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
10978 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
10979 exp->type = 25;
10980 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
10981 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
10982 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
10983 exp->compound->compound.context = context;
10984 PopContext(context);
10985 }
10986 break;
10987 case 8:
10988 {
10989 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
10990 {
10991 exp->type = 5;
10992 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
10993 ProcessExpressionType((*exp->list).first);
10994 break;
10995 }
10996 else
10997 {
10998 exp->type = 5;
10999 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
11000 newExp->needCast = 0x1;
11001 ProcessExpressionType((*exp->list).first);
11002 break;
11003 }
11004 }
11005 default:
11006 {
11007 if(exp->expType->kind == 20)
11008 {
11009 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
11010
11011 if(type)
11012 {
11013 FreeType(exp->destType);
11014 FreeType(exp->expType);
11015 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11016 break;
11017 }
11018 }
11019 if(newExp->type == 8 && newExp->member.memberType == 3)
11020 {
11021 exp->type = 4;
11022 exp->op.op = '*';
11023 exp->op.exp1 = (((void *)0));
11024 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
11025 }
11026 else
11027 {
11028 char typeString[1024];
11029 struct Declarator * decl;
11030 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11031
11032 typeString[0] = '\0';
11033 PrintType(exp->expType, typeString, 0x0, 0x0);
11034 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11035 exp->type = 11;
11036 exp->cast.typeName = MkTypeName(specs, decl);
11037 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11038 exp->cast.exp->needCast = 0x1;
11039 }
11040 break;
11041 }
11042 }
11043 }
11044 }
11045
11046 extern int strncmp(const char * , const char * , int n);
11047
11048 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
11049
11050 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
11051 {
11052 int nsLen = strlen(nameSpace);
11053 struct Symbol * symbol;
11054
11055 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)))
11056 {
11057 char * s = symbol->string;
11058
11059 if(!strncmp(s, nameSpace, nsLen))
11060 {
11061 int c;
11062 char * namePart;
11063
11064 for(c = strlen(s) - 1; c >= 0; c--)
11065 if(s[c] == ':')
11066 break;
11067 namePart = s + c + 1;
11068 if(!strcmp(namePart, name))
11069 {
11070 return symbol;
11071 }
11072 }
11073 else
11074 break;
11075 }
11076 return (((void *)0));
11077 }
11078
11079 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
11080 {
11081 int c;
11082 char nameSpace[1024];
11083 char * namePart;
11084 unsigned int gotColon = 0x0;
11085
11086 nameSpace[0] = '\0';
11087 for(c = strlen(name) - 1; c >= 0; c--)
11088 if(name[c] == ':')
11089 {
11090 gotColon = 0x1;
11091 break;
11092 }
11093 namePart = name + c + 1;
11094 while(c >= 0 && name[c] == ':')
11095 c--;
11096 if(c >= 0)
11097 {
11098 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
11099
11100 if(symbol)
11101 return symbol;
11102 memcpy(nameSpace, name, c + 1);
11103 nameSpace[c + 1] = (char)0;
11104 return ScanWithNameSpace(tree, nameSpace, namePart);
11105 }
11106 else if(gotColon)
11107 {
11108 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11109
11110 return symbol;
11111 }
11112 else
11113 {
11114 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11115
11116 if(symbol)
11117 return symbol;
11118 return ScanWithNameSpace(tree, "", namePart);
11119 }
11120 return (((void *)0));
11121 }
11122
11123 static void ProcessDeclaration(struct Declaration * decl);
11124
11125 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
11126 {
11127 struct Context * ctx;
11128 struct Symbol * symbol = (((void *)0));
11129
11130 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
11131 {
11132 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
11133 {
11134 symbol = (((void *)0));
11135 if(thisNameSpace)
11136 {
11137 char curName[1024];
11138
11139 strcpy(curName, thisNameSpace);
11140 strcat(curName, "::");
11141 strcat(curName, name);
11142 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
11143 }
11144 if(!symbol)
11145 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
11146 }
11147 else
11148 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
11149 if(symbol || ctx == endContext)
11150 break;
11151 }
11152 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
11153 {
11154 if(symbol->pointerExternal->type == 0)
11155 {
11156 struct FunctionDefinition * function = symbol->pointerExternal->function;
11157 struct Context * tmpContext = curContext;
11158
11159 curContext = (((void *)0));
11160 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
11161 curContext = tmpContext;
11162 symbol->pointerExternal->symbol = symbol;
11163 DeclareType(symbol->type, 0x1, 0x1);
11164 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
11165 symbol->id = curExternal->symbol->idCode;
11166 }
11167 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
11168 {
11169 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
11170 symbol->id = curExternal->symbol->idCode;
11171 }
11172 }
11173 return symbol;
11174 }
11175
11176 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
11177 {
11178 if(!type->isSigned && type->kind != 22)
11179 ListAdd(specs, MkSpecifier(UNSIGNED));
11180 switch(type->kind)
11181 {
11182 case 8:
11183 {
11184 if(type->_class->registered)
11185 {
11186 if(!type->_class->registered->dataType)
11187 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11188 GetTypeSpecs(type->_class->registered->dataType, specs);
11189 }
11190 break;
11191 }
11192 case 7:
11193 ListAdd(specs, MkSpecifier(DOUBLE));
11194 break;
11195 case 6:
11196 ListAdd(specs, MkSpecifier(FLOAT));
11197 break;
11198 case 1:
11199 ListAdd(specs, MkSpecifier(CHAR));
11200 break;
11201 case 2:
11202 ListAdd(specs, MkSpecifier(SHORT));
11203 break;
11204 case 4:
11205 ListAdd(specs, MkSpecifier(INT64));
11206 break;
11207 case 22:
11208 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
11209 break;
11210 case 3:
11211 default:
11212 ListAdd(specs, MkSpecifier(INT));
11213 break;
11214 }
11215 }
11216
11217 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
11218
11219 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int printFunction, unsigned int fullName)
11220 {
11221 if(type)
11222 {
11223 switch(type->kind)
11224 {
11225 case 8:
11226 if(type->_class && type->_class->string)
11227 {
11228 if(type->classObjectType == 2)
11229 strcat(string, "typed_object");
11230 else if(fullName)
11231 strcat(string, type->_class->string);
11232 else
11233 {
11234 if(type->_class->registered)
11235 strcat(string, type->_class->registered->name);
11236 else
11237 strcat(string, type->_class->string);
11238 }
11239 }
11240 break;
11241 case 13:
11242 {
11243 {
11244 _PrintType(type->type, string, 0x0, printFunction, fullName);
11245 strcat(string, " *");
11246 }
11247 break;
11248 }
11249 case 0:
11250 strcat(string, "void");
11251 break;
11252 case 3:
11253 strcat(string, type->isSigned ? "int" : "uint");
11254 break;
11255 case 4:
11256 strcat(string, type->isSigned ? "int64" : "uint64");
11257 break;
11258 case 22:
11259 strcat(string, type->isSigned ? "intptr" : "uintptr");
11260 break;
11261 case 1:
11262 strcat(string, type->isSigned ? "char" : "byte");
11263 break;
11264 case 2:
11265 strcat(string, type->isSigned ? "short" : "uint16");
11266 break;
11267 case 6:
11268 strcat(string, "float");
11269 break;
11270 case 7:
11271 strcat(string, "double");
11272 break;
11273 case 9:
11274 if(type->enumName)
11275 {
11276 strcat(string, "struct ");
11277 strcat(string, type->enumName);
11278 }
11279 else if(type->typeName)
11280 {
11281 strcat(string, type->typeName);
11282 }
11283 else
11284 {
11285 struct Type * member;
11286
11287 strcat(string, "struct {");
11288 for(member = type->members.first; member; member = member->next)
11289 {
11290 PrintType(member, string, 0x1, fullName);
11291 strcat(string, "; ");
11292 }
11293 strcat(string, "}");
11294 }
11295 break;
11296 case 10:
11297 if(type->enumName)
11298 {
11299 strcat(string, "union ");
11300 strcat(string, type->enumName);
11301 }
11302 else if(type->typeName)
11303 {
11304 strcat(string, type->typeName);
11305 }
11306 else
11307 {
11308 strcat(string, "union ");
11309 strcat(string, "(unnamed)");
11310 }
11311 break;
11312 case 15:
11313 if(type->enumName)
11314 {
11315 strcat(string, "enum ");
11316 strcat(string, type->enumName);
11317 }
11318 else if(type->typeName)
11319 {
11320 strcat(string, type->typeName);
11321 }
11322 else
11323 strcat(string, "enum");
11324 break;
11325 case 11:
11326 {
11327 if(printFunction)
11328 {
11329 if(type->dllExport)
11330 strcat(string, "dllexport ");
11331 PrintType(type->returnType, string, 0x0, fullName);
11332 strcat(string, " ");
11333 }
11334 if(printName)
11335 {
11336 if(type->name)
11337 {
11338 if(fullName)
11339 strcat(string, type->name);
11340 else
11341 {
11342 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11343
11344 if(name)
11345 name += 2;
11346 else
11347 name = type->name;
11348 strcat(string, name);
11349 }
11350 }
11351 }
11352 if(printFunction)
11353 {
11354 struct Type * param;
11355
11356 strcat(string, "(");
11357 for(param = type->params.first; param; param = param->next)
11358 {
11359 PrintType(param, string, 0x1, fullName);
11360 if(param->next)
11361 strcat(string, ", ");
11362 }
11363 strcat(string, ")");
11364 }
11365 break;
11366 }
11367 case 12:
11368 {
11369 {
11370 char baseType[1024], size[256];
11371 struct Type * arrayType = type;
11372
11373 baseType[0] = '\0';
11374 size[0] = '\0';
11375 while(arrayType->kind == 12)
11376 {
11377 strcat(size, "[");
11378 if(arrayType->enumClass)
11379 strcat(size, arrayType->enumClass->string);
11380 else if(arrayType->arraySizeExp)
11381 PrintExpression(arrayType->arraySizeExp, size);
11382 strcat(size, "]");
11383 arrayType = arrayType->arrayType;
11384 }
11385 _PrintType(arrayType, baseType, printName, printFunction, fullName);
11386 strcat(string, baseType);
11387 strcat(string, size);
11388 }
11389 printName = 0x0;
11390 break;
11391 }
11392 case 14:
11393 strcat(string, "...");
11394 break;
11395 case 16:
11396 _PrintType(type->method->dataType, string, 0x0, printFunction, fullName);
11397 break;
11398 case 19:
11399 strcat(string, "subclass(");
11400 strcat(string, type->_class ? type->_class->string : "int");
11401 strcat(string, ")");
11402 break;
11403 case 20:
11404 strcat(string, type->templateParameter->identifier->string);
11405 break;
11406 case 21:
11407 strcat(string, "thisclass");
11408 break;
11409 case 17:
11410 strcat(string, "__builtin_va_list");
11411 break;
11412 }
11413 if(type->name && printName && type->kind != 11 && (type->kind != 13 || type->type->kind != 11))
11414 {
11415 strcat(string, " ");
11416 strcat(string, type->name);
11417 }
11418 }
11419 }
11420
11421 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11422 {
11423 struct Type * funcType;
11424
11425 for(funcType = type; funcType && (funcType->kind == 13 || funcType->kind == 12); funcType = funcType->type)
11426 ;
11427 if(funcType && funcType->kind == 11 && type != funcType)
11428 {
11429 char typeString[1024];
11430 struct Type * param;
11431
11432 PrintType(funcType->returnType, string, 0x0, fullName);
11433 strcat(string, "(");
11434 _PrintType(type, string, printName, 0x0, fullName);
11435 strcat(string, ")");
11436 strcat(string, "(");
11437 for(param = funcType->params.first; param; param = param->next)
11438 {
11439 PrintType(param, string, 0x1, fullName);
11440 if(param->next)
11441 strcat(string, ", ");
11442 }
11443 strcat(string, ")");
11444 }
11445 else
11446 _PrintType(type, string, printName, 0x1, fullName);
11447 if(type->bitFieldCount)
11448 {
11449 char count[100];
11450
11451 sprintf(count, ":%d", type->bitFieldCount);
11452 strcat(string, count);
11453 }
11454 }
11455
11456 static struct Type * FindMember(struct Type * type, char * string)
11457 {
11458 struct Type * memberType;
11459
11460 for(memberType = type->members.first; memberType; memberType = memberType->next)
11461 {
11462 if(!memberType->name)
11463 {
11464 struct Type * subType = FindMember(memberType, string);
11465
11466 if(subType)
11467 return subType;
11468 }
11469 else if(!strcmp(memberType->name, string))
11470 return memberType;
11471 }
11472 return (((void *)0));
11473 }
11474
11475 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11476 {
11477 struct Type * memberType;
11478
11479 for(memberType = type->members.first; memberType; memberType = memberType->next)
11480 {
11481 if(!memberType->name)
11482 {
11483 struct Type * subType = FindMember(memberType, string);
11484
11485 if(subType)
11486 {
11487 *offset += memberType->offset;
11488 return subType;
11489 }
11490 }
11491 else if(!strcmp(memberType->name, string))
11492 {
11493 *offset += memberType->offset;
11494 return memberType;
11495 }
11496 }
11497 return (((void *)0));
11498 }
11499
11500 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11501
11502 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11503
11504 struct Expression * ParseExpressionString(char * expression)
11505 {
11506 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11507 ((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));
11508 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11509 echoOn = 0x0;
11510 parsedExpression = (((void *)0));
11511 resetScanner();
11512 expression_yyparse();
11513 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11514 return parsedExpression;
11515 }
11516
11517 extern char *  QMkString(char *  source);
11518
11519 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11520 {
11521 void * __ecereTemp1;
11522 struct Identifier * id = exp->identifier;
11523 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11524 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11525 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11526 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11527
11528 if(_class && _class->type == 4)
11529 {
11530 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11531 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11532
11533 if(enumClass)
11534 {
11535 struct __ecereNameSpace__ecere__com__Class * baseClass;
11536
11537 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11538 {
11539 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11540
11541 for(value = e->values.first; value; value = value->next)
11542 {
11543 if(!strcmp(value->name, id->string))
11544 break;
11545 }
11546 if(value)
11547 {
11548 char constant[256];
11549
11550 FreeExpContents(exp);
11551 exp->type = 2;
11552 exp->isConstant = 0x1;
11553 if(!strcmp(baseClass->dataTypeString, "int"))
11554 sprintf(constant, "%d", value->data);
11555 else
11556 sprintf(constant, "0x%X", value->data);
11557 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11558 exp->expType = MkClassType(baseClass->fullName);
11559 break;
11560 }
11561 }
11562 }
11563 if(value)
11564 return 0x1;
11565 }
11566 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11567 {
11568 ProcessMethodType(method);
11569 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 16, ((struct Type *)__ecereTemp1)->method = method, ((struct Type *)__ecereTemp1)->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), ((struct Type *)__ecereTemp1));
11570 return 0x1;
11571 }
11572 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11573 {
11574 if(!prop->dataType)
11575 ProcessPropertyType(prop);
11576 exp->expType = prop->dataType;
11577 if(prop->dataType)
11578 prop->dataType->refCount++;
11579 return 0x1;
11580 }
11581 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11582 {
11583 if(!member->dataType)
11584 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11585 exp->expType = member->dataType;
11586 if(member->dataType)
11587 member->dataType->refCount++;
11588 return 0x1;
11589 }
11590 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11591 {
11592 if(!classProp->dataType)
11593 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11594 if(classProp->constant)
11595 {
11596 FreeExpContents(exp);
11597 exp->isConstant = 0x1;
11598 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
11599 {
11600 exp->type = 3;
11601 exp->constant = QMkString((char *)classProp->Get(_class));
11602 }
11603 else
11604 {
11605 char constant[256];
11606
11607 exp->type = 2;
11608 sprintf(constant, "%d", (int)classProp->Get(_class));
11609 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11610 }
11611 }
11612 else
11613 {
11614 }
11615 exp->expType = classProp->dataType;
11616 if(classProp->dataType)
11617 classProp->dataType->refCount++;
11618 return 0x1;
11619 }
11620 return 0x0;
11621 }
11622
11623 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
11624 {
11625 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
11626 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
11627 struct __ecereNameSpace__ecere__com__NameSpace * child;
11628
11629 if(!data)
11630 {
11631 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)))
11632 {
11633 data = ScanGlobalData(child, name);
11634 if(data)
11635 break;
11636 }
11637 }
11638 return data;
11639 }
11640
11641 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
11642
11643 extern char *  strncpy(char * , const char * , int n);
11644
11645 static struct GlobalData * FindGlobalData(char * name)
11646 {
11647 int start = 0, c;
11648 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
11649
11650 nameSpace = globalData;
11651 for(c = 0; name[c]; c++)
11652 {
11653 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
11654 {
11655 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
11656 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
11657
11658 strncpy(spaceName, name + start, c - start);
11659 spaceName[c - start] = '\0';
11660 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
11661 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
11662 if(!newSpace)
11663 return (((void *)0));
11664 nameSpace = newSpace;
11665 if(name[c] == ':')
11666 c++;
11667 start = c + 1;
11668 }
11669 }
11670 if(c - start)
11671 {
11672 return ScanGlobalData(nameSpace, name + start);
11673 }
11674 return (((void *)0));
11675 }
11676
11677 static int definedExpStackPos;
11678
11679 static void * definedExpStack[512];
11680
11681 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
11682 {
11683 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
11684
11685 FreeExpContents(checkedExp);
11686 FreeType(checkedExp->expType);
11687 FreeType(checkedExp->destType);
11688 *checkedExp = *newExp;
11689 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11690 checkedExp->prev = prev;
11691 checkedExp->next = next;
11692 }
11693
11694 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
11695
11696 extern int printf(char * , ...);
11697
11698 void __ecereMethod_Expression_Clear();
11699
11700 void ApplyAnyObjectLogic(struct Expression * e)
11701 {
11702 struct Type * destType = e->destType;
11703
11704 if(destType && (destType->classObjectType == 3))
11705 {
11706 if(e && e->expType)
11707 {
11708 struct Type * type = e->expType;
11709 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
11710
11711 if(type->kind == 8 && type->_class && type->_class->registered)
11712 {
11713 _class = type->_class->registered;
11714 }
11715 else if(type->kind == 19)
11716 {
11717 _class = FindClass("ecere::com::Class")->registered;
11718 }
11719 else
11720 {
11721 char string[1024] = "";
11722 struct Symbol * classSym;
11723
11724 PrintType(type, string, 0x0, 0x1);
11725 classSym = FindClass(string);
11726 if(classSym)
11727 _class = classSym->registered;
11728 }
11729 if((_class && (_class->type == 4 || _class->type == 3 || _class->type == 2 || _class->type == 1000) && strcmp(_class->fullName, "class") && strcmp(_class->fullName, "ecere::com::Class")) || (!e->expType->classObjectType && (((type->kind != 13 && type->kind != 19 && (type->kind != 8 || !type->_class || !type->_class->registered || type->_class->registered->type == 1))) || destType->byReference)))
11730 {
11731 if(!_class || strcmp(_class->fullName, "char *"))
11732 {
11733 struct Expression * checkedExp = e, * newExp;
11734
11735 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
11736 {
11737 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
11738 {
11739 if(checkedExp->type == 25)
11740 {
11741 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
11742 }
11743 else
11744 checkedExp = (*checkedExp->list).last;
11745 }
11746 else if(checkedExp->type == 11)
11747 checkedExp = checkedExp->cast.exp;
11748 }
11749 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
11750 {
11751 newExp = checkedExp->op.exp2;
11752 checkedExp->op.exp2 = (((void *)0));
11753 FreeExpContents(checkedExp);
11754 if(e->expType && e->expType->passAsTemplate)
11755 {
11756 char size[100];
11757
11758 ComputeTypeSize(e->expType);
11759 sprintf(size, "%d", e->expType->size);
11760 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))))));
11761 }
11762 ReplaceExpContents(checkedExp, newExp);
11763 e->byReference = 0x1;
11764 }
11765 else if(!e->byReference || (_class && _class->type == 5))
11766 {
11767 struct Expression * checkedExp, * newExp;
11768
11769 {
11770 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;
11771
11772 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
11773 {
11774 struct Context * context = PushContext();
11775 struct Declarator * decl;
11776 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11777 char typeString[1024];
11778 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11779
11780 typeString[0] = '\0';
11781 *newExp = *e;
11782 newExp->prev = (((void *)0));
11783 newExp->next = (((void *)0));
11784 newExp->expType = (((void *)0));
11785 PrintType(e->expType, typeString, 0x0, 0x1);
11786 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11787 newExp->destType = ProcessType(specs, decl);
11788 curContext = context;
11789 e->type = 25;
11790 if(curCompound)
11791 {
11792 char name[100];
11793 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
11794
11795 sprintf(name, "__internalValue%03X", internalValueCounter++);
11796 if(!curCompound->compound.declarations)
11797 curCompound->compound.declarations = MkList();
11798 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
11799 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
11800 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
11801 e->compound = MkCompoundStmt((((void *)0)), stmts);
11802 }
11803 else
11804 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
11805 {
11806 struct Type * type = e->destType;
11807
11808 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11809 CopyTypeInto(e->destType, type);
11810 e->destType->refCount = 1;
11811 e->destType->classObjectType = 0;
11812 FreeType(type);
11813 }
11814 e->compound->compound.context = context;
11815 PopContext(context);
11816 curContext = context->parent;
11817 }
11818 }
11819 checkedExp = e;
11820 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
11821 {
11822 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
11823 {
11824 if(checkedExp->type == 25)
11825 {
11826 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
11827 }
11828 else
11829 checkedExp = (*checkedExp->list).last;
11830 }
11831 else if(checkedExp->type == 11)
11832 checkedExp = checkedExp->cast.exp;
11833 }
11834 {
11835 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11836
11837 *operand = *checkedExp;
11838 checkedExp->destType = (((void *)0));
11839 checkedExp->expType = (((void *)0));
11840 __ecereMethod_Expression_Clear(checkedExp);
11841 checkedExp->type = 4;
11842 checkedExp->op.op = '&';
11843 checkedExp->op.exp1 = (((void *)0));
11844 checkedExp->op.exp2 = operand;
11845 }
11846 }
11847 }
11848 }
11849 }
11850 }
11851 {
11852 }
11853 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))))
11854 {
11855 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && !strcmp(e->expType->_class->registered->name, "class"))
11856 {
11857 return ;
11858 }
11859 else
11860 {
11861 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11862
11863 *thisExp = *e;
11864 thisExp->prev = (((void *)0));
11865 thisExp->next = (((void *)0));
11866 __ecereMethod_Expression_Clear(e);
11867 e->type = 5;
11868 e->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpBrackets(MkListOne(thisExp))));
11869 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
11870 ((struct Expression *)(*e->list).first)->byReference = 0x1;
11871 {
11872 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11873 CopyTypeInto(e->expType, thisExp->expType);
11874 e->expType->byReference = 0x0;
11875 e->expType->refCount = 1;
11876 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))
11877 {
11878 e->expType->classObjectType = 0;
11879 }
11880 }
11881 }
11882 }
11883 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
11884 {
11885 if(destType->kind == 14)
11886 {
11887 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unspecified type\n", (((void *)0))));
11888 }
11889 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
11890 {
11891 unsigned int byReference = e->expType->byReference;
11892 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11893 struct Declarator * decl;
11894 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11895 char typeString[1024];
11896 struct Type * type;
11897 int backupClassObjectType;
11898
11899 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
11900 type = e->expType;
11901 else
11902 type = destType;
11903 backupClassObjectType = type->classObjectType;
11904 type->classObjectType = 0;
11905 typeString[0] = '\0';
11906 PrintType(type, typeString, 0x0, 0x1);
11907 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11908 type->classObjectType = backupClassObjectType;
11909 *thisExp = *e;
11910 thisExp->prev = (((void *)0));
11911 thisExp->next = (((void *)0));
11912 __ecereMethod_Expression_Clear(e);
11913 if((type->kind == 8 && type->_class && type->_class->registered && strcmp(type->_class->registered->fullName, "ecere::com::Instance") && (type->_class->registered->type == 1000 || type->_class->registered->type == 2 || type->_class->registered->type == 4 || type->_class->registered->type == 3)) || (type->kind != 13 && type->kind != 12 && type->kind != 8) || (!destType->byReference && byReference && (destType->kind != 13 || type->kind != 13)))
11914 {
11915 e->type = 4;
11916 e->op.op = '*';
11917 e->op.exp1 = (((void *)0));
11918 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
11919 }
11920 else
11921 {
11922 e->type = 11;
11923 e->cast.typeName = MkTypeName(specs, decl);
11924 e->cast.exp = thisExp;
11925 e->byReference = 0x1;
11926 }
11927 e->expType = type;
11928 e->destType = destType;
11929 type->refCount++;
11930 destType->refCount++;
11931 }
11932 }
11933 }
11934
11935 extern char *  strstr(char * , const char * );
11936
11937 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
11938
11939 struct __ecereNameSpace__ecere__com__DefinedExpression
11940 {
11941 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
11942 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
11943 char *  name;
11944 char *  value;
11945 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
11946 } __attribute__ ((gcc_struct));
11947
11948 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
11949
11950 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
11951
11952 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
11953
11954 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
11955
11956 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
11957
11958 extern struct Expression * CopyExpression(struct Expression * exp);
11959
11960 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
11961
11962 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
11963
11964 static void ProcessStatement(struct Statement * stmt);
11965
11966 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
11967
11968 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
11969
11970 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
11971
11972 extern char *  sourceFile;
11973
11974 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
11975
11976 void ProcessExpressionType(struct Expression * exp)
11977 {
11978 void * __ecereTemp2;
11979 void * __ecereTemp1;
11980 unsigned int unresolved = 0x0;
11981 struct Location oldyylloc = yylloc;
11982 unsigned int notByReference = 0x0;
11983
11984 if(!exp || exp->expType)
11985 return ;
11986 yylloc = exp->loc;
11987 switch(exp->type)
11988 {
11989 case 0:
11990 {
11991 struct Identifier * id = exp->identifier;
11992
11993 if(!id)
11994 return ;
11995 if(id->_class && id->_class->name)
11996 {
11997 id->classSym = id->_class->symbol;
11998 }
11999 if(strstr(id->string, "__ecereClass") == id->string)
12000 {
12001 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
12002 break;
12003 }
12004 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
12005 {
12006 ReplaceClassMembers(exp, thisClass);
12007 if(exp->type != 0)
12008 {
12009 ProcessExpressionType(exp);
12010 break;
12011 }
12012 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
12013 break;
12014 }
12015 else
12016 {
12017 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12018
12019 if(!symbol)
12020 {
12021 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
12022 break;
12023 else
12024 {
12025 if(thisClass)
12026 {
12027 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
12028 if(exp->type != 0)
12029 {
12030 ProcessExpressionType(exp);
12031 break;
12032 }
12033 }
12034 else if(currentClass && !id->_class)
12035 {
12036 if(ResolveIdWithClass(exp, currentClass, 0x1))
12037 break;
12038 }
12039 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12040 }
12041 }
12042 if(symbol)
12043 {
12044 struct Type * type = symbol->type;
12045 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
12046
12047 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
12048 {
12049 struct Context * context = SetupTemplatesContext(_class);
12050
12051 type = ReplaceThisClassType(_class);
12052 FinishTemplatesContext(context);
12053 if(type)
12054 type->refCount = 0;
12055 }
12056 FreeSpecifier(id->_class);
12057 id->_class = (((void *)0));
12058 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12059 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
12060 id->classSym = (((void *)0));
12061 exp->expType = type;
12062 if(type)
12063 type->refCount++;
12064 if(type && (type->kind == 15 || (_class && _class->type == 4)))
12065 exp->isConstant = 0x1;
12066 if(symbol->isParam || !strcmp(id->string, "this"))
12067 {
12068 if(_class && _class->type == 1)
12069 exp->byReference = 0x1;
12070 }
12071 if(symbol->isIterator)
12072 {
12073 if(symbol->isIterator == 3)
12074 {
12075 exp->type = 5;
12076 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
12077 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
12078 exp->expType = (((void *)0));
12079 ProcessExpressionType(exp);
12080 }
12081 else if(symbol->isIterator != 4)
12082 {
12083 exp->type = 8;
12084 exp->member.exp = MkExpIdentifier(exp->identifier);
12085 exp->member.exp->expType = exp->expType;
12086 exp->member.member = MkIdentifier("data");
12087 exp->expType = (((void *)0));
12088 ProcessExpressionType(exp);
12089 }
12090 }
12091 break;
12092 }
12093 else
12094 {
12095 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
12096
12097 if(thisNameSpace && !(id->_class && !id->_class->name))
12098 {
12099 char name[1024];
12100
12101 strcpy(name, thisNameSpace);
12102 strcat(name, "::");
12103 strcat(name, id->string);
12104 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
12105 }
12106 if(!definedExp)
12107 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
12108 if(definedExp)
12109 {
12110 int c;
12111
12112 for(c = 0; c < definedExpStackPos; c++)
12113 if(definedExpStack[c] == definedExp)
12114 break;
12115 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
12116 {
12117 struct Location backupYylloc = yylloc;
12118
12119 definedExpStack[definedExpStackPos++] = definedExp;
12120 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
12121 ((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));
12122 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
12123 echoOn = 0x0;
12124 parsedExpression = (((void *)0));
12125 resetScanner();
12126 expression_yyparse();
12127 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
12128 yylloc = backupYylloc;
12129 if(parsedExpression)
12130 {
12131 FreeIdentifier(id);
12132 exp->type = 5;
12133 exp->list = MkListOne(parsedExpression);
12134 parsedExpression->loc = yylloc;
12135 ProcessExpressionType(exp);
12136 definedExpStackPos--;
12137 return ;
12138 }
12139 definedExpStackPos--;
12140 }
12141 else
12142 {
12143 if(inCompiler)
12144 {
12145 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
12146 }
12147 }
12148 }
12149 else
12150 {
12151 struct GlobalData * data = (((void *)0));
12152
12153 if(thisNameSpace && !(id->_class && !id->_class->name))
12154 {
12155 char name[1024];
12156
12157 strcpy(name, thisNameSpace);
12158 strcat(name, "::");
12159 strcat(name, id->string);
12160 data = FindGlobalData(name);
12161 }
12162 if(!data)
12163 data = FindGlobalData(id->string);
12164 if(data)
12165 {
12166 DeclareGlobalData(data);
12167 exp->expType = data->dataType;
12168 if(data->dataType)
12169 data->dataType->refCount++;
12170 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12171 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12172 FreeSpecifier(id->_class);
12173 id->_class = (((void *)0));
12174 break;
12175 }
12176 else
12177 {
12178 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
12179
12180 if(thisNameSpace && !(id->_class && !id->_class->name))
12181 {
12182 char name[1024];
12183
12184 strcpy(name, thisNameSpace);
12185 strcat(name, "::");
12186 strcat(name, id->string);
12187 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12188 }
12189 if(!function)
12190 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12191 if(function)
12192 {
12193 char name[1024];
12194
12195 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12196 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12197 name[0] = (char)0;
12198 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12199 strcpy(name, "__ecereFunction_");
12200 FullClassNameCat(name, id->string, 0x0);
12201 if(DeclareFunction(function, name))
12202 {
12203 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12204 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12205 }
12206 exp->expType = function->dataType;
12207 if(function->dataType)
12208 function->dataType->refCount++;
12209 FreeSpecifier(id->_class);
12210 id->_class = (((void *)0));
12211 break;
12212 }
12213 }
12214 }
12215 }
12216 }
12217 unresolved = 0x1;
12218 break;
12219 }
12220 case 1:
12221 {
12222 struct __ecereNameSpace__ecere__com__Class * _class;
12223
12224 if(!exp->instance->_class)
12225 {
12226 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12227 {
12228 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12229 }
12230 }
12231 ProcessInstantiationType(exp->instance);
12232 exp->isConstant = exp->instance->isConstant;
12233 if(exp->instance->_class)
12234 {
12235 exp->expType = MkClassType(exp->instance->_class->name);
12236 }
12237 break;
12238 }
12239 case 2:
12240 {
12241 if(!exp->expType)
12242 {
12243 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12244
12245 exp->expType = type;
12246 if(exp->constant[0] == '\'')
12247 {
12248 if((int)((unsigned char *)exp->constant)[1] > 127)
12249 {
12250 int nb;
12251 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12252
12253 if(nb < 2)
12254 ch = exp->constant[1];
12255 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12256 exp->constant = PrintUInt(ch);
12257 type->kind = 8;
12258 type->_class = FindClass("unichar");
12259 type->isSigned = 0x0;
12260 }
12261 else
12262 {
12263 type->kind = 1;
12264 type->isSigned = 0x1;
12265 }
12266 }
12267 else if(strchr(exp->constant, '.'))
12268 {
12269 char ch = exp->constant[strlen(exp->constant) - 1];
12270
12271 if(ch == 'f')
12272 type->kind = 6;
12273 else
12274 type->kind = 7;
12275 type->isSigned = 0x1;
12276 }
12277 else
12278 {
12279 if(exp->constant[0] == '0' && exp->constant[1])
12280 type->isSigned = 0x0;
12281 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12282 type->isSigned = 0x0;
12283 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12284 type->isSigned = 0x0;
12285 else
12286 type->isSigned = 0x1;
12287 type->kind = 3;
12288 }
12289 exp->isConstant = 0x1;
12290 }
12291 break;
12292 }
12293 case 3:
12294 {
12295 exp->isConstant = 0x1;
12296 exp->expType = (__ecereTemp2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp2)->refCount = 1, ((struct Type *)__ecereTemp2)->kind = 13, ((struct Type *)__ecereTemp2)->type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 1, ((struct Type *)__ecereTemp1)->constant = 0x1, ((struct Type *)__ecereTemp1)), ((struct Type *)__ecereTemp2));
12297 break;
12298 }
12299 case 13:
12300 case 28:
12301 ProcessExpressionType(exp->_new.size);
12302 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = ProcessType(exp->_new.typeName->qualifiers, exp->_new.typeName->declarator), ((struct Type *)__ecereTemp1));
12303 DeclareType(exp->expType->type, 0x0, 0x0);
12304 break;
12305 case 14:
12306 case 29:
12307 ProcessExpressionType(exp->_renew.size);
12308 ProcessExpressionType(exp->_renew.exp);
12309 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), ((struct Type *)__ecereTemp1));
12310 DeclareType(exp->expType->type, 0x0, 0x0);
12311 break;
12312 case 4:
12313 {
12314 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12315 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12316 unsigned int useDestType = 0x0, useSideType = 0x0;
12317 struct Location oldyylloc = yylloc;
12318 unsigned int useSideUnit = 0x0;
12319 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
12320
12321 switch(exp->op.op)
12322 {
12323 case '=':
12324 case MUL_ASSIGN:
12325 case DIV_ASSIGN:
12326 case MOD_ASSIGN:
12327 case ADD_ASSIGN:
12328 case SUB_ASSIGN:
12329 case LEFT_ASSIGN:
12330 case RIGHT_ASSIGN:
12331 case AND_ASSIGN:
12332 case XOR_ASSIGN:
12333 case OR_ASSIGN:
12334 assign = 0x1;
12335 break;
12336 case '!':
12337 break;
12338 case AND_OP:
12339 case OR_OP:
12340 boolOps = 0x1;
12341 boolResult = 0x1;
12342 break;
12343 case EQ_OP:
12344 case '<':
12345 case '>':
12346 case LE_OP:
12347 case GE_OP:
12348 case NE_OP:
12349 boolResult = 0x1;
12350 useSideType = 0x1;
12351 break;
12352 case '+':
12353 case '-':
12354 useSideUnit = 0x1;
12355 case '|':
12356 case '&':
12357 case '^':
12358 case '/':
12359 case '%':
12360 case '*':
12361 if(exp->op.op != '*' || exp->op.exp1)
12362 {
12363 useSideType = 0x1;
12364 useDestType = 0x1;
12365 }
12366 break;
12367 }
12368 if(exp->op.op == '&')
12369 {
12370 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12371 {
12372 struct Identifier * id = exp->op.exp2->identifier;
12373 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12374
12375 if(symbol && symbol->isIterator == 2)
12376 {
12377 exp->type = 8;
12378 exp->member.exp = exp->op.exp2;
12379 exp->member.member = MkIdentifier("key");
12380 exp->expType = (((void *)0));
12381 exp->op.exp2->expType = symbol->type;
12382 symbol->type->refCount++;
12383 ProcessExpressionType(exp);
12384 FreeType(dummy);
12385 break;
12386 }
12387 }
12388 }
12389 if(exp->op.exp1)
12390 {
12391 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))
12392 {
12393 if(exp->op.exp1->destType)
12394 FreeType(exp->op.exp1->destType);
12395 exp->op.exp1->destType = exp->destType;
12396 if(exp->destType)
12397 exp->destType->refCount++;
12398 }
12399 else if(!assign)
12400 {
12401 if(exp->op.exp1->destType)
12402 FreeType(exp->op.exp1->destType);
12403 exp->op.exp1->destType = dummy;
12404 dummy->refCount++;
12405 }
12406 if(exp->op.exp1->destType && exp->op.op != '=')
12407 exp->op.exp1->destType->count++;
12408 ProcessExpressionType(exp->op.exp1);
12409 if(exp->op.exp1->destType && exp->op.op != '=')
12410 exp->op.exp1->destType->count--;
12411 if(exp->op.exp1->destType == dummy)
12412 {
12413 FreeType(dummy);
12414 exp->op.exp1->destType = (((void *)0));
12415 }
12416 type1 = exp->op.exp1->expType;
12417 }
12418 if(exp->op.exp2)
12419 {
12420 char expString[10240];
12421
12422 expString[0] = '\0';
12423 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12424 {
12425 if(exp->op.exp1)
12426 {
12427 exp->op.exp2->destType = exp->op.exp1->expType;
12428 if(exp->op.exp1->expType)
12429 exp->op.exp1->expType->refCount++;
12430 }
12431 else
12432 {
12433 exp->op.exp2->destType = exp->destType;
12434 if(exp->destType)
12435 exp->destType->refCount++;
12436 }
12437 if(type1)
12438 type1->refCount++;
12439 exp->expType = type1;
12440 }
12441 else if(assign)
12442 {
12443 if(inCompiler)
12444 PrintExpression(exp->op.exp2, expString);
12445 if(type1 && type1->kind == 13)
12446 {
12447 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)
12448 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12449 else if(exp->op.op == '=')
12450 {
12451 if(exp->op.exp2->destType)
12452 FreeType(exp->op.exp2->destType);
12453 exp->op.exp2->destType = type1;
12454 if(type1)
12455 type1->refCount++;
12456 }
12457 }
12458 else
12459 {
12460 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)
12461 ;
12462 else
12463 {
12464 if(exp->op.exp2->destType)
12465 FreeType(exp->op.exp2->destType);
12466 exp->op.exp2->destType = type1;
12467 if(type1)
12468 type1->refCount++;
12469 }
12470 }
12471 if(type1)
12472 type1->refCount++;
12473 exp->expType = type1;
12474 }
12475 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)))
12476 {
12477 if(exp->op.exp2->destType)
12478 FreeType(exp->op.exp2->destType);
12479 exp->op.exp2->destType = exp->destType;
12480 if(exp->destType)
12481 exp->destType->refCount++;
12482 }
12483 else
12484 {
12485 if(exp->op.exp2->destType)
12486 FreeType(exp->op.exp2->destType);
12487 exp->op.exp2->destType = dummy;
12488 dummy->refCount++;
12489 }
12490 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12491 {
12492 FreeType(exp->op.exp2->destType);
12493 exp->op.exp2->destType = type1;
12494 type1->refCount++;
12495 }
12496 if(exp->op.exp2->destType && exp->op.op != '=')
12497 exp->op.exp2->destType->count++;
12498 ProcessExpressionType(exp->op.exp2);
12499 if(exp->op.exp2->destType && exp->op.op != '=')
12500 exp->op.exp2->destType->count--;
12501 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12502 {
12503 if(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)
12504 {
12505 if(exp->op.op != '=' && type1->type->kind == 0)
12506 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12507 }
12508 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)))
12509 {
12510 if(exp->op.op == ADD_ASSIGN)
12511 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12512 }
12513 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))
12514 {
12515 if(exp->op.op == ADD_ASSIGN)
12516 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12517 }
12518 else if(inCompiler)
12519 {
12520 char type1String[1024];
12521 char type2String[1024];
12522
12523 type1String[0] = '\0';
12524 type2String[0] = '\0';
12525 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12526 PrintType(type1, type2String, 0x0, 0x1);
12527 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12528 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12529 }
12530 }
12531 if(exp->op.exp2->destType == dummy)
12532 {
12533 FreeType(dummy);
12534 exp->op.exp2->destType = (((void *)0));
12535 }
12536 type2 = exp->op.exp2->expType;
12537 }
12538 dummy->kind = 0;
12539 if(exp->op.op == SIZEOF)
12540 {
12541 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
12542 exp->isConstant = 0x1;
12543 }
12544 else if(exp->op.op == '*' && !exp->op.exp1)
12545 {
12546 exp->expType = Dereference(type2);
12547 if(type2 && type2->kind == 8)
12548 notByReference = 0x1;
12549 }
12550 else if(exp->op.op == '&' && !exp->op.exp1)
12551 exp->expType = Reference(type2);
12552 else if(!assign)
12553 {
12554 if(boolOps)
12555 {
12556 if(exp->op.exp1)
12557 {
12558 if(exp->op.exp1->destType)
12559 FreeType(exp->op.exp1->destType);
12560 exp->op.exp1->destType = MkClassType("bool");
12561 exp->op.exp1->destType->truth = 0x1;
12562 if(!exp->op.exp1->expType)
12563 ProcessExpressionType(exp->op.exp1);
12564 else
12565 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12566 FreeType(exp->op.exp1->expType);
12567 exp->op.exp1->expType = MkClassType("bool");
12568 exp->op.exp1->expType->truth = 0x1;
12569 }
12570 if(exp->op.exp2)
12571 {
12572 if(exp->op.exp2->destType)
12573 FreeType(exp->op.exp2->destType);
12574 exp->op.exp2->destType = MkClassType("bool");
12575 exp->op.exp2->destType->truth = 0x1;
12576 if(!exp->op.exp2->expType)
12577 ProcessExpressionType(exp->op.exp2);
12578 else
12579 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12580 FreeType(exp->op.exp2->expType);
12581 exp->op.exp2->expType = MkClassType("bool");
12582 exp->op.exp2->expType->truth = 0x1;
12583 }
12584 }
12585 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")))))
12586 {
12587 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
12588 {
12589 if(exp->op.exp2->destType)
12590 FreeType(exp->op.exp2->destType);
12591 exp->op.exp2->destType = type1;
12592 type1->refCount++;
12593 if(exp->op.exp1->destType)
12594 FreeType(exp->op.exp1->destType);
12595 exp->op.exp1->destType = type2;
12596 type2->refCount++;
12597 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)
12598 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);
12599 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
12600 {
12601 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12602
12603 if(argExp)
12604 {
12605 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12606
12607 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
12608 ProcessExpressionType(exp->op.exp1);
12609 if(type2->kind != 13)
12610 {
12611 ProcessExpressionType(classExp);
12612 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"))))))));
12613 if(!exp->op.exp2->expType)
12614 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
12615 ProcessExpressionType(exp->op.exp2);
12616 }
12617 }
12618 }
12619 if(!boolResult && ((type1->kind == 13 || type1->kind == 12 || (type1->kind == 8 && !strcmp(type1->_class->string, "String"))) && (type2->kind == 22 || type2->kind == 4 || type2->kind == 3 || type2->kind == 2 || type2->kind == 1)))
12620 {
12621 if(type1->kind != 8 && type1->type->kind == 0)
12622 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12623 exp->expType = type1;
12624 if(type1)
12625 type1->refCount++;
12626 }
12627 else if(!boolResult && ((type2->kind == 13 || type2->kind == 12 || (type2->kind == 8 && !strcmp(type2->_class->string, "String"))) && (type1->kind == 22 || type1->kind == 4 || type1->kind == 3 || type1->kind == 2 || type1->kind == 1)))
12628 {
12629 if(type2->kind != 8 && type2->type->kind == 0)
12630 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12631 exp->expType = type2;
12632 if(type2)
12633 type2->refCount++;
12634 }
12635 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))
12636 {
12637 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
12638 }
12639 else
12640 {
12641 unsigned int success = 0x0;
12642
12643 if(type1->kind == 13 && type2->kind == 13)
12644 {
12645 if(exp->op.op == '+')
12646 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12647 else if(exp->op.op == '-')
12648 {
12649 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
12650 {
12651 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
12652 success = 0x1;
12653 if(type1->type->kind == 20)
12654 {
12655 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12656
12657 if(argExp)
12658 {
12659 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12660
12661 ProcessExpressionType(classExp);
12662 exp->type = 5;
12663 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")))))));
12664 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
12665 FreeType(dummy);
12666 return ;
12667 }
12668 }
12669 }
12670 }
12671 }
12672 if(!success && exp->op.exp1->type == 2)
12673 {
12674 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12675 {
12676 if(exp->expType)
12677 FreeType(exp->expType);
12678 exp->expType = exp->op.exp1->destType;
12679 if(exp->op.exp1->destType)
12680 exp->op.exp1->destType->refCount++;
12681 success = 0x1;
12682 }
12683 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12684 {
12685 if(exp->expType)
12686 FreeType(exp->expType);
12687 exp->expType = exp->op.exp2->destType;
12688 if(exp->op.exp2->destType)
12689 exp->op.exp2->destType->refCount++;
12690 success = 0x1;
12691 }
12692 }
12693 else if(!success)
12694 {
12695 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12696 {
12697 if(exp->expType)
12698 FreeType(exp->expType);
12699 exp->expType = exp->op.exp2->destType;
12700 if(exp->op.exp2->destType)
12701 exp->op.exp2->destType->refCount++;
12702 success = 0x1;
12703 }
12704 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12705 {
12706 if(exp->expType)
12707 FreeType(exp->expType);
12708 exp->expType = exp->op.exp1->destType;
12709 if(exp->op.exp1->destType)
12710 exp->op.exp1->destType->refCount++;
12711 success = 0x1;
12712 }
12713 }
12714 if(!success)
12715 {
12716 char expString1[10240];
12717 char expString2[10240];
12718 char type1[1024];
12719 char type2[1024];
12720
12721 expString1[0] = '\0';
12722 expString2[0] = '\0';
12723 type1[0] = '\0';
12724 type2[0] = '\0';
12725 if(inCompiler)
12726 {
12727 PrintExpression(exp->op.exp1, expString1);
12728 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12729 PrintExpression(exp->op.exp2, expString2);
12730 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12731 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
12732 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
12733 }
12734 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
12735 }
12736 }
12737 }
12738 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12739 {
12740 if(exp->op.exp1->destType)
12741 FreeType(exp->op.exp1->destType);
12742 exp->op.exp1->destType = type2->_class->registered->dataType;
12743 if(type2->_class->registered->dataType)
12744 type2->_class->registered->dataType->refCount++;
12745 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12746 exp->expType = type2;
12747 if(type2)
12748 type2->refCount++;
12749 }
12750 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
12751 {
12752 if(exp->op.exp2->destType)
12753 FreeType(exp->op.exp2->destType);
12754 exp->op.exp2->destType = type1->_class->registered->dataType;
12755 if(type1->_class->registered->dataType)
12756 type1->_class->registered->dataType->refCount++;
12757 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12758 exp->expType = type1;
12759 if(type1)
12760 type1->refCount++;
12761 }
12762 else if(type1)
12763 {
12764 unsigned int valid = 0x0;
12765
12766 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
12767 {
12768 if(exp->op.exp2->destType)
12769 FreeType(exp->op.exp2->destType);
12770 if(!type1->_class->registered->dataType)
12771 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
12772 exp->op.exp2->destType = type1->_class->registered->dataType;
12773 exp->op.exp2->destType->refCount++;
12774 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12775 type2 = exp->op.exp2->destType;
12776 exp->expType = type2;
12777 type2->refCount++;
12778 }
12779 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
12780 {
12781 if(exp->op.exp1->destType)
12782 FreeType(exp->op.exp1->destType);
12783 if(!type2->_class->registered->dataType)
12784 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
12785 exp->op.exp1->destType = type2->_class->registered->dataType;
12786 exp->op.exp1->destType->refCount++;
12787 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12788 type1 = exp->op.exp1->destType;
12789 exp->expType = type1;
12790 type1->refCount++;
12791 }
12792 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
12793 {
12794 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
12795 {
12796 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
12797 {
12798 if(exp->expType)
12799 FreeType(exp->expType);
12800 exp->expType = exp->op.exp1->expType;
12801 if(exp->op.exp2->expType)
12802 exp->op.exp1->expType->refCount++;
12803 valid = 0x1;
12804 }
12805 }
12806 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
12807 {
12808 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
12809 {
12810 if(exp->expType)
12811 FreeType(exp->expType);
12812 exp->expType = exp->op.exp2->expType;
12813 if(exp->op.exp2->expType)
12814 exp->op.exp2->expType->refCount++;
12815 valid = 0x1;
12816 }
12817 }
12818 }
12819 if(!valid)
12820 {
12821 if(exp->op.exp2->destType)
12822 FreeType(exp->op.exp2->destType);
12823 exp->op.exp2->destType = type1;
12824 type1->refCount++;
12825 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12826 {
12827 if(exp->expType)
12828 FreeType(exp->expType);
12829 exp->expType = exp->op.exp2->destType;
12830 if(exp->op.exp2->destType)
12831 exp->op.exp2->destType->refCount++;
12832 }
12833 else if(type1 && type2)
12834 {
12835 char expString1[10240];
12836 char expString2[10240];
12837 char type1String[1024];
12838 char type2String[1024];
12839
12840 expString1[0] = '\0';
12841 expString2[0] = '\0';
12842 type1String[0] = '\0';
12843 type2String[0] = '\0';
12844 if(inCompiler)
12845 {
12846 PrintExpression(exp->op.exp1, expString1);
12847 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12848 PrintExpression(exp->op.exp2, expString2);
12849 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12850 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
12851 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
12852 }
12853 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
12854 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
12855 {
12856 exp->expType = exp->op.exp1->expType;
12857 if(exp->op.exp1->expType)
12858 exp->op.exp1->expType->refCount++;
12859 }
12860 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
12861 {
12862 exp->expType = exp->op.exp2->expType;
12863 if(exp->op.exp2->expType)
12864 exp->op.exp2->expType->refCount++;
12865 }
12866 }
12867 }
12868 }
12869 else if(type2)
12870 {
12871 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
12872 {
12873 struct Type * oldType = exp->op.exp1->expType;
12874
12875 exp->op.exp1->expType = (((void *)0));
12876 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12877 FreeType(oldType);
12878 else
12879 exp->op.exp1->expType = oldType;
12880 }
12881 if(exp->op.exp1->destType)
12882 FreeType(exp->op.exp1->destType);
12883 exp->op.exp1->destType = type2;
12884 type2->refCount++;
12885 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12886 {
12887 if(exp->expType)
12888 FreeType(exp->expType);
12889 exp->expType = exp->op.exp1->destType;
12890 if(exp->op.exp1->destType)
12891 exp->op.exp1->destType->refCount++;
12892 }
12893 }
12894 }
12895 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
12896 {
12897 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12898 {
12899 if(exp->op.exp1->destType)
12900 FreeType(exp->op.exp1->destType);
12901 exp->op.exp1->destType = type2->_class->registered->dataType;
12902 if(type2->_class->registered->dataType)
12903 type2->_class->registered->dataType->refCount++;
12904 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12905 }
12906 if(exp->op.op == '!')
12907 {
12908 exp->expType = MkClassType("bool");
12909 exp->expType->truth = 0x1;
12910 }
12911 else
12912 {
12913 exp->expType = type2;
12914 if(type2)
12915 type2->refCount++;
12916 }
12917 }
12918 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
12919 {
12920 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
12921 {
12922 if(exp->op.exp2->destType)
12923 FreeType(exp->op.exp2->destType);
12924 exp->op.exp2->destType = type1->_class->registered->dataType;
12925 if(type1->_class->registered->dataType)
12926 type1->_class->registered->dataType->refCount++;
12927 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12928 }
12929 exp->expType = type1;
12930 if(type1)
12931 type1->refCount++;
12932 }
12933 }
12934 yylloc = exp->loc;
12935 if(exp->op.exp1 && !exp->op.exp1->expType)
12936 {
12937 char expString[10000];
12938
12939 expString[0] = '\0';
12940 if(inCompiler)
12941 {
12942 PrintExpression(exp->op.exp1, expString);
12943 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12944 }
12945 if(expString[0])
12946 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
12947 }
12948 if(exp->op.exp2 && !exp->op.exp2->expType)
12949 {
12950 char expString[10240];
12951
12952 expString[0] = '\0';
12953 if(inCompiler)
12954 {
12955 PrintExpression(exp->op.exp2, expString);
12956 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12957 }
12958 if(expString[0])
12959 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
12960 }
12961 if(boolResult)
12962 {
12963 FreeType(exp->expType);
12964 exp->expType = MkClassType("bool");
12965 exp->expType->truth = 0x1;
12966 }
12967 if(exp->op.op != SIZEOF)
12968 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
12969 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
12970 {
12971 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
12972 }
12973 yylloc = oldyylloc;
12974 FreeType(dummy);
12975 break;
12976 }
12977 case 5:
12978 case 34:
12979 {
12980 struct Expression * e;
12981
12982 exp->isConstant = 0x1;
12983 for(e = (*exp->list).first; e; e = e->next)
12984 {
12985 unsigned int inced = 0x0;
12986
12987 if(!e->next)
12988 {
12989 FreeType(e->destType);
12990 e->destType = exp->destType;
12991 if(e->destType)
12992 {
12993 exp->destType->refCount++;
12994 e->destType->count++;
12995 inced = 0x1;
12996 }
12997 }
12998 ProcessExpressionType(e);
12999 if(inced)
13000 exp->destType->count--;
13001 if(!exp->expType && !e->next)
13002 {
13003 exp->expType = e->expType;
13004 if(e->expType)
13005 e->expType->refCount++;
13006 }
13007 if(!e->isConstant)
13008 exp->isConstant = 0x0;
13009 }
13010 e = (*exp->list).first;
13011 if(!e->next && e->type == 8)
13012 {
13013 struct Expression * next = exp->next, * prev = exp->prev;
13014
13015 FreeType(exp->expType);
13016 FreeType(exp->destType);
13017 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
13018 *exp = *e;
13019 exp->prev = prev;
13020 exp->next = next;
13021 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
13022 ProcessExpressionType(exp);
13023 }
13024 break;
13025 }
13026 case 6:
13027 {
13028 struct Expression * e;
13029
13030 exp->isConstant = 0x1;
13031 ProcessExpressionType(exp->index.exp);
13032 if(!exp->index.exp->isConstant)
13033 exp->isConstant = 0x0;
13034 if(exp->index.exp->expType)
13035 {
13036 struct Type * source = exp->index.exp->expType;
13037
13038 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)
13039 {
13040 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
13041
13042 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
13043 if(exp->index.index && (*exp->index.index).last)
13044 {
13045 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
13046 }
13047 }
13048 }
13049 for(e = (*exp->index.index).first; e; e = e->next)
13050 {
13051 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
13052 {
13053 if(e->destType)
13054 FreeType(e->destType);
13055 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
13056 }
13057 ProcessExpressionType(e);
13058 if(!e->next)
13059 {
13060 }
13061 if(!e->isConstant)
13062 exp->isConstant = 0x0;
13063 }
13064 if(!exp->expType)
13065 exp->expType = Dereference(exp->index.exp->expType);
13066 if(exp->expType)
13067 DeclareType(exp->expType, 0x0, 0x0);
13068 break;
13069 }
13070 case 7:
13071 {
13072 struct Expression * e;
13073 struct Type * functionType;
13074 struct Type * methodType = (((void *)0));
13075 char name[1024];
13076
13077 name[0] = '\0';
13078 if(inCompiler)
13079 {
13080 PrintExpression(exp->call.exp, name);
13081 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
13082 {
13083 PrintExpression(exp->call.exp, name);
13084 }
13085 }
13086 if(exp->call.exp->type == 0)
13087 {
13088 struct Expression * idExp = exp->call.exp;
13089 struct Identifier * id = idExp->identifier;
13090
13091 if(!strcmp(id->string, "__builtin_frame_address"))
13092 {
13093 exp->expType = ProcessTypeString("void *", 0x1);
13094 if(exp->call.arguments && (*exp->call.arguments).first)
13095 ProcessExpressionType((*exp->call.arguments).first);
13096 break;
13097 }
13098 else if(!strcmp(id->string, "__ENDIAN_PAD"))
13099 {
13100 exp->expType = ProcessTypeString("int", 0x1);
13101 if(exp->call.arguments && (*exp->call.arguments).first)
13102 ProcessExpressionType((*exp->call.arguments).first);
13103 break;
13104 }
13105 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
13106 {
13107 struct Expression * a = (((void *)0));
13108 struct Expression * b = (((void *)0));
13109 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
13110
13111 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
13112 {
13113 a = (*exp->call.arguments).first;
13114 b = (*exp->call.arguments).last;
13115 tempExp1 = a;
13116 tempExp2 = b;
13117 }
13118 else if((*exp->call.arguments).count == 1)
13119 {
13120 a = (*exp->call.arguments).first;
13121 tempExp1 = a;
13122 }
13123 if(a)
13124 {
13125 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
13126 idExp->identifier = (((void *)0));
13127 FreeExpContents(exp);
13128 ProcessExpressionType(a);
13129 if(b)
13130 ProcessExpressionType(b);
13131 exp->type = 5;
13132 exp->list = MkList();
13133 if(a->expType && (!b || b->expType))
13134 {
13135 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
13136 {
13137 if(inCompiler)
13138 {
13139 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13140 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
13141 struct Declaration * decl;
13142 char temp1[1024], temp2[1024];
13143
13144 GetTypeSpecs(a->expType, specs);
13145 if(a && !a->isConstant && a->type != 0)
13146 {
13147 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
13148 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
13149 tempExp1 = QMkExpId(temp1);
13150 tempExp1->expType = a->expType;
13151 if(a->expType)
13152 a->expType->refCount++;
13153 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
13154 }
13155 if(b && !b->isConstant && b->type != 0)
13156 {
13157 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
13158 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
13159 tempExp2 = QMkExpId(temp2);
13160 tempExp2->expType = b->expType;
13161 if(b->expType)
13162 b->expType->refCount++;
13163 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
13164 }
13165 decl = MkDeclaration(specs, decls);
13166 if(!curCompound->compound.declarations)
13167 curCompound->compound.declarations = MkList();
13168 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
13169 }
13170 }
13171 }
13172 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13173 {
13174 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13175
13176 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13177 exp->expType = a->expType;
13178 if(a->expType)
13179 a->expType->refCount++;
13180 }
13181 else if(!strcmp(id->string, "Abs"))
13182 {
13183 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13184 exp->expType = a->expType;
13185 if(a->expType)
13186 a->expType->refCount++;
13187 }
13188 else if(!strcmp(id->string, "Sgn"))
13189 {
13190 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"))))));
13191 exp->expType = ProcessTypeString("int", 0x0);
13192 }
13193 FreeExpression(tempExp1);
13194 if(tempExp2)
13195 FreeExpression(tempExp2);
13196 FreeIdentifier(id);
13197 break;
13198 }
13199 }
13200 }
13201 {
13202 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
13203
13204 if(!exp->call.exp->destType)
13205 {
13206 exp->call.exp->destType = dummy;
13207 dummy->refCount++;
13208 }
13209 ProcessExpressionType(exp->call.exp);
13210 if(exp->call.exp->destType == dummy)
13211 {
13212 FreeType(dummy);
13213 exp->call.exp->destType = (((void *)0));
13214 }
13215 FreeType(dummy);
13216 }
13217 functionType = exp->call.exp->expType;
13218 if(functionType && functionType->kind == 16)
13219 {
13220 methodType = functionType;
13221 functionType = methodType->method->dataType;
13222 if(exp->call.exp->expType->usedClass)
13223 {
13224 char typeString[1024];
13225
13226 typeString[0] = '\0';
13227 PrintType(functionType, typeString, 0x1, 0x1);
13228 if(strstr(typeString, "thisclass"))
13229 {
13230 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13231 struct Declarator * decl;
13232
13233 {
13234 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13235
13236 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13237 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13238 thisClassParams = 0x0;
13239 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13240 {
13241 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13242
13243 thisClass = exp->call.exp->expType->usedClass;
13244 ProcessDeclarator(decl);
13245 thisClass = backupThisClass;
13246 }
13247 thisClassParams = 0x1;
13248 functionType = ProcessType(specs, decl);
13249 functionType->refCount = 0;
13250 FinishTemplatesContext(context);
13251 }
13252 FreeList(specs, FreeSpecifier);
13253 FreeDeclarator(decl);
13254 }
13255 }
13256 }
13257 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13258 {
13259 struct Type * type = functionType->type;
13260
13261 if(!functionType->refCount)
13262 {
13263 functionType->type = (((void *)0));
13264 FreeType(functionType);
13265 }
13266 functionType = type;
13267 }
13268 if(functionType && functionType->kind != 11)
13269 {
13270 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13271 }
13272 else if(functionType)
13273 {
13274 unsigned int emptyParams = 0x0, noParams = 0x0;
13275 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13276 struct Type * type = functionType->params.first;
13277 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13278 int extra = 0;
13279 struct Location oldyylloc = yylloc;
13280
13281 if(!type)
13282 emptyParams = 0x1;
13283 if(functionType->extraParam && e)
13284 {
13285 e->destType = MkClassType(functionType->thisClass->string);
13286 e = e->next;
13287 }
13288 if(!functionType->staticMethod)
13289 {
13290 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13291 {
13292 type = MkClassType(memberExp->member.exp->expType->_class->string);
13293 if(e)
13294 {
13295 e->destType = type;
13296 e = e->next;
13297 type = functionType->params.first;
13298 }
13299 else
13300 type->refCount = 0;
13301 }
13302 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13303 {
13304 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13305 if(e)
13306 {
13307 e->destType = type;
13308 e = e->next;
13309 type = functionType->params.first;
13310 }
13311 else
13312 type->refCount = 0;
13313 }
13314 }
13315 if(type && type->kind == 0)
13316 {
13317 noParams = 0x1;
13318 if(!type->refCount)
13319 FreeType(type);
13320 type = (((void *)0));
13321 }
13322 for(; e; e = e->next)
13323 {
13324 if(!type && !emptyParams)
13325 {
13326 yylloc = e->loc;
13327 if(methodType && methodType->methodClass)
13328 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);
13329 else
13330 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);
13331 break;
13332 }
13333 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13334 {
13335 struct Type * templatedType = (((void *)0));
13336 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13337 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13338 int id = 0;
13339
13340 if(_class && _class->templateArgs)
13341 {
13342 struct __ecereNameSpace__ecere__com__Class * sClass;
13343
13344 for(sClass = _class; sClass; sClass = sClass->base)
13345 {
13346 if(sClass->templateClass)
13347 sClass = sClass->templateClass;
13348 id = 0;
13349 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13350 {
13351 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13352 {
13353 struct __ecereNameSpace__ecere__com__Class * nextClass;
13354
13355 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13356 {
13357 if(nextClass->templateClass)
13358 nextClass = nextClass->templateClass;
13359 id += nextClass->templateParams.count;
13360 }
13361 break;
13362 }
13363 id++;
13364 }
13365 if(curParam)
13366 break;
13367 }
13368 }
13369 if(curParam && _class->templateArgs[id].dataTypeString)
13370 {
13371 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13372
13373 {
13374 struct Context * context = SetupTemplatesContext(_class);
13375
13376 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13377 FinishTemplatesContext(context);
13378 }
13379 e->destType = templatedType;
13380 if(templatedType)
13381 {
13382 templatedType->passAsTemplate = 0x1;
13383 }
13384 }
13385 else
13386 {
13387 e->destType = type;
13388 if(type)
13389 type->refCount++;
13390 }
13391 }
13392 else
13393 {
13394 e->destType = type;
13395 if(type)
13396 type->refCount++;
13397 }
13398 if(type && type->kind != 14)
13399 {
13400 struct Type * next = type->next;
13401
13402 if(!type->refCount)
13403 FreeType(type);
13404 type = next;
13405 }
13406 }
13407 if(type && type->kind != 14)
13408 {
13409 if(methodType && methodType->methodClass)
13410 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);
13411 else
13412 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);
13413 }
13414 yylloc = oldyylloc;
13415 if(type && !type->refCount)
13416 FreeType(type);
13417 }
13418 else
13419 {
13420 functionType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 0, ((struct Type *)__ecereTemp1)->kind = 11, ((struct Type *)__ecereTemp1));
13421 if(exp->call.exp->type == 0)
13422 {
13423 char * string = exp->call.exp->identifier->string;
13424
13425 if(inCompiler)
13426 {
13427 struct Symbol * symbol;
13428 struct Location oldyylloc = yylloc;
13429
13430 yylloc = exp->call.exp->identifier->loc;
13431 if(strstr(string, "__builtin_") == string)
13432 ;
13433 else
13434 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13435 symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->string = __ecereNameSpace__ecere__sys__CopyString(string), ((struct Symbol *)__ecereTemp1)->type = ProcessTypeString("int()", 0x1), ((struct Symbol *)__ecereTemp1));
13436 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13437 if(strstr(symbol->string, "::"))
13438 globalContext->hasNameSpace = 0x1;
13439 yylloc = oldyylloc;
13440 }
13441 }
13442 else if(exp->call.exp->type == 8)
13443 {
13444 }
13445 else
13446 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13447 if(!functionType->returnType)
13448 {
13449 functionType->returnType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
13450 }
13451 }
13452 if(functionType && functionType->kind == 11)
13453 {
13454 exp->expType = functionType->returnType;
13455 if(functionType->returnType)
13456 functionType->returnType->refCount++;
13457 if(!functionType->refCount)
13458 FreeType(functionType);
13459 }
13460 if(exp->call.arguments)
13461 {
13462 for(e = (*exp->call.arguments).first; e; e = e->next)
13463 {
13464 struct Type * destType = e->destType;
13465
13466 ProcessExpressionType(e);
13467 }
13468 }
13469 break;
13470 }
13471 case 8:
13472 {
13473 struct Type * type;
13474 struct Location oldyylloc = yylloc;
13475 unsigned int thisPtr = (exp->member.exp && exp->member.exp->type == 0 && !strcmp(exp->member.exp->identifier->string, "this"));
13476
13477 exp->thisPtr = thisPtr;
13478 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13479 {
13480 exp->member.member->classSym = exp->member.member->_class->symbol;
13481 }
13482 ProcessExpressionType(exp->member.exp);
13483 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)
13484 {
13485 exp->isConstant = 0x0;
13486 }
13487 else
13488 exp->isConstant = exp->member.exp->isConstant;
13489 type = exp->member.exp->expType;
13490 yylloc = exp->loc;
13491 if(type && (type->kind == 20))
13492 {
13493 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13494 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13495
13496 if(_class)
13497 {
13498 for(param = _class->templateParams.first; param; param = param->next)
13499 {
13500 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
13501 break;
13502 }
13503 }
13504 if(param && param->defaultArg.member)
13505 {
13506 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
13507
13508 if(argExp)
13509 {
13510 struct Expression * expMember = exp->member.exp;
13511 struct Declarator * decl;
13512 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13513 char thisClassTypeString[1024];
13514
13515 FreeIdentifier(exp->member.member);
13516 ProcessExpressionType(argExp);
13517 {
13518 char * colon = strstr(param->defaultArg.memberString, "::");
13519
13520 if(colon)
13521 {
13522 char className[1024];
13523 struct __ecereNameSpace__ecere__com__Class * sClass;
13524
13525 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
13526 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
13527 }
13528 else
13529 strcpy(thisClassTypeString, _class->fullName);
13530 }
13531 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
13532 exp->expType = ProcessType(specs, decl);
13533 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
13534 {
13535 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13536 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13537 int c;
13538 int paramCount = 0;
13539 int lastParam = -1;
13540 char templateString[1024];
13541 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13542
13543 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13544 for(cClass = expClass; cClass; cClass = cClass->base)
13545 {
13546 int p = 0;
13547
13548 for(param = cClass->templateParams.first; param; param = param->next)
13549 {
13550 int id = p;
13551 struct __ecereNameSpace__ecere__com__Class * sClass;
13552 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13553
13554 for(sClass = cClass->base; sClass; sClass = sClass->base)
13555 id += sClass->templateParams.count;
13556 arg = expClass->templateArgs[id];
13557 for(sClass = _class; sClass; sClass = sClass->base)
13558 {
13559 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
13560 int p = 0;
13561 struct __ecereNameSpace__ecere__com__Class * nextClass;
13562
13563 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13564 p += nextClass->templateParams.count;
13565 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
13566 {
13567 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
13568 {
13569 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13570 {
13571 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
13572 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
13573 break;
13574 }
13575 }
13576 }
13577 }
13578 {
13579 char argument[256];
13580
13581 argument[0] = '\0';
13582 switch(param->type)
13583 {
13584 case 2:
13585 {
13586 char expString[1024];
13587 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13588 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13589 struct Expression * exp;
13590 char * string = PrintHexUInt64(arg.expression.ui64);
13591
13592 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13593 ProcessExpressionType(exp);
13594 ComputeExpression(exp);
13595 expString[0] = '\0';
13596 PrintExpression(exp, expString);
13597 strcat(argument, expString);
13598 FreeExpression(exp);
13599 break;
13600 }
13601 case 1:
13602 {
13603 strcat(argument, arg.member->name);
13604 break;
13605 }
13606 case 0:
13607 {
13608 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13609 {
13610 if(!strcmp(arg.dataTypeString, "thisclass"))
13611 strcat(argument, thisClassTypeString);
13612 else
13613 strcat(argument, arg.dataTypeString);
13614 }
13615 break;
13616 }
13617 }
13618 if(argument[0])
13619 {
13620 if(paramCount)
13621 strcat(templateString, ", ");
13622 if(lastParam != p - 1)
13623 {
13624 strcat(templateString, param->name);
13625 strcat(templateString, " = ");
13626 }
13627 strcat(templateString, argument);
13628 paramCount++;
13629 lastParam = p;
13630 }
13631 p++;
13632 }
13633 }
13634 }
13635 {
13636 int len = strlen(templateString);
13637
13638 if(templateString[len - 1] == '>')
13639 templateString[len++] = ' ';
13640 templateString[len++] = '>';
13641 templateString[len++] = '\0';
13642 }
13643 {
13644 struct Context * context = SetupTemplatesContext(_class);
13645
13646 FreeType(exp->expType);
13647 exp->expType = ProcessTypeString(templateString, 0x0);
13648 FinishTemplatesContext(context);
13649 }
13650 }
13651 exp->type = 5;
13652 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")))))))));
13653 }
13654 }
13655 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
13656 {
13657 type = ProcessTemplateParameterType(type->templateParameter);
13658 }
13659 }
13660 if(type && (type->kind == 20))
13661 ;
13662 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13663 {
13664 struct Identifier * id = exp->member.member;
13665 int typeKind = type->kind;
13666 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));
13667
13668 if(typeKind == 19 && exp->member.exp->type == 26)
13669 {
13670 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
13671 typeKind = 8;
13672 }
13673 if(id && (typeKind == 3 || typeKind == 15))
13674 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
13675 if(_class && id)
13676 {
13677 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
13678 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
13679 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
13680 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
13681 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
13682
13683 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
13684 exp->member.memberType = 1;
13685 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
13686 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
13687 if(typeKind != 19)
13688 {
13689 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
13690 {
13691 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13692 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
13693 {
13694 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13695 if(prop)
13696 member = (((void *)0));
13697 }
13698 if(!member && !prop)
13699 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13700 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
13701 exp->member.thisPtr = 0x1;
13702 }
13703 else
13704 {
13705 if(!id->classSym)
13706 {
13707 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
13708 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13709 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
13710 }
13711 if(!prop && !member)
13712 {
13713 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
13714 if(!method)
13715 {
13716 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13717 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13718 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13719 }
13720 }
13721 if(member && prop)
13722 {
13723 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
13724 prop = (((void *)0));
13725 else
13726 member = (((void *)0));
13727 }
13728 }
13729 }
13730 if(!prop && !member)
13731 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
13732 if(!prop && !member && !method)
13733 {
13734 if(typeKind == 19)
13735 {
13736 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
13737 if(classProp)
13738 {
13739 exp->member.memberType = 5;
13740 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
13741 }
13742 else
13743 {
13744 char structName[1024];
13745 struct Identifier * id = exp->member.member;
13746 struct Expression * classExp = exp->member.exp;
13747
13748 type->refCount++;
13749 FreeType(classExp->expType);
13750 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
13751 strcpy(structName, "__ecereClassData_");
13752 FullClassNameCat(structName, type->_class->string, 0x0);
13753 exp->type = 9;
13754 exp->member.member = id;
13755 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"))))))));
13756 FreeType(type);
13757 ProcessExpressionType(exp);
13758 return ;
13759 }
13760 }
13761 else
13762 {
13763 struct Symbol * classSym = FindClass(id->string);
13764
13765 if(classSym)
13766 {
13767 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
13768
13769 if(convertClass)
13770 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
13771 }
13772 }
13773 }
13774 if(prop)
13775 {
13776 exp->member.memberType = 1;
13777 if(!prop->dataType)
13778 ProcessPropertyType(prop);
13779 exp->expType = prop->dataType;
13780 if(prop->dataType)
13781 prop->dataType->refCount++;
13782 }
13783 else if(member)
13784 {
13785 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
13786 {
13787 FreeExpContents(exp);
13788 exp->type = 0;
13789 exp->identifier = MkIdentifier("class");
13790 ProcessExpressionType(exp);
13791 return ;
13792 }
13793 exp->member.memberType = 3;
13794 DeclareStruct(_class->fullName, 0x0);
13795 if(!member->dataType)
13796 {
13797 struct Context * context = SetupTemplatesContext(_class);
13798
13799 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
13800 FinishTemplatesContext(context);
13801 }
13802 exp->expType = member->dataType;
13803 if(member->dataType)
13804 member->dataType->refCount++;
13805 }
13806 else if(revConvert)
13807 {
13808 exp->member.memberType = 4;
13809 exp->expType = MkClassType(revConvert->_class->fullName);
13810 }
13811 else if(method)
13812 {
13813 if(inCompiler)
13814 {
13815 exp->member.memberType = 2;
13816 }
13817 if(!method->dataType)
13818 ProcessMethodType(method);
13819 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 16, ((struct Type *)__ecereTemp1)->method = method, ((struct Type *)__ecereTemp1));
13820 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
13821 exp->expType->usedClass = _class;
13822 }
13823 else if(!classProp)
13824 {
13825 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
13826 {
13827 FreeExpContents(exp);
13828 exp->type = 0;
13829 exp->identifier = MkIdentifier("class");
13830 ProcessExpressionType(exp);
13831 return ;
13832 }
13833 yylloc = exp->member.member->loc;
13834 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
13835 if(inCompiler)
13836 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
13837 }
13838 if(_class && exp->expType)
13839 {
13840 struct __ecereNameSpace__ecere__com__Class * tClass;
13841
13842 tClass = _class;
13843 while(tClass && !tClass->templateClass)
13844 tClass = tClass->base;
13845 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
13846 {
13847 int id = 0;
13848 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13849 struct __ecereNameSpace__ecere__com__Class * sClass;
13850
13851 for(sClass = tClass; sClass; sClass = sClass->base)
13852 {
13853 id = 0;
13854 if(sClass->templateClass)
13855 sClass = sClass->templateClass;
13856 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13857 {
13858 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
13859 {
13860 for(sClass = sClass->base; sClass; sClass = sClass->base)
13861 id += sClass->templateParams.count;
13862 break;
13863 }
13864 id++;
13865 }
13866 if(curParam)
13867 break;
13868 }
13869 if(curParam && tClass->templateArgs[id].dataTypeString)
13870 {
13871 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
13872 struct Context * context = SetupTemplatesContext(tClass);
13873
13874 FreeType(exp->expType);
13875 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
13876 if(exp->expType)
13877 {
13878 if(exp->expType->kind == 21)
13879 {
13880 FreeType(exp->expType);
13881 exp->expType = ReplaceThisClassType(_class);
13882 }
13883 if(tClass->templateClass)
13884 exp->expType->passAsTemplate = 0x1;
13885 if(!exp->destType)
13886 {
13887 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
13888 if(exp->destType->kind == 21)
13889 {
13890 FreeType(exp->destType);
13891 exp->destType = ReplaceThisClassType(_class);
13892 }
13893 }
13894 }
13895 FinishTemplatesContext(context);
13896 }
13897 }
13898 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
13899 {
13900 int id = 0;
13901 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13902 struct __ecereNameSpace__ecere__com__Class * sClass;
13903
13904 for(sClass = tClass; sClass; sClass = sClass->base)
13905 {
13906 id = 0;
13907 if(sClass->templateClass)
13908 sClass = sClass->templateClass;
13909 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13910 {
13911 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
13912 {
13913 for(sClass = sClass->base; sClass; sClass = sClass->base)
13914 id += sClass->templateParams.count;
13915 break;
13916 }
13917 id++;
13918 }
13919 if(curParam)
13920 break;
13921 }
13922 if(curParam)
13923 {
13924 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
13925 struct Context * context = SetupTemplatesContext(tClass);
13926 struct Type * basicType;
13927
13928 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
13929 if(basicType)
13930 {
13931 if(basicType->kind == 21)
13932 {
13933 FreeType(basicType);
13934 basicType = ReplaceThisClassType(_class);
13935 }
13936 FreeType(exp->expType);
13937 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = basicType, ((struct Type *)__ecereTemp1));
13938 if(!exp->destType)
13939 {
13940 exp->destType = exp->expType;
13941 exp->destType->refCount++;
13942 }
13943 {
13944 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13945 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13946 struct Declarator * decl;
13947
13948 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
13949 *newExp = *exp;
13950 if(exp->destType)
13951 exp->destType->refCount++;
13952 if(exp->expType)
13953 exp->expType->refCount++;
13954 exp->type = 11;
13955 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
13956 exp->cast.exp = newExp;
13957 }
13958 }
13959 FinishTemplatesContext(context);
13960 }
13961 }
13962 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
13963 {
13964 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13965
13966 if(expClass)
13967 {
13968 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13969 int c;
13970 int p = 0;
13971 int paramCount = 0;
13972 int lastParam = -1;
13973 char templateString[1024];
13974 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13975
13976 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13977 while(cClass != expClass)
13978 {
13979 struct __ecereNameSpace__ecere__com__Class * sClass;
13980
13981 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
13982 ;
13983 cClass = sClass;
13984 for(param = cClass->templateParams.first; param; param = param->next)
13985 {
13986 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
13987 int c;
13988 int cp = 0;
13989 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
13990 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13991
13992 while(cClassCur != tClass && !paramCur)
13993 {
13994 struct __ecereNameSpace__ecere__com__Class * sClassCur;
13995
13996 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
13997 ;
13998 cClassCur = sClassCur;
13999 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
14000 {
14001 if(!strcmp(paramCur->name, param->name))
14002 {
14003 break;
14004 }
14005 cp++;
14006 }
14007 }
14008 if(paramCur && paramCur->type == 0)
14009 arg = tClass->templateArgs[cp];
14010 else
14011 arg = expClass->templateArgs[p];
14012 {
14013 char argument[256];
14014
14015 argument[0] = '\0';
14016 switch(param->type)
14017 {
14018 case 2:
14019 {
14020 char expString[1024];
14021 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14022 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14023 struct Expression * exp;
14024 char * string = PrintHexUInt64(arg.expression.ui64);
14025
14026 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14027 ProcessExpressionType(exp);
14028 ComputeExpression(exp);
14029 expString[0] = '\0';
14030 PrintExpression(exp, expString);
14031 strcat(argument, expString);
14032 FreeExpression(exp);
14033 break;
14034 }
14035 case 1:
14036 {
14037 strcat(argument, arg.member->name);
14038 break;
14039 }
14040 case 0:
14041 {
14042 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14043 strcat(argument, arg.dataTypeString);
14044 break;
14045 }
14046 }
14047 if(argument[0])
14048 {
14049 if(paramCount)
14050 strcat(templateString, ", ");
14051 if(lastParam != p - 1)
14052 {
14053 strcat(templateString, param->name);
14054 strcat(templateString, " = ");
14055 }
14056 strcat(templateString, argument);
14057 paramCount++;
14058 lastParam = p;
14059 }
14060 }
14061 p++;
14062 }
14063 }
14064 {
14065 int len = strlen(templateString);
14066
14067 if(templateString[len - 1] == '>')
14068 templateString[len++] = ' ';
14069 templateString[len++] = '>';
14070 templateString[len++] = '\0';
14071 }
14072 FreeType(exp->expType);
14073 {
14074 struct Context * context = SetupTemplatesContext(tClass);
14075
14076 exp->expType = ProcessTypeString(templateString, 0x0);
14077 FinishTemplatesContext(context);
14078 }
14079 }
14080 }
14081 }
14082 }
14083 else
14084 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)");
14085 }
14086 else if(type && (type->kind == 9 || type->kind == 10))
14087 {
14088 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
14089
14090 if(memberType)
14091 {
14092 exp->expType = memberType;
14093 if(memberType)
14094 memberType->refCount++;
14095 }
14096 }
14097 else
14098 {
14099 char expString[10240];
14100
14101 expString[0] = '\0';
14102 if(inCompiler)
14103 {
14104 PrintExpression(exp, expString);
14105 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14106 }
14107 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
14108 }
14109 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
14110 {
14111 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
14112 {
14113 struct Identifier * id = exp->member.member;
14114 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));
14115
14116 if(_class)
14117 {
14118 FreeType(exp->expType);
14119 exp->expType = ReplaceThisClassType(_class);
14120 }
14121 }
14122 }
14123 yylloc = oldyylloc;
14124 break;
14125 }
14126 case 9:
14127 {
14128 struct Type * destType = exp->destType;
14129
14130 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
14131 {
14132 exp->member.member->classSym = exp->member.member->_class->symbol;
14133 }
14134 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
14135 exp->type = 8;
14136 if(destType)
14137 destType->count++;
14138 ProcessExpressionType(exp);
14139 if(destType)
14140 destType->count--;
14141 break;
14142 }
14143 case 15:
14144 {
14145 struct Symbol * classSym = exp->_class->symbol;
14146
14147 if(classSym && classSym->registered)
14148 {
14149 if(classSym->registered->type == 5)
14150 {
14151 char name[1024];
14152
14153 name[0] = '\0';
14154 DeclareStruct(classSym->string, 0x0);
14155 FreeSpecifier(exp->_class);
14156 exp->type = 10;
14157 FullClassNameCat(name, classSym->string, 0x0);
14158 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
14159 }
14160 else
14161 {
14162 if(classSym->registered->fixed)
14163 {
14164 FreeSpecifier(exp->_class);
14165 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
14166 exp->type = 2;
14167 }
14168 else
14169 {
14170 char className[1024];
14171
14172 strcpy(className, "__ecereClass_");
14173 FullClassNameCat(className, classSym->string, 0x1);
14174 MangleClassName(className);
14175 DeclareClass(classSym, className);
14176 FreeExpContents(exp);
14177 exp->type = 9;
14178 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14179 exp->member.member = MkIdentifier("structSize");
14180 }
14181 }
14182 }
14183 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14184 break;
14185 }
14186 case 10:
14187 {
14188 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
14189
14190 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14191 exp->isConstant = 0x1;
14192 DeclareType(type, 0x0, 0x0);
14193 FreeType(type);
14194 break;
14195 }
14196 case 11:
14197 {
14198 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14199
14200 type->count = (unsigned int)1;
14201 FreeType(exp->cast.exp->destType);
14202 exp->cast.exp->destType = type;
14203 type->refCount++;
14204 ProcessExpressionType(exp->cast.exp);
14205 type->count = (unsigned int)0;
14206 exp->expType = type;
14207 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14208 {
14209 void * prev = exp->prev, * next = exp->next;
14210 struct Type * expType = exp->cast.exp->destType;
14211 struct Expression * castExp = exp->cast.exp;
14212 struct Type * destType = exp->destType;
14213
14214 if(expType)
14215 expType->refCount++;
14216 FreeType(exp->expType);
14217 FreeTypeName(exp->cast.typeName);
14218 *exp = *castExp;
14219 FreeType(exp->expType);
14220 FreeType(exp->destType);
14221 exp->expType = expType;
14222 exp->destType = destType;
14223 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14224 exp->prev = prev;
14225 exp->next = next;
14226 }
14227 else
14228 {
14229 exp->isConstant = exp->cast.exp->isConstant;
14230 }
14231 break;
14232 }
14233 case 35:
14234 {
14235 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14236
14237 type->refCount++;
14238 exp->expType = type;
14239 break;
14240 }
14241 case 36:
14242 {
14243 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14244
14245 ProcessExpressionType(exp->vaArg.exp);
14246 type->refCount++;
14247 exp->expType = type;
14248 break;
14249 }
14250 case 12:
14251 {
14252 struct Expression * e;
14253
14254 exp->isConstant = 0x1;
14255 FreeType(exp->cond.cond->destType);
14256 exp->cond.cond->destType = MkClassType("bool");
14257 exp->cond.cond->destType->truth = 0x1;
14258 ProcessExpressionType(exp->cond.cond);
14259 if(!exp->cond.cond->isConstant)
14260 exp->isConstant = 0x0;
14261 for(e = (*exp->cond.exp).first; e; e = e->next)
14262 {
14263 if(!e->next)
14264 {
14265 FreeType(e->destType);
14266 e->destType = exp->destType;
14267 if(e->destType)
14268 e->destType->refCount++;
14269 }
14270 ProcessExpressionType(e);
14271 if(!e->next)
14272 {
14273 exp->expType = e->expType;
14274 if(e->expType)
14275 e->expType->refCount++;
14276 }
14277 if(!e->isConstant)
14278 exp->isConstant = 0x0;
14279 }
14280 FreeType(exp->cond.elseExp->destType);
14281 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14282 if(exp->cond.elseExp->destType)
14283 exp->cond.elseExp->destType->refCount++;
14284 ProcessExpressionType(exp->cond.elseExp);
14285 if(!exp->cond.elseExp->isConstant)
14286 exp->isConstant = 0x0;
14287 break;
14288 }
14289 case 25:
14290 {
14291 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14292 {
14293 struct Statement * last = (*exp->compound->compound.statements).last;
14294
14295 if(last->type == 3 && last->expressions && (*last->expressions).last)
14296 {
14297 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14298 if(exp->destType)
14299 exp->destType->refCount++;
14300 }
14301 ProcessStatement(exp->compound);
14302 exp->expType = ((struct Expression *)(*last->expressions).last)->expType;
14303 if(((struct Expression *)(*last->expressions).last)->expType)
14304 exp->expType->refCount++;
14305 }
14306 break;
14307 }
14308 case 26:
14309 {
14310 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14311
14312 if(spec && spec->type == 1)
14313 {
14314 exp->expType = MkClassType(spec->name);
14315 exp->expType->kind = 19;
14316 exp->byReference = 0x1;
14317 }
14318 else
14319 {
14320 exp->expType = MkClassType("ecere::com::Class");
14321 exp->byReference = 0x1;
14322 }
14323 break;
14324 }
14325 case 27:
14326 {
14327 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14328
14329 if(_class)
14330 {
14331 struct Identifier * id = exp->classData.id;
14332 char structName[1024];
14333 struct Expression * classExp;
14334
14335 strcpy(structName, "__ecereClassData_");
14336 FullClassNameCat(structName, _class->fullName, 0x0);
14337 exp->type = 9;
14338 exp->member.member = id;
14339 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14340 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14341 else
14342 classExp = MkExpIdentifier(MkIdentifier("class"));
14343 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"))))))));
14344 ProcessExpressionType(exp);
14345 return ;
14346 }
14347 break;
14348 }
14349 case 37:
14350 {
14351 struct Type * type = (((void *)0));
14352 char * typeString = (((void *)0));
14353 char typeStringBuf[1024];
14354
14355 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))
14356 {
14357 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14358
14359 typeString = templateClass->templateArgs[2].dataTypeString;
14360 }
14361 else if(exp->list)
14362 {
14363 struct Expression * e;
14364
14365 for(e = (*exp->list).first; e; e = e->next)
14366 {
14367 ProcessExpressionType(e);
14368 if(e->expType)
14369 {
14370 if(!type)
14371 {
14372 type = e->expType;
14373 type->refCount++;
14374 }
14375 else
14376 {
14377 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14378 {
14379 FreeType(type);
14380 type = e->expType;
14381 e->expType = (((void *)0));
14382 e = (*exp->list).first;
14383 ProcessExpressionType(e);
14384 if(e->expType)
14385 {
14386 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14387 {
14388 FreeType(e->expType);
14389 e->expType = (((void *)0));
14390 FreeType(type);
14391 type = (((void *)0));
14392 break;
14393 }
14394 }
14395 }
14396 }
14397 if(e->expType)
14398 {
14399 FreeType(e->expType);
14400 e->expType = (((void *)0));
14401 }
14402 }
14403 }
14404 if(type)
14405 {
14406 typeStringBuf[0] = '\0';
14407 PrintType(type, typeStringBuf, 0x0, 0x1);
14408 typeString = typeStringBuf;
14409 FreeType(type);
14410 type = (((void *)0));
14411 }
14412 }
14413 if(typeString)
14414 {
14415 char templateString[1024];
14416 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14417 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14418 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14419 struct Expression * expExt;
14420 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14421
14422 sprintf(templateString, "Container<%s>", typeString);
14423 if(exp->list)
14424 {
14425 struct Expression * e;
14426
14427 type = ProcessTypeString(typeString, 0x0);
14428 while(e = (*exp->list).first)
14429 {
14430 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14431 e->destType = type;
14432 type->refCount++;
14433 ProcessExpressionType(e);
14434 ListAdd(initializers, MkInitializerAssignment(e));
14435 }
14436 FreeType(type);
14437 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14438 }
14439 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
14440 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
14441 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14442 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
14443 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14444 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
14445 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14446 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
14447 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14448 ListAdd(structInitializers, MkInitializerAssignment((__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression), ((struct Expression *)__ecereTemp1)->type = 2, ((struct Expression *)__ecereTemp1)->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, (void *)0), ((struct Expression *)__ecereTemp1))));
14449 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14450 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
14451 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14452 exp->expType = ProcessTypeString(templateString, 0x0);
14453 exp->type = 5;
14454 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
14455 ProcessExpressionType(expExt);
14456 }
14457 else
14458 {
14459 exp->expType = ProcessTypeString("Container", 0x0);
14460 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
14461 }
14462 break;
14463 }
14464 }
14465 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
14466 {
14467 FreeType(exp->expType);
14468 exp->expType = ReplaceThisClassType(thisClass);
14469 }
14470 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
14471 {
14472 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
14473
14474 if(symbol)
14475 {
14476 if(exp->expType->kind != 15)
14477 {
14478 struct Type * member;
14479 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
14480
14481 FreeType(exp->expType);
14482 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14483 exp->expType->kind = symbol->type->kind;
14484 exp->expType->refCount++;
14485 exp->expType->enumName = enumName;
14486 exp->expType->members = symbol->type->members;
14487 for(member = symbol->type->members.first; member; member = member->next)
14488 member->refCount++;
14489 }
14490 else
14491 {
14492 struct __ecereNameSpace__ecere__sys__NamedLink * member;
14493
14494 for(member = symbol->type->members.first; member; member = member->next)
14495 {
14496 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(16), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
14497
14498 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
14499 }
14500 }
14501 }
14502 }
14503 yylloc = exp->loc;
14504 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
14505 ;
14506 else if(exp->destType && !exp->destType->keepCast)
14507 {
14508 if(!CheckExpressionType(exp, exp->destType, 0x0))
14509 {
14510 if(!exp->destType->count || unresolved)
14511 {
14512 if(!exp->expType)
14513 {
14514 yylloc = exp->loc;
14515 if(exp->destType->kind != 14)
14516 {
14517 char type2[1024];
14518
14519 type2[0] = '\0';
14520 if(inCompiler)
14521 {
14522 char expString[10240];
14523
14524 expString[0] = '\0';
14525 PrintType(exp->destType, type2, 0x0, 0x1);
14526 if(inCompiler)
14527 {
14528 PrintExpression(exp, expString);
14529 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14530 }
14531 if(unresolved)
14532 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
14533 else if(exp->type != 16)
14534 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
14535 }
14536 }
14537 else
14538 {
14539 char expString[10240];
14540
14541 expString[0] = '\0';
14542 if(inCompiler)
14543 {
14544 PrintExpression(exp, expString);
14545 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14546 }
14547 if(unresolved)
14548 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
14549 else if(exp->type != 16)
14550 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14551 }
14552 }
14553 else
14554 {
14555 char type1[1024];
14556 char type2[1024];
14557
14558 type1[0] = '\0';
14559 type2[0] = '\0';
14560 if(inCompiler)
14561 {
14562 PrintType(exp->expType, type1, 0x0, 0x1);
14563 PrintType(exp->destType, type2, 0x0, 0x1);
14564 }
14565 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)))
14566 ;
14567 else
14568 {
14569 char expString[10240];
14570
14571 expString[0] = '\0';
14572 if(inCompiler)
14573 {
14574 PrintExpression(exp, expString);
14575 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14576 }
14577 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
14578 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
14579 FreeType(exp->expType);
14580 exp->destType->refCount++;
14581 exp->expType = exp->destType;
14582 }
14583 }
14584 }
14585 }
14586 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
14587 {
14588 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14589 char typeString[1024];
14590 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14591 struct Declarator * decl;
14592
14593 typeString[0] = '\0';
14594 *newExp = *exp;
14595 if(exp->expType)
14596 exp->expType->refCount++;
14597 if(exp->expType)
14598 exp->expType->refCount++;
14599 exp->type = 11;
14600 newExp->destType = exp->expType;
14601 PrintType(exp->expType, typeString, 0x0, 0x0);
14602 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14603 exp->cast.typeName = MkTypeName(specs, decl);
14604 exp->cast.exp = newExp;
14605 }
14606 }
14607 else if(unresolved)
14608 {
14609 if(exp->identifier->_class && exp->identifier->_class->name)
14610 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
14611 else if(exp->identifier->string && exp->identifier->string[0])
14612 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
14613 }
14614 else if(!exp->expType && exp->type != 16)
14615 {
14616 char expString[10240];
14617
14618 expString[0] = '\0';
14619 if(inCompiler)
14620 {
14621 PrintExpression(exp, expString);
14622 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14623 }
14624 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14625 }
14626 ApplyAnyObjectLogic(exp);
14627 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5)
14628 {
14629 exp->byReference = 0x1;
14630 }
14631 yylloc = oldyylloc;
14632 }
14633
14634 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)
14635 {
14636 if(*curMember)
14637 {
14638 *curMember = (*curMember)->next;
14639 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
14640 {
14641 *curMember = subMemberStack[--(*subMemberStackPos)];
14642 *curMember = (*curMember)->next;
14643 }
14644 while((*curMember) && (*curMember)->isProperty)
14645 *curMember = (*curMember)->next;
14646 if(subMemberStackPos)
14647 {
14648 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14649 {
14650 subMemberStack[(*subMemberStackPos)++] = *curMember;
14651 *curMember = (*curMember)->members.first;
14652 while(*curMember && (*curMember)->isProperty)
14653 *curMember = (*curMember)->next;
14654 }
14655 }
14656 }
14657 while(!*curMember)
14658 {
14659 if(!*curMember)
14660 {
14661 if(subMemberStackPos && *subMemberStackPos)
14662 {
14663 *curMember = subMemberStack[--(*subMemberStackPos)];
14664 *curMember = (*curMember)->next;
14665 }
14666 else
14667 {
14668 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
14669
14670 if(*curClass == _class)
14671 break;
14672 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
14673 ;
14674 *curMember = (*curClass)->membersAndProperties.first;
14675 }
14676 while((*curMember) && (*curMember)->isProperty)
14677 *curMember = (*curMember)->next;
14678 if(subMemberStackPos)
14679 {
14680 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14681 {
14682 subMemberStack[(*subMemberStackPos)++] = *curMember;
14683 *curMember = (*curMember)->members.first;
14684 while(*curMember && (*curMember)->isProperty)
14685 *curMember = (*curMember)->next;
14686 }
14687 }
14688 }
14689 }
14690 }
14691
14692 static void ProcessInitializer(struct Initializer * init, struct Type * type)
14693 {
14694 switch(init->type)
14695 {
14696 case 0:
14697 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
14698 {
14699 if(init->exp && !init->exp->destType)
14700 {
14701 FreeType(init->exp->destType);
14702 init->exp->destType = type;
14703 if(type)
14704 type->refCount++;
14705 }
14706 if(init->exp)
14707 {
14708 ProcessExpressionType(init->exp);
14709 init->isConstant = init->exp->isConstant;
14710 }
14711 break;
14712 }
14713 else
14714 {
14715 struct Expression * exp = init->exp;
14716 struct Instantiation * inst = exp->instance;
14717 struct MembersInit * members;
14718
14719 init->type = 1;
14720 init->list = MkList();
14721 if(inst->members)
14722 {
14723 for(members = (*inst->members).first; members; members = members->next)
14724 {
14725 if(members->type == 0)
14726 {
14727 struct MemberInit * member;
14728
14729 for(member = (*members->dataMembers).first; member; member = member->next)
14730 {
14731 ListAdd(init->list, member->initializer);
14732 member->initializer = (((void *)0));
14733 }
14734 }
14735 }
14736 }
14737 FreeExpression(exp);
14738 }
14739 case 1:
14740 {
14741 struct Initializer * i;
14742 struct Type * initializerType = (((void *)0));
14743 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
14744 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
14745 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
14746 int subMemberStackPos = 0;
14747
14748 if(type && type->kind == 12)
14749 initializerType = Dereference(type);
14750 else if(type && (type->kind == 9 || type->kind == 10))
14751 initializerType = type->members.first;
14752 for(i = (*init->list).first; i; i = i->next)
14753 {
14754 if(type && type->kind == 8 && type->_class && type->_class->registered)
14755 {
14756 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
14757 if(curMember)
14758 {
14759 if(!curMember->dataType)
14760 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
14761 initializerType = curMember->dataType;
14762 }
14763 }
14764 ProcessInitializer(i, initializerType);
14765 if(initializerType && type && (type->kind == 9 || type->kind == 10))
14766 initializerType = initializerType->next;
14767 if(!i->isConstant)
14768 init->isConstant = 0x0;
14769 }
14770 if(type && type->kind == 12)
14771 FreeType(initializerType);
14772 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
14773 {
14774 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
14775 }
14776 break;
14777 }
14778 }
14779 }
14780
14781 extern struct Symbol * FindType(struct Context * ctx, char *  name);
14782
14783 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
14784
14785 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
14786 {
14787 switch(spec->type)
14788 {
14789 case 0:
14790 {
14791 if(spec->specifier == THISCLASS)
14792 {
14793 if(thisClass)
14794 {
14795 spec->type = 1;
14796 spec->name = ReplaceThisClass(thisClass);
14797 spec->symbol = FindClass(spec->name);
14798 ProcessSpecifier(spec, declareStruct);
14799 }
14800 }
14801 break;
14802 }
14803 case 1:
14804 {
14805 struct Symbol * symbol = FindType(curContext, spec->name);
14806
14807 if(symbol)
14808 DeclareType(symbol->type, 0x1, 0x1);
14809 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
14810 DeclareStruct(spec->name, 0x0);
14811 break;
14812 }
14813 case 2:
14814 {
14815 struct Enumerator * e;
14816
14817 if(spec->list)
14818 {
14819 for(e = (*spec->list).first; e; e = e->next)
14820 {
14821 if(e->exp)
14822 ProcessExpressionType(e->exp);
14823 }
14824 }
14825 break;
14826 }
14827 case 3:
14828 case 4:
14829 {
14830 if(spec->definitions)
14831 {
14832 struct ClassDef * def;
14833 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
14834
14835 ProcessClass(spec->definitions, symbol);
14836 }
14837 break;
14838 }
14839 }
14840 }
14841
14842 static void ProcessDeclarator(struct Declarator * decl)
14843 {
14844 switch(decl->type)
14845 {
14846 case 1:
14847 if(decl->identifier->classSym)
14848 {
14849 FreeSpecifier(decl->identifier->_class);
14850 decl->identifier->_class = (((void *)0));
14851 }
14852 break;
14853 case 3:
14854 if(decl->array.exp)
14855 ProcessExpressionType(decl->array.exp);
14856 case 0:
14857 case 2:
14858 case 4:
14859 case 5:
14860 case 6:
14861 case 7:
14862 if(decl->declarator)
14863 ProcessDeclarator(decl->declarator);
14864 if(decl->type == 4)
14865 {
14866 struct Identifier * id = GetDeclId(decl);
14867
14868 if(id && id->_class)
14869 {
14870 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
14871
14872 if(!decl->function.parameters)
14873 decl->function.parameters = MkList();
14874 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
14875 id->_class = (((void *)0));
14876 }
14877 if(decl->function.parameters)
14878 {
14879 struct TypeName * param;
14880
14881 for(param = (*decl->function.parameters).first; param; param = param->next)
14882 {
14883 if(param->qualifiers && (*param->qualifiers).first)
14884 {
14885 struct Specifier * spec = (*param->qualifiers).first;
14886
14887 if(spec && spec->specifier == TYPED_OBJECT)
14888 {
14889 struct Declarator * d = param->declarator;
14890 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);
14891
14892 FreeList(param->qualifiers, FreeSpecifier);
14893 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
14894 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
14895 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
14896 param = newParam;
14897 }
14898 else if(spec && spec->specifier == ANY_OBJECT)
14899 {
14900 struct Declarator * d = param->declarator;
14901
14902 FreeList(param->qualifiers, FreeSpecifier);
14903 param->qualifiers = MkListOne(MkSpecifier(VOID));
14904 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
14905 }
14906 else if(spec->specifier == THISCLASS)
14907 {
14908 if(thisClass)
14909 {
14910 spec->type = 1;
14911 spec->name = ReplaceThisClass(thisClass);
14912 spec->symbol = FindClass(spec->name);
14913 ProcessSpecifier(spec, 0x0);
14914 }
14915 }
14916 }
14917 if(param->declarator)
14918 ProcessDeclarator(param->declarator);
14919 }
14920 }
14921 }
14922 break;
14923 }
14924 }
14925
14926 extern struct Identifier * CopyIdentifier(struct Identifier * id);
14927
14928 extern void FreeInitDeclarator(struct InitDeclarator * decl);
14929
14930 static void ProcessDeclaration(struct Declaration * decl)
14931 {
14932 yylloc = decl->loc;
14933 switch(decl->type)
14934 {
14935 case 1:
14936 {
14937 unsigned int declareStruct = 0x0;
14938
14939 if(decl->declarators)
14940 {
14941 struct InitDeclarator * d;
14942
14943 for(d = (*decl->declarators).first; d; d = d->next)
14944 {
14945 struct Type * type, * subType;
14946
14947 ProcessDeclarator(d->declarator);
14948 type = ProcessType(decl->specifiers, d->declarator);
14949 if(d->initializer)
14950 {
14951 ProcessInitializer(d->initializer, type);
14952 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
14953 {
14954 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
14955 {
14956 struct Instantiation * inst = d->initializer->exp->instance;
14957
14958 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
14959 d->initializer->exp->instance = (((void *)0));
14960 if(decl->specifiers)
14961 FreeList(decl->specifiers, FreeSpecifier);
14962 FreeList(decl->declarators, FreeInitDeclarator);
14963 d = (((void *)0));
14964 decl->type = 2;
14965 decl->inst = inst;
14966 }
14967 }
14968 }
14969 for(subType = type; subType; )
14970 {
14971 if(subType->kind == 8)
14972 {
14973 declareStruct = 0x1;
14974 break;
14975 }
14976 else if(subType->kind == 13)
14977 break;
14978 else if(subType->kind == 12)
14979 subType = subType->arrayType;
14980 else
14981 break;
14982 }
14983 FreeType(type);
14984 if(!d)
14985 break;
14986 }
14987 }
14988 if(decl->specifiers)
14989 {
14990 struct Specifier * s;
14991
14992 for(s = (*decl->specifiers).first; s; s = s->next)
14993 {
14994 ProcessSpecifier(s, declareStruct);
14995 }
14996 }
14997 break;
14998 }
14999 case 2:
15000 {
15001 ProcessInstantiationType(decl->inst);
15002 break;
15003 }
15004 case 0:
15005 {
15006 struct Specifier * spec;
15007 struct Declarator * d;
15008 unsigned int declareStruct = 0x0;
15009
15010 if(decl->declarators)
15011 {
15012 for(d = (*decl->declarators).first; d; d = d->next)
15013 {
15014 struct Type * type = ProcessType(decl->specifiers, d->declarator);
15015 struct Type * subType;
15016
15017 ProcessDeclarator(d);
15018 for(subType = type; subType; )
15019 {
15020 if(subType->kind == 8)
15021 {
15022 declareStruct = 0x1;
15023 break;
15024 }
15025 else if(subType->kind == 13)
15026 break;
15027 else if(subType->kind == 12)
15028 subType = subType->arrayType;
15029 else
15030 break;
15031 }
15032 FreeType(type);
15033 }
15034 }
15035 if(decl->specifiers)
15036 {
15037 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
15038 ProcessSpecifier(spec, declareStruct);
15039 }
15040 break;
15041 }
15042 }
15043 }
15044
15045 static struct FunctionDefinition * curFunction;
15046
15047 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
15048 {
15049 char propName[1024], propNameM[1024];
15050 char getName[1024], setName[1024];
15051 struct __ecereNameSpace__ecere__sys__OldList * args;
15052
15053 DeclareProperty(prop, setName, getName);
15054 strcpy(propName, "__ecereProp_");
15055 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15056 strcat(propName, "_");
15057 FullClassNameCat(propName, prop->name, 0x1);
15058 MangleClassName(propName);
15059 strcpy(propNameM, "__ecerePropM_");
15060 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
15061 strcat(propNameM, "_");
15062 FullClassNameCat(propNameM, prop->name, 0x1);
15063 MangleClassName(propNameM);
15064 if(prop->isWatchable)
15065 {
15066 args = MkList();
15067 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15068 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15069 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15070 args = MkList();
15071 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15072 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15073 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15074 }
15075 {
15076 args = MkList();
15077 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15078 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15079 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15080 args = MkList();
15081 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15082 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15083 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15084 }
15085 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15086 curFunction->propSet->fireWatchersDone = 0x1;
15087 }
15088
15089 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
15090
15091 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
15092
15093 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
15094
15095 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
15096
15097 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
15098
15099 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
15100
15101 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
15102
15103 extern void FreePropertyWatch(struct PropertyWatch * watcher);
15104
15105 static void ProcessStatement(struct Statement * stmt)
15106 {
15107 yylloc = stmt->loc;
15108 switch(stmt->type)
15109 {
15110 case 0:
15111 ProcessStatement(stmt->labeled.stmt);
15112 break;
15113 case 1:
15114 if(stmt->caseStmt.exp)
15115 {
15116 FreeType(stmt->caseStmt.exp->destType);
15117 stmt->caseStmt.exp->destType = curSwitchType;
15118 if(curSwitchType)
15119 curSwitchType->refCount++;
15120 ProcessExpressionType(stmt->caseStmt.exp);
15121 ComputeExpression(stmt->caseStmt.exp);
15122 }
15123 if(stmt->caseStmt.stmt)
15124 ProcessStatement(stmt->caseStmt.stmt);
15125 break;
15126 case 2:
15127 {
15128 if(stmt->compound.context)
15129 {
15130 struct Declaration * decl;
15131 struct Statement * s;
15132 struct Statement * prevCompound = curCompound;
15133 struct Context * prevContext = curContext;
15134
15135 if(!stmt->compound.isSwitch)
15136 {
15137 curCompound = stmt;
15138 curContext = stmt->compound.context;
15139 }
15140 if(stmt->compound.declarations)
15141 {
15142 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
15143 ProcessDeclaration(decl);
15144 }
15145 if(stmt->compound.statements)
15146 {
15147 for(s = (*stmt->compound.statements).first; s; s = s->next)
15148 ProcessStatement(s);
15149 }
15150 curContext = prevContext;
15151 curCompound = prevCompound;
15152 }
15153 break;
15154 }
15155 case 3:
15156 {
15157 struct Expression * exp;
15158
15159 if(stmt->expressions)
15160 {
15161 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15162 ProcessExpressionType(exp);
15163 }
15164 break;
15165 }
15166 case 4:
15167 {
15168 struct Expression * exp;
15169
15170 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15171 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15172 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15173 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15174 {
15175 ProcessExpressionType(exp);
15176 }
15177 if(stmt->ifStmt.stmt)
15178 ProcessStatement(stmt->ifStmt.stmt);
15179 if(stmt->ifStmt.elseStmt)
15180 ProcessStatement(stmt->ifStmt.elseStmt);
15181 break;
15182 }
15183 case 5:
15184 {
15185 struct Type * oldSwitchType = curSwitchType;
15186
15187 if(stmt->switchStmt.exp)
15188 {
15189 struct Expression * exp;
15190
15191 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15192 {
15193 if(!exp->next)
15194 {
15195 ProcessExpressionType(exp);
15196 }
15197 if(!exp->next)
15198 curSwitchType = exp->expType;
15199 }
15200 }
15201 ProcessStatement(stmt->switchStmt.stmt);
15202 curSwitchType = oldSwitchType;
15203 break;
15204 }
15205 case 6:
15206 {
15207 if(stmt->whileStmt.exp)
15208 {
15209 struct Expression * exp;
15210
15211 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15212 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15213 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15214 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15215 {
15216 ProcessExpressionType(exp);
15217 }
15218 }
15219 if(stmt->whileStmt.stmt)
15220 ProcessStatement(stmt->whileStmt.stmt);
15221 break;
15222 }
15223 case 7:
15224 {
15225 if(stmt->doWhile.exp)
15226 {
15227 struct Expression * exp;
15228
15229 if((*stmt->doWhile.exp).last)
15230 {
15231 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15232 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15233 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15234 }
15235 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15236 {
15237 ProcessExpressionType(exp);
15238 }
15239 }
15240 if(stmt->doWhile.stmt)
15241 ProcessStatement(stmt->doWhile.stmt);
15242 break;
15243 }
15244 case 8:
15245 {
15246 struct Expression * exp;
15247
15248 if(stmt->forStmt.init)
15249 ProcessStatement(stmt->forStmt.init);
15250 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15251 {
15252 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15253 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15254 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15255 }
15256 if(stmt->forStmt.check)
15257 ProcessStatement(stmt->forStmt.check);
15258 if(stmt->forStmt.increment)
15259 {
15260 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15261 ProcessExpressionType(exp);
15262 }
15263 if(stmt->forStmt.stmt)
15264 ProcessStatement(stmt->forStmt.stmt);
15265 break;
15266 }
15267 case 18:
15268 {
15269 struct Identifier * id = stmt->forEachStmt.id;
15270 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15271 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15272 struct Statement * block = stmt->forEachStmt.stmt;
15273 char iteratorType[1024];
15274 struct Type * source;
15275 struct Expression * e;
15276 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));
15277 struct Expression * arrayExp;
15278 char * typeString = (((void *)0));
15279 int builtinCount = 0;
15280
15281 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15282 {
15283 if(!e->next)
15284 {
15285 FreeType(e->destType);
15286 e->destType = ProcessTypeString("Container", 0x0);
15287 }
15288 if(!isBuiltin || e->next)
15289 ProcessExpressionType(e);
15290 }
15291 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15292 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15293 {
15294 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15295 struct Symbol * symbol;
15296 struct Expression * expIt = (((void *)0));
15297 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15298 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15299 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15300 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15301
15302 stmt->type = 2;
15303 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15304 stmt->compound.context->parent = curContext;
15305 curContext = stmt->compound.context;
15306 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15307 {
15308 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15309 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15310
15311 isCustomAVLTree = 0x1;
15312 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15313 isAVLTree = 0x1;
15314 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15315 isMap = 0x1;
15316 }
15317 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15318 isArray = 0x1;
15319 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15320 {
15321 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15322
15323 isLinkList = 0x1;
15324 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15325 }
15326 if(isArray)
15327 {
15328 struct Declarator * decl;
15329 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15330
15331 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15332 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15333 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15334 }
15335 else if(isBuiltin)
15336 {
15337 struct Type * type = (((void *)0));
15338 char typeStringBuf[1024];
15339
15340 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15341 if(((struct Expression *)(*exp).last)->type == 11)
15342 {
15343 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15344
15345 if(typeName)
15346 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15347 }
15348 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)
15349 {
15350 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15351
15352 typeString = templateClass->templateArgs[2].dataTypeString;
15353 }
15354 else if(arrayExp->list)
15355 {
15356 struct Expression * e;
15357
15358 for(e = (*arrayExp->list).first; e; e = e->next)
15359 {
15360 ProcessExpressionType(e);
15361 if(e->expType)
15362 {
15363 if(!type)
15364 {
15365 type = e->expType;
15366 type->refCount++;
15367 }
15368 else
15369 {
15370 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15371 {
15372 FreeType(type);
15373 type = e->expType;
15374 e->expType = (((void *)0));
15375 e = (*arrayExp->list).first;
15376 ProcessExpressionType(e);
15377 if(e->expType)
15378 {
15379 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15380 {
15381 FreeType(e->expType);
15382 e->expType = (((void *)0));
15383 FreeType(type);
15384 type = (((void *)0));
15385 break;
15386 }
15387 }
15388 }
15389 }
15390 if(e->expType)
15391 {
15392 FreeType(e->expType);
15393 e->expType = (((void *)0));
15394 }
15395 }
15396 }
15397 if(type)
15398 {
15399 typeStringBuf[0] = '\0';
15400 PrintType(type, typeStringBuf, 0x0, 0x1);
15401 typeString = typeStringBuf;
15402 FreeType(type);
15403 }
15404 }
15405 if(typeString)
15406 {
15407 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15408 struct Declarator * decl;
15409 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15410
15411 if(arrayExp->list)
15412 {
15413 struct Expression * e;
15414
15415 builtinCount = (*arrayExp->list).count;
15416 type = ProcessTypeString(typeString, 0x0);
15417 while(e = (*arrayExp->list).first)
15418 {
15419 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15420 e->destType = type;
15421 type->refCount++;
15422 ProcessExpressionType(e);
15423 ListAdd(initializers, MkInitializerAssignment(e));
15424 }
15425 FreeType(type);
15426 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15427 }
15428 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15429 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15430 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorArray(PlugDeclarator(decl, MkDeclaratorIdentifier(MkIdentifier("__internalArray"))), (((void *)0))), MkInitializerList(initializers)))));
15431 FreeList(exp, FreeExpression);
15432 }
15433 else
15434 {
15435 arrayExp->expType = ProcessTypeString("Container", 0x0);
15436 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15437 }
15438 }
15439 else if(isLinkList && !isList)
15440 {
15441 struct Declarator * decl;
15442 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15443
15444 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15445 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15446 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15447 }
15448 else if(_class->templateArgs)
15449 {
15450 if(isMap)
15451 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15452 else
15453 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
15454 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
15455 }
15456 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
15457 if(block && block->type == 2 && block->compound.context)
15458 {
15459 block->compound.context->parent = stmt->compound.context;
15460 }
15461 if(filter)
15462 {
15463 block = MkIfStmt(filter, block, (((void *)0)));
15464 }
15465 if(isArray)
15466 {
15467 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));
15468 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15469 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15470 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15471 }
15472 else if(isBuiltin)
15473 {
15474 char count[128];
15475
15476 sprintf(count, "%d", builtinCount);
15477 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));
15478 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15479 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15480 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15481 }
15482 else if(isLinkList && !isList)
15483 {
15484 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
15485 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
15486
15487 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
15488 {
15489 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));
15490 }
15491 else
15492 {
15493 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15494 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
15495
15496 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));
15497 }
15498 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15499 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15500 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15501 }
15502 else
15503 {
15504 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
15505 }
15506 ProcessExpressionType(expIt);
15507 if((*stmt->compound.declarations).first)
15508 ProcessDeclaration((*stmt->compound.declarations).first);
15509 if(symbol)
15510 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
15511 ProcessStatement(stmt);
15512 curContext = stmt->compound.context->parent;
15513 break;
15514 }
15515 else
15516 {
15517 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
15518 }
15519 break;
15520 }
15521 case 9:
15522 break;
15523 case 10:
15524 break;
15525 case 11:
15526 break;
15527 case 12:
15528 {
15529 struct Expression * exp;
15530
15531 if(stmt->expressions)
15532 {
15533 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15534 {
15535 if(!exp->next)
15536 {
15537 if(curFunction && !curFunction->type)
15538 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
15539 FreeType(exp->destType);
15540 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
15541 if(exp->destType)
15542 exp->destType->refCount++;
15543 }
15544 ProcessExpressionType(exp);
15545 }
15546 }
15547 break;
15548 }
15549 case 14:
15550 {
15551 ProcessDeclaration(stmt->decl);
15552 break;
15553 }
15554 case 13:
15555 {
15556 struct AsmField * field;
15557
15558 if(stmt->asmStmt.inputFields)
15559 {
15560 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
15561 if(field->expression)
15562 ProcessExpressionType(field->expression);
15563 }
15564 if(stmt->asmStmt.outputFields)
15565 {
15566 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
15567 if(field->expression)
15568 ProcessExpressionType(field->expression);
15569 }
15570 if(stmt->asmStmt.clobberedFields)
15571 {
15572 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
15573 {
15574 if(field->expression)
15575 ProcessExpressionType(field->expression);
15576 }
15577 }
15578 break;
15579 }
15580 case 17:
15581 {
15582 struct PropertyWatch * propWatch;
15583 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15584 struct Expression * object = stmt->_watch.object;
15585 struct Expression * watcher = stmt->_watch.watcher;
15586
15587 if(watcher)
15588 ProcessExpressionType(watcher);
15589 if(object)
15590 ProcessExpressionType(object);
15591 if(inCompiler)
15592 {
15593 if(watcher || thisClass)
15594 {
15595 struct External * external = curExternal;
15596 struct Context * context = curContext;
15597
15598 stmt->type = 3;
15599 stmt->expressions = MkList();
15600 curExternal = external->prev;
15601 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15602 {
15603 struct ClassFunction * func;
15604 char watcherName[1024];
15605 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
15606 struct External * createdExternal;
15607 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
15608
15609 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
15610 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
15611 if(propWatch->deleteWatch)
15612 strcat(watcherName, "_delete");
15613 else
15614 {
15615 struct Identifier * propID;
15616
15617 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15618 {
15619 strcat(watcherName, "_");
15620 strcat(watcherName, propID->string);
15621 }
15622 }
15623 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
15624 {
15625 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
15626 ProcessClassFunctionBody(func, propWatch->compound);
15627 propWatch->compound = (((void *)0));
15628 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
15629 createdExternal->symbol->idCode = external->symbol->idCode;
15630 curExternal = createdExternal;
15631 ProcessFunction(createdExternal->function);
15632 {
15633 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
15634
15635 externalDecl->declaration = decl;
15636 if(decl->symbol && !decl->symbol->pointerExternal)
15637 decl->symbol->pointerExternal = externalDecl;
15638 }
15639 if(propWatch->deleteWatch)
15640 {
15641 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15642
15643 ListAdd(args, CopyExpression(object));
15644 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15645 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15646 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
15647 }
15648 else
15649 {
15650 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
15651 struct Identifier * propID;
15652
15653 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15654 {
15655 char propName[1024];
15656 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15657
15658 if(prop)
15659 {
15660 char getName[1024], setName[1024];
15661 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15662
15663 DeclareProperty(prop, setName, getName);
15664 strcpy(propName, "__ecereProp_");
15665 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15666 strcat(propName, "_");
15667 FullClassNameCat(propName, prop->name, 0x1);
15668 ListAdd(args, CopyExpression(object));
15669 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15670 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15671 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15672 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
15673 }
15674 else
15675 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
15676 }
15677 }
15678 }
15679 else
15680 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
15681 }
15682 curExternal = external;
15683 curContext = context;
15684 if(watcher)
15685 FreeExpression(watcher);
15686 if(object)
15687 FreeExpression(object);
15688 FreeList(watches, FreePropertyWatch);
15689 }
15690 else
15691 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
15692 }
15693 else
15694 {
15695 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15696 {
15697 ProcessStatement(propWatch->compound);
15698 }
15699 }
15700 break;
15701 }
15702 case 15:
15703 {
15704 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15705 struct Expression * object = stmt->_watch.object;
15706 struct __ecereNameSpace__ecere__com__Class * _class;
15707
15708 if(object)
15709 ProcessExpressionType(object);
15710 if(inCompiler)
15711 {
15712 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
15713 if(_class)
15714 {
15715 struct Identifier * propID;
15716
15717 stmt->type = 3;
15718 stmt->expressions = MkList();
15719 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15720 {
15721 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
15722 }
15723 else if(!watches)
15724 {
15725 }
15726 if(watches)
15727 {
15728 for(propID = (*watches).first; propID; propID = propID->next)
15729 {
15730 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15731
15732 if(prop)
15733 {
15734 CreateFireWatcher(prop, object, stmt);
15735 }
15736 else
15737 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
15738 }
15739 }
15740 else
15741 {
15742 struct __ecereNameSpace__ecere__com__Property * prop;
15743 struct __ecereNameSpace__ecere__com__Class * base;
15744
15745 for(base = _class; base; base = base->base)
15746 {
15747 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
15748 {
15749 if(prop->isProperty && prop->isWatchable)
15750 {
15751 CreateFireWatcher(prop, object, stmt);
15752 }
15753 }
15754 }
15755 }
15756 if(object)
15757 FreeExpression(object);
15758 FreeList(watches, FreeIdentifier);
15759 }
15760 else
15761 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
15762 }
15763 break;
15764 }
15765 case 16:
15766 {
15767 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15768 struct Expression * object = stmt->_watch.object;
15769 struct Expression * watcher = stmt->_watch.watcher;
15770 struct __ecereNameSpace__ecere__com__Class * _class;
15771
15772 if(object)
15773 ProcessExpressionType(object);
15774 if(watcher)
15775 ProcessExpressionType(watcher);
15776 if(inCompiler)
15777 {
15778 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
15779 if(watcher || thisClass)
15780 {
15781 if(_class)
15782 {
15783 struct Identifier * propID;
15784
15785 stmt->type = 3;
15786 stmt->expressions = MkList();
15787 if(!watches)
15788 {
15789 struct __ecereNameSpace__ecere__sys__OldList * args;
15790
15791 args = MkList();
15792 ListAdd(args, CopyExpression(object));
15793 ListAdd(args, MkExpConstant("0"));
15794 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15795 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
15796 }
15797 else
15798 {
15799 for(propID = (*watches).first; propID; propID = propID->next)
15800 {
15801 char propName[1024];
15802 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15803
15804 if(prop)
15805 {
15806 char getName[1024], setName[1024];
15807 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15808
15809 DeclareProperty(prop, setName, getName);
15810 strcpy(propName, "__ecereProp_");
15811 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15812 strcat(propName, "_");
15813 FullClassNameCat(propName, prop->name, 0x1);
15814 MangleClassName(propName);
15815 ListAdd(args, CopyExpression(object));
15816 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15817 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15818 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
15819 }
15820 else
15821 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
15822 }
15823 }
15824 if(object)
15825 FreeExpression(object);
15826 if(watcher)
15827 FreeExpression(watcher);
15828 FreeList(watches, FreeIdentifier);
15829 }
15830 else
15831 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
15832 }
15833 else
15834 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
15835 }
15836 break;
15837 }
15838 }
15839 }
15840
15841 extern struct Expression * QBrackets(struct Expression * exp);
15842
15843 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
15844
15845 extern struct Declarator * QMkPtrDecl(char *  id);
15846
15847 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
15848
15849 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
15850
15851 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
15852
15853 static void ProcessFunction(struct FunctionDefinition * function)
15854 {
15855 void * __ecereTemp2;
15856 void * __ecereTemp1;
15857 struct Identifier * id = GetDeclId(function->declarator);
15858 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
15859 struct Type * type = symbol ? symbol->type : (((void *)0));
15860 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
15861 struct Context * oldTopContext = topContext;
15862
15863 yylloc = function->loc;
15864 if(type && type->thisClass)
15865 {
15866 struct Symbol * classSym = type->thisClass;
15867 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
15868 char className[1024];
15869 char structName[1024];
15870 struct Declarator * funcDecl;
15871 struct Symbol * thisSymbol;
15872 unsigned int typedObject = 0x0;
15873
15874 if(_class && !_class->base)
15875 {
15876 _class = currentClass;
15877 if(_class && !_class->symbol)
15878 _class->symbol = FindClass(_class->fullName);
15879 classSym = _class ? _class->symbol : (((void *)0));
15880 typedObject = 0x1;
15881 }
15882 thisClass = _class;
15883 if(inCompiler && _class)
15884 {
15885 if(type->kind == 11)
15886 {
15887 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
15888 {
15889 struct Type * param = symbol->type->params.first;
15890
15891 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
15892 FreeType(param);
15893 }
15894 if(type->classObjectType != 1)
15895 {
15896 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
15897 symbol->type->staticMethod = 0x1;
15898 symbol->type->thisClass = (((void *)0));
15899 symbol->type->extraParam = 0x0;
15900 }
15901 }
15902 strcpy(className, "__ecereClass_");
15903 FullClassNameCat(className, _class->fullName, 0x1);
15904 MangleClassName(className);
15905 structName[0] = (char)0;
15906 FullClassNameCat(structName, _class->fullName, 0x0);
15907 funcDecl = GetFuncDecl(function->declarator);
15908 if(funcDecl)
15909 {
15910 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
15911 {
15912 struct TypeName * param = (*funcDecl->function.parameters).first;
15913
15914 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
15915 {
15916 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
15917 FreeTypeName(param);
15918 }
15919 }
15920 if(!function->propertyNoThis)
15921 {
15922 struct TypeName * thisParam;
15923
15924 if(type->classObjectType != 1)
15925 {
15926 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
15927 if(!funcDecl->function.parameters)
15928 funcDecl->function.parameters = MkList();
15929 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15930 }
15931 if(typedObject)
15932 {
15933 if(type->classObjectType != 1)
15934 {
15935 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
15936 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
15937 }
15938 thisParam = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), ((struct TypeName *)__ecereTemp1)->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), ((struct TypeName *)__ecereTemp1)->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), ((struct TypeName *)__ecereTemp1));
15939 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15940 }
15941 }
15942 }
15943 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
15944 {
15945 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
15946
15947 funcDecl = GetFuncDecl(initDecl->declarator);
15948 if(funcDecl)
15949 {
15950 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
15951 {
15952 struct TypeName * param = (*funcDecl->function.parameters).first;
15953
15954 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
15955 {
15956 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
15957 FreeTypeName(param);
15958 }
15959 }
15960 if(type->classObjectType != 1)
15961 {
15962 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
15963 {
15964 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
15965
15966 if(!funcDecl->function.parameters)
15967 funcDecl->function.parameters = MkList();
15968 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15969 }
15970 }
15971 }
15972 }
15973 }
15974 if(function->body)
15975 {
15976 if(type->classObjectType != 1)
15977 {
15978 thisSymbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->string = __ecereNameSpace__ecere__sys__CopyString("this"), ((struct Symbol *)__ecereTemp1)->type = classSym ? MkClassType(classSym->string) : (((void *)0)), ((struct Symbol *)__ecereTemp1));
15979 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15980 if(typedObject && thisSymbol->type)
15981 {
15982 thisSymbol->type->classObjectType = 2;
15983 thisSymbol->type->byReference = type->byReference;
15984 }
15985 }
15986 }
15987 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
15988 {
15989 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
15990
15991 {
15992 struct __ecereNameSpace__ecere__com__Class * base;
15993
15994 for(base = _class; base && base->type != 1000; base = base->next)
15995 {
15996 for(member = base->membersAndProperties.first; member; member = member->next)
15997 if(!member->isProperty)
15998 break;
15999 if(member)
16000 break;
16001 }
16002 }
16003 for(member = _class->membersAndProperties.first; member; member = member->next)
16004 if(!member->isProperty)
16005 break;
16006 if(member)
16007 {
16008 char pointerName[1024];
16009 struct Declaration * decl;
16010 struct Initializer * initializer;
16011 struct Expression * exp, * bytePtr;
16012
16013 strcpy(pointerName, "__ecerePointer_");
16014 FullClassNameCat(pointerName, _class->fullName, 0x0);
16015 {
16016 char className[1024];
16017
16018 strcpy(className, "__ecereClass_");
16019 FullClassNameCat(className, classSym->string, 0x1);
16020 MangleClassName(className);
16021 DeclareClass(classSym, className);
16022 }
16023 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
16024 if(_class->fixed)
16025 {
16026 char string[256];
16027
16028 sprintf(string, "%d", _class->offset);
16029 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
16030 }
16031 else
16032 {
16033 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
16034 }
16035 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
16036 exp->expType = (__ecereTemp2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp2)->refCount = 1, ((struct Type *)__ecereTemp2)->kind = 13, ((struct Type *)__ecereTemp2)->type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 0, ((struct Type *)__ecereTemp1)), ((struct Type *)__ecereTemp2));
16037 if(function->body)
16038 {
16039 yylloc = function->body->loc;
16040 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
16041 {
16042 struct Context * prevContext = curContext;
16043
16044 curContext = function->body->compound.context;
16045 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
16046 curContext = prevContext;
16047 }
16048 decl->symbol = (((void *)0));
16049 if(!function->body->compound.declarations)
16050 function->body->compound.declarations = MkList();
16051 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
16052 }
16053 }
16054 }
16055 }
16056 else
16057 thisClass = (((void *)0));
16058 if(id)
16059 {
16060 FreeSpecifier(id->_class);
16061 id->_class = (((void *)0));
16062 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16063 {
16064 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16065
16066 id = GetDeclId(initDecl->declarator);
16067 FreeSpecifier(id->_class);
16068 id->_class = (((void *)0));
16069 }
16070 }
16071 if(function->body)
16072 topContext = function->body->compound.context;
16073 {
16074 struct FunctionDefinition * oldFunction = curFunction;
16075
16076 curFunction = function;
16077 if(function->body)
16078 ProcessStatement(function->body);
16079 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
16080 {
16081 struct Statement * prevCompound = curCompound;
16082 struct Context * prevContext = curContext;
16083 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
16084
16085 if(!function->body->compound.statements)
16086 function->body->compound.statements = MkList();
16087 ListAdd(function->body->compound.statements, fireWatchers);
16088 curCompound = function->body;
16089 curContext = function->body->compound.context;
16090 ProcessStatement(fireWatchers);
16091 curContext = prevContext;
16092 curCompound = prevCompound;
16093 }
16094 curFunction = oldFunction;
16095 }
16096 if(function->declarator)
16097 {
16098 ProcessDeclarator(function->declarator);
16099 }
16100 topContext = oldTopContext;
16101 thisClass = oldThisClass;
16102 }
16103
16104 extern void FreeSymbol(struct Symbol * symbol);
16105
16106 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
16107
16108 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
16109 {
16110 struct ClassDef * def;
16111 struct External * external = curExternal;
16112 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
16113
16114 for(def = definitions->first; def; def = def->next)
16115 {
16116 if(def->type == 0)
16117 {
16118 if(def->function->declarator)
16119 curExternal = def->function->declarator->symbol->pointerExternal;
16120 else
16121 curExternal = external;
16122 ProcessFunction((struct FunctionDefinition *)def->function);
16123 }
16124 else if(def->type == 2)
16125 {
16126 if(def->decl->type == 2)
16127 {
16128 thisClass = regClass;
16129 ProcessInstantiationType(def->decl->inst);
16130 thisClass = (((void *)0));
16131 }
16132 else
16133 {
16134 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
16135
16136 if(regClass)
16137 thisClass = regClass;
16138 ProcessDeclaration(def->decl);
16139 thisClass = backThisClass;
16140 }
16141 }
16142 else if(def->type == 1 && def->defProperties)
16143 {
16144 struct MemberInit * defProperty;
16145 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);
16146
16147 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16148 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
16149 {
16150 thisClass = regClass;
16151 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
16152 thisClass = (((void *)0));
16153 }
16154 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16155 FreeSymbol(thisSymbol);
16156 }
16157 else if(def->type == 3 && def->propertyDef)
16158 {
16159 struct PropertyDef * prop = def->propertyDef;
16160
16161 thisClass = regClass;
16162 if(prop->setStmt)
16163 {
16164 if(regClass)
16165 {
16166 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16167
16168 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16169 }
16170 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16171 ProcessStatement(prop->setStmt);
16172 }
16173 if(prop->getStmt)
16174 {
16175 if(regClass)
16176 {
16177 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16178
16179 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16180 }
16181 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16182 ProcessStatement(prop->getStmt);
16183 }
16184 if(prop->issetStmt)
16185 {
16186 if(regClass)
16187 {
16188 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16189
16190 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16191 }
16192 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16193 ProcessStatement(prop->issetStmt);
16194 }
16195 thisClass = (((void *)0));
16196 }
16197 else if(def->type == 4 && def->propertyWatch)
16198 {
16199 struct PropertyWatch * propertyWatch = def->propertyWatch;
16200
16201 thisClass = regClass;
16202 if(propertyWatch->compound)
16203 {
16204 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);
16205
16206 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16207 curExternal = (((void *)0));
16208 ProcessStatement(propertyWatch->compound);
16209 }
16210 thisClass = (((void *)0));
16211 }
16212 }
16213 }
16214
16215 void DeclareFunctionUtil(char * s)
16216 {
16217 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
16218
16219 if(function)
16220 {
16221 char name[1024];
16222
16223 name[0] = (char)0;
16224 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
16225 strcpy(name, "__ecereFunction_");
16226 FullClassNameCat(name, s, 0x0);
16227 DeclareFunction(function, name);
16228 }
16229 }
16230
16231 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16232
16233 void ComputeDataTypes()
16234 {
16235 void * __ecereTemp1;
16236 struct External * external;
16237 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16238 struct External * after = (((void *)0));
16239
16240 currentClass = (((void *)0));
16241 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16242 for(external = (*ast).first; external; external = external->next)
16243 {
16244 if(external->type == 1)
16245 {
16246 struct Declaration * decl = external->declaration;
16247
16248 if(decl)
16249 {
16250 struct __ecereNameSpace__ecere__sys__OldList * decls = decl->declarators;
16251
16252 if(decls)
16253 {
16254 struct InitDeclarator * initDecl = (*decls).first;
16255
16256 if(initDecl)
16257 {
16258 struct Declarator * declarator = initDecl->declarator;
16259
16260 if(declarator && declarator->type == 1)
16261 {
16262 struct Identifier * id = declarator->identifier;
16263
16264 if(id && id->string)
16265 {
16266 if(!strcmp(id->string, "uintptr_t") || !strcmp(id->string, "intptr_t"))
16267 {
16268 external->symbol->id = -1001, external->symbol->idCode = -1001;
16269 after = external;
16270 }
16271 }
16272 }
16273 }
16274 }
16275 }
16276 }
16277 }
16278 temp->symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->id = -1000, ((struct Symbol *)__ecereTemp1)->idCode = -1000, ((struct Symbol *)__ecereTemp1));
16279 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), after, temp);
16280 curExternal = temp;
16281 DeclareFunctionUtil("eSystem_New");
16282 DeclareFunctionUtil("eSystem_New0");
16283 DeclareFunctionUtil("eSystem_Renew");
16284 DeclareFunctionUtil("eSystem_Renew0");
16285 DeclareFunctionUtil("eClass_GetProperty");
16286 DeclareStruct("ecere::com::Class", 0x0);
16287 DeclareStruct("ecere::com::Instance", 0x0);
16288 DeclareStruct("ecere::com::Property", 0x0);
16289 DeclareStruct("ecere::com::DataMember", 0x0);
16290 DeclareStruct("ecere::com::Method", 0x0);
16291 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16292 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16293 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16294 for(external = (*ast).first; external; external = external->next)
16295 {
16296 afterExternal = curExternal = external;
16297 if(external->type == 0)
16298 {
16299 currentClass = external->function->_class;
16300 ProcessFunction(external->function);
16301 }
16302 else if(external->type == 1)
16303 {
16304 currentClass = (((void *)0));
16305 ProcessDeclaration(external->declaration);
16306 }
16307 else if(external->type == 2)
16308 {
16309 struct ClassDefinition * _class = external->_class;
16310
16311 currentClass = external->symbol->registered;
16312 if(_class->definitions)
16313 {
16314 ProcessClass(_class->definitions, _class->symbol);
16315 }
16316 if(inCompiler)
16317 {
16318 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16319 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16320 }
16321 }
16322 else if(external->type == 4)
16323 {
16324 thisNameSpace = external->id->string;
16325 }
16326 }
16327 currentClass = (((void *)0));
16328 thisNameSpace = (((void *)0));
16329 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16330 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16331 }
16332
16333 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);
16334
16335 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, char *  name, char *  baseName, int size, int sizeClass, unsigned int (* )(void * ), void (* )(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
16336
16337 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16338 {
16339 struct __ecereNameSpace__ecere__com__Class * class;
16340
16341 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16342 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16343 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16344 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16345 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16346 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16347 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16348 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16349 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16350 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16351 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16352 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16353 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16354 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16355 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16356 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16357 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16358 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16359 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16360 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16361 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16362 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16363 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
16364 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
16365 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16366 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16367 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16368 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16369 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16370 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16371 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16372 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16373 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16374 __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);
16375 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16376 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16377 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16378 __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);
16379 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16380 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16381 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16382 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16383 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16384 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16385 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16386 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16387 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16388 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16389 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16390 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16391 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16392 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + 12)))->application && class)
16393 __ecereClass_Conversion = class;
16394 __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);
16395 __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);
16396 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16397 __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);
16398 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16399 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16400 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16401 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16402 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16403 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16404 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16405 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16406 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16407 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16408 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16409 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16410 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16411 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16412 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16413 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
16414 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16415 }
16416
16417 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16418 {
16419
16420 }
16421