c8c74eb3e285d90b47d9d1dfc544eefc7768da44
[sdk] / compiler / bootstrap / libec / bootstrap / pass15.c
1 #if defined(__GNUC__)
2 typedef long long int64;
3 typedef unsigned long long uint64;
4 #ifndef _WIN32
5 #define __declspec(x)
6 #endif
7 #elif defined(__TINYC__)
8 #include <stdarg.h>
9 #define __builtin_va_list va_list
10 #define __builtin_va_start va_start
11 #define __builtin_va_end va_end
12 #ifdef _WIN32
13 #define strcasecmp stricmp
14 #define strncasecmp strnicmp
15 #define __declspec(x) __attribute__((x))
16 #else
17 #define __declspec(x)
18 #endif
19 typedef long long int64;
20 typedef unsigned long long uint64;
21 #else
22 typedef __int64 int64;
23 typedef unsigned __int64 uint64;
24 #endif
25 #ifdef __BIG_ENDIAN__
26 #define __ENDIAN_PAD(x) (8 - (x))
27 #else
28 #define __ENDIAN_PAD(x) 0
29 #endif
30 #include <stdint.h>
31 #include <sys/types.h>
32
33 #if /*defined(_W64) || */(defined(__WORDSIZE) && __WORDSIZE == 8) || defined(__x86_64__)
34 #define _64BIT 1
35 #else
36 #define _64BIT 0
37 #endif
38
39 #define arch_PointerSize                  sizeof(void *)
40 #define structSize_Instance               (_64BIT ? 24 : 12)
41 #define structSize_Module                 (_64BIT ? 560 : 300)
42 #define structSize_NamedLink              (_64BIT ? 32 : 16)
43
44 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
45
46 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
47
48 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
49
50 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
51
52 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
53
54 struct __ecereNameSpace__ecere__sys__BTNode;
55
56 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;
57
58 struct __ecereNameSpace__ecere__sys__BinaryTree
59 {
60 struct __ecereNameSpace__ecere__sys__BTNode * root;
61 int count;
62 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
63 void (*  FreeKey)(void *  key);
64 } __attribute__ ((gcc_struct));
65
66 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;
67
68 struct __ecereNameSpace__ecere__sys__OldList
69 {
70 void *  first;
71 void *  last;
72 int count;
73 unsigned int offset;
74 unsigned int circ;
75 } __attribute__ ((gcc_struct));
76
77 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;
78
79 struct __ecereNameSpace__ecere__com__Method
80 {
81 char *  name;
82 struct __ecereNameSpace__ecere__com__Method * parent;
83 struct __ecereNameSpace__ecere__com__Method * left;
84 struct __ecereNameSpace__ecere__com__Method * right;
85 int depth;
86 int (*  function)();
87 int vid;
88 int type;
89 struct __ecereNameSpace__ecere__com__Class * _class;
90 void *  symbol;
91 char *  dataTypeString;
92 struct Type * dataType;
93 int memberAccess;
94 } __attribute__ ((gcc_struct));
95
96 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;
97
98 struct __ecereNameSpace__ecere__com__Property
99 {
100 struct __ecereNameSpace__ecere__com__Property * prev;
101 struct __ecereNameSpace__ecere__com__Property * next;
102 char *  name;
103 unsigned int isProperty;
104 int memberAccess;
105 int id;
106 struct __ecereNameSpace__ecere__com__Class * _class;
107 char *  dataTypeString;
108 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
109 struct Type * dataType;
110 void (*  Set)(void * , int);
111 int (*  Get)(void * );
112 unsigned int (*  IsSet)(void * );
113 void *  data;
114 void *  symbol;
115 int vid;
116 unsigned int conversion;
117 unsigned int watcherOffset;
118 char *  category;
119 unsigned int compiled;
120 unsigned int selfWatchable;
121 unsigned int isWatchable;
122 } __attribute__ ((gcc_struct));
123
124 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
125
126 struct CodePosition
127 {
128 int line;
129 int charPos;
130 int pos;
131 int included;
132 } __attribute__ ((gcc_struct));
133
134 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
135
136 struct Location
137 {
138 struct CodePosition start;
139 struct CodePosition end;
140 } __attribute__ ((gcc_struct));
141
142 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attrib;
143
144 struct Attrib;
145
146 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ExtDecl;
147
148 struct ExtDecl
149 {
150 struct Location loc;
151 int type;
152 union
153 {
154 char * s;
155 struct Attrib * attr;
156 } __attribute__ ((gcc_struct));
157 } __attribute__ ((gcc_struct));
158
159 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
160
161 struct ClassDefinition
162 {
163 struct ClassDefinition * prev;
164 struct ClassDefinition * next;
165 struct Location loc;
166 struct Specifier * _class;
167 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
168 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
169 struct Symbol * symbol;
170 struct Location blockStart;
171 struct Location nameLoc;
172 int endid;
173 int declMode;
174 unsigned int deleteWatchable;
175 } __attribute__ ((gcc_struct));
176
177 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
178
179 struct Context
180 {
181 struct Context * parent;
182 struct __ecereNameSpace__ecere__sys__BinaryTree types;
183 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
184 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
185 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
186 int nextID;
187 int simpleID;
188 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
189 struct ClassDefinition * classDef;
190 unsigned int templateTypesOnly;
191 unsigned int hasNameSpace;
192 } __attribute__ ((gcc_struct));
193
194 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
195
196 struct Instantiation
197 {
198 struct Instantiation * prev;
199 struct Instantiation * next;
200 struct Location loc;
201 struct Specifier * _class;
202 struct Expression * exp;
203 struct __ecereNameSpace__ecere__sys__OldList *  members;
204 struct Symbol * symbol;
205 unsigned int fullSet;
206 unsigned int isConstant;
207 unsigned char *  data;
208 struct Location nameLoc;
209 struct Location insideLoc;
210 unsigned int built;
211 } __attribute__ ((gcc_struct));
212
213 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
214
215 struct Declaration
216 {
217 struct Declaration * prev;
218 struct Declaration * next;
219 struct Location loc;
220 int type;
221 union
222 {
223 struct
224 {
225 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
226 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
227 } __attribute__ ((gcc_struct));
228 struct Instantiation * inst;
229 struct
230 {
231 struct Identifier * id;
232 struct Expression * exp;
233 } __attribute__ ((gcc_struct));
234 } __attribute__ ((gcc_struct));
235 struct Specifier * extStorage;
236 struct Symbol * symbol;
237 int declMode;
238 } __attribute__ ((gcc_struct));
239
240 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
241
242 struct Statement
243 {
244 struct Statement * prev;
245 struct Statement * next;
246 struct Location loc;
247 int type;
248 union
249 {
250 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
251 struct
252 {
253 struct Identifier * id;
254 struct Statement * stmt;
255 } __attribute__ ((gcc_struct)) labeled;
256 struct
257 {
258 struct Expression * exp;
259 struct Statement * stmt;
260 } __attribute__ ((gcc_struct)) caseStmt;
261 struct
262 {
263 struct __ecereNameSpace__ecere__sys__OldList * declarations;
264 struct __ecereNameSpace__ecere__sys__OldList * statements;
265 struct Context * context;
266 unsigned int isSwitch;
267 } __attribute__ ((gcc_struct)) compound;
268 struct
269 {
270 struct __ecereNameSpace__ecere__sys__OldList * exp;
271 struct Statement * stmt;
272 struct Statement * elseStmt;
273 } __attribute__ ((gcc_struct)) ifStmt;
274 struct
275 {
276 struct __ecereNameSpace__ecere__sys__OldList * exp;
277 struct Statement * stmt;
278 } __attribute__ ((gcc_struct)) switchStmt;
279 struct
280 {
281 struct __ecereNameSpace__ecere__sys__OldList * exp;
282 struct Statement * stmt;
283 } __attribute__ ((gcc_struct)) whileStmt;
284 struct
285 {
286 struct __ecereNameSpace__ecere__sys__OldList * exp;
287 struct Statement * stmt;
288 } __attribute__ ((gcc_struct)) doWhile;
289 struct
290 {
291 struct Statement * init;
292 struct Statement * check;
293 struct __ecereNameSpace__ecere__sys__OldList * increment;
294 struct Statement * stmt;
295 } __attribute__ ((gcc_struct)) forStmt;
296 struct
297 {
298 struct Identifier * id;
299 } __attribute__ ((gcc_struct)) gotoStmt;
300 struct
301 {
302 struct Specifier * spec;
303 char * statements;
304 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
305 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
306 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
307 } __attribute__ ((gcc_struct)) asmStmt;
308 struct
309 {
310 struct Expression * watcher;
311 struct Expression * object;
312 struct __ecereNameSpace__ecere__sys__OldList * watches;
313 } __attribute__ ((gcc_struct)) _watch;
314 struct
315 {
316 struct Identifier * id;
317 struct __ecereNameSpace__ecere__sys__OldList * exp;
318 struct __ecereNameSpace__ecere__sys__OldList * filter;
319 struct Statement * stmt;
320 } __attribute__ ((gcc_struct)) forEachStmt;
321 struct Declaration * decl;
322 } __attribute__ ((gcc_struct));
323 } __attribute__ ((gcc_struct));
324
325 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
326
327 struct TypeName
328 {
329 struct TypeName * prev;
330 struct TypeName * next;
331 struct Location loc;
332 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
333 struct Declarator * declarator;
334 int classObjectType;
335 struct Expression * bitCount;
336 } __attribute__ ((gcc_struct));
337
338 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
339
340 struct Initializer
341 {
342 struct Initializer * prev;
343 struct Initializer * next;
344 struct Location loc;
345 int type;
346 union
347 {
348 struct Expression * exp;
349 struct __ecereNameSpace__ecere__sys__OldList *  list;
350 } __attribute__ ((gcc_struct));
351 unsigned int isConstant;
352 } __attribute__ ((gcc_struct));
353
354 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
355
356 struct __ecereNameSpace__ecere__com__DataValue
357 {
358 union
359 {
360 char c;
361 unsigned char uc;
362 short s;
363 unsigned short us;
364 int i;
365 unsigned int ui;
366 void *  p;
367 float f;
368 double d;
369 long long i64;
370 uint64 ui64;
371 } __attribute__ ((gcc_struct));
372 } __attribute__ ((gcc_struct));
373
374 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
375
376 struct Expression
377 {
378 struct Expression * prev;
379 struct Expression * next;
380 struct Location loc;
381 int type;
382 union
383 {
384 struct
385 {
386 char *  constant;
387 struct Identifier * identifier;
388 } __attribute__ ((gcc_struct));
389 struct Statement * compound;
390 struct Instantiation * instance;
391 char *  string;
392 struct __ecereNameSpace__ecere__sys__OldList *  list;
393 struct
394 {
395 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
396 struct Declarator * decl;
397 } __attribute__ ((gcc_struct)) _classExp;
398 struct
399 {
400 struct Identifier * id;
401 } __attribute__ ((gcc_struct)) classData;
402 struct
403 {
404 struct Expression * exp;
405 struct __ecereNameSpace__ecere__sys__OldList * arguments;
406 struct Location argLoc;
407 } __attribute__ ((gcc_struct)) call;
408 struct
409 {
410 struct Expression * exp;
411 struct __ecereNameSpace__ecere__sys__OldList * index;
412 } __attribute__ ((gcc_struct)) index;
413 struct
414 {
415 struct Expression * exp;
416 struct Identifier * member;
417 int memberType;
418 unsigned int thisPtr;
419 } __attribute__ ((gcc_struct)) member;
420 struct
421 {
422 int op;
423 struct Expression * exp1;
424 struct Expression * exp2;
425 } __attribute__ ((gcc_struct)) op;
426 struct TypeName * typeName;
427 struct Specifier * _class;
428 struct
429 {
430 struct TypeName * typeName;
431 struct Expression * exp;
432 } __attribute__ ((gcc_struct)) cast;
433 struct
434 {
435 struct Expression * cond;
436 struct __ecereNameSpace__ecere__sys__OldList * exp;
437 struct Expression * elseExp;
438 } __attribute__ ((gcc_struct)) cond;
439 struct
440 {
441 struct TypeName * typeName;
442 struct Expression * size;
443 } __attribute__ ((gcc_struct)) _new;
444 struct
445 {
446 struct TypeName * typeName;
447 struct Expression * size;
448 struct Expression * exp;
449 } __attribute__ ((gcc_struct)) _renew;
450 struct
451 {
452 char * table;
453 struct Identifier * id;
454 } __attribute__ ((gcc_struct)) db;
455 struct
456 {
457 struct Expression * ds;
458 struct Expression * name;
459 } __attribute__ ((gcc_struct)) dbopen;
460 struct
461 {
462 struct TypeName * typeName;
463 struct Initializer * initializer;
464 } __attribute__ ((gcc_struct)) initializer;
465 struct
466 {
467 struct Expression * exp;
468 struct TypeName * typeName;
469 } __attribute__ ((gcc_struct)) vaArg;
470 } __attribute__ ((gcc_struct));
471 unsigned int debugValue;
472 struct __ecereNameSpace__ecere__com__DataValue val;
473 uint64 address;
474 unsigned int hasAddress;
475 struct Type * expType;
476 struct Type * destType;
477 unsigned int usage;
478 int tempCount;
479 unsigned int byReference;
480 unsigned int isConstant;
481 unsigned int addedThis;
482 unsigned int needCast;
483 unsigned int thisPtr;
484 } __attribute__ ((gcc_struct));
485
486 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
487
488 struct TemplateDatatype
489 {
490 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
491 struct Declarator * decl;
492 } __attribute__ ((gcc_struct));
493
494 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
495
496 struct TemplateArgument;
497
498 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
499
500 struct TemplateParameter
501 {
502 struct TemplateParameter * prev;
503 struct TemplateParameter * next;
504 struct Location loc;
505 int type;
506 struct Identifier * identifier;
507 union
508 {
509 struct TemplateDatatype * dataType;
510 int memberType;
511 } __attribute__ ((gcc_struct));
512 struct TemplateArgument * defaultArgument;
513 char *  dataTypeString;
514 struct Type * baseType;
515 } __attribute__ ((gcc_struct));
516
517 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
518
519 struct Specifier
520 {
521 struct Specifier * prev;
522 struct Specifier * next;
523 struct Location loc;
524 int type;
525 union
526 {
527 int specifier;
528 struct
529 {
530 struct ExtDecl * extDecl;
531 char *  name;
532 struct Symbol * symbol;
533 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
534 } __attribute__ ((gcc_struct));
535 struct
536 {
537 struct Identifier * id;
538 struct __ecereNameSpace__ecere__sys__OldList *  list;
539 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
540 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
541 unsigned int addNameSpace;
542 struct Context * ctx;
543 struct ExtDecl * extDeclStruct;
544 } __attribute__ ((gcc_struct));
545 struct Expression * expression;
546 struct Specifier * _class;
547 struct TemplateParameter * templateParameter;
548 } __attribute__ ((gcc_struct));
549 } __attribute__ ((gcc_struct));
550
551 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
552
553 struct Identifier
554 {
555 struct Identifier * prev;
556 struct Identifier * next;
557 struct Location loc;
558 struct Symbol * classSym;
559 struct Specifier * _class;
560 char *  string;
561 struct Identifier * badID;
562 } __attribute__ ((gcc_struct));
563
564 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
565
566 struct Pointer;
567
568 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
569
570 struct Declarator
571 {
572 struct Declarator * prev;
573 struct Declarator * next;
574 struct Location loc;
575 int type;
576 struct Symbol * symbol;
577 struct Declarator * declarator;
578 union
579 {
580 struct Identifier * identifier;
581 struct
582 {
583 struct Expression * exp;
584 struct Expression * posExp;
585 struct Attrib * attrib;
586 } __attribute__ ((gcc_struct)) structDecl;
587 struct
588 {
589 struct Expression * exp;
590 struct Specifier * enumClass;
591 } __attribute__ ((gcc_struct)) array;
592 struct
593 {
594 struct __ecereNameSpace__ecere__sys__OldList * parameters;
595 } __attribute__ ((gcc_struct)) function;
596 struct
597 {
598 struct Pointer * pointer;
599 } __attribute__ ((gcc_struct)) pointer;
600 struct
601 {
602 struct ExtDecl * extended;
603 } __attribute__ ((gcc_struct)) extended;
604 } __attribute__ ((gcc_struct));
605 } __attribute__ ((gcc_struct));
606
607 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
608
609 struct FunctionDefinition
610 {
611 struct FunctionDefinition * prev;
612 struct FunctionDefinition * next;
613 struct Location loc;
614 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
615 struct Declarator * declarator;
616 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
617 struct Statement * body;
618 struct __ecereNameSpace__ecere__com__Class * _class;
619 struct __ecereNameSpace__ecere__sys__OldList attached;
620 int declMode;
621 struct Type * type;
622 struct Symbol * propSet;
623 int tempCount;
624 unsigned int propertyNoThis;
625 } __attribute__ ((gcc_struct));
626
627 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
628
629 struct DBTableDef;
630
631 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
632
633 struct External
634 {
635 struct External * prev;
636 struct External * next;
637 struct Location loc;
638 int type;
639 struct Symbol * symbol;
640 union
641 {
642 struct FunctionDefinition * function;
643 struct ClassDefinition * _class;
644 struct Declaration * declaration;
645 char *  importString;
646 struct Identifier * id;
647 struct DBTableDef * table;
648 } __attribute__ ((gcc_struct));
649 int importType;
650 } __attribute__ ((gcc_struct));
651
652 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
653
654 struct ModuleImport
655 {
656 struct ModuleImport * prev;
657 struct ModuleImport * next;
658 char *  name;
659 struct __ecereNameSpace__ecere__sys__OldList classes;
660 struct __ecereNameSpace__ecere__sys__OldList functions;
661 int importType;
662 int importAccess;
663 } __attribute__ ((gcc_struct));
664
665 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
666
667 struct ClassImport
668 {
669 struct ClassImport * prev;
670 struct ClassImport * next;
671 char *  name;
672 struct __ecereNameSpace__ecere__sys__OldList methods;
673 struct __ecereNameSpace__ecere__sys__OldList properties;
674 unsigned int itself;
675 unsigned int isRemote;
676 } __attribute__ ((gcc_struct));
677
678 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
679
680 struct Symbol
681 {
682 char *  string;
683 struct Symbol * parent;
684 struct Symbol * left;
685 struct Symbol * right;
686 int depth;
687 struct Type * type;
688 union
689 {
690 struct __ecereNameSpace__ecere__com__Method * method;
691 struct __ecereNameSpace__ecere__com__Property * _property;
692 struct __ecereNameSpace__ecere__com__Class * registered;
693 } __attribute__ ((gcc_struct));
694 int id;
695 int idCode;
696 union
697 {
698 struct
699 {
700 struct External * pointerExternal;
701 struct External * structExternal;
702 } __attribute__ ((gcc_struct));
703 struct
704 {
705 struct External * externalGet;
706 struct External * externalSet;
707 struct External * externalPtr;
708 struct External * externalIsSet;
709 } __attribute__ ((gcc_struct));
710 struct
711 {
712 struct External * methodExternal;
713 struct External * methodCodeExternal;
714 } __attribute__ ((gcc_struct));
715 } __attribute__ ((gcc_struct));
716 unsigned int imported;
717 unsigned int declaredStructSym;
718 struct __ecereNameSpace__ecere__com__Class * _class;
719 unsigned int declaredStruct;
720 unsigned int needConstructor;
721 unsigned int needDestructor;
722 char *  constructorName;
723 char *  structName;
724 char *  className;
725 char *  destructorName;
726 struct ModuleImport * module;
727 struct ClassImport * _import;
728 struct Location nameLoc;
729 unsigned int isParam;
730 unsigned int isRemote;
731 unsigned int isStruct;
732 unsigned int fireWatchersDone;
733 int declaring;
734 unsigned int classData;
735 unsigned int isStatic;
736 char *  shortName;
737 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
738 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
739 struct Context * ctx;
740 int isIterator;
741 struct Expression * propCategory;
742 } __attribute__ ((gcc_struct));
743
744 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
745
746 struct Type
747 {
748 struct Type * prev;
749 struct Type * next;
750 int refCount;
751 union
752 {
753 struct Symbol * _class;
754 struct
755 {
756 struct __ecereNameSpace__ecere__sys__OldList members;
757 char *  enumName;
758 } __attribute__ ((gcc_struct));
759 struct
760 {
761 struct Type * returnType;
762 struct __ecereNameSpace__ecere__sys__OldList params;
763 struct Symbol * thisClass;
764 unsigned int staticMethod;
765 struct TemplateParameter * thisClassTemplate;
766 } __attribute__ ((gcc_struct));
767 struct
768 {
769 struct __ecereNameSpace__ecere__com__Method * method;
770 struct __ecereNameSpace__ecere__com__Class * methodClass;
771 struct __ecereNameSpace__ecere__com__Class * usedClass;
772 } __attribute__ ((gcc_struct));
773 struct
774 {
775 struct Type * arrayType;
776 int arraySize;
777 struct Expression * arraySizeExp;
778 unsigned int freeExp;
779 struct Symbol * enumClass;
780 } __attribute__ ((gcc_struct));
781 struct Type * type;
782 struct TemplateParameter * templateParameter;
783 } __attribute__ ((gcc_struct));
784 int kind;
785 unsigned int size;
786 char *  name;
787 char *  typeName;
788 int classObjectType;
789 int alignment;
790 unsigned int offset;
791 int bitFieldCount;
792 int count;
793 unsigned int isSigned : 1;
794 unsigned int constant : 1;
795 unsigned int truth : 1;
796 unsigned int byReference : 1;
797 unsigned int extraParam : 1;
798 unsigned int directClassAccess : 1;
799 unsigned int computing : 1;
800 unsigned int keepCast : 1;
801 unsigned int passAsTemplate : 1;
802 unsigned int dllExport : 1;
803 unsigned int attrStdcall : 1;
804 unsigned int declaredWithStruct : 1;
805 } __attribute__ ((gcc_struct));
806
807 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
808
809 struct __ecereNameSpace__ecere__com__Class
810 {
811 struct __ecereNameSpace__ecere__com__Class * prev;
812 struct __ecereNameSpace__ecere__com__Class * next;
813 char *  name;
814 int offset;
815 int structSize;
816 int (* *  _vTbl)();
817 int vTblSize;
818 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
819 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
820 int offsetClass;
821 int sizeClass;
822 struct __ecereNameSpace__ecere__com__Class * base;
823 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
824 struct __ecereNameSpace__ecere__sys__BinaryTree members;
825 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
826 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
827 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
828 struct __ecereNameSpace__ecere__sys__OldList derivatives;
829 int memberID;
830 int startMemberID;
831 int type;
832 struct __ecereNameSpace__ecere__com__Instance * module;
833 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
834 char *  dataTypeString;
835 struct Type * dataType;
836 int typeSize;
837 int defaultAlignment;
838 void (*  Initialize)();
839 int memberOffset;
840 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
841 char *  designerClass;
842 unsigned int noExpansion;
843 char *  defaultProperty;
844 unsigned int comRedefinition;
845 int count;
846 unsigned int isRemote;
847 unsigned int internalDecl;
848 void *  data;
849 unsigned int computeSize;
850 int structAlignment;
851 int destructionWatchOffset;
852 unsigned int fixed;
853 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
854 int inheritanceAccess;
855 char *  fullName;
856 void *  symbol;
857 struct __ecereNameSpace__ecere__sys__OldList conversions;
858 struct __ecereNameSpace__ecere__sys__OldList templateParams;
859 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
860 struct __ecereNameSpace__ecere__com__Class * templateClass;
861 struct __ecereNameSpace__ecere__sys__OldList templatized;
862 int numParams;
863 unsigned int isInstanceClass;
864 } __attribute__ ((gcc_struct));
865
866 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
867
868 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
869
870 struct __ecereNameSpace__ecere__com__Instance
871 {
872 int (* *  _vTbl)();
873 struct __ecereNameSpace__ecere__com__Class * _class;
874 int _refCount;
875 } __attribute__ ((gcc_struct));
876
877 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
878
879 struct __ecereNameSpace__ecere__com__DataMember
880 {
881 struct __ecereNameSpace__ecere__com__DataMember * prev;
882 struct __ecereNameSpace__ecere__com__DataMember * next;
883 char *  name;
884 unsigned int isProperty;
885 int memberAccess;
886 int id;
887 struct __ecereNameSpace__ecere__com__Class * _class;
888 char *  dataTypeString;
889 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
890 struct Type * dataType;
891 int type;
892 int offset;
893 int memberID;
894 struct __ecereNameSpace__ecere__sys__OldList members;
895 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
896 int memberOffset;
897 int structAlignment;
898 } __attribute__ ((gcc_struct));
899
900 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
901
902 struct __ecereNameSpace__ecere__com__SerialBuffer
903 {
904 unsigned char *  _buffer;
905 unsigned int count;
906 unsigned int _size;
907 unsigned int pos;
908 } __attribute__ ((gcc_struct));
909
910 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
911
912 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
913 {
914 union
915 {
916 struct
917 {
918 char *  dataTypeString;
919 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
920 } __attribute__ ((gcc_struct));
921 struct __ecereNameSpace__ecere__com__DataValue expression;
922 struct
923 {
924 char *  memberString;
925 union
926 {
927 struct __ecereNameSpace__ecere__com__DataMember * member;
928 struct __ecereNameSpace__ecere__com__Property * prop;
929 struct __ecereNameSpace__ecere__com__Method * method;
930 } __attribute__ ((gcc_struct));
931 } __attribute__ ((gcc_struct));
932 } __attribute__ ((gcc_struct));
933 } __attribute__ ((gcc_struct));
934
935 void exit(int status);
936
937 void * calloc(size_t nmemb, size_t size);
938
939 void free(void * ptr);
940
941 void * malloc(size_t size);
942
943 void * realloc(void * ptr, size_t size);
944
945 long int strtol(const char * nptr, char ** endptr, int base);
946
947 long long int strtoll(const char * nptr, char ** endptr, int base);
948
949 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
950
951 enum yytokentype
952 {
953 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
954 };
955
956 typedef union YYSTYPE
957 {
958 int specifierType;
959 int i;
960 int declMode;
961 struct Identifier * id;
962 struct Expression * exp;
963 struct Specifier * specifier;
964 struct __ecereNameSpace__ecere__sys__OldList * list;
965 struct Enumerator * enumerator;
966 struct Declarator * declarator;
967 struct Pointer * pointer;
968 struct Initializer * initializer;
969 struct InitDeclarator * initDeclarator;
970 struct TypeName * typeName;
971 struct Declaration * declaration;
972 struct Statement * stmt;
973 struct FunctionDefinition * function;
974 struct External * external;
975 struct Context * context;
976 struct AsmField * asmField;
977 struct Attrib * attrib;
978 struct ExtDecl * extDecl;
979 struct Attribute * attribute;
980 struct Instantiation * instance;
981 struct MembersInit * membersInit;
982 struct MemberInit * memberInit;
983 struct ClassFunction * classFunction;
984 struct ClassDefinition * _class;
985 struct ClassDef * classDef;
986 struct PropertyDef * prop;
987 char * string;
988 struct Symbol * symbol;
989 struct PropertyWatch * propertyWatch;
990 struct TemplateParameter * templateParameter;
991 struct TemplateArgument * templateArgument;
992 struct TemplateDatatype * templateDatatype;
993 struct DBTableEntry * dbtableEntry;
994 struct DBIndexItem * dbindexItem;
995 struct DBTableDef * dbtableDef;
996 } __attribute__ ((gcc_struct)) YYSTYPE;
997
998 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
999
1000 struct Enumerator
1001 {
1002 struct Enumerator * prev;
1003 struct Enumerator * next;
1004 struct Location loc;
1005 struct Identifier * id;
1006 struct Expression * exp;
1007 } __attribute__ ((gcc_struct));
1008
1009 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
1010
1011 struct InitDeclarator
1012 {
1013 struct InitDeclarator * prev;
1014 struct InitDeclarator * next;
1015 struct Location loc;
1016 struct Declarator * declarator;
1017 struct Initializer * initializer;
1018 } __attribute__ ((gcc_struct));
1019
1020 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
1021
1022 struct AsmField
1023 {
1024 struct AsmField * prev;
1025 struct AsmField * next;
1026 struct Location loc;
1027 char *  command;
1028 struct Expression * expression;
1029 } __attribute__ ((gcc_struct));
1030
1031 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
1032
1033 struct Attribute;
1034
1035 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
1036
1037 struct ClassFunction
1038 {
1039 struct ClassFunction * prev;
1040 struct ClassFunction * next;
1041 struct Location loc;
1042 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1043 struct Declarator * declarator;
1044 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1045 struct Statement * body;
1046 struct __ecereNameSpace__ecere__com__Class * _class;
1047 struct __ecereNameSpace__ecere__sys__OldList attached;
1048 int declMode;
1049 struct Type * type;
1050 struct Symbol * propSet;
1051 unsigned int isVirtual;
1052 unsigned int isConstructor;
1053 unsigned int isDestructor;
1054 unsigned int dontMangle;
1055 int id;
1056 int idCode;
1057 } __attribute__ ((gcc_struct));
1058
1059 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1060
1061 struct MembersInit
1062 {
1063 struct MembersInit * prev;
1064 struct MembersInit * next;
1065 struct Location loc;
1066 int type;
1067 union
1068 {
1069 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1070 struct ClassFunction * function;
1071 } __attribute__ ((gcc_struct));
1072 } __attribute__ ((gcc_struct));
1073
1074 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1075
1076 struct MemberInit
1077 {
1078 struct MemberInit * prev;
1079 struct MemberInit * next;
1080 struct Location loc;
1081 struct Location realLoc;
1082 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1083 struct Initializer * initializer;
1084 unsigned int used;
1085 unsigned int variable;
1086 unsigned int takeOutExp;
1087 } __attribute__ ((gcc_struct));
1088
1089 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1090
1091 struct PropertyDef
1092 {
1093 struct PropertyDef * prev;
1094 struct PropertyDef * next;
1095 struct Location loc;
1096 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1097 struct Declarator * declarator;
1098 struct Identifier * id;
1099 struct Statement * getStmt;
1100 struct Statement * setStmt;
1101 struct Statement * issetStmt;
1102 struct Symbol * symbol;
1103 unsigned int conversion;
1104 unsigned int isWatchable;
1105 struct Expression * category;
1106 } __attribute__ ((gcc_struct));
1107
1108 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1109
1110 struct PropertyWatch
1111 {
1112 struct PropertyWatch * prev;
1113 struct PropertyWatch * next;
1114 struct Location loc;
1115 struct Statement * compound;
1116 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1117 unsigned int deleteWatch;
1118 } __attribute__ ((gcc_struct));
1119
1120 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1121
1122 struct ClassDef
1123 {
1124 struct ClassDef * prev;
1125 struct ClassDef * next;
1126 struct Location loc;
1127 int type;
1128 union
1129 {
1130 struct Declaration * decl;
1131 struct ClassFunction * function;
1132 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1133 struct PropertyDef * propertyDef;
1134 struct PropertyWatch * propertyWatch;
1135 char *  designer;
1136 struct Identifier * defaultProperty;
1137 struct
1138 {
1139 struct Identifier * id;
1140 struct Initializer * initializer;
1141 } __attribute__ ((gcc_struct));
1142 } __attribute__ ((gcc_struct));
1143 int memberAccess;
1144 void *  object;
1145 } __attribute__ ((gcc_struct));
1146
1147 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1148
1149 struct DBTableEntry;
1150
1151 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1152
1153 struct DBIndexItem;
1154
1155 extern YYSTYPE yylval;
1156
1157 extern struct Location yylloc;
1158
1159 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1160
1161 extern int returnCode;
1162
1163 extern struct Expression * parsedExpression;
1164
1165 extern unsigned int yydebug;
1166
1167 void SetYydebug(unsigned int b)
1168 {
1169 yydebug = b;
1170 }
1171
1172 extern unsigned int echoOn;
1173
1174 void resetScanner();
1175
1176 int propWatcherID;
1177
1178 int expression_yyparse();
1179
1180 static struct Statement * curCompound;
1181
1182 struct External * curExternal, * afterExternal;
1183
1184 static struct Type * curSwitchType;
1185
1186 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1187
1188 struct __ecereNameSpace__ecere__com__Class * thisClass;
1189
1190 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1191 {
1192 thisClass = c;
1193 }
1194
1195 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1196 {
1197 return thisClass;
1198 }
1199
1200 static char * thisNameSpace;
1201
1202 struct __ecereNameSpace__ecere__com__Class * containerClass;
1203
1204 unsigned int thisClassParams = 0x1;
1205
1206 unsigned int internalValueCounter;
1207
1208 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1209
1210 extern size_t strlen(const char * );
1211
1212 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1213
1214 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1215
1216 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1217
1218 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1219
1220 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1221
1222 void PrintExpression(struct Expression * exp, char * string)
1223 {
1224 {
1225 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1226 int count;
1227
1228 if(exp)
1229 OutputExpression(exp, f);
1230 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1231 count = strlen(string);
1232 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);
1233 string[count] = '\0';
1234 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1235 }
1236 }
1237
1238 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1239
1240 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1241
1242 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1243 {
1244 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1245 {
1246 if(!param->baseType)
1247 {
1248 if(param->dataTypeString)
1249 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1250 else
1251 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1252 }
1253 return param->baseType;
1254 }
1255 return (((void *)0));
1256 }
1257
1258 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1259 {
1260 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1261 return 0x1;
1262 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1263 {
1264 return 0x0;
1265 }
1266 if(type1->kind == type2->kind)
1267 {
1268 switch(type1->kind)
1269 {
1270 case 1:
1271 case 2:
1272 case 3:
1273 case 4:
1274 case 22:
1275 case 23:
1276 if(type1->passAsTemplate && !type2->passAsTemplate)
1277 return 0x1;
1278 return type1->isSigned != type2->isSigned;
1279 case 8:
1280 return type1->_class != type2->_class;
1281 case 13:
1282 return NeedCast(type1->type, type2->type);
1283 default:
1284 return 0x1;
1285 }
1286 }
1287 return 0x1;
1288 }
1289
1290 extern int strcmp(const char * , const char * );
1291
1292 extern struct Context * curContext;
1293
1294 extern struct Context * topContext;
1295
1296 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1297
1298 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);
1299
1300 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1301
1302 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);
1303
1304 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);
1305
1306 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1307
1308 struct __ecereNameSpace__ecere__com__ClassProperty
1309 {
1310 char *  name;
1311 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1312 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1313 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1314 int depth;
1315 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, long long);
1316 long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1317 char *  dataTypeString;
1318 struct Type * dataType;
1319 unsigned int constant;
1320 } __attribute__ ((gcc_struct));
1321
1322 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1323
1324 extern struct Expression * QMkExpId(char *  id);
1325
1326 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1327
1328 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1329 {
1330 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1331 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1332 char *  name;
1333 int type;
1334 union
1335 {
1336 char *  dataTypeString;
1337 int memberType;
1338 } __attribute__ ((gcc_struct));
1339 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1340 void *  param;
1341 } __attribute__ ((gcc_struct));
1342
1343 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1344
1345 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1346
1347 extern void FreeIdentifier(struct Identifier * id);
1348
1349 void ProcessExpressionType(struct Expression * exp);
1350
1351 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1352
1353 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1354
1355 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1356
1357 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1358
1359 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1360
1361 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1362
1363 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1364
1365 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1366
1367 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1368 {
1369 if(exp->type == 0 && exp->identifier)
1370 {
1371 struct Identifier * id = exp->identifier;
1372 struct Context * ctx;
1373 struct Symbol * symbol = (((void *)0));
1374
1375 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1376 {
1377 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1378 {
1379 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1380 if(symbol)
1381 break;
1382 }
1383 }
1384 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1385 {
1386 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1387 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1388 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1389 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
1390
1391 if(!prop)
1392 {
1393 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1394 }
1395 if(!prop && !method)
1396 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1397 if(!prop && !method && !member)
1398 {
1399 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1400 }
1401 if(prop || method || member || classProp)
1402 {
1403 exp->type = 8;
1404 exp->member.member = id;
1405 exp->member.memberType = 0;
1406 exp->member.exp = QMkExpId("this");
1407 exp->addedThis = 0x1;
1408 }
1409 else if(_class && _class->templateParams.first)
1410 {
1411 struct __ecereNameSpace__ecere__com__Class * sClass;
1412
1413 for(sClass = _class; sClass; sClass = sClass->base)
1414 {
1415 if(sClass->templateParams.first)
1416 {
1417 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1418
1419 for(param = sClass->templateParams.first; param; param = param->next)
1420 {
1421 if(param->type == 2 && !strcmp(param->name, id->string))
1422 {
1423 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1424
1425 if(argExp)
1426 {
1427 struct Declarator * decl;
1428 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1429
1430 FreeIdentifier(exp->member.member);
1431 ProcessExpressionType(argExp);
1432 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1433 exp->expType = ProcessType(specs, decl);
1434 exp->type = 5;
1435 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1436 }
1437 }
1438 }
1439 }
1440 }
1441 }
1442 }
1443 }
1444 }
1445
1446 extern int sprintf(char * , char * , ...);
1447
1448 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1449
1450 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1451
1452 char * PrintInt(long long result)
1453 {
1454 char temp[100];
1455
1456 if(result > (((long long)0x7fffffffffffffffLL)))
1457 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1458 else
1459 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1460 return __ecereNameSpace__ecere__sys__CopyString(temp);
1461 }
1462
1463 char * PrintUInt(uint64 result)
1464 {
1465 char temp[100];
1466
1467 if(result > (0xffffffff))
1468 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1469 else if(result > (((int)0x7fffffff)))
1470 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1471 else
1472 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1473 return __ecereNameSpace__ecere__sys__CopyString(temp);
1474 }
1475
1476 char * PrintInt64(long long result)
1477 {
1478 char temp[100];
1479
1480 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1481 return __ecereNameSpace__ecere__sys__CopyString(temp);
1482 }
1483
1484 char * PrintUInt64(uint64 result)
1485 {
1486 char temp[100];
1487
1488 if(result > (((long long)0x7fffffffffffffffLL)))
1489 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1490 else
1491 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1492 return __ecereNameSpace__ecere__sys__CopyString(temp);
1493 }
1494
1495 char * PrintHexUInt(uint64 result)
1496 {
1497 char temp[100];
1498
1499 if(result > (0xffffffff))
1500 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1501 else
1502 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1503 return __ecereNameSpace__ecere__sys__CopyString(temp);
1504 }
1505
1506 char * PrintHexUInt64(uint64 result)
1507 {
1508 char temp[100];
1509
1510 if(result > (0xffffffff))
1511 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1512 else
1513 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1514 return __ecereNameSpace__ecere__sys__CopyString(temp);
1515 }
1516
1517 char * PrintShort(short result)
1518 {
1519 char temp[100];
1520
1521 sprintf(temp, "%d", (unsigned short)result);
1522 return __ecereNameSpace__ecere__sys__CopyString(temp);
1523 }
1524
1525 char * PrintUShort(unsigned short result)
1526 {
1527 char temp[100];
1528
1529 if(result > (unsigned short)32767)
1530 sprintf(temp, "0x%X", (int)result);
1531 else
1532 sprintf(temp, "%d", (int)result);
1533 return __ecereNameSpace__ecere__sys__CopyString(temp);
1534 }
1535
1536 extern int isprint(int c);
1537
1538 char * PrintChar(char result)
1539 {
1540 char temp[100];
1541
1542 if(result > (char)0 && isprint(result))
1543 sprintf(temp, "'%c'", result);
1544 else if(result < (char)0)
1545 sprintf(temp, "%d", (int)result);
1546 else
1547 sprintf(temp, "0x%X", (unsigned char)result);
1548 return __ecereNameSpace__ecere__sys__CopyString(temp);
1549 }
1550
1551 char * PrintUChar(unsigned char result)
1552 {
1553 char temp[100];
1554
1555 sprintf(temp, "0x%X", result);
1556 return __ecereNameSpace__ecere__sys__CopyString(temp);
1557 }
1558
1559 char * PrintFloat(float result)
1560 {
1561 char temp[350];
1562
1563 sprintf(temp, "%.16ff", result);
1564 return __ecereNameSpace__ecere__sys__CopyString(temp);
1565 }
1566
1567 char * PrintDouble(double result)
1568 {
1569 char temp[350];
1570
1571 sprintf(temp, "%.16f", result);
1572 return __ecereNameSpace__ecere__sys__CopyString(temp);
1573 }
1574
1575 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1576
1577 struct OpTable
1578 {
1579 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1580 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1581 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1582 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1583 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1584 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1585 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1586 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1587 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1588 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1589 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1590 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1591 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1592 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1593 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1594 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1595 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1596 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1597 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1598 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1599 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1600 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1601 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1602 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1603 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1604 unsigned int (*  Not)(struct Expression *, struct Operand *);
1605 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1606 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1607 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1608 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1609 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1610 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1611 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1612 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1613 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1614 } __attribute__ ((gcc_struct));
1615
1616 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1617
1618 struct Operand
1619 {
1620 int kind;
1621 struct Type * type;
1622 unsigned int ptrSize;
1623 union
1624 {
1625 char c;
1626 unsigned char uc;
1627 short s;
1628 unsigned short us;
1629 int i;
1630 unsigned int ui;
1631 float f;
1632 double d;
1633 long long i64;
1634 uint64 ui64;
1635 } __attribute__ ((gcc_struct));
1636 struct OpTable ops;
1637 } __attribute__ ((gcc_struct));
1638
1639 struct Operand GetOperand(struct Expression * exp);
1640
1641 unsigned int GetInt(struct Expression * exp, int * value2)
1642 {
1643 struct Operand op2 = GetOperand(exp);
1644
1645 if(op2.kind == 3 && op2.type->isSigned)
1646 *value2 = op2.i;
1647 else if(op2.kind == 3)
1648 *value2 = (int)op2.ui;
1649 else if(op2.kind == 4 && op2.type->isSigned)
1650 *value2 = (int)op2.i64;
1651 else if(op2.kind == 4)
1652 *value2 = (int)op2.ui64;
1653 else if(op2.kind == 23 && op2.type->isSigned)
1654 *value2 = (int)op2.i64;
1655 else if(op2.kind == 23)
1656 *value2 = (int)op2.ui64;
1657 else if(op2.kind == 22 && op2.type->isSigned)
1658 *value2 = (int)op2.i64;
1659 else if(op2.kind == 22)
1660 *value2 = (int)op2.ui64;
1661 else if(op2.kind == 2 && op2.type->isSigned)
1662 *value2 = (int)op2.s;
1663 else if(op2.kind == 2)
1664 *value2 = (int)op2.us;
1665 else if(op2.kind == 1 && op2.type->isSigned)
1666 *value2 = (int)op2.c;
1667 else if(op2.kind == 1)
1668 *value2 = (int)op2.uc;
1669 else if(op2.kind == 6)
1670 *value2 = (int)op2.f;
1671 else if(op2.kind == 7)
1672 *value2 = (int)op2.d;
1673 else if(op2.kind == 13)
1674 *value2 = (int)op2.ui64;
1675 else
1676 return 0x0;
1677 return 0x1;
1678 }
1679
1680 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1681 {
1682 struct Operand op2 = GetOperand(exp);
1683
1684 if(op2.kind == 3 && op2.type->isSigned)
1685 *value2 = (unsigned int)op2.i;
1686 else if(op2.kind == 3)
1687 *value2 = op2.ui;
1688 else if(op2.kind == 4 && op2.type->isSigned)
1689 *value2 = (unsigned int)op2.i64;
1690 else if(op2.kind == 4)
1691 *value2 = (unsigned int)op2.ui64;
1692 else if(op2.kind == 23 && op2.type->isSigned)
1693 *value2 = (unsigned int)op2.i64;
1694 else if(op2.kind == 23)
1695 *value2 = (unsigned int)op2.ui64;
1696 else if(op2.kind == 22 && op2.type->isSigned)
1697 *value2 = (unsigned int)op2.i64;
1698 else if(op2.kind == 22)
1699 *value2 = (unsigned int)op2.ui64;
1700 else if(op2.kind == 2 && op2.type->isSigned)
1701 *value2 = (unsigned int)op2.s;
1702 else if(op2.kind == 2)
1703 *value2 = (unsigned int)op2.us;
1704 else if(op2.kind == 1 && op2.type->isSigned)
1705 *value2 = (unsigned int)op2.c;
1706 else if(op2.kind == 1)
1707 *value2 = (unsigned int)op2.uc;
1708 else if(op2.kind == 6)
1709 *value2 = (unsigned int)op2.f;
1710 else if(op2.kind == 7)
1711 *value2 = (unsigned int)op2.d;
1712 else if(op2.kind == 13)
1713 *value2 = (unsigned int)op2.ui64;
1714 else
1715 return 0x0;
1716 return 0x1;
1717 }
1718
1719 unsigned int GetInt64(struct Expression * exp, long long * value2)
1720 {
1721 struct Operand op2 = GetOperand(exp);
1722
1723 if(op2.kind == 3 && op2.type->isSigned)
1724 *value2 = (long long)op2.i;
1725 else if(op2.kind == 3)
1726 *value2 = (long long)op2.ui;
1727 else if(op2.kind == 4 && op2.type->isSigned)
1728 *value2 = op2.i64;
1729 else if(op2.kind == 4)
1730 *value2 = (long long)op2.ui64;
1731 else if(op2.kind == 23 && op2.type->isSigned)
1732 *value2 = op2.i64;
1733 else if(op2.kind == 23)
1734 *value2 = (long long)op2.ui64;
1735 else if(op2.kind == 22 && op2.type->isSigned)
1736 *value2 = op2.i64;
1737 else if(op2.kind == 22)
1738 *value2 = (long long)op2.ui64;
1739 else if(op2.kind == 2 && op2.type->isSigned)
1740 *value2 = (long long)op2.s;
1741 else if(op2.kind == 2)
1742 *value2 = (long long)op2.us;
1743 else if(op2.kind == 1 && op2.type->isSigned)
1744 *value2 = (long long)op2.c;
1745 else if(op2.kind == 1)
1746 *value2 = (long long)op2.uc;
1747 else if(op2.kind == 6)
1748 *value2 = (long long)op2.f;
1749 else if(op2.kind == 7)
1750 *value2 = (long long)op2.d;
1751 else if(op2.kind == 13)
1752 *value2 = (long long)op2.ui64;
1753 else
1754 return 0x0;
1755 return 0x1;
1756 }
1757
1758 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1759 {
1760 struct Operand op2 = GetOperand(exp);
1761
1762 if(op2.kind == 3 && op2.type->isSigned)
1763 *value2 = (uint64)op2.i;
1764 else if(op2.kind == 3)
1765 *value2 = (uint64)op2.ui;
1766 else if(op2.kind == 4 && op2.type->isSigned)
1767 *value2 = (uint64)op2.i64;
1768 else if(op2.kind == 4)
1769 *value2 = op2.ui64;
1770 else if(op2.kind == 23 && op2.type->isSigned)
1771 *value2 = (uint64)op2.i64;
1772 else if(op2.kind == 23)
1773 *value2 = op2.ui64;
1774 else if(op2.kind == 22 && op2.type->isSigned)
1775 *value2 = (uint64)op2.i64;
1776 else if(op2.kind == 22)
1777 *value2 = op2.ui64;
1778 else if(op2.kind == 2 && op2.type->isSigned)
1779 *value2 = (uint64)op2.s;
1780 else if(op2.kind == 2)
1781 *value2 = (uint64)op2.us;
1782 else if(op2.kind == 1 && op2.type->isSigned)
1783 *value2 = (uint64)op2.c;
1784 else if(op2.kind == 1)
1785 *value2 = (uint64)op2.uc;
1786 else if(op2.kind == 6)
1787 *value2 = (uint64)op2.f;
1788 else if(op2.kind == 7)
1789 *value2 = (uint64)op2.d;
1790 else if(op2.kind == 13)
1791 *value2 = op2.ui64;
1792 else
1793 return 0x0;
1794 return 0x1;
1795 }
1796
1797 unsigned int GetIntPtr(struct Expression * exp, intptr_t * value2)
1798 {
1799 struct Operand op2 = GetOperand(exp);
1800
1801 if(op2.kind == 3 && op2.type->isSigned)
1802 *value2 = (intptr_t)op2.i;
1803 else if(op2.kind == 3)
1804 *value2 = (intptr_t)op2.ui;
1805 else if(op2.kind == 4 && op2.type->isSigned)
1806 *value2 = (intptr_t)op2.i64;
1807 else if(op2.kind == 4)
1808 *value2 = (intptr_t)op2.ui64;
1809 else if(op2.kind == 23 && op2.type->isSigned)
1810 *value2 = (intptr_t)op2.i64;
1811 else if(op2.kind == 23)
1812 *value2 = (intptr_t)op2.ui64;
1813 else if(op2.kind == 22 && op2.type->isSigned)
1814 *value2 = (intptr_t)op2.i64;
1815 else if(op2.kind == 22)
1816 *value2 = (intptr_t)op2.ui64;
1817 else if(op2.kind == 2 && op2.type->isSigned)
1818 *value2 = (intptr_t)op2.s;
1819 else if(op2.kind == 2)
1820 *value2 = (intptr_t)op2.us;
1821 else if(op2.kind == 1 && op2.type->isSigned)
1822 *value2 = (intptr_t)op2.c;
1823 else if(op2.kind == 1)
1824 *value2 = (intptr_t)op2.uc;
1825 else if(op2.kind == 6)
1826 *value2 = (intptr_t)op2.f;
1827 else if(op2.kind == 7)
1828 *value2 = (intptr_t)op2.d;
1829 else if(op2.kind == 13)
1830 *value2 = (intptr_t)op2.ui64;
1831 else
1832 return 0x0;
1833 return 0x1;
1834 }
1835
1836 unsigned int GetUIntPtr(struct Expression * exp, uintptr_t * value2)
1837 {
1838 struct Operand op2 = GetOperand(exp);
1839
1840 if(op2.kind == 3 && op2.type->isSigned)
1841 *value2 = (uintptr_t)op2.i;
1842 else if(op2.kind == 3)
1843 *value2 = (uintptr_t)op2.ui;
1844 else if(op2.kind == 4 && op2.type->isSigned)
1845 *value2 = (uintptr_t)op2.i64;
1846 else if(op2.kind == 4)
1847 *value2 = (uintptr_t)op2.ui64;
1848 else if(op2.kind == 23 && op2.type->isSigned)
1849 *value2 = (uintptr_t)op2.i64;
1850 else if(op2.kind == 23)
1851 *value2 = (uintptr_t)op2.ui64;
1852 else if(op2.kind == 22 && op2.type->isSigned)
1853 *value2 = (uintptr_t)op2.i64;
1854 else if(op2.kind == 22)
1855 *value2 = (uintptr_t)op2.ui64;
1856 else if(op2.kind == 2 && op2.type->isSigned)
1857 *value2 = (uintptr_t)op2.s;
1858 else if(op2.kind == 2)
1859 *value2 = (uintptr_t)op2.us;
1860 else if(op2.kind == 1 && op2.type->isSigned)
1861 *value2 = (uintptr_t)op2.c;
1862 else if(op2.kind == 1)
1863 *value2 = (uintptr_t)op2.uc;
1864 else if(op2.kind == 6)
1865 *value2 = (uintptr_t)op2.f;
1866 else if(op2.kind == 7)
1867 *value2 = (uintptr_t)op2.d;
1868 else if(op2.kind == 13)
1869 *value2 = (uintptr_t)op2.ui64;
1870 else
1871 return 0x0;
1872 return 0x1;
1873 }
1874
1875 unsigned int GetIntSize(struct Expression * exp, ssize_t * value2)
1876 {
1877 struct Operand op2 = GetOperand(exp);
1878
1879 if(op2.kind == 3 && op2.type->isSigned)
1880 *value2 = (ssize_t)op2.i;
1881 else if(op2.kind == 3)
1882 *value2 = (ssize_t)op2.ui;
1883 else if(op2.kind == 4 && op2.type->isSigned)
1884 *value2 = (ssize_t)op2.i64;
1885 else if(op2.kind == 4)
1886 *value2 = (ssize_t)op2.ui64;
1887 else if(op2.kind == 23 && op2.type->isSigned)
1888 *value2 = (ssize_t)op2.i64;
1889 else if(op2.kind == 23)
1890 *value2 = (ssize_t)op2.ui64;
1891 else if(op2.kind == 22 && op2.type->isSigned)
1892 *value2 = (ssize_t)op2.i64;
1893 else if(op2.kind == 22)
1894 *value2 = (ssize_t)op2.ui64;
1895 else if(op2.kind == 2 && op2.type->isSigned)
1896 *value2 = (ssize_t)op2.s;
1897 else if(op2.kind == 2)
1898 *value2 = (ssize_t)op2.us;
1899 else if(op2.kind == 1 && op2.type->isSigned)
1900 *value2 = (ssize_t)op2.c;
1901 else if(op2.kind == 1)
1902 *value2 = (ssize_t)op2.uc;
1903 else if(op2.kind == 6)
1904 *value2 = (ssize_t)op2.f;
1905 else if(op2.kind == 7)
1906 *value2 = (ssize_t)op2.d;
1907 else if(op2.kind == 13)
1908 *value2 = (ssize_t)op2.ui64;
1909 else
1910 return 0x0;
1911 return 0x1;
1912 }
1913
1914 unsigned int GetUIntSize(struct Expression * exp, size_t * value2)
1915 {
1916 struct Operand op2 = GetOperand(exp);
1917
1918 if(op2.kind == 3 && op2.type->isSigned)
1919 *value2 = (size_t)op2.i;
1920 else if(op2.kind == 3)
1921 *value2 = (size_t)op2.ui;
1922 else if(op2.kind == 4 && op2.type->isSigned)
1923 *value2 = (size_t)op2.i64;
1924 else if(op2.kind == 4)
1925 *value2 = (size_t)op2.ui64;
1926 else if(op2.kind == 23 && op2.type->isSigned)
1927 *value2 = (size_t)op2.i64;
1928 else if(op2.kind == 23)
1929 *value2 = (size_t)op2.ui64;
1930 else if(op2.kind == 22 && op2.type->isSigned)
1931 *value2 = (size_t)op2.i64;
1932 else if(op2.kind == 22)
1933 *value2 = (size_t)op2.ui64;
1934 else if(op2.kind == 2 && op2.type->isSigned)
1935 *value2 = (size_t)op2.s;
1936 else if(op2.kind == 2)
1937 *value2 = (size_t)op2.us;
1938 else if(op2.kind == 1 && op2.type->isSigned)
1939 *value2 = (size_t)op2.c;
1940 else if(op2.kind == 1)
1941 *value2 = (size_t)op2.uc;
1942 else if(op2.kind == 6)
1943 *value2 = (size_t)op2.f;
1944 else if(op2.kind == 7)
1945 *value2 = (size_t)op2.d;
1946 else if(op2.kind == 13)
1947 *value2 = (size_t)op2.ui64;
1948 else
1949 return 0x0;
1950 return 0x1;
1951 }
1952
1953 unsigned int GetShort(struct Expression * exp, short * value2)
1954 {
1955 struct Operand op2 = GetOperand(exp);
1956
1957 if(op2.kind == 3 && op2.type->isSigned)
1958 *value2 = (short)op2.i;
1959 else if(op2.kind == 3)
1960 *value2 = (short)op2.ui;
1961 else if(op2.kind == 4 && op2.type->isSigned)
1962 *value2 = (short)op2.i64;
1963 else if(op2.kind == 4)
1964 *value2 = (short)op2.ui64;
1965 else if(op2.kind == 23 && op2.type->isSigned)
1966 *value2 = (short)op2.i64;
1967 else if(op2.kind == 23)
1968 *value2 = (short)op2.ui64;
1969 else if(op2.kind == 22 && op2.type->isSigned)
1970 *value2 = (short)op2.i64;
1971 else if(op2.kind == 22)
1972 *value2 = (short)op2.ui64;
1973 else if(op2.kind == 2 && op2.type->isSigned)
1974 *value2 = op2.s;
1975 else if(op2.kind == 2)
1976 *value2 = (short)op2.us;
1977 else if(op2.kind == 1 && op2.type->isSigned)
1978 *value2 = (short)op2.c;
1979 else if(op2.kind == 1)
1980 *value2 = (short)op2.uc;
1981 else if(op2.kind == 6)
1982 *value2 = (short)op2.f;
1983 else if(op2.kind == 7)
1984 *value2 = (short)op2.d;
1985 else if(op2.kind == 13)
1986 *value2 = (short)op2.ui64;
1987 else
1988 return 0x0;
1989 return 0x1;
1990 }
1991
1992 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
1993 {
1994 struct Operand op2 = GetOperand(exp);
1995
1996 if(op2.kind == 3 && op2.type->isSigned)
1997 *value2 = (unsigned short)op2.i;
1998 else if(op2.kind == 3)
1999 *value2 = (unsigned short)op2.ui;
2000 else if(op2.kind == 4 && op2.type->isSigned)
2001 *value2 = (unsigned short)op2.i64;
2002 else if(op2.kind == 4)
2003 *value2 = (unsigned short)op2.ui64;
2004 else if(op2.kind == 23 && op2.type->isSigned)
2005 *value2 = (unsigned short)op2.i64;
2006 else if(op2.kind == 23)
2007 *value2 = (unsigned short)op2.ui64;
2008 else if(op2.kind == 22 && op2.type->isSigned)
2009 *value2 = (unsigned short)op2.i64;
2010 else if(op2.kind == 22)
2011 *value2 = (unsigned short)op2.ui64;
2012 else if(op2.kind == 2 && op2.type->isSigned)
2013 *value2 = (unsigned short)op2.s;
2014 else if(op2.kind == 2)
2015 *value2 = op2.us;
2016 else if(op2.kind == 1 && op2.type->isSigned)
2017 *value2 = (unsigned short)op2.c;
2018 else if(op2.kind == 1)
2019 *value2 = (unsigned short)op2.uc;
2020 else if(op2.kind == 6)
2021 *value2 = (unsigned short)op2.f;
2022 else if(op2.kind == 7)
2023 *value2 = (unsigned short)op2.d;
2024 else if(op2.kind == 13)
2025 *value2 = (unsigned short)op2.ui64;
2026 else
2027 return 0x0;
2028 return 0x1;
2029 }
2030
2031 unsigned int GetChar(struct Expression * exp, char * value2)
2032 {
2033 struct Operand op2 = GetOperand(exp);
2034
2035 if(op2.kind == 3 && op2.type->isSigned)
2036 *value2 = (char)op2.i;
2037 else if(op2.kind == 3)
2038 *value2 = (char)op2.ui;
2039 else if(op2.kind == 4 && op2.type->isSigned)
2040 *value2 = (char)op2.i64;
2041 else if(op2.kind == 4)
2042 *value2 = (char)op2.ui64;
2043 else if(op2.kind == 23 && op2.type->isSigned)
2044 *value2 = (char)op2.i64;
2045 else if(op2.kind == 23)
2046 *value2 = (char)op2.ui64;
2047 else if(op2.kind == 22 && op2.type->isSigned)
2048 *value2 = (char)op2.i64;
2049 else if(op2.kind == 22)
2050 *value2 = (char)op2.ui64;
2051 else if(op2.kind == 2 && op2.type->isSigned)
2052 *value2 = (char)op2.s;
2053 else if(op2.kind == 2)
2054 *value2 = (char)op2.us;
2055 else if(op2.kind == 1 && op2.type->isSigned)
2056 *value2 = op2.c;
2057 else if(op2.kind == 1)
2058 *value2 = (char)op2.uc;
2059 else if(op2.kind == 6)
2060 *value2 = (char)op2.f;
2061 else if(op2.kind == 7)
2062 *value2 = (char)op2.d;
2063 else if(op2.kind == 13)
2064 *value2 = (char)op2.ui64;
2065 else
2066 return 0x0;
2067 return 0x1;
2068 }
2069
2070 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
2071 {
2072 struct Operand op2 = GetOperand(exp);
2073
2074 if(op2.kind == 3 && op2.type->isSigned)
2075 *value2 = (unsigned char)op2.i;
2076 else if(op2.kind == 3)
2077 *value2 = (unsigned char)op2.ui;
2078 else if(op2.kind == 4 && op2.type->isSigned)
2079 *value2 = (unsigned char)op2.i64;
2080 else if(op2.kind == 4)
2081 *value2 = (unsigned char)op2.ui64;
2082 else if(op2.kind == 23 && op2.type->isSigned)
2083 *value2 = (unsigned char)op2.i64;
2084 else if(op2.kind == 23)
2085 *value2 = (unsigned char)op2.ui64;
2086 else if(op2.kind == 22 && op2.type->isSigned)
2087 *value2 = (unsigned char)op2.i64;
2088 else if(op2.kind == 22)
2089 *value2 = (unsigned char)op2.ui64;
2090 else if(op2.kind == 2 && op2.type->isSigned)
2091 *value2 = (unsigned char)op2.s;
2092 else if(op2.kind == 2)
2093 *value2 = (unsigned char)op2.us;
2094 else if(op2.kind == 1 && op2.type->isSigned)
2095 *value2 = (unsigned char)op2.c;
2096 else if(op2.kind == 1)
2097 *value2 = op2.uc;
2098 else if(op2.kind == 6)
2099 *value2 = (unsigned char)op2.f;
2100 else if(op2.kind == 7)
2101 *value2 = (unsigned char)op2.d;
2102 else if(op2.kind == 13)
2103 *value2 = (unsigned char)op2.ui64;
2104 else
2105 return 0x0;
2106 return 0x1;
2107 }
2108
2109 unsigned int GetFloat(struct Expression * exp, float * value2)
2110 {
2111 struct Operand op2 = GetOperand(exp);
2112
2113 if(op2.kind == 3 && op2.type->isSigned)
2114 *value2 = (float)(float)op2.i;
2115 else if(op2.kind == 3)
2116 *value2 = (float)(float)op2.ui;
2117 else if(op2.kind == 4 && op2.type->isSigned)
2118 *value2 = (float)(float)op2.i64;
2119 else if(op2.kind == 4)
2120 *value2 = (float)(float)op2.ui64;
2121 else if(op2.kind == 23 && op2.type->isSigned)
2122 *value2 = (float)(float)op2.i64;
2123 else if(op2.kind == 23)
2124 *value2 = (float)(float)op2.ui64;
2125 else if(op2.kind == 22 && op2.type->isSigned)
2126 *value2 = (float)(float)op2.i64;
2127 else if(op2.kind == 22)
2128 *value2 = (float)(float)op2.ui64;
2129 else if(op2.kind == 2 && op2.type->isSigned)
2130 *value2 = (float)(float)op2.s;
2131 else if(op2.kind == 2)
2132 *value2 = (float)(float)op2.us;
2133 else if(op2.kind == 1 && op2.type->isSigned)
2134 *value2 = (float)(float)op2.c;
2135 else if(op2.kind == 1)
2136 *value2 = (float)(float)op2.uc;
2137 else if(op2.kind == 6)
2138 *value2 = (float)op2.f;
2139 else if(op2.kind == 7)
2140 *value2 = (float)op2.d;
2141 else if(op2.kind == 13)
2142 *value2 = (float)(float)op2.ui64;
2143 else
2144 return 0x0;
2145 return 0x1;
2146 }
2147
2148 unsigned int GetDouble(struct Expression * exp, double * value2)
2149 {
2150 struct Operand op2 = GetOperand(exp);
2151
2152 if(op2.kind == 3 && op2.type->isSigned)
2153 *value2 = (double)(double)op2.i;
2154 else if(op2.kind == 3)
2155 *value2 = (double)(double)op2.ui;
2156 else if(op2.kind == 4 && op2.type->isSigned)
2157 *value2 = (double)(double)op2.i64;
2158 else if(op2.kind == 4)
2159 *value2 = (double)(double)op2.ui64;
2160 else if(op2.kind == 23 && op2.type->isSigned)
2161 *value2 = (double)(double)op2.i64;
2162 else if(op2.kind == 23)
2163 *value2 = (double)(double)op2.ui64;
2164 else if(op2.kind == 22 && op2.type->isSigned)
2165 *value2 = (double)(double)op2.i64;
2166 else if(op2.kind == 22)
2167 *value2 = (double)(double)op2.ui64;
2168 else if(op2.kind == 2 && op2.type->isSigned)
2169 *value2 = (double)(double)op2.s;
2170 else if(op2.kind == 2)
2171 *value2 = (double)(double)op2.us;
2172 else if(op2.kind == 1 && op2.type->isSigned)
2173 *value2 = (double)(double)op2.c;
2174 else if(op2.kind == 1)
2175 *value2 = (double)(double)op2.uc;
2176 else if(op2.kind == 6)
2177 *value2 = (double)op2.f;
2178 else if(op2.kind == 7)
2179 *value2 = (double)op2.d;
2180 else if(op2.kind == 13)
2181 *value2 = (double)(double)op2.ui64;
2182 else
2183 return 0x0;
2184 return 0x1;
2185 }
2186
2187 void ComputeExpression(struct Expression * exp);
2188
2189 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2190
2191 extern int targetBits;
2192
2193 int ComputeTypeSize(struct Type * type);
2194
2195 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2196
2197 struct __ecereNameSpace__ecere__com__BitMember
2198 {
2199 struct __ecereNameSpace__ecere__com__BitMember * prev;
2200 struct __ecereNameSpace__ecere__com__BitMember * next;
2201 char *  name;
2202 unsigned int isProperty;
2203 int memberAccess;
2204 int id;
2205 struct __ecereNameSpace__ecere__com__Class * _class;
2206 char *  dataTypeString;
2207 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2208 struct Type * dataType;
2209 int type;
2210 int size;
2211 int pos;
2212 uint64 mask;
2213 } __attribute__ ((gcc_struct));
2214
2215 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2216
2217 struct __ecereNameSpace__ecere__sys__OldLink
2218 {
2219 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2220 struct __ecereNameSpace__ecere__sys__OldLink * next;
2221 void *  data;
2222 } __attribute__ ((gcc_struct));
2223
2224 void FinishTemplatesContext(struct Context * context);
2225
2226 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2227 {
2228 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2229 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2230
2231 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))
2232 {
2233 int c;
2234 int unionMemberOffset = 0;
2235 int bitFields = 0;
2236
2237 if(member)
2238 {
2239 member->memberOffset = 0;
2240 if(targetBits < sizeof(void *) * 8)
2241 member->structAlignment = 0;
2242 }
2243 else if(targetBits < sizeof(void *) * 8)
2244 _class->structAlignment = 0;
2245 if(!member && ((_class->type == 0 || _class->type == 5) || (_class->type == 1 && _class->memberOffset && _class->memberOffset > _class->base->structSize)))
2246 _class->memberOffset = (_class->base && _class->type == 1) ? _class->base->structSize : 0;
2247 if(!member && _class->destructionWatchOffset)
2248 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2249 {
2250 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2251
2252 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2253 {
2254 if(!dataMember->isProperty)
2255 {
2256 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2257 {
2258 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2259 }
2260 }
2261 }
2262 }
2263 {
2264 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2265
2266 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2267 {
2268 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2269 {
2270 if(!isMember && _class->type == 2 && dataMember->dataType)
2271 {
2272 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2273 uint64 mask = 0;
2274 int d;
2275
2276 ComputeTypeSize(dataMember->dataType);
2277 if(bitMember->pos == -1)
2278 bitMember->pos = _class->memberOffset;
2279 if(!bitMember->size)
2280 bitMember->size = dataMember->dataType->size * 8;
2281 _class->memberOffset = bitMember->pos + bitMember->size;
2282 for(d = 0; d < bitMember->size; d++)
2283 {
2284 if(d)
2285 mask <<= 1;
2286 mask |= 1;
2287 }
2288 bitMember->mask = mask << bitMember->pos;
2289 }
2290 else if(dataMember->type == 0 && dataMember->dataType)
2291 {
2292 int size;
2293 int alignment = 0;
2294
2295 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2296 ComputeTypeSize(dataMember->dataType);
2297 if(dataMember->dataType->bitFieldCount)
2298 {
2299 bitFields += dataMember->dataType->bitFieldCount;
2300 size = 0;
2301 }
2302 else
2303 {
2304 if(bitFields)
2305 {
2306 int size = (bitFields + 7) / 8;
2307
2308 if(isMember)
2309 {
2310 int __simpleStruct0;
2311
2312 if(alignment)
2313 {
2314 int __simpleStruct0;
2315
2316 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2317 if(member->memberOffset % alignment)
2318 member->memberOffset += alignment - (member->memberOffset % alignment);
2319 }
2320 dataMember->offset = member->memberOffset;
2321 if(member->type == 1)
2322 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2323 else
2324 {
2325 member->memberOffset += size;
2326 }
2327 }
2328 else
2329 {
2330 if(alignment)
2331 {
2332 int __simpleStruct0;
2333
2334 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2335 if(_class->memberOffset % alignment)
2336 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2337 }
2338 dataMember->offset = _class->memberOffset;
2339 _class->memberOffset += size;
2340 }
2341 bitFields = 0;
2342 }
2343 size = dataMember->dataType->size;
2344 alignment = dataMember->dataType->alignment;
2345 }
2346 if(isMember)
2347 {
2348 int __simpleStruct0;
2349
2350 if(alignment)
2351 {
2352 int __simpleStruct0;
2353
2354 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2355 if(member->memberOffset % alignment)
2356 member->memberOffset += alignment - (member->memberOffset % alignment);
2357 }
2358 dataMember->offset = member->memberOffset;
2359 if(member->type == 1)
2360 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2361 else
2362 {
2363 member->memberOffset += size;
2364 }
2365 }
2366 else
2367 {
2368 if(alignment)
2369 {
2370 int __simpleStruct0;
2371
2372 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2373 if(_class->memberOffset % alignment)
2374 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2375 }
2376 dataMember->offset = _class->memberOffset;
2377 _class->memberOffset += size;
2378 }
2379 }
2380 else
2381 {
2382 int alignment;
2383
2384 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2385 alignment = dataMember->structAlignment;
2386 if(isMember)
2387 {
2388 int __simpleStruct0;
2389
2390 if(alignment)
2391 {
2392 int __simpleStruct0;
2393
2394 if(member->memberOffset % alignment)
2395 member->memberOffset += alignment - (member->memberOffset % alignment);
2396 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2397 }
2398 dataMember->offset = member->memberOffset;
2399 if(member->type == 1)
2400 unionMemberOffset = (__simpleStruct0 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2401 else
2402 member->memberOffset += dataMember->memberOffset;
2403 }
2404 else
2405 {
2406 if(alignment)
2407 {
2408 int __simpleStruct0;
2409
2410 if(_class->memberOffset % alignment)
2411 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2412 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2413 }
2414 dataMember->offset = _class->memberOffset;
2415 _class->memberOffset += dataMember->memberOffset;
2416 }
2417 }
2418 }
2419 }
2420 if(bitFields)
2421 {
2422 int alignment = 0;
2423 int size = (bitFields + 7) / 8;
2424
2425 if(isMember)
2426 {
2427 int __simpleStruct0;
2428
2429 if(alignment)
2430 {
2431 int __simpleStruct0;
2432
2433 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2434 if(member->memberOffset % alignment)
2435 member->memberOffset += alignment - (member->memberOffset % alignment);
2436 }
2437 if(member->type == 1)
2438 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2439 else
2440 {
2441 member->memberOffset += size;
2442 }
2443 }
2444 else
2445 {
2446 if(alignment)
2447 {
2448 int __simpleStruct0;
2449
2450 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2451 if(_class->memberOffset % alignment)
2452 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2453 }
2454 _class->memberOffset += size;
2455 }
2456 bitFields = 0;
2457 }
2458 }
2459 if(member && member->type == 1)
2460 {
2461 member->memberOffset = unionMemberOffset;
2462 }
2463 if(!isMember)
2464 {
2465 if(_class->type != 2)
2466 {
2467 int extra = 0;
2468
2469 if(_class->structAlignment)
2470 {
2471 if(_class->memberOffset % _class->structAlignment)
2472 extra += _class->structAlignment - (_class->memberOffset % _class->structAlignment);
2473 }
2474 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset + extra;
2475 if(!member)
2476 {
2477 struct __ecereNameSpace__ecere__com__Property * prop;
2478
2479 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2480 {
2481 if(prop->isProperty && prop->isWatchable)
2482 {
2483 prop->watcherOffset = _class->structSize;
2484 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2485 }
2486 }
2487 }
2488 {
2489 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2490
2491 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2492 {
2493 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2494
2495 if(deriv->computeSize)
2496 {
2497 deriv->offset = _class->structSize;
2498 deriv->memberOffset = 0;
2499 deriv->structSize = deriv->offset;
2500 ComputeClassMembers(deriv, 0x0);
2501 }
2502 }
2503 }
2504 }
2505 }
2506 }
2507 if(context)
2508 FinishTemplatesContext(context);
2509 }
2510
2511 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2512
2513 struct __ecereNameSpace__ecere__com__NameSpace
2514 {
2515 char *  name;
2516 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2517 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2518 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2519 int depth;
2520 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2521 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2522 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2523 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2524 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2525 } __attribute__ ((gcc_struct));
2526
2527 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2528
2529 struct __ecereNameSpace__ecere__com__Module
2530 {
2531 struct __ecereNameSpace__ecere__com__Instance * application;
2532 struct __ecereNameSpace__ecere__sys__OldList classes;
2533 struct __ecereNameSpace__ecere__sys__OldList defines;
2534 struct __ecereNameSpace__ecere__sys__OldList functions;
2535 struct __ecereNameSpace__ecere__sys__OldList modules;
2536 struct __ecereNameSpace__ecere__com__Instance * prev;
2537 struct __ecereNameSpace__ecere__com__Instance * next;
2538 char *  name;
2539 void *  library;
2540 void *  Unload;
2541 int importType;
2542 int origImportType;
2543 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2544 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2545 } __attribute__ ((gcc_struct));
2546
2547 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2548 {
2549 struct __ecereNameSpace__ecere__com__Class * _class;
2550 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2551
2552 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
2553 ComputeModuleClasses(subModule->data);
2554 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->classes.first; _class; _class = _class->next)
2555 ComputeClassMembers(_class, 0x0);
2556 }
2557
2558 extern unsigned int inCompiler;
2559
2560 extern void Compiler_Error(char *  format, ...);
2561
2562 extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
2563
2564 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
2565
2566 int ComputeTypeSize(struct Type * type)
2567 {
2568 unsigned int size = type ? type->size : 0;
2569
2570 if(!size && type && !type->computing)
2571 {
2572 type->computing = 0x1;
2573 switch(type->kind)
2574 {
2575 case 1:
2576 type->alignment = size = sizeof(char);
2577 break;
2578 case 3:
2579 type->alignment = size = sizeof(int);
2580 break;
2581 case 4:
2582 type->alignment = size = sizeof(long long);
2583 break;
2584 case 22:
2585 type->alignment = size = targetBits / 8;
2586 break;
2587 case 23:
2588 type->alignment = size = targetBits / 8;
2589 break;
2590 case 5:
2591 type->alignment = size = sizeof(long);
2592 break;
2593 case 2:
2594 type->alignment = size = sizeof(short);
2595 break;
2596 case 6:
2597 type->alignment = size = sizeof(float);
2598 break;
2599 case 7:
2600 type->alignment = size = sizeof(double);
2601 break;
2602 case 8:
2603 {
2604 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2605
2606 if(_class && _class->type == 1)
2607 {
2608 ComputeClassMembers(_class, 0x0);
2609 type->alignment = _class->structAlignment;
2610 size = _class->structSize;
2611 if(type->alignment && size % type->alignment)
2612 size += type->alignment - (size % type->alignment);
2613 }
2614 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2615 {
2616 if(!_class->dataType)
2617 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2618 size = type->alignment = ComputeTypeSize(_class->dataType);
2619 }
2620 else
2621 size = type->alignment = targetBits / 8;
2622 break;
2623 }
2624 case 13:
2625 case 19:
2626 size = type->alignment = targetBits / 8;
2627 break;
2628 case 12:
2629 if(type->arraySizeExp)
2630 {
2631 ProcessExpressionType(type->arraySizeExp);
2632 ComputeExpression(type->arraySizeExp);
2633 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)))
2634 {
2635 struct Location oldLoc = yylloc;
2636 char expression[10240];
2637
2638 expression[0] = '\0';
2639 type->arraySizeExp->expType = (((void *)0));
2640 yylloc = type->arraySizeExp->loc;
2641 if(inCompiler)
2642 PrintExpression(type->arraySizeExp, expression);
2643 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Array size not constant int (%s)\n", (((void *)0))), expression);
2644 yylloc = oldLoc;
2645 }
2646 GetInt(type->arraySizeExp, &type->arraySize);
2647 }
2648 else if(type->enumClass)
2649 {
2650 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2651 {
2652 type->arraySize = (int)__ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2653 }
2654 else
2655 type->arraySize = 0;
2656 }
2657 else
2658 {
2659 type->arraySize = 0;
2660 }
2661 size = ComputeTypeSize(type->type) * type->arraySize;
2662 if(type->type)
2663 type->alignment = type->type->alignment;
2664 break;
2665 case 9:
2666 {
2667 struct Type * member;
2668
2669 for(member = type->members.first; member; member = member->next)
2670 {
2671 int __simpleStruct0, __simpleStruct1;
2672 unsigned int addSize = ComputeTypeSize(member);
2673
2674 member->offset = size;
2675 if(member->alignment && size % member->alignment)
2676 member->offset += member->alignment - (size % member->alignment);
2677 size = member->offset;
2678 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2679 size += addSize;
2680 }
2681 if(type->alignment && size % type->alignment)
2682 size += type->alignment - (size % type->alignment);
2683 break;
2684 }
2685 case 10:
2686 {
2687 struct Type * member;
2688
2689 for(member = type->members.first; member; member = member->next)
2690 {
2691 int __simpleStruct0, __simpleStruct1;
2692 unsigned int addSize = ComputeTypeSize(member);
2693
2694 member->offset = size;
2695 if(member->alignment && size % member->alignment)
2696 member->offset += member->alignment - (size % member->alignment);
2697 size = member->offset;
2698 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2699 size = ((size > addSize) ? size : addSize);
2700 }
2701 if(type->alignment && size % type->alignment)
2702 size += type->alignment - (size % type->alignment);
2703 break;
2704 }
2705 case 20:
2706 {
2707 struct TemplateParameter * param = type->templateParameter;
2708 struct Type * baseType = ProcessTemplateParameterType(param);
2709
2710 if(baseType)
2711 {
2712 size = ComputeTypeSize(baseType);
2713 type->alignment = baseType->alignment;
2714 }
2715 else
2716 type->alignment = size = sizeof(uint64);
2717 break;
2718 }
2719 case 15:
2720 {
2721 type->alignment = size = sizeof(enum
2722 {
2723 test
2724 });
2725 break;
2726 }
2727 case 21:
2728 {
2729 type->alignment = size = targetBits / 8;
2730 break;
2731 }
2732 }
2733 type->size = size;
2734 type->computing = 0x0;
2735 }
2736 return size;
2737 }
2738
2739 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2740
2741 extern struct Identifier * MkIdentifier(char *  string);
2742
2743 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2744
2745 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2746
2747 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2748
2749 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2750
2751 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2752
2753 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2754
2755 extern void FreeType(struct Type * type);
2756
2757 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2758
2759 extern struct Specifier * MkSpecifier(int specifier);
2760
2761 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2762
2763 extern struct Expression * MkExpConstant(char *  string);
2764
2765 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)
2766 {
2767 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2768 unsigned int totalSize = 0;
2769 unsigned int maxSize = 0;
2770 int alignment, size;
2771 struct __ecereNameSpace__ecere__com__DataMember * member;
2772 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2773
2774 if(addedPadding)
2775 *addedPadding = 0x0;
2776 if(!isMember && _class->base)
2777 {
2778 maxSize = _class->structSize;
2779 {
2780 if(_class->type == 1 || _class->type == 5)
2781 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass, (((void *)0)));
2782 else
2783 {
2784 unsigned int baseSize = _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2785
2786 if(maxSize > baseSize)
2787 maxSize -= baseSize;
2788 else
2789 maxSize = 0;
2790 }
2791 }
2792 }
2793 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2794 {
2795 if(!member->isProperty)
2796 {
2797 switch(member->type)
2798 {
2799 case 0:
2800 {
2801 if(member->dataTypeString)
2802 {
2803 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2804 struct Declarator * decl;
2805
2806 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2807 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2808 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2809 if(!member->dataType)
2810 member->dataType = ProcessType(specs, decl);
2811 ReplaceThisClassSpecifiers(specs, topClass);
2812 {
2813 struct Type * type = ProcessType(specs, decl);
2814
2815 DeclareType(member->dataType, 0x0, 0x0);
2816 FreeType(type);
2817 }
2818 ComputeTypeSize(member->dataType);
2819 size = member->dataType->size;
2820 alignment = member->dataType->alignment;
2821 if(alignment)
2822 {
2823 if(totalSize % alignment)
2824 totalSize += alignment - (totalSize % alignment);
2825 }
2826 totalSize += size;
2827 }
2828 break;
2829 }
2830 case 1:
2831 case 2:
2832 {
2833 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2834
2835 size = 0;
2836 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass, (((void *)0)));
2837 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
2838 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
2839 alignment = member->structAlignment;
2840 if(alignment)
2841 {
2842 if(totalSize % alignment)
2843 totalSize += alignment - (totalSize % alignment);
2844 }
2845 totalSize += size;
2846 break;
2847 }
2848 }
2849 }
2850 }
2851 if(retSize)
2852 {
2853 unsigned int __simpleStruct0;
2854
2855 if(topMember && topMember->type == 1)
2856 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
2857 else
2858 *retSize += totalSize;
2859 }
2860 else if(totalSize < maxSize && _class->type != 1000)
2861 {
2862 int autoPadding = 0;
2863
2864 if(!isMember && _class->structAlignment && totalSize % _class->structAlignment)
2865 autoPadding = _class->structAlignment - (totalSize % _class->structAlignment);
2866 if(totalSize + autoPadding < maxSize)
2867 {
2868 char sizeString[50];
2869
2870 sprintf(sizeString, "%d", maxSize - totalSize);
2871 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
2872 if(addedPadding)
2873 *addedPadding = 0x1;
2874 }
2875 }
2876 if(context)
2877 FinishTemplatesContext(context);
2878 return topMember ? topMember->memberID : _class->memberID;
2879 }
2880
2881 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2882 {
2883 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2884 unsigned int totalSize = 0;
2885 struct __ecereNameSpace__ecere__com__DataMember * member;
2886 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2887
2888 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
2889 DeclareMembers(_class->base, 0x0);
2890 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2891 {
2892 if(!member->isProperty)
2893 {
2894 switch(member->type)
2895 {
2896 case 0:
2897 {
2898 if(!member->dataType && member->dataTypeString)
2899 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
2900 if(member->dataType)
2901 DeclareType(member->dataType, 0x0, 0x0);
2902 break;
2903 }
2904 case 1:
2905 case 2:
2906 {
2907 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
2908 break;
2909 }
2910 }
2911 }
2912 }
2913 if(context)
2914 FinishTemplatesContext(context);
2915 return topMember ? topMember->memberID : _class->memberID;
2916 }
2917
2918 extern struct Symbol * FindClass(char *  name);
2919
2920 extern char *  strchr(const char * , int);
2921
2922 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
2923
2924 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (*  FreeFunction)(void * ));
2925
2926 extern void FreeClassDef(struct ClassDef * def);
2927
2928 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
2929
2930 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
2931
2932 extern char *  strcpy(char * , const char * );
2933
2934 extern void MangleClassName(char *  className);
2935
2936 extern void DeclareClass(struct Symbol * classSym, char *  className);
2937
2938 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
2939
2940 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
2941
2942 void DeclareStruct(char * name, unsigned int skipNoHead)
2943 {
2944 struct External * external = (((void *)0));
2945 struct Symbol * classSym = FindClass(name);
2946
2947 if(!inCompiler || !classSym)
2948 return ;
2949 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
2950 return ;
2951 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
2952 {
2953 struct Declaration * decl;
2954 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2955 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
2956 char structName[1024];
2957
2958 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
2959 classSym->declaring++;
2960 if(strchr(classSym->string, '<'))
2961 {
2962 if(classSym->registered->templateClass)
2963 {
2964 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
2965 classSym->declaring--;
2966 }
2967 return ;
2968 }
2969 DeclareMembers(classSym->registered, 0x0);
2970 structName[0] = (char)0;
2971 FullClassNameCat(structName, name, 0x0);
2972 if(!skipNoHead)
2973 {
2974 unsigned int addedPadding = 0x0;
2975
2976 classSym->declaredStructSym = 0x1;
2977 declarations = MkList();
2978 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered, &addedPadding);
2979 if(!(*declarations).count || ((*declarations).count == 1 && addedPadding))
2980 {
2981 FreeList(declarations, FreeClassDef);
2982 declarations = (((void *)0));
2983 }
2984 }
2985 if(skipNoHead || declarations)
2986 {
2987 if(external && external->declaration)
2988 {
2989 ((struct Specifier *)(*external->declaration->specifiers).first)->definitions = declarations;
2990 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2991 {
2992 if(classSym->structExternal)
2993 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2994 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2995 classSym->id = curExternal->symbol->idCode;
2996 classSym->idCode = curExternal->symbol->idCode;
2997 }
2998 }
2999 else
3000 {
3001 if(!external)
3002 external = MkExternalDeclaration((((void *)0)));
3003 specifiers = MkList();
3004 declarators = MkList();
3005 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
3006 external->declaration = decl = MkDeclaration(specifiers, declarators);
3007 if(decl->symbol && !decl->symbol->pointerExternal)
3008 decl->symbol->pointerExternal = external;
3009 if(classSym->registered && classSym->registered->type == 1)
3010 {
3011 char className[1024];
3012
3013 strcpy(className, "__ecereClass_");
3014 FullClassNameCat(className, classSym->string, 0x1);
3015 MangleClassName(className);
3016 DeclareClass(classSym, className);
3017 external->symbol = classSym;
3018 classSym->pointerExternal = external;
3019 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3020 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3021 }
3022 else
3023 {
3024 char className[1024];
3025
3026 strcpy(className, "__ecereClass_");
3027 FullClassNameCat(className, classSym->string, 0x1);
3028 MangleClassName(className);
3029 classSym->structExternal = external;
3030 DeclareClass(classSym, className);
3031 external->symbol = classSym;
3032 }
3033 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
3034 }
3035 }
3036 classSym->declaring--;
3037 }
3038 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3039 {
3040 classSym->declaring++;
3041 {
3042 if(classSym->registered)
3043 DeclareMembers(classSym->registered, 0x0);
3044 }
3045 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
3046 {
3047 if(classSym->structExternal)
3048 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3049 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3050 classSym->id = curExternal->symbol->idCode;
3051 classSym->idCode = curExternal->symbol->idCode;
3052 }
3053 classSym->declaring--;
3054 }
3055 }
3056
3057 extern char *  strcat(char * , const char * );
3058
3059 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
3060
3061 extern struct ModuleImport * mainModule;
3062
3063 extern struct Specifier * MkSpecifierName(char *  name);
3064
3065 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
3066
3067 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
3068
3069 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
3070
3071 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
3072
3073 extern void FreeDeclarator(struct Declarator * decl);
3074
3075 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
3076
3077 struct PropertyImport
3078 {
3079 struct PropertyImport * prev;
3080 struct PropertyImport * next;
3081 char *  name;
3082 unsigned int isVirtual;
3083 unsigned int hasSet;
3084 unsigned int hasGet;
3085 } __attribute__ ((gcc_struct));
3086
3087 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3088
3089 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
3090 {
3091 struct Symbol * symbol = prop->symbol;
3092 char propName[1024];
3093
3094 strcpy(setName, "__ecereProp_");
3095 FullClassNameCat(setName, prop->_class->fullName, 0x0);
3096 strcat(setName, "_Set_");
3097 FullClassNameCat(setName, prop->name, 0x1);
3098 strcpy(getName, "__ecereProp_");
3099 FullClassNameCat(getName, prop->_class->fullName, 0x0);
3100 strcat(getName, "_Get_");
3101 FullClassNameCat(getName, prop->name, 0x1);
3102 strcpy(propName, "__ecereProp_");
3103 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3104 strcat(propName, "_");
3105 FullClassNameCat(propName, prop->name, 0x1);
3106 MangleClassName(getName);
3107 MangleClassName(setName);
3108 MangleClassName(propName);
3109 if(prop->_class->type == 1)
3110 DeclareStruct(prop->_class->fullName, 0x0);
3111 if(!symbol || curExternal->symbol->idCode < symbol->id)
3112 {
3113 unsigned int imported = 0x0;
3114 unsigned int dllImport = 0x0;
3115
3116 if(!symbol || symbol->_import)
3117 {
3118 if(!symbol)
3119 {
3120 struct Symbol * classSym;
3121
3122 if(!prop->_class->symbol)
3123 prop->_class->symbol = FindClass(prop->_class->fullName);
3124 classSym = prop->_class->symbol;
3125 if(classSym && !classSym->_import)
3126 {
3127 struct ModuleImport * module;
3128
3129 if(prop->_class->module)
3130 module = FindModule(prop->_class->module);
3131 else
3132 module = mainModule;
3133 classSym->_import = __extension__ ({
3134 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
3135
3136 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), __ecereInstance1->isRemote = prop->_class->isRemote, __ecereInstance1;
3137 });
3138 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3139 }
3140 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3141 symbol->_import = (struct ClassImport *)__extension__ ({
3142 struct PropertyImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport);
3143
3144 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), __ecereInstance1->isVirtual = 0x0, __ecereInstance1->hasSet = prop->Set ? 0x1 : 0x0, __ecereInstance1->hasGet = prop->Get ? 0x1 : 0x0, __ecereInstance1;
3145 });
3146 if(classSym)
3147 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
3148 }
3149 imported = 0x1;
3150 if(prop->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + structSize_Instance)))->importType != 1)
3151 dllImport = 0x1;
3152 }
3153 if(!symbol->type)
3154 {
3155 struct Context * context = SetupTemplatesContext(prop->_class);
3156
3157 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
3158 FinishTemplatesContext(context);
3159 }
3160 if(prop->Get)
3161 {
3162 if(!symbol->externalGet || symbol->externalGet->type == 0)
3163 {
3164 struct Declaration * decl;
3165 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3166 struct Declarator * d;
3167 struct __ecereNameSpace__ecere__sys__OldList * params;
3168 struct Specifier * spec;
3169 struct External * external;
3170 struct Declarator * typeDecl;
3171 unsigned int simple = 0x0;
3172
3173 specifiers = MkList();
3174 declarators = MkList();
3175 params = MkList();
3176 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3177 d = MkDeclaratorIdentifier(MkIdentifier(getName));
3178 if(dllImport)
3179 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3180 {
3181 struct Context * context = SetupTemplatesContext(prop->_class);
3182
3183 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
3184 FinishTemplatesContext(context);
3185 }
3186 for(spec = (*specifiers).first; spec; spec = spec->next)
3187 {
3188 if(spec->type == 1)
3189 {
3190 if((!typeDecl || typeDecl->type == 1))
3191 {
3192 struct Symbol * classSym = spec->symbol;
3193
3194 symbol->_class = classSym->registered;
3195 if(classSym->registered && classSym->registered->type == 1)
3196 {
3197 DeclareStruct(spec->name, 0x0);
3198 simple = 0x1;
3199 }
3200 }
3201 }
3202 }
3203 if(!simple)
3204 d = PlugDeclarator(typeDecl, d);
3205 else
3206 {
3207 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3208 specifiers = MkList();
3209 }
3210 d = MkDeclaratorFunction(d, params);
3211 if(dllImport)
3212 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3213 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3214 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3215 if(simple)
3216 ListAdd(specifiers, MkSpecifier(VOID));
3217 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3218 decl = MkDeclaration(specifiers, declarators);
3219 external = MkExternalDeclaration(decl);
3220 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3221 external->symbol = symbol;
3222 symbol->externalGet = external;
3223 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3224 if(typeDecl)
3225 FreeDeclarator(typeDecl);
3226 }
3227 else
3228 {
3229 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3230 }
3231 }
3232 if(prop->Set)
3233 {
3234 if(!symbol->externalSet || symbol->externalSet->type == 0)
3235 {
3236 struct Declaration * decl;
3237 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3238 struct Declarator * d;
3239 struct __ecereNameSpace__ecere__sys__OldList * params;
3240 struct Specifier * spec;
3241 struct External * external;
3242 struct Declarator * typeDecl;
3243
3244 declarators = MkList();
3245 params = MkList();
3246 if(!prop->conversion || prop->_class->type == 1)
3247 {
3248 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3249 }
3250 specifiers = MkList();
3251 {
3252 struct Context * context = SetupTemplatesContext(prop->_class);
3253
3254 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3255 FinishTemplatesContext(context);
3256 }
3257 ListAdd(params, MkTypeName(specifiers, d));
3258 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3259 if(dllImport)
3260 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3261 d = MkDeclaratorFunction(d, params);
3262 for(spec = (*specifiers).first; spec; spec = spec->next)
3263 {
3264 if(spec->type == 1)
3265 {
3266 if((!typeDecl || typeDecl->type == 1))
3267 {
3268 struct Symbol * classSym = spec->symbol;
3269
3270 symbol->_class = classSym->registered;
3271 if(classSym->registered && classSym->registered->type == 1)
3272 DeclareStruct(spec->name, 0x0);
3273 }
3274 }
3275 }
3276 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3277 specifiers = MkList();
3278 if(dllImport)
3279 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3280 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3281 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3282 if(!prop->conversion || prop->_class->type == 1)
3283 ListAdd(specifiers, MkSpecifier(VOID));
3284 else
3285 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3286 decl = MkDeclaration(specifiers, declarators);
3287 external = MkExternalDeclaration(decl);
3288 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3289 external->symbol = symbol;
3290 symbol->externalSet = external;
3291 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3292 }
3293 else
3294 {
3295 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3296 }
3297 }
3298 if(!symbol->externalPtr)
3299 {
3300 struct Declaration * decl;
3301 struct External * external;
3302 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3303
3304 if(imported)
3305 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3306 else
3307 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3308 ListAdd(specifiers, MkSpecifierName("Property"));
3309 {
3310 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3311
3312 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3313 if(!imported)
3314 {
3315 strcpy(propName, "__ecerePropM_");
3316 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3317 strcat(propName, "_");
3318 FullClassNameCat(propName, prop->name, 0x1);
3319 MangleClassName(propName);
3320 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3321 }
3322 decl = MkDeclaration(specifiers, list);
3323 }
3324 external = MkExternalDeclaration(decl);
3325 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3326 external->symbol = symbol;
3327 symbol->externalPtr = external;
3328 }
3329 else
3330 {
3331 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3332 }
3333 symbol->id = curExternal->symbol->idCode;
3334 }
3335 }
3336
3337 struct Type * Dereference(struct Type * source)
3338 {
3339 struct Type * type = (((void *)0));
3340
3341 if(source)
3342 {
3343 if(source->kind == 13 || source->kind == 12)
3344 {
3345 type = source->type;
3346 source->type->refCount++;
3347 }
3348 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3349 {
3350 type = __extension__ ({
3351 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3352
3353 __ecereInstance1->kind = 1, __ecereInstance1->refCount = 1, __ecereInstance1;
3354 });
3355 }
3356 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3357 {
3358 type = source;
3359 source->refCount++;
3360 }
3361 else
3362 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot dereference type\n", (((void *)0))));
3363 }
3364 return type;
3365 }
3366
3367 static struct Type * Reference(struct Type * source)
3368 {
3369 struct Type * type = (((void *)0));
3370
3371 if(source)
3372 {
3373 type = __extension__ ({
3374 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3375
3376 __ecereInstance1->kind = 13, __ecereInstance1->type = source, __ecereInstance1->refCount = 1, __ecereInstance1;
3377 });
3378 source->refCount++;
3379 }
3380 return type;
3381 }
3382
3383 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);
3384
3385 extern void *  memcpy(void * , const void * , size_t size);
3386
3387 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3388
3389 extern void FreeExpression(struct Expression * exp);
3390
3391 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3392
3393 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);
3394
3395 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3396
3397 extern struct Type * MkClassType(char *  name);
3398
3399 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);
3400
3401 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)
3402 {
3403 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3404 unsigned int found = 0x0;
3405 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3406 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3407 unsigned int freeType = 0x0;
3408
3409 yylloc = member->loc;
3410 if(!ident)
3411 {
3412 if(curMember)
3413 {
3414 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3415 if(*curMember)
3416 {
3417 found = 0x1;
3418 dataMember = *curMember;
3419 }
3420 }
3421 }
3422 else
3423 {
3424 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3425 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3426 int _subMemberStackPos = 0;
3427
3428 if(!thisMember)
3429 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3430 if(thisMember)
3431 {
3432 dataMember = thisMember;
3433 if(curMember && thisMember->memberAccess == 1)
3434 {
3435 *curMember = thisMember;
3436 *curClass = thisMember->_class;
3437 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
3438 *subMemberStackPos = _subMemberStackPos;
3439 }
3440 found = 0x1;
3441 }
3442 else
3443 {
3444 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3445 if(method && method->type == 1)
3446 found = 0x1;
3447 else
3448 method = (((void *)0));
3449 }
3450 }
3451 if(found)
3452 {
3453 struct Type * type = (((void *)0));
3454
3455 if(dataMember)
3456 {
3457 if(!dataMember->dataType && dataMember->dataTypeString)
3458 {
3459 struct Context * context = SetupTemplatesContext(_class);
3460
3461 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3462 FinishTemplatesContext(context);
3463 }
3464 type = dataMember->dataType;
3465 }
3466 else if(method)
3467 {
3468 if(!method->dataType)
3469 ProcessMethodType(method);
3470 type = method->dataType;
3471 }
3472 if(ident && ident->next)
3473 {
3474 for(ident = ident->next; ident && type; ident = ident->next)
3475 {
3476 if(type->kind == 8)
3477 {
3478 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3479 if(!dataMember)
3480 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3481 if(dataMember)
3482 type = dataMember->dataType;
3483 }
3484 else if(type->kind == 9 || type->kind == 10)
3485 {
3486 struct Type * memberType;
3487
3488 for(memberType = type->members.first; memberType; memberType = memberType->next)
3489 {
3490 if(!strcmp(memberType->name, ident->string))
3491 {
3492 type = memberType;
3493 break;
3494 }
3495 }
3496 }
3497 }
3498 }
3499 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3500 {
3501 int id = 0;
3502 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3503 struct __ecereNameSpace__ecere__com__Class * sClass;
3504
3505 for(sClass = _class; sClass; sClass = sClass->base)
3506 {
3507 id = 0;
3508 if(sClass->templateClass)
3509 sClass = sClass->templateClass;
3510 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3511 {
3512 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3513 {
3514 for(sClass = sClass->base; sClass; sClass = sClass->base)
3515 {
3516 if(sClass->templateClass)
3517 sClass = sClass->templateClass;
3518 id += sClass->templateParams.count;
3519 }
3520 break;
3521 }
3522 id++;
3523 }
3524 if(curParam)
3525 break;
3526 }
3527 if(curParam)
3528 {
3529 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3530
3531 if(arg.dataTypeString)
3532 {
3533 type = ProcessTypeString(arg.dataTypeString, 0x0);
3534 freeType = 0x1;
3535 if(type && _class->templateClass)
3536 type->passAsTemplate = 0x1;
3537 if(type)
3538 {
3539 }
3540 }
3541 }
3542 }
3543 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3544 {
3545 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3546 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3547 int c;
3548 int paramCount = 0;
3549 int lastParam = -1;
3550 char templateString[1024];
3551 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3552
3553 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3554 for(cClass = expClass; cClass; cClass = cClass->base)
3555 {
3556 int p = 0;
3557
3558 if(cClass->templateClass)
3559 cClass = cClass->templateClass;
3560 for(param = cClass->templateParams.first; param; param = param->next)
3561 {
3562 int id = p;
3563 struct __ecereNameSpace__ecere__com__Class * sClass;
3564 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3565
3566 for(sClass = cClass->base; sClass; sClass = sClass->base)
3567 {
3568 if(sClass->templateClass)
3569 sClass = sClass->templateClass;
3570 id += sClass->templateParams.count;
3571 }
3572 arg = expClass->templateArgs[id];
3573 for(sClass = _class; sClass; sClass = sClass->base)
3574 {
3575 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3576 int p = 0;
3577 struct __ecereNameSpace__ecere__com__Class * nextClass;
3578
3579 if(sClass->templateClass)
3580 sClass = sClass->templateClass;
3581 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3582 {
3583 if(nextClass->templateClass)
3584 nextClass = nextClass->templateClass;
3585 p += nextClass->templateParams.count;
3586 }
3587 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3588 {
3589 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3590 {
3591 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3592 {
3593 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3594 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3595 break;
3596 }
3597 }
3598 }
3599 }
3600 {
3601 char argument[256];
3602
3603 argument[0] = '\0';
3604 switch(param->type)
3605 {
3606 case 2:
3607 {
3608 char expString[1024];
3609 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3610 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3611 struct Expression * exp;
3612 char * string = PrintHexUInt64(arg.expression.ui64);
3613
3614 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3615 ProcessExpressionType(exp);
3616 ComputeExpression(exp);
3617 expString[0] = '\0';
3618 PrintExpression(exp, expString);
3619 strcat(argument, expString);
3620 FreeExpression(exp);
3621 break;
3622 }
3623 case 1:
3624 {
3625 strcat(argument, arg.member->name);
3626 break;
3627 }
3628 case 0:
3629 {
3630 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3631 strcat(argument, arg.dataTypeString);
3632 break;
3633 }
3634 }
3635 if(argument[0])
3636 {
3637 if(paramCount)
3638 strcat(templateString, ", ");
3639 if(lastParam != p - 1)
3640 {
3641 strcat(templateString, param->name);
3642 strcat(templateString, " = ");
3643 }
3644 strcat(templateString, argument);
3645 paramCount++;
3646 lastParam = p;
3647 }
3648 p++;
3649 }
3650 }
3651 }
3652 {
3653 int len = strlen(templateString);
3654
3655 if(templateString[len - 1] == '<')
3656 len--;
3657 else
3658 {
3659 if(templateString[len - 1] == '>')
3660 templateString[len++] = ' ';
3661 templateString[len++] = '>';
3662 }
3663 templateString[len++] = '\0';
3664 }
3665 {
3666 struct Context * context = SetupTemplatesContext(_class);
3667
3668 if(freeType)
3669 FreeType(type);
3670 type = ProcessTypeString(templateString, 0x0);
3671 freeType = 0x1;
3672 FinishTemplatesContext(context);
3673 }
3674 }
3675 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3676 {
3677 ProcessExpressionType(member->initializer->exp);
3678 if(!member->initializer->exp->expType)
3679 {
3680 if(inCompiler)
3681 {
3682 char expString[10240];
3683
3684 expString[0] = '\0';
3685 PrintExpression(member->initializer->exp, expString);
3686 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3687 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3688 }
3689 }
3690 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3691 {
3692 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible instance method %s\n", (((void *)0))), ident->string);
3693 }
3694 }
3695 else if(member->initializer)
3696 {
3697 ProcessInitializer(member->initializer, type);
3698 }
3699 if(freeType)
3700 FreeType(type);
3701 }
3702 else
3703 {
3704 if(_class && _class->type == 3)
3705 {
3706 if(member->initializer)
3707 {
3708 struct Type * type = MkClassType(_class->fullName);
3709
3710 ProcessInitializer(member->initializer, type);
3711 FreeType(type);
3712 }
3713 }
3714 else
3715 {
3716 if(member->initializer)
3717 {
3718 ProcessInitializer(member->initializer, (((void *)0)));
3719 }
3720 if(ident)
3721 {
3722 if(method)
3723 {
3724 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3725 }
3726 else if(_class)
3727 {
3728 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3729 if(inCompiler)
3730 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3731 }
3732 }
3733 else if(_class)
3734 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3735 }
3736 }
3737 }
3738
3739 extern struct Identifier * GetDeclId(struct Declarator * decl);
3740
3741 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);
3742
3743 extern void FreeSpecifier(struct Specifier * spec);
3744
3745 static void ProcessFunction(struct FunctionDefinition * function);
3746
3747 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (*  CopyFunction)(void * ));
3748
3749 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3750
3751 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3752
3753 extern void FreeClassFunction(struct ClassFunction * func);
3754
3755 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3756
3757 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3758
3759 void ProcessInstantiationType(struct Instantiation * inst)
3760 {
3761 yylloc = inst->loc;
3762 if(inst->_class)
3763 {
3764 struct MembersInit * members;
3765 struct Symbol * classSym;
3766 struct __ecereNameSpace__ecere__com__Class * _class;
3767
3768 classSym = inst->_class->symbol;
3769 _class = classSym ? classSym->registered : (((void *)0));
3770 if(!_class || _class->type != 5)
3771 DeclareStruct(inst->_class->name, 0x0);
3772 afterExternal = afterExternal ? afterExternal : curExternal;
3773 if(inst->exp)
3774 ProcessExpressionType(inst->exp);
3775 inst->isConstant = 0x1;
3776 if(inst->members)
3777 {
3778 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3779 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3780 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3781 int subMemberStackPos = 0;
3782
3783 for(members = (*inst->members).first; members; members = members->next)
3784 {
3785 switch(members->type)
3786 {
3787 case 1:
3788 {
3789 char name[1024];
3790 static unsigned int instMethodID = 0;
3791 struct External * external = curExternal;
3792 struct Context * context = curContext;
3793 struct Declarator * declarator = members->function->declarator;
3794 struct Identifier * nameID = GetDeclId(declarator);
3795 char * unmangled = nameID ? nameID->string : (((void *)0));
3796 struct Expression * exp;
3797 struct External * createdExternal = (((void *)0));
3798
3799 if(inCompiler)
3800 {
3801 char number[16];
3802
3803 strcpy(name, "__ecereInstMeth_");
3804 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3805 strcat(name, "_");
3806 strcat(name, nameID->string);
3807 strcat(name, "_");
3808 sprintf(number, "_%08d", instMethodID++);
3809 strcat(name, number);
3810 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3811 }
3812 if(declarator)
3813 {
3814 struct Symbol * symbol = declarator->symbol;
3815 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3816
3817 if(method && method->type == 1)
3818 {
3819 symbol->method = method;
3820 ProcessMethodType(method);
3821 if(!symbol->type->thisClass)
3822 {
3823 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3824 {
3825 if(!currentClass->symbol)
3826 currentClass->symbol = FindClass(currentClass->fullName);
3827 symbol->type->thisClass = currentClass->symbol;
3828 }
3829 else
3830 {
3831 if(!_class->symbol)
3832 _class->symbol = FindClass(_class->fullName);
3833 symbol->type->thisClass = _class->symbol;
3834 }
3835 }
3836 DeclareType(symbol->type, 0x1, 0x1);
3837 }
3838 else if(classSym)
3839 {
3840 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
3841 }
3842 }
3843 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
3844 if(nameID)
3845 {
3846 FreeSpecifier(nameID->_class);
3847 nameID->_class = (((void *)0));
3848 }
3849 if(inCompiler)
3850 {
3851 struct Type * type = declarator->symbol->type;
3852 struct External * oldExternal = curExternal;
3853
3854 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
3855 {
3856 struct External * externalDecl;
3857
3858 externalDecl = MkExternalDeclaration((((void *)0)));
3859 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
3860 if(createdExternal->function)
3861 {
3862 ProcessFunction(createdExternal->function);
3863 {
3864 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
3865
3866 externalDecl->declaration = decl;
3867 if(decl->symbol && !decl->symbol->pointerExternal)
3868 decl->symbol->pointerExternal = externalDecl;
3869 declarator->symbol->pointerExternal = externalDecl;
3870 }
3871 }
3872 }
3873 }
3874 else if(declarator)
3875 {
3876 curExternal = declarator->symbol->pointerExternal;
3877 ProcessFunction((struct FunctionDefinition *)members->function);
3878 }
3879 curExternal = external;
3880 curContext = context;
3881 if(inCompiler)
3882 {
3883 FreeClassFunction(members->function);
3884 exp = QMkExpId(name);
3885 members->type = 0;
3886 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
3887 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
3888 }
3889 break;
3890 }
3891 case 0:
3892 {
3893 if(members->dataMembers && classSym)
3894 {
3895 struct MemberInit * member;
3896 struct Location oldyyloc = yylloc;
3897
3898 for(member = (*members->dataMembers).first; member; member = member->next)
3899 {
3900 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
3901 if(member->initializer && !member->initializer->isConstant)
3902 inst->isConstant = 0x0;
3903 }
3904 yylloc = oldyyloc;
3905 }
3906 break;
3907 }
3908 }
3909 }
3910 }
3911 }
3912 }
3913
3914 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
3915 {
3916 if(inCompiler)
3917 {
3918 if(type->kind == 11)
3919 {
3920 struct Type * param;
3921
3922 if(declareParams)
3923 {
3924 for(param = type->params.first; param; param = param->next)
3925 DeclareType(param, declarePointers, 0x1);
3926 }
3927 DeclareType(type->returnType, declarePointers, 0x1);
3928 }
3929 else if(type->kind == 13 && declarePointers)
3930 DeclareType(type->type, declarePointers, 0x0);
3931 else if(type->kind == 8)
3932 {
3933 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
3934 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
3935 }
3936 else if(type->kind == 9 || type->kind == 10)
3937 {
3938 struct Type * member;
3939
3940 for(member = type->members.first; member; member = member->next)
3941 DeclareType(member, 0x0, 0x0);
3942 }
3943 else if(type->kind == 12)
3944 DeclareType(type->arrayType, declarePointers, 0x0);
3945 }
3946 }
3947
3948 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
3949
3950 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
3951 {
3952 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
3953 int id = 0;
3954 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3955 struct __ecereNameSpace__ecere__com__Class * sClass;
3956
3957 for(sClass = _class; sClass; sClass = sClass->base)
3958 {
3959 id = 0;
3960 if(sClass->templateClass)
3961 sClass = sClass->templateClass;
3962 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3963 {
3964 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
3965 {
3966 for(sClass = sClass->base; sClass; sClass = sClass->base)
3967 {
3968 if(sClass->templateClass)
3969 sClass = sClass->templateClass;
3970 id += sClass->templateParams.count;
3971 }
3972 break;
3973 }
3974 id++;
3975 }
3976 if(curParam)
3977 break;
3978 }
3979 if(curParam)
3980 {
3981 arg = &_class->templateArgs[id];
3982 if(arg && param->type == 0)
3983 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
3984 }
3985 return arg;
3986 }
3987
3988 extern struct Context * PushContext(void);
3989
3990 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
3991
3992 struct TemplatedType
3993 {
3994 uintptr_t key;
3995 struct __ecereNameSpace__ecere__sys__BTNode * parent;
3996 struct __ecereNameSpace__ecere__sys__BTNode * left;
3997 struct __ecereNameSpace__ecere__sys__BTNode * right;
3998 int depth;
3999 struct TemplateParameter * param;
4000 } __attribute__ ((gcc_struct));
4001
4002 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
4003
4004 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
4005 {
4006 struct Context * context = PushContext();
4007
4008 context->templateTypesOnly = 0x1;
4009 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
4010 {
4011 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
4012
4013 for(; param; param = param->next)
4014 {
4015 if(param->type == 0 && param->identifier)
4016 {
4017 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (uintptr_t)param->identifier->string, type->param = param, type);
4018
4019 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4020 }
4021 }
4022 }
4023 else if(_class)
4024 {
4025 struct __ecereNameSpace__ecere__com__Class * sClass;
4026
4027 for(sClass = _class; sClass; sClass = sClass->base)
4028 {
4029 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
4030
4031 for(p = sClass->templateParams.first; p; p = p->next)
4032 {
4033 if(p->type == 0)
4034 {
4035 struct TemplateParameter * param = p->param;
4036 struct TemplatedType * type;
4037
4038 if(!param)
4039 {
4040 p->param = param = __extension__ ({
4041 struct TemplateParameter * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter);
4042
4043 __ecereInstance1->identifier = MkIdentifier(p->name), __ecereInstance1->type = p->type, __ecereInstance1->dataTypeString = p->dataTypeString, __ecereInstance1;
4044 });
4045 }
4046 type = __extension__ ({
4047 struct TemplatedType * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType);
4048
4049 __ecereInstance1->key = (uintptr_t)p->name, __ecereInstance1->param = param, __ecereInstance1;
4050 });
4051 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4052 }
4053 }
4054 }
4055 }
4056 return context;
4057 }
4058
4059 extern void PopContext(struct Context * ctx);
4060
4061 extern void FreeContext(struct Context * context);
4062
4063 void FinishTemplatesContext(struct Context * context)
4064 {
4065 PopContext(context);
4066 FreeContext(context);
4067 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
4068 }
4069
4070 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
4071 {
4072 if(!method->dataType)
4073 {
4074 struct Context * context = SetupTemplatesContext(method->_class);
4075
4076 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4077 FinishTemplatesContext(context);
4078 if(method->type != 1 && method->dataType)
4079 {
4080 if(!method->dataType->thisClass && !method->dataType->staticMethod)
4081 {
4082 if(!method->_class->symbol)
4083 method->_class->symbol = FindClass(method->_class->fullName);
4084 method->dataType->thisClass = method->_class->symbol;
4085 }
4086 }
4087 }
4088 }
4089
4090 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
4091 {
4092 if(!prop->dataType)
4093 {
4094 struct Context * context = SetupTemplatesContext(prop->_class);
4095
4096 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
4097 FinishTemplatesContext(context);
4098 }
4099 }
4100
4101 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
4102
4103 extern void FreeTypeName(struct TypeName * typeName);
4104
4105 static void ProcessDeclarator(struct Declarator * decl);
4106
4107 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
4108
4109 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
4110
4111 struct MethodImport
4112 {
4113 struct MethodImport * prev;
4114 struct MethodImport * next;
4115 char *  name;
4116 unsigned int isVirtual;
4117 } __attribute__ ((gcc_struct));
4118
4119 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
4120
4121 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
4122 {
4123 struct Symbol * symbol = method->symbol;
4124
4125 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
4126 {
4127 unsigned int imported = 0x0;
4128 unsigned int dllImport = 0x0;
4129
4130 if(!method->dataType)
4131 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4132 if(!symbol || symbol->_import || method->type == 1)
4133 {
4134 if(!symbol || method->type == 1)
4135 {
4136 struct Symbol * classSym;
4137
4138 if(!method->_class->symbol)
4139 method->_class->symbol = FindClass(method->_class->fullName);
4140 classSym = method->_class->symbol;
4141 if(!classSym->_import)
4142 {
4143 struct ModuleImport * module;
4144
4145 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->name)
4146 module = FindModule(method->_class->module);
4147 else
4148 module = mainModule;
4149 classSym->_import = __extension__ ({
4150 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
4151
4152 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), __ecereInstance1->isRemote = method->_class->isRemote, __ecereInstance1;
4153 });
4154 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
4155 }
4156 if(!symbol)
4157 {
4158 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4159 }
4160 if(!symbol->_import)
4161 {
4162 symbol->_import = (struct ClassImport *)__extension__ ({
4163 struct MethodImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport);
4164
4165 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->name), __ecereInstance1->isVirtual = method->type == 1, __ecereInstance1;
4166 });
4167 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
4168 }
4169 if(!symbol)
4170 {
4171 symbol->type = method->dataType;
4172 if(symbol->type)
4173 symbol->type->refCount++;
4174 }
4175 }
4176 if(!method->dataType->dllExport)
4177 {
4178 imported = 0x1;
4179 if(method->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->importType != 1)
4180 dllImport = 0x1;
4181 }
4182 }
4183 if(method->type != 1 && method->dataType)
4184 DeclareType(method->dataType, 0x1, 0x1);
4185 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4186 {
4187 struct Declaration * decl;
4188 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4189 struct Declarator * d;
4190 struct Declarator * funcDecl;
4191 struct External * external;
4192
4193 specifiers = MkList();
4194 declarators = MkList();
4195 if(dllImport)
4196 ListAdd(specifiers, MkSpecifier(EXTERN));
4197 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
4198 ListAdd(specifiers, MkSpecifier(STATIC));
4199 if(method->type == 1)
4200 {
4201 ListAdd(specifiers, MkSpecifier(INT));
4202 d = MkDeclaratorIdentifier(MkIdentifier(name));
4203 }
4204 else
4205 {
4206 d = MkDeclaratorIdentifier(MkIdentifier(name));
4207 if(dllImport)
4208 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4209 {
4210 struct Context * context = SetupTemplatesContext(method->_class);
4211
4212 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
4213 FinishTemplatesContext(context);
4214 }
4215 funcDecl = GetFuncDecl(d);
4216 if(dllImport)
4217 {
4218 struct Specifier * spec, * next;
4219
4220 for(spec = (*specifiers).first; spec; spec = next)
4221 {
4222 next = spec->next;
4223 if(spec->type == 5)
4224 {
4225 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4226 FreeSpecifier(spec);
4227 }
4228 }
4229 }
4230 if(method->dataType && !method->dataType->staticMethod)
4231 {
4232 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4233 {
4234 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4235 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")));
4236 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4237 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4238
4239 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4240 {
4241 struct TypeName * param = (*funcDecl->function.parameters).first;
4242
4243 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4244 FreeTypeName(param);
4245 }
4246 if(!funcDecl->function.parameters)
4247 funcDecl->function.parameters = MkList();
4248 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4249 }
4250 }
4251 }
4252 ProcessDeclarator(d);
4253 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4254 decl = MkDeclaration(specifiers, declarators);
4255 ReplaceThisClassSpecifiers(specifiers, method->_class);
4256 if(symbol->pointerExternal)
4257 {
4258 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4259
4260 {
4261 *functionSymbol = *symbol;
4262 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4263 if(functionSymbol->type)
4264 functionSymbol->type->refCount++;
4265 }
4266 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4267 symbol->pointerExternal->symbol = functionSymbol;
4268 }
4269 external = MkExternalDeclaration(decl);
4270 if(curExternal)
4271 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4272 external->symbol = symbol;
4273 symbol->pointerExternal = external;
4274 }
4275 else if(ast)
4276 {
4277 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4278 }
4279 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4280 }
4281 }
4282
4283 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4284 {
4285 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4286 {
4287 unsigned int first = 0x1;
4288 int p = 0;
4289 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4290 int lastParam = -1;
4291 char className[1024];
4292
4293 strcpy(className, _class->fullName);
4294 for(param = _class->templateParams.first; param; param = param->next)
4295 {
4296 {
4297 if(first)
4298 strcat(className, "<");
4299 if(!first)
4300 strcat(className, ", ");
4301 if(lastParam + 1 != p)
4302 {
4303 strcat(className, param->name);
4304 strcat(className, " = ");
4305 }
4306 strcat(className, param->name);
4307 first = 0x0;
4308 lastParam = p;
4309 }
4310 p++;
4311 }
4312 if(!first)
4313 {
4314 int len = strlen(className);
4315
4316 if(className[len - 1] == '>')
4317 className[len++] = ' ';
4318 className[len++] = '>';
4319 className[len++] = '\0';
4320 }
4321 return __ecereNameSpace__ecere__sys__CopyString(className);
4322 }
4323 else
4324 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4325 }
4326
4327 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4328 {
4329 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4330 {
4331 unsigned int first = 0x1;
4332 int p = 0;
4333 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4334 int lastParam = -1;
4335 char className[1024];
4336
4337 strcpy(className, _class->fullName);
4338 for(param = _class->templateParams.first; param; param = param->next)
4339 {
4340 {
4341 if(first)
4342 strcat(className, "<");
4343 if(!first)
4344 strcat(className, ", ");
4345 if(lastParam + 1 != p)
4346 {
4347 strcat(className, param->name);
4348 strcat(className, " = ");
4349 }
4350 strcat(className, param->name);
4351 first = 0x0;
4352 lastParam = p;
4353 }
4354 p++;
4355 }
4356 if(!first)
4357 {
4358 int len = strlen(className);
4359
4360 if(className[len - 1] == '>')
4361 className[len++] = ' ';
4362 className[len++] = '>';
4363 className[len++] = '\0';
4364 }
4365 return MkClassType(className);
4366 }
4367 else
4368 {
4369 return MkClassType(_class->fullName);
4370 }
4371 }
4372
4373 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4374 {
4375 if(specs != (((void *)0)) && _class)
4376 {
4377 struct Specifier * spec;
4378
4379 for(spec = specs->first; spec; spec = spec->next)
4380 {
4381 if(spec->type == 0 && spec->specifier == THISCLASS)
4382 {
4383 spec->type = 1;
4384 spec->name = ReplaceThisClass(_class);
4385 spec->symbol = FindClass(spec->name);
4386 }
4387 }
4388 }
4389 }
4390
4391 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4392
4393 struct __ecereNameSpace__ecere__com__GlobalFunction
4394 {
4395 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4396 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4397 char *  name;
4398 int (*  function)();
4399 struct __ecereNameSpace__ecere__com__Instance * module;
4400 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4401 char *  dataTypeString;
4402 struct Type * dataType;
4403 void *  symbol;
4404 } __attribute__ ((gcc_struct));
4405
4406 extern struct Context * globalContext;
4407
4408 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4409
4410 struct FunctionImport
4411 {
4412 struct FunctionImport * prev;
4413 struct FunctionImport * next;
4414 char *  name;
4415 } __attribute__ ((gcc_struct));
4416
4417 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4418 {
4419 struct Symbol * symbol = function->symbol;
4420
4421 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4422 {
4423 unsigned int imported = 0x0;
4424 unsigned int dllImport = 0x0;
4425
4426 if(!function->dataType)
4427 {
4428 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4429 if(!function->dataType->thisClass)
4430 function->dataType->staticMethod = 0x1;
4431 }
4432 if(inCompiler)
4433 {
4434 if(!symbol)
4435 {
4436 struct ModuleImport * module = FindModule(function->module);
4437
4438 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4439 if(module->name)
4440 {
4441 if(!function->dataType->dllExport)
4442 {
4443 symbol->_import = (struct ClassImport *)__extension__ ({
4444 struct FunctionImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport);
4445
4446 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(function->name), __ecereInstance1;
4447 });
4448 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4449 }
4450 }
4451 {
4452 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4453 if(!symbol->type->thisClass)
4454 symbol->type->staticMethod = 0x1;
4455 }
4456 }
4457 imported = symbol->_import ? 0x1 : 0x0;
4458 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1)
4459 dllImport = 0x1;
4460 }
4461 DeclareType(function->dataType, 0x1, 0x1);
4462 if(inCompiler)
4463 {
4464 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4465 {
4466 struct Declaration * decl;
4467 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4468 struct Declarator * d;
4469 struct Declarator * funcDecl;
4470 struct External * external;
4471
4472 specifiers = MkList();
4473 declarators = MkList();
4474 ListAdd(specifiers, MkSpecifier(EXTERN));
4475 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4476 if(dllImport)
4477 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4478 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4479 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType == 1)
4480 {
4481 struct Specifier * spec;
4482
4483 for(spec = (*specifiers).first; spec; spec = spec->next)
4484 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4485 {
4486 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4487 FreeSpecifier(spec);
4488 break;
4489 }
4490 }
4491 funcDecl = GetFuncDecl(d);
4492 if(funcDecl && !funcDecl->function.parameters)
4493 {
4494 funcDecl->function.parameters = MkList();
4495 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4496 }
4497 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4498 {
4499 struct Context * oldCtx = curContext;
4500
4501 curContext = globalContext;
4502 decl = MkDeclaration(specifiers, declarators);
4503 curContext = oldCtx;
4504 }
4505 if(symbol->pointerExternal)
4506 {
4507 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4508
4509 {
4510 *functionSymbol = *symbol;
4511 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4512 if(functionSymbol->type)
4513 functionSymbol->type->refCount++;
4514 }
4515 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4516 symbol->pointerExternal->symbol = functionSymbol;
4517 }
4518 external = MkExternalDeclaration(decl);
4519 if(curExternal)
4520 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4521 external->symbol = symbol;
4522 symbol->pointerExternal = external;
4523 }
4524 else
4525 {
4526 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4527 }
4528 if(curExternal)
4529 symbol->id = curExternal->symbol->idCode;
4530 }
4531 }
4532 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1) ? 0x1 : 0x0;
4533 }
4534
4535 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4536
4537 struct GlobalData
4538 {
4539 uintptr_t key;
4540 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4541 struct __ecereNameSpace__ecere__sys__BTNode * left;
4542 struct __ecereNameSpace__ecere__sys__BTNode * right;
4543 int depth;
4544 struct __ecereNameSpace__ecere__com__Instance * module;
4545 char *  dataTypeString;
4546 struct Type * dataType;
4547 void *  symbol;
4548 char *  fullName;
4549 } __attribute__ ((gcc_struct));
4550
4551 void DeclareGlobalData(struct GlobalData * data)
4552 {
4553 struct Symbol * symbol = data->symbol;
4554
4555 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4556 {
4557 if(inCompiler)
4558 {
4559 if(!symbol)
4560 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4561 }
4562 if(!data->dataType)
4563 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4564 DeclareType(data->dataType, 0x1, 0x1);
4565 if(inCompiler)
4566 {
4567 if(!symbol->pointerExternal)
4568 {
4569 struct Declaration * decl;
4570 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4571 struct Declarator * d;
4572 struct External * external;
4573
4574 specifiers = MkList();
4575 declarators = MkList();
4576 ListAdd(specifiers, MkSpecifier(EXTERN));
4577 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4578 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4579 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4580 decl = MkDeclaration(specifiers, declarators);
4581 external = MkExternalDeclaration(decl);
4582 if(curExternal)
4583 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4584 external->symbol = symbol;
4585 symbol->pointerExternal = external;
4586 }
4587 else
4588 {
4589 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4590 }
4591 if(curExternal)
4592 symbol->id = curExternal->symbol->idCode;
4593 }
4594 }
4595 }
4596
4597 struct Conversion
4598 {
4599 struct Conversion * prev, * next;
4600 struct __ecereNameSpace__ecere__com__Property * convert;
4601 unsigned int isGet;
4602 struct Type * resultType;
4603 } __attribute__ ((gcc_struct));
4604
4605 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4606
4607 extern void Compiler_Warning(char *  format, ...);
4608
4609 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4610
4611 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)
4612 {
4613 if(source && dest)
4614 {
4615 if(source->kind == 20 && dest->kind != 20)
4616 {
4617 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4618
4619 if(type)
4620 source = type;
4621 }
4622 if(dest->kind == 20 && source->kind != 20)
4623 {
4624 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4625
4626 if(type)
4627 dest = type;
4628 }
4629 if(dest->classObjectType == 2)
4630 {
4631 if(source->classObjectType != 3)
4632 return 0x1;
4633 else
4634 {
4635 if((dest->_class && strcmp(dest->_class->string, "class")) || (source->_class && strcmp(source->_class->string, "class")))
4636 {
4637 return 0x1;
4638 }
4639 }
4640 }
4641 else
4642 {
4643 if(source->classObjectType == 3)
4644 return 0x1;
4645 if(dest->classObjectType == 3 && source->classObjectType != 2)
4646 return 0x1;
4647 }
4648 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4649 {
4650 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4651 return 0x1;
4652 }
4653 if(dest->kind == 14 && source->kind != 0)
4654 return 0x1;
4655 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))
4656 return 0x1;
4657 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))
4658 return 0x1;
4659 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4660 {
4661 if(source->_class->registered && source->_class->registered->type == 3)
4662 {
4663 if(conversions != (((void *)0)))
4664 {
4665 if(source->_class->registered == dest->_class->registered)
4666 return 0x1;
4667 }
4668 else
4669 {
4670 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4671
4672 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4673 ;
4674 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4675 ;
4676 if(sourceBase == destBase)
4677 return 0x1;
4678 }
4679 }
4680 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))
4681 return 0x1;
4682 else
4683 {
4684 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4 && ((source->_class && source->_class->registered && source->_class->registered->type != 4) || source->kind == 8))
4685 {
4686 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4687 {
4688 return 0x1;
4689 }
4690 }
4691 }
4692 }
4693 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4694 return 0x1;
4695 if(doConversion)
4696 {
4697 if(source->kind == 8)
4698 {
4699 struct __ecereNameSpace__ecere__com__Class * _class;
4700
4701 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4702 {
4703 struct __ecereNameSpace__ecere__com__Property * convert;
4704
4705 for(convert = _class->conversions.first; convert; convert = convert->next)
4706 {
4707 if(convert->memberAccess == 1 || _class->module == privateModule)
4708 {
4709 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4710
4711 if(!convert->dataType)
4712 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4713 if(MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x0, 0x1, 0x0, 0x1))
4714 {
4715 if(!conversions && !convert->Get)
4716 return 0x1;
4717 else if(conversions != (((void *)0)))
4718 {
4719 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))
4720 return 0x1;
4721 else
4722 {
4723 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4724
4725 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4726 return 0x1;
4727 }
4728 }
4729 }
4730 }
4731 }
4732 }
4733 }
4734 if(dest->kind == 8)
4735 {
4736 struct __ecereNameSpace__ecere__com__Class * _class;
4737
4738 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4739 {
4740 struct __ecereNameSpace__ecere__com__Property * convert;
4741
4742 for(convert = _class->conversions.first; convert; convert = convert->next)
4743 {
4744 if(convert->memberAccess == 1 || _class->module == privateModule)
4745 {
4746 if(!convert->dataType)
4747 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4748 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4749 {
4750 if(!conversions && !convert->Set)
4751 return 0x1;
4752 else if(conversions != (((void *)0)))
4753 {
4754 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))
4755 return 0x1;
4756 else
4757 {
4758 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4759
4760 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4761 return 0x1;
4762 }
4763 }
4764 }
4765 }
4766 }
4767 }
4768 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4769 {
4770 if(!dest->_class->registered->dataType)
4771 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4772 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4773 {
4774 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4775 {
4776 return 0x1;
4777 }
4778 }
4779 }
4780 }
4781 if(source->kind == 8)
4782 {
4783 struct __ecereNameSpace__ecere__com__Class * _class;
4784
4785 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4786 {
4787 struct __ecereNameSpace__ecere__com__Property * convert;
4788
4789 for(convert = _class->conversions.first; convert; convert = convert->next)
4790 {
4791 if(convert->memberAccess == 1 || _class->module == privateModule)
4792 {
4793 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4794
4795 if(!convert->dataType)
4796 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4797 if(convert->dataType != source && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x1))
4798 {
4799 if(!conversions && !convert->Get)
4800 return 0x1;
4801 else if(conversions != (((void *)0)))
4802 {
4803 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))
4804 return 0x1;
4805 else
4806 {
4807 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4808
4809 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4810 return 0x1;
4811 }
4812 }
4813 }
4814 }
4815 }
4816 }
4817 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4818 {
4819 if(!source->_class->registered->dataType)
4820 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4821 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4822 {
4823 return 0x1;
4824 }
4825 }
4826 }
4827 }
4828 if(source->kind == 8 || source->kind == 19)
4829 ;
4830 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
4831 return 0x1;
4832 else if(dest->kind == 7 && source->kind == 6)
4833 return 0x1;
4834 else if(dest->kind == 2 && source->kind == 1)
4835 return 0x1;
4836 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1 || source->kind == 23))
4837 return 0x1;
4838 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 22 || source->kind == 23))
4839 return 0x1;
4840 else if(dest->kind == 22 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 23 || source->kind == 4))
4841 return 0x1;
4842 else if(dest->kind == 23 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4 || source->kind == 22))
4843 return 0x1;
4844 else if(source->kind == 15 && (dest->kind == 3 || dest->kind == 2 || dest->kind == 1 || dest->kind == 5 || dest->kind == 4 || dest->kind == 22 || dest->kind == 23))
4845 return 0x1;
4846 else if(dest->kind == 15 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 5 || source->kind == 4 || source->kind == 22 || source->kind == 23))
4847 return 0x1;
4848 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)))
4849 {
4850 struct Type * paramSource, * paramDest;
4851
4852 if(dest->kind == 16)
4853 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
4854 if(source->kind == 16)
4855 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
4856 if(dest->kind == 13 && dest->type->kind == 11)
4857 dest = dest->type;
4858 if(source->kind == 13 && source->type->kind == 11)
4859 source = source->type;
4860 if(dest->kind == 16)
4861 dest = dest->method->dataType;
4862 if(source->kind == 16)
4863 source = source->method->dataType;
4864 paramSource = source->params.first;
4865 if(paramSource && paramSource->kind == 0)
4866 paramSource = (((void *)0));
4867 paramDest = dest->params.first;
4868 if(paramDest && paramDest->kind == 0)
4869 paramDest = (((void *)0));
4870 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
4871 {
4872 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))))
4873 {
4874 if(paramDest && paramDest->kind == 8)
4875 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
4876 else
4877 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class should not take an object\n", (((void *)0))));
4878 return 0x0;
4879 }
4880 paramDest = paramDest->next;
4881 }
4882 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
4883 {
4884 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
4885 {
4886 if(dest->thisClass)
4887 {
4888 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
4889 {
4890 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4891 return 0x0;
4892 }
4893 }
4894 else
4895 {
4896 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
4897 {
4898 if(owningClassDest)
4899 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
4900 else
4901 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "overriding class expected to be derived from method class\n", (((void *)0))));
4902 return 0x0;
4903 }
4904 }
4905 paramSource = paramSource->next;
4906 }
4907 else
4908 {
4909 if(dest->thisClass)
4910 {
4911 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
4912 {
4913 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4914 return 0x0;
4915 }
4916 }
4917 else
4918 {
4919 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
4920 {
4921 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
4922 return 0x0;
4923 }
4924 }
4925 }
4926 }
4927 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4928 {
4929 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible return type for function\n", (((void *)0))));
4930 return 0x0;
4931 }
4932 for(; paramDest; paramDest = paramDest->next)
4933 {
4934 if(!paramSource)
4935 {
4936 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough parameters\n", (((void *)0))));
4937 return 0x0;
4938 }
4939 {
4940 struct Type * paramDestType = paramDest;
4941 struct Type * paramSourceType = paramSource;
4942 struct Type * type = paramDestType;
4943
4944 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
4945 {
4946 int id = 0;
4947 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4948 struct __ecereNameSpace__ecere__com__Class * sClass;
4949
4950 for(sClass = owningClassSource; sClass; sClass = sClass->base)
4951 {
4952 id = 0;
4953 if(sClass->templateClass)
4954 sClass = sClass->templateClass;
4955 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4956 {
4957 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
4958 {
4959 for(sClass = sClass->base; sClass; sClass = sClass->base)
4960 {
4961 if(sClass->templateClass)
4962 sClass = sClass->templateClass;
4963 id += sClass->templateParams.count;
4964 }
4965 break;
4966 }
4967 id++;
4968 }
4969 if(curParam)
4970 break;
4971 }
4972 if(curParam)
4973 {
4974 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
4975
4976 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
4977 }
4978 }
4979 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)))
4980 {
4981 char type[1024];
4982
4983 type[0] = (char)0;
4984 PrintType(paramDest, type, 0x0, 0x1);
4985 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
4986 if(paramDestType != paramDest)
4987 FreeType(paramDestType);
4988 return 0x0;
4989 }
4990 if(paramDestType != paramDest)
4991 FreeType(paramDestType);
4992 }
4993 paramSource = paramSource->next;
4994 }
4995 if(paramSource)
4996 {
4997 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many parameters\n", (((void *)0))));
4998 return 0x0;
4999 }
5000 return 0x1;
5001 }
5002 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
5003 {
5004 return 0x1;
5005 }
5006 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
5007 {
5008 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5009 return 0x1;
5010 }
5011 }
5012 return 0x0;
5013 }
5014
5015 static void FreeConvert(struct Conversion * convert)
5016 {
5017 if(convert->resultType)
5018 FreeType(convert->resultType);
5019 }
5020
5021 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
5022
5023 struct __ecereNameSpace__ecere__com__BTNamedLink
5024 {
5025 char *  name;
5026 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
5027 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
5028 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
5029 int depth;
5030 void *  data;
5031 } __attribute__ ((gcc_struct));
5032
5033 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
5034
5035 struct __ecereNameSpace__ecere__com__EnumClassData
5036 {
5037 struct __ecereNameSpace__ecere__sys__OldList values;
5038 int largest;
5039 } __attribute__ ((gcc_struct));
5040
5041 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
5042
5043 struct __ecereNameSpace__ecere__sys__NamedLink
5044 {
5045 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
5046 struct __ecereNameSpace__ecere__sys__NamedLink * next;
5047 char *  name;
5048 void *  data;
5049 } __attribute__ ((gcc_struct));
5050
5051 extern void FreeExpContents(struct Expression * exp);
5052
5053 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
5054
5055 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
5056
5057 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
5058
5059 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
5060
5061 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
5062
5063 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5064 {
5065 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
5066
5067 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)))
5068 {
5069 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
5070
5071 if(_class->type == 4)
5072 {
5073 struct __ecereNameSpace__ecere__sys__OldList converts = 
5074 {
5075 0, 0, 0, 0, 0
5076 };
5077 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5078
5079 type->kind = 8;
5080 if(!_class->symbol)
5081 _class->symbol = FindClass(_class->fullName);
5082 type->_class = _class->symbol;
5083 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
5084 {
5085 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5086 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5087
5088 if(enumClass)
5089 {
5090 struct __ecereNameSpace__ecere__com__Class * baseClass;
5091
5092 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
5093 {
5094 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
5095
5096 for(value = e->values.first; value; value = value->next)
5097 {
5098 if(!strcmp(value->name, string))
5099 break;
5100 }
5101 if(value)
5102 {
5103 FreeExpContents(sourceExp);
5104 FreeType(sourceExp->expType);
5105 sourceExp->isConstant = 0x1;
5106 sourceExp->expType = MkClassType(baseClass->fullName);
5107 {
5108 char constant[256];
5109
5110 sourceExp->type = 2;
5111 if(!strcmp(baseClass->dataTypeString, "int"))
5112 sprintf(constant, "%d", (int)value->data);
5113 else
5114 sprintf(constant, "0x%X", (int)value->data);
5115 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5116 }
5117 while(converts.first)
5118 {
5119 struct Conversion * convert = converts.first;
5120
5121 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
5122 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
5123 }
5124 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5125 return 0x1;
5126 }
5127 }
5128 }
5129 }
5130 if(converts.first)
5131 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
5132 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5133 }
5134 }
5135 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)))
5136 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
5137 return 0x1;
5138 return 0x0;
5139 }
5140
5141 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
5142
5143 struct __ecereNameSpace__ecere__com__SubModule
5144 {
5145 struct __ecereNameSpace__ecere__com__SubModule * prev;
5146 struct __ecereNameSpace__ecere__com__SubModule * next;
5147 struct __ecereNameSpace__ecere__com__Instance * module;
5148 int importMode;
5149 } __attribute__ ((gcc_struct));
5150
5151 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
5152 {
5153 struct __ecereNameSpace__ecere__com__SubModule * subModule;
5154
5155 if(searchFor == searchIn)
5156 return 0x1;
5157 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
5158 {
5159 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->application)
5160 {
5161 if(ModuleVisibility(subModule->module, searchFor))
5162 return 0x1;
5163 }
5164 }
5165 return 0x0;
5166 }
5167
5168 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
5169
5170 struct __ecereNameSpace__ecere__com__Application
5171 {
5172 int argc;
5173 char * *  argv;
5174 int exitCode;
5175 unsigned int isGUIApp;
5176 struct __ecereNameSpace__ecere__sys__OldList allModules;
5177 char *  parsedCommand;
5178 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
5179 } __attribute__ ((gcc_struct));
5180
5181 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5182 {
5183 struct __ecereNameSpace__ecere__com__Instance * module;
5184
5185 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + structSize_Instance)))->application + structSize_Module)))->systemNameSpace, sourceExp, dest, string, conversions))
5186 return 0x1;
5187 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + structSize_Instance)))->application + structSize_Instance)))->privateNameSpace, sourceExp, dest, string, conversions))
5188 return 0x1;
5189 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + structSize_Instance)))->application + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5190 return 0x1;
5191 for(module = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + structSize_Instance)))->application + structSize_Module)))->allModules.first; module; module = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->next)
5192 {
5193 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5194 return 0x1;
5195 }
5196 return 0x0;
5197 }
5198
5199 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
5200
5201 void ReadString(char *  output, char *  string);
5202
5203 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
5204
5205 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
5206
5207 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
5208
5209 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
5210 {
5211 struct Type * source = sourceExp->expType;
5212 struct Type * realDest = dest;
5213 struct Type * backupSourceExpType = (((void *)0));
5214
5215 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5216 return 0x1;
5217 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5218 {
5219 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5220 {
5221 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5222
5223 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5224 ;
5225 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5226 ;
5227 if(sourceBase == destBase)
5228 return 0x1;
5229 }
5230 }
5231 if(source)
5232 {
5233 struct __ecereNameSpace__ecere__sys__OldList * specs;
5234 unsigned int flag = 0x0;
5235 long long value = (((int)0x7fffffff));
5236
5237 source->refCount++;
5238 dest->refCount++;
5239 if(sourceExp->type == 2)
5240 {
5241 if(source->isSigned)
5242 value = strtoll(sourceExp->constant, (((void *)0)), 0);
5243 else
5244 value = strtoull(sourceExp->constant, (((void *)0)), 0);
5245 }
5246 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
5247 {
5248 if(source->isSigned)
5249 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
5250 else
5251 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
5252 }
5253 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5254 {
5255 FreeType(source);
5256 source = __extension__ ({
5257 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5258
5259 __ecereInstance1->kind = 3, __ecereInstance1->isSigned = 0x0, __ecereInstance1->refCount = 1, __ecereInstance1;
5260 });
5261 }
5262 if(dest->kind == 8)
5263 {
5264 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5265
5266 if(_class && _class->type == 3)
5267 {
5268 if(source->kind != 8)
5269 {
5270 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5271 struct Type * tempDest, * tempSource;
5272
5273 for(; _class->base->type != 1000; _class = _class->base)
5274 ;
5275 tempSource = dest;
5276 tempDest = tempType;
5277 tempType->kind = 8;
5278 if(!_class->symbol)
5279 _class->symbol = FindClass(_class->fullName);
5280 tempType->_class = _class->symbol;
5281 tempType->truth = dest->truth;
5282 if(tempType->_class)
5283 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5284 backupSourceExpType = sourceExp->expType;
5285 sourceExp->expType = dest;
5286 dest->refCount++;
5287 flag = 0x1;
5288 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5289 }
5290 }
5291 if(_class && _class->type == 2 && source->kind != 8)
5292 {
5293 if(!dest->_class->registered->dataType)
5294 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5295 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5296 {
5297 FreeType(source);
5298 FreeType(sourceExp->expType);
5299 source = sourceExp->expType = MkClassType(dest->_class->string);
5300 source->refCount++;
5301 }
5302 }
5303 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5304 {
5305 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5306 struct Declarator * decl;
5307 char string[1024];
5308
5309 ReadString(string, sourceExp->string);
5310 decl = SpecDeclFromString(string, specs, (((void *)0)));
5311 FreeExpContents(sourceExp);
5312 FreeType(sourceExp->expType);
5313 sourceExp->type = 26;
5314 sourceExp->_classExp.specifiers = specs;
5315 sourceExp->_classExp.decl = decl;
5316 sourceExp->expType = dest;
5317 dest->refCount++;
5318 FreeType(source);
5319 FreeType(dest);
5320 if(backupSourceExpType)
5321 FreeType(backupSourceExpType);
5322 return 0x1;
5323 }
5324 }
5325 else if(source->kind == 8)
5326 {
5327 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5328
5329 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5330 {
5331 if(dest->kind != 8)
5332 {
5333 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5334 struct Type * tempDest, * tempSource;
5335
5336 if(!source->_class->registered->dataType)
5337 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5338 for(; _class->base->type != 1000; _class = _class->base)
5339 ;
5340 tempDest = source;
5341 tempSource = tempType;
5342 tempType->kind = 8;
5343 tempType->_class = FindClass(_class->fullName);
5344 tempType->truth = source->truth;
5345 tempType->classObjectType = source->classObjectType;
5346 if(tempType->_class)
5347 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5348 if(conversions->last)
5349 {
5350 ((struct Conversion *)conversions->last)->resultType = dest;
5351 dest->refCount++;
5352 }
5353 FreeType(sourceExp->expType);
5354 sourceExp->expType = MkClassType(_class->fullName);
5355 sourceExp->expType->truth = source->truth;
5356 sourceExp->expType->classObjectType = source->classObjectType;
5357 if(!sourceExp->destType)
5358 {
5359 FreeType(sourceExp->destType);
5360 sourceExp->destType = sourceExp->expType;
5361 if(sourceExp->expType)
5362 sourceExp->expType->refCount++;
5363 }
5364 if(!_class->dataType)
5365 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5366 FreeType(dest);
5367 dest = MkClassType(source->_class->string);
5368 dest->truth = source->truth;
5369 dest->classObjectType = source->classObjectType;
5370 FreeType(source);
5371 source = _class->dataType;
5372 source->refCount++;
5373 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5374 }
5375 }
5376 }
5377 if(!flag)
5378 {
5379 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5380 {
5381 FreeType(source);
5382 FreeType(dest);
5383 return 0x1;
5384 }
5385 }
5386 if(dest->kind == 8)
5387 {
5388 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5389
5390 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5391 {
5392 if(_class->type == 0 || _class->type == 5)
5393 {
5394 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5395
5396 *newExp = *sourceExp;
5397 if(sourceExp->destType)
5398 sourceExp->destType->refCount++;
5399 if(sourceExp->expType)
5400 sourceExp->expType->refCount++;
5401 sourceExp->type = 11;
5402 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5403 sourceExp->cast.exp = newExp;
5404 FreeType(sourceExp->expType);
5405 sourceExp->expType = (((void *)0));
5406 ProcessExpressionType(sourceExp);
5407 if(!inCompiler)
5408 {
5409 FreeType(sourceExp->expType);
5410 sourceExp->expType = dest;
5411 }
5412 FreeType(source);
5413 if(inCompiler)
5414 FreeType(dest);
5415 if(backupSourceExpType)
5416 FreeType(backupSourceExpType);
5417 return 0x1;
5418 }
5419 if(!_class->dataType)
5420 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5421 FreeType(dest);
5422 dest = _class->dataType;
5423 dest->refCount++;
5424 }
5425 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5426 {
5427 specs = MkListOne(MkSpecifier(DOUBLE));
5428 }
5429 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 7))
5430 {
5431 specs = MkListOne(MkSpecifier(FLOAT));
5432 }
5433 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5434 {
5435 specs = MkList();
5436 if(!dest->isSigned)
5437 ListAdd(specs, MkSpecifier(UNSIGNED));
5438 ListAdd(specs, MkSpecifier(INT64));
5439 }
5440 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5441 {
5442 specs = MkList();
5443 if(!dest->isSigned)
5444 ListAdd(specs, MkSpecifier(UNSIGNED));
5445 ListAdd(specs, MkSpecifier(INT));
5446 }
5447 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5448 {
5449 specs = MkList();
5450 if(!dest->isSigned)
5451 ListAdd(specs, MkSpecifier(UNSIGNED));
5452 ListAdd(specs, MkSpecifier(SHORT));
5453 }
5454 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5455 {
5456 specs = MkList();
5457 if(!dest->isSigned)
5458 ListAdd(specs, MkSpecifier(UNSIGNED));
5459 ListAdd(specs, MkSpecifier(CHAR));
5460 }
5461 else
5462 {
5463 FreeType(source);
5464 FreeType(dest);
5465 if(backupSourceExpType)
5466 {
5467 if(sourceExp->expType)
5468 FreeType(sourceExp->expType);
5469 sourceExp->expType = backupSourceExpType;
5470 }
5471 return 0x0;
5472 }
5473 }
5474 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))
5475 {
5476 specs = MkListOne(MkSpecifier(DOUBLE));
5477 }
5478 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5479 {
5480 specs = MkListOne(MkSpecifier(FLOAT));
5481 }
5482 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)))
5483 {
5484 specs = MkList();
5485 if(!dest->isSigned)
5486 ListAdd(specs, MkSpecifier(UNSIGNED));
5487 ListAdd(specs, MkSpecifier(CHAR));
5488 }
5489 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)))))
5490 {
5491 specs = MkList();
5492 if(!dest->isSigned)
5493 ListAdd(specs, MkSpecifier(UNSIGNED));
5494 ListAdd(specs, MkSpecifier(SHORT));
5495 }
5496 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3))
5497 {
5498 specs = MkList();
5499 if(!dest->isSigned)
5500 ListAdd(specs, MkSpecifier(UNSIGNED));
5501 ListAdd(specs, MkSpecifier(INT));
5502 }
5503 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5504 {
5505 specs = MkList();
5506 if(!dest->isSigned)
5507 ListAdd(specs, MkSpecifier(UNSIGNED));
5508 ListAdd(specs, MkSpecifier(INT64));
5509 }
5510 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5511 {
5512 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5513 }
5514 else
5515 {
5516 FreeType(source);
5517 FreeType(dest);
5518 if(backupSourceExpType)
5519 {
5520 if(sourceExp->expType)
5521 FreeType(sourceExp->expType);
5522 sourceExp->expType = backupSourceExpType;
5523 }
5524 return 0x0;
5525 }
5526 if(!flag)
5527 {
5528 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5529
5530 *newExp = *sourceExp;
5531 newExp->prev = (((void *)0));
5532 newExp->next = (((void *)0));
5533 if(sourceExp->destType)
5534 sourceExp->destType->refCount++;
5535 if(sourceExp->expType)
5536 sourceExp->expType->refCount++;
5537 sourceExp->type = 11;
5538 if(realDest->kind == 8)
5539 {
5540 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5541 FreeList(specs, FreeSpecifier);
5542 }
5543 else
5544 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5545 if(newExp->type == 4)
5546 {
5547 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5548 }
5549 else
5550 sourceExp->cast.exp = newExp;
5551 FreeType(sourceExp->expType);
5552 sourceExp->expType = (((void *)0));
5553 ProcessExpressionType(sourceExp);
5554 }
5555 else
5556 FreeList(specs, FreeSpecifier);
5557 FreeType(dest);
5558 FreeType(source);
5559 if(backupSourceExpType)
5560 FreeType(backupSourceExpType);
5561 return 0x1;
5562 }
5563 else
5564 {
5565 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5566 sourceExp = (*sourceExp->list).last;
5567 if(sourceExp->type == 0)
5568 {
5569 struct Identifier * id = sourceExp->identifier;
5570
5571 if(dest->kind == 8)
5572 {
5573 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5574 {
5575 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5576 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5577
5578 if(enumClass)
5579 {
5580 for(; _class && _class->type == 4; _class = _class->base)
5581 {
5582 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5583 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5584
5585 for(value = e->values.first; value; value = value->next)
5586 {
5587 if(!strcmp(value->name, id->string))
5588 break;
5589 }
5590 if(value)
5591 {
5592 FreeExpContents(sourceExp);
5593 FreeType(sourceExp->expType);
5594 sourceExp->isConstant = 0x1;
5595 sourceExp->expType = MkClassType(_class->fullName);
5596 {
5597 char constant[256];
5598
5599 sourceExp->type = 2;
5600 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5601 sprintf(constant, "%d", (int)value->data);
5602 else
5603 sprintf(constant, "0x%X", (int)value->data);
5604 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5605 }
5606 return 0x1;
5607 }
5608 }
5609 }
5610 }
5611 }
5612 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5613 return 0x1;
5614 }
5615 }
5616 return 0x0;
5617 }
5618
5619 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5620 {
5621 int value2 = op2->i;
5622
5623 exp->type = 2;
5624 exp->string = PrintInt(op1->i + value2);
5625 if(!exp->expType)
5626 {
5627 exp->expType = op1->type;
5628 if(op1->type)
5629 op1->type->refCount++;
5630 }
5631 return 0x1;
5632 }
5633
5634 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5635 {
5636 unsigned int value2 = op2->ui;
5637
5638 exp->type = 2;
5639 exp->string = PrintUInt(op1->ui + value2);
5640 if(!exp->expType)
5641 {
5642 exp->expType = op1->type;
5643 if(op1->type)
5644 op1->type->refCount++;
5645 }
5646 return 0x1;
5647 }
5648
5649 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5650 {
5651 short value2 = op2->s;
5652
5653 exp->type = 2;
5654 exp->string = PrintShort(op1->s + value2);
5655 if(!exp->expType)
5656 {
5657 exp->expType = op1->type;
5658 if(op1->type)
5659 op1->type->refCount++;
5660 }
5661 return 0x1;
5662 }
5663
5664 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5665 {
5666 unsigned short value2 = op2->us;
5667
5668 exp->type = 2;
5669 exp->string = PrintUShort(op1->us + value2);
5670 if(!exp->expType)
5671 {
5672 exp->expType = op1->type;
5673 if(op1->type)
5674 op1->type->refCount++;
5675 }
5676 return 0x1;
5677 }
5678
5679 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5680 {
5681 char value2 = op2->c;
5682
5683 exp->type = 2;
5684 exp->string = PrintChar(op1->c + value2);
5685 if(!exp->expType)
5686 {
5687 exp->expType = op1->type;
5688 if(op1->type)
5689 op1->type->refCount++;
5690 }
5691 return 0x1;
5692 }
5693
5694 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5695 {
5696 unsigned char value2 = op2->uc;
5697
5698 exp->type = 2;
5699 exp->string = PrintUChar(op1->uc + value2);
5700 if(!exp->expType)
5701 {
5702 exp->expType = op1->type;
5703 if(op1->type)
5704 op1->type->refCount++;
5705 }
5706 return 0x1;
5707 }
5708
5709 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5710 {
5711 float value2 = op2->f;
5712
5713 exp->type = 2;
5714 exp->string = PrintFloat(op1->f + value2);
5715 if(!exp->expType)
5716 {
5717 exp->expType = op1->type;
5718 if(op1->type)
5719 op1->type->refCount++;
5720 }
5721 return 0x1;
5722 }
5723
5724 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5725 {
5726 double value2 = op2->d;
5727
5728 exp->type = 2;
5729 exp->string = PrintDouble(op1->d + value2);
5730 if(!exp->expType)
5731 {
5732 exp->expType = op1->type;
5733 if(op1->type)
5734 op1->type->refCount++;
5735 }
5736 return 0x1;
5737 }
5738
5739 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5740 {
5741 int value2 = op2->i;
5742
5743 exp->type = 2;
5744 exp->string = PrintInt(op1->i - value2);
5745 if(!exp->expType)
5746 {
5747 exp->expType = op1->type;
5748 if(op1->type)
5749 op1->type->refCount++;
5750 }
5751 return 0x1;
5752 }
5753
5754 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5755 {
5756 unsigned int value2 = op2->ui;
5757
5758 exp->type = 2;
5759 exp->string = PrintUInt(op1->ui - value2);
5760 if(!exp->expType)
5761 {
5762 exp->expType = op1->type;
5763 if(op1->type)
5764 op1->type->refCount++;
5765 }
5766 return 0x1;
5767 }
5768
5769 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5770 {
5771 short value2 = op2->s;
5772
5773 exp->type = 2;
5774 exp->string = PrintShort(op1->s - value2);
5775 if(!exp->expType)
5776 {
5777 exp->expType = op1->type;
5778 if(op1->type)
5779 op1->type->refCount++;
5780 }
5781 return 0x1;
5782 }
5783
5784 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5785 {
5786 unsigned short value2 = op2->us;
5787
5788 exp->type = 2;
5789 exp->string = PrintUShort(op1->us - value2);
5790 if(!exp->expType)
5791 {
5792 exp->expType = op1->type;
5793 if(op1->type)
5794 op1->type->refCount++;
5795 }
5796 return 0x1;
5797 }
5798
5799 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5800 {
5801 char value2 = op2->c;
5802
5803 exp->type = 2;
5804 exp->string = PrintChar(op1->c - value2);
5805 if(!exp->expType)
5806 {
5807 exp->expType = op1->type;
5808 if(op1->type)
5809 op1->type->refCount++;
5810 }
5811 return 0x1;
5812 }
5813
5814 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5815 {
5816 unsigned char value2 = op2->uc;
5817
5818 exp->type = 2;
5819 exp->string = PrintUChar(op1->uc - value2);
5820 if(!exp->expType)
5821 {
5822 exp->expType = op1->type;
5823 if(op1->type)
5824 op1->type->refCount++;
5825 }
5826 return 0x1;
5827 }
5828
5829 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5830 {
5831 float value2 = op2->f;
5832
5833 exp->type = 2;
5834 exp->string = PrintFloat(op1->f - value2);
5835 if(!exp->expType)
5836 {
5837 exp->expType = op1->type;
5838 if(op1->type)
5839 op1->type->refCount++;
5840 }
5841 return 0x1;
5842 }
5843
5844 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5845 {
5846 double value2 = op2->d;
5847
5848 exp->type = 2;
5849 exp->string = PrintDouble(op1->d - value2);
5850 if(!exp->expType)
5851 {
5852 exp->expType = op1->type;
5853 if(op1->type)
5854 op1->type->refCount++;
5855 }
5856 return 0x1;
5857 }
5858
5859 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5860 {
5861 int value2 = op2->i;
5862
5863 exp->type = 2;
5864 exp->string = PrintInt(op1->i * value2);
5865 if(!exp->expType)
5866 {
5867 exp->expType = op1->type;
5868 if(op1->type)
5869 op1->type->refCount++;
5870 }
5871 return 0x1;
5872 }
5873
5874 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5875 {
5876 unsigned int value2 = op2->ui;
5877
5878 exp->type = 2;
5879 exp->string = PrintUInt(op1->ui * value2);
5880 if(!exp->expType)
5881 {
5882 exp->expType = op1->type;
5883 if(op1->type)
5884 op1->type->refCount++;
5885 }
5886 return 0x1;
5887 }
5888
5889 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5890 {
5891 short value2 = op2->s;
5892
5893 exp->type = 2;
5894 exp->string = PrintShort(op1->s * value2);
5895 if(!exp->expType)
5896 {
5897 exp->expType = op1->type;
5898 if(op1->type)
5899 op1->type->refCount++;
5900 }
5901 return 0x1;
5902 }
5903
5904 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5905 {
5906 unsigned short value2 = op2->us;
5907
5908 exp->type = 2;
5909 exp->string = PrintUShort(op1->us * value2);
5910 if(!exp->expType)
5911 {
5912 exp->expType = op1->type;
5913 if(op1->type)
5914 op1->type->refCount++;
5915 }
5916 return 0x1;
5917 }
5918
5919 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5920 {
5921 char value2 = op2->c;
5922
5923 exp->type = 2;
5924 exp->string = PrintChar(op1->c * value2);
5925 if(!exp->expType)
5926 {
5927 exp->expType = op1->type;
5928 if(op1->type)
5929 op1->type->refCount++;
5930 }
5931 return 0x1;
5932 }
5933
5934 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5935 {
5936 unsigned char value2 = op2->uc;
5937
5938 exp->type = 2;
5939 exp->string = PrintUChar(op1->uc * value2);
5940 if(!exp->expType)
5941 {
5942 exp->expType = op1->type;
5943 if(op1->type)
5944 op1->type->refCount++;
5945 }
5946 return 0x1;
5947 }
5948
5949 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5950 {
5951 float value2 = op2->f;
5952
5953 exp->type = 2;
5954 exp->string = PrintFloat(op1->f * value2);
5955 if(!exp->expType)
5956 {
5957 exp->expType = op1->type;
5958 if(op1->type)
5959 op1->type->refCount++;
5960 }
5961 return 0x1;
5962 }
5963
5964 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5965 {
5966 double value2 = op2->d;
5967
5968 exp->type = 2;
5969 exp->string = PrintDouble(op1->d * value2);
5970 if(!exp->expType)
5971 {
5972 exp->expType = op1->type;
5973 if(op1->type)
5974 op1->type->refCount++;
5975 }
5976 return 0x1;
5977 }
5978
5979 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5980 {
5981 int value2 = op2->i;
5982
5983 exp->type = 2;
5984 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
5985 if(!exp->expType)
5986 {
5987 exp->expType = op1->type;
5988 if(op1->type)
5989 op1->type->refCount++;
5990 }
5991 return 0x1;
5992 }
5993
5994 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5995 {
5996 unsigned int value2 = op2->ui;
5997
5998 exp->type = 2;
5999 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
6000 if(!exp->expType)
6001 {
6002 exp->expType = op1->type;
6003 if(op1->type)
6004 op1->type->refCount++;
6005 }
6006 return 0x1;
6007 }
6008
6009 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6010 {
6011 short value2 = op2->s;
6012
6013 exp->type = 2;
6014 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
6015 if(!exp->expType)
6016 {
6017 exp->expType = op1->type;
6018 if(op1->type)
6019 op1->type->refCount++;
6020 }
6021 return 0x1;
6022 }
6023
6024 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6025 {
6026 unsigned short value2 = op2->us;
6027
6028 exp->type = 2;
6029 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
6030 if(!exp->expType)
6031 {
6032 exp->expType = op1->type;
6033 if(op1->type)
6034 op1->type->refCount++;
6035 }
6036 return 0x1;
6037 }
6038
6039 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6040 {
6041 char value2 = op2->c;
6042
6043 exp->type = 2;
6044 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
6045 if(!exp->expType)
6046 {
6047 exp->expType = op1->type;
6048 if(op1->type)
6049 op1->type->refCount++;
6050 }
6051 return 0x1;
6052 }
6053
6054 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6055 {
6056 unsigned char value2 = op2->uc;
6057
6058 exp->type = 2;
6059 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
6060 if(!exp->expType)
6061 {
6062 exp->expType = op1->type;
6063 if(op1->type)
6064 op1->type->refCount++;
6065 }
6066 return 0x1;
6067 }
6068
6069 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6070 {
6071 float value2 = op2->f;
6072
6073 exp->type = 2;
6074 exp->string = PrintFloat(value2 ? (op1->f / value2) : 0);
6075 if(!exp->expType)
6076 {
6077 exp->expType = op1->type;
6078 if(op1->type)
6079 op1->type->refCount++;
6080 }
6081 return 0x1;
6082 }
6083
6084 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6085 {
6086 double value2 = op2->d;
6087
6088 exp->type = 2;
6089 exp->string = PrintDouble(value2 ? (op1->d / value2) : 0);
6090 if(!exp->expType)
6091 {
6092 exp->expType = op1->type;
6093 if(op1->type)
6094 op1->type->refCount++;
6095 }
6096 return 0x1;
6097 }
6098
6099 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6100 {
6101 int value2 = op2->i;
6102
6103 exp->type = 2;
6104 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
6105 if(!exp->expType)
6106 {
6107 exp->expType = op1->type;
6108 if(op1->type)
6109 op1->type->refCount++;
6110 }
6111 return 0x1;
6112 }
6113
6114 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6115 {
6116 unsigned int value2 = op2->ui;
6117
6118 exp->type = 2;
6119 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
6120 if(!exp->expType)
6121 {
6122 exp->expType = op1->type;
6123 if(op1->type)
6124 op1->type->refCount++;
6125 }
6126 return 0x1;
6127 }
6128
6129 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6130 {
6131 short value2 = op2->s;
6132
6133 exp->type = 2;
6134 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
6135 if(!exp->expType)
6136 {
6137 exp->expType = op1->type;
6138 if(op1->type)
6139 op1->type->refCount++;
6140 }
6141 return 0x1;
6142 }
6143
6144 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6145 {
6146 unsigned short value2 = op2->us;
6147
6148 exp->type = 2;
6149 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
6150 if(!exp->expType)
6151 {
6152 exp->expType = op1->type;
6153 if(op1->type)
6154 op1->type->refCount++;
6155 }
6156 return 0x1;
6157 }
6158
6159 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6160 {
6161 char value2 = op2->c;
6162
6163 exp->type = 2;
6164 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
6165 if(!exp->expType)
6166 {
6167 exp->expType = op1->type;
6168 if(op1->type)
6169 op1->type->refCount++;
6170 }
6171 return 0x1;
6172 }
6173
6174 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6175 {
6176 unsigned char value2 = op2->uc;
6177
6178 exp->type = 2;
6179 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
6180 if(!exp->expType)
6181 {
6182 exp->expType = op1->type;
6183 if(op1->type)
6184 op1->type->refCount++;
6185 }
6186 return 0x1;
6187 }
6188
6189 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
6190 {
6191 exp->type = 2;
6192 exp->string = PrintInt(-op1->i);
6193 if(!exp->expType)
6194 {
6195 exp->expType = op1->type;
6196 if(op1->type)
6197 op1->type->refCount++;
6198 }
6199 return 0x1;
6200 }
6201
6202 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
6203 {
6204 exp->type = 2;
6205 exp->string = PrintUInt(-op1->ui);
6206 if(!exp->expType)
6207 {
6208 exp->expType = op1->type;
6209 if(op1->type)
6210 op1->type->refCount++;
6211 }
6212 return 0x1;
6213 }
6214
6215 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
6216 {
6217 exp->type = 2;
6218 exp->string = PrintShort(-op1->s);
6219 if(!exp->expType)
6220 {
6221 exp->expType = op1->type;
6222 if(op1->type)
6223 op1->type->refCount++;
6224 }
6225 return 0x1;
6226 }
6227
6228 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
6229 {
6230 exp->type = 2;
6231 exp->string = PrintUShort(-op1->us);
6232 if(!exp->expType)
6233 {
6234 exp->expType = op1->type;
6235 if(op1->type)
6236 op1->type->refCount++;
6237 }
6238 return 0x1;
6239 }
6240
6241 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
6242 {
6243 exp->type = 2;
6244 exp->string = PrintChar(-op1->c);
6245 if(!exp->expType)
6246 {
6247 exp->expType = op1->type;
6248 if(op1->type)
6249 op1->type->refCount++;
6250 }
6251 return 0x1;
6252 }
6253
6254 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
6255 {
6256 exp->type = 2;
6257 exp->string = PrintUChar(-op1->uc);
6258 if(!exp->expType)
6259 {
6260 exp->expType = op1->type;
6261 if(op1->type)
6262 op1->type->refCount++;
6263 }
6264 return 0x1;
6265 }
6266
6267 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
6268 {
6269 exp->type = 2;
6270 exp->string = PrintFloat(-op1->f);
6271 if(!exp->expType)
6272 {
6273 exp->expType = op1->type;
6274 if(op1->type)
6275 op1->type->refCount++;
6276 }
6277 return 0x1;
6278 }
6279
6280 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6281 {
6282 exp->type = 2;
6283 exp->string = PrintDouble(-op1->d);
6284 if(!exp->expType)
6285 {
6286 exp->expType = op1->type;
6287 if(op1->type)
6288 op1->type->refCount++;
6289 }
6290 return 0x1;
6291 }
6292
6293 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6294 {
6295 exp->type = 2;
6296 exp->string = PrintInt(++op1->i);
6297 if(!exp->expType)
6298 {
6299 exp->expType = op1->type;
6300 if(op1->type)
6301 op1->type->refCount++;
6302 }
6303 return 0x1;
6304 }
6305
6306 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6307 {
6308 exp->type = 2;
6309 exp->string = PrintUInt(++op1->ui);
6310 if(!exp->expType)
6311 {
6312 exp->expType = op1->type;
6313 if(op1->type)
6314 op1->type->refCount++;
6315 }
6316 return 0x1;
6317 }
6318
6319 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6320 {
6321 exp->type = 2;
6322 exp->string = PrintShort(++op1->s);
6323 if(!exp->expType)
6324 {
6325 exp->expType = op1->type;
6326 if(op1->type)
6327 op1->type->refCount++;
6328 }
6329 return 0x1;
6330 }
6331
6332 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6333 {
6334 exp->type = 2;
6335 exp->string = PrintUShort(++op1->us);
6336 if(!exp->expType)
6337 {
6338 exp->expType = op1->type;
6339 if(op1->type)
6340 op1->type->refCount++;
6341 }
6342 return 0x1;
6343 }
6344
6345 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6346 {
6347 exp->type = 2;
6348 exp->string = PrintChar(++op1->c);
6349 if(!exp->expType)
6350 {
6351 exp->expType = op1->type;
6352 if(op1->type)
6353 op1->type->refCount++;
6354 }
6355 return 0x1;
6356 }
6357
6358 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6359 {
6360 exp->type = 2;
6361 exp->string = PrintUChar(++op1->uc);
6362 if(!exp->expType)
6363 {
6364 exp->expType = op1->type;
6365 if(op1->type)
6366 op1->type->refCount++;
6367 }
6368 return 0x1;
6369 }
6370
6371 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6372 {
6373 exp->type = 2;
6374 exp->string = PrintFloat(++op1->f);
6375 if(!exp->expType)
6376 {
6377 exp->expType = op1->type;
6378 if(op1->type)
6379 op1->type->refCount++;
6380 }
6381 return 0x1;
6382 }
6383
6384 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6385 {
6386 exp->type = 2;
6387 exp->string = PrintDouble(++op1->d);
6388 if(!exp->expType)
6389 {
6390 exp->expType = op1->type;
6391 if(op1->type)
6392 op1->type->refCount++;
6393 }
6394 return 0x1;
6395 }
6396
6397 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6398 {
6399 exp->type = 2;
6400 exp->string = PrintInt(--op1->i);
6401 if(!exp->expType)
6402 {
6403 exp->expType = op1->type;
6404 if(op1->type)
6405 op1->type->refCount++;
6406 }
6407 return 0x1;
6408 }
6409
6410 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6411 {
6412 exp->type = 2;
6413 exp->string = PrintUInt(--op1->ui);
6414 if(!exp->expType)
6415 {
6416 exp->expType = op1->type;
6417 if(op1->type)
6418 op1->type->refCount++;
6419 }
6420 return 0x1;
6421 }
6422
6423 static unsigned int ShortDec(struct Expression * exp, struct Operand * op1)
6424 {
6425 exp->type = 2;
6426 exp->string = PrintShort(--op1->s);
6427 if(!exp->expType)
6428 {
6429 exp->expType = op1->type;
6430 if(op1->type)
6431 op1->type->refCount++;
6432 }
6433 return 0x1;
6434 }
6435
6436 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6437 {
6438 exp->type = 2;
6439 exp->string = PrintUShort(--op1->us);
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 CharDec(struct Expression * exp, struct Operand * op1)
6450 {
6451 exp->type = 2;
6452 exp->string = PrintChar(--op1->c);
6453 if(!exp->expType)
6454 {
6455 exp->expType = op1->type;
6456 if(op1->type)
6457 op1->type->refCount++;
6458 }
6459 return 0x1;
6460 }
6461
6462 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6463 {
6464 exp->type = 2;
6465 exp->string = PrintUChar(--op1->uc);
6466 if(!exp->expType)
6467 {
6468 exp->expType = op1->type;
6469 if(op1->type)
6470 op1->type->refCount++;
6471 }
6472 return 0x1;
6473 }
6474
6475 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6476 {
6477 exp->type = 2;
6478 exp->string = PrintFloat(--op1->f);
6479 if(!exp->expType)
6480 {
6481 exp->expType = op1->type;
6482 if(op1->type)
6483 op1->type->refCount++;
6484 }
6485 return 0x1;
6486 }
6487
6488 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6489 {
6490 exp->type = 2;
6491 exp->string = PrintDouble(--op1->d);
6492 if(!exp->expType)
6493 {
6494 exp->expType = op1->type;
6495 if(op1->type)
6496 op1->type->refCount++;
6497 }
6498 return 0x1;
6499 }
6500
6501 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6502 {
6503 int value2 = op2->i;
6504
6505 exp->type = 2;
6506 exp->string = PrintInt(op1->i = value2);
6507 if(!exp->expType)
6508 {
6509 exp->expType = op1->type;
6510 if(op1->type)
6511 op1->type->refCount++;
6512 }
6513 return 0x1;
6514 }
6515
6516 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6517 {
6518 unsigned int value2 = op2->ui;
6519
6520 exp->type = 2;
6521 exp->string = PrintUInt(op1->ui = value2);
6522 if(!exp->expType)
6523 {
6524 exp->expType = op1->type;
6525 if(op1->type)
6526 op1->type->refCount++;
6527 }
6528 return 0x1;
6529 }
6530
6531 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6532 {
6533 short value2 = op2->s;
6534
6535 exp->type = 2;
6536 exp->string = PrintShort(op1->s = value2);
6537 if(!exp->expType)
6538 {
6539 exp->expType = op1->type;
6540 if(op1->type)
6541 op1->type->refCount++;
6542 }
6543 return 0x1;
6544 }
6545
6546 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6547 {
6548 unsigned short value2 = op2->us;
6549
6550 exp->type = 2;
6551 exp->string = PrintUShort(op1->us = value2);
6552 if(!exp->expType)
6553 {
6554 exp->expType = op1->type;
6555 if(op1->type)
6556 op1->type->refCount++;
6557 }
6558 return 0x1;
6559 }
6560
6561 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6562 {
6563 char value2 = op2->c;
6564
6565 exp->type = 2;
6566 exp->string = PrintChar(op1->c = value2);
6567 if(!exp->expType)
6568 {
6569 exp->expType = op1->type;
6570 if(op1->type)
6571 op1->type->refCount++;
6572 }
6573 return 0x1;
6574 }
6575
6576 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6577 {
6578 unsigned char value2 = op2->uc;
6579
6580 exp->type = 2;
6581 exp->string = PrintUChar(op1->uc = value2);
6582 if(!exp->expType)
6583 {
6584 exp->expType = op1->type;
6585 if(op1->type)
6586 op1->type->refCount++;
6587 }
6588 return 0x1;
6589 }
6590
6591 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6592 {
6593 float value2 = op2->f;
6594
6595 exp->type = 2;
6596 exp->string = PrintFloat(op1->f = value2);
6597 if(!exp->expType)
6598 {
6599 exp->expType = op1->type;
6600 if(op1->type)
6601 op1->type->refCount++;
6602 }
6603 return 0x1;
6604 }
6605
6606 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6607 {
6608 double value2 = op2->d;
6609
6610 exp->type = 2;
6611 exp->string = PrintDouble(op1->d = value2);
6612 if(!exp->expType)
6613 {
6614 exp->expType = op1->type;
6615 if(op1->type)
6616 op1->type->refCount++;
6617 }
6618 return 0x1;
6619 }
6620
6621 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6622 {
6623 int value2 = op2->i;
6624
6625 exp->type = 2;
6626 exp->string = PrintInt(op1->i += value2);
6627 if(!exp->expType)
6628 {
6629 exp->expType = op1->type;
6630 if(op1->type)
6631 op1->type->refCount++;
6632 }
6633 return 0x1;
6634 }
6635
6636 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6637 {
6638 unsigned int value2 = op2->ui;
6639
6640 exp->type = 2;
6641 exp->string = PrintUInt(op1->ui += value2);
6642 if(!exp->expType)
6643 {
6644 exp->expType = op1->type;
6645 if(op1->type)
6646 op1->type->refCount++;
6647 }
6648 return 0x1;
6649 }
6650
6651 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6652 {
6653 short value2 = op2->s;
6654
6655 exp->type = 2;
6656 exp->string = PrintShort(op1->s += value2);
6657 if(!exp->expType)
6658 {
6659 exp->expType = op1->type;
6660 if(op1->type)
6661 op1->type->refCount++;
6662 }
6663 return 0x1;
6664 }
6665
6666 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6667 {
6668 unsigned short value2 = op2->us;
6669
6670 exp->type = 2;
6671 exp->string = PrintUShort(op1->us += value2);
6672 if(!exp->expType)
6673 {
6674 exp->expType = op1->type;
6675 if(op1->type)
6676 op1->type->refCount++;
6677 }
6678 return 0x1;
6679 }
6680
6681 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6682 {
6683 char value2 = op2->c;
6684
6685 exp->type = 2;
6686 exp->string = PrintChar(op1->c += value2);
6687 if(!exp->expType)
6688 {
6689 exp->expType = op1->type;
6690 if(op1->type)
6691 op1->type->refCount++;
6692 }
6693 return 0x1;
6694 }
6695
6696 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6697 {
6698 unsigned char value2 = op2->uc;
6699
6700 exp->type = 2;
6701 exp->string = PrintUChar(op1->uc += value2);
6702 if(!exp->expType)
6703 {
6704 exp->expType = op1->type;
6705 if(op1->type)
6706 op1->type->refCount++;
6707 }
6708 return 0x1;
6709 }
6710
6711 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6712 {
6713 float value2 = op2->f;
6714
6715 exp->type = 2;
6716 exp->string = PrintFloat(op1->f += value2);
6717 if(!exp->expType)
6718 {
6719 exp->expType = op1->type;
6720 if(op1->type)
6721 op1->type->refCount++;
6722 }
6723 return 0x1;
6724 }
6725
6726 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6727 {
6728 double value2 = op2->d;
6729
6730 exp->type = 2;
6731 exp->string = PrintDouble(op1->d += value2);
6732 if(!exp->expType)
6733 {
6734 exp->expType = op1->type;
6735 if(op1->type)
6736 op1->type->refCount++;
6737 }
6738 return 0x1;
6739 }
6740
6741 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6742 {
6743 int value2 = op2->i;
6744
6745 exp->type = 2;
6746 exp->string = PrintInt(op1->i -= value2);
6747 if(!exp->expType)
6748 {
6749 exp->expType = op1->type;
6750 if(op1->type)
6751 op1->type->refCount++;
6752 }
6753 return 0x1;
6754 }
6755
6756 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6757 {
6758 unsigned int value2 = op2->ui;
6759
6760 exp->type = 2;
6761 exp->string = PrintUInt(op1->ui -= value2);
6762 if(!exp->expType)
6763 {
6764 exp->expType = op1->type;
6765 if(op1->type)
6766 op1->type->refCount++;
6767 }
6768 return 0x1;
6769 }
6770
6771 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6772 {
6773 short value2 = op2->s;
6774
6775 exp->type = 2;
6776 exp->string = PrintShort(op1->s -= value2);
6777 if(!exp->expType)
6778 {
6779 exp->expType = op1->type;
6780 if(op1->type)
6781 op1->type->refCount++;
6782 }
6783 return 0x1;
6784 }
6785
6786 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6787 {
6788 unsigned short value2 = op2->us;
6789
6790 exp->type = 2;
6791 exp->string = PrintUShort(op1->us -= value2);
6792 if(!exp->expType)
6793 {
6794 exp->expType = op1->type;
6795 if(op1->type)
6796 op1->type->refCount++;
6797 }
6798 return 0x1;
6799 }
6800
6801 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6802 {
6803 char value2 = op2->c;
6804
6805 exp->type = 2;
6806 exp->string = PrintChar(op1->c -= value2);
6807 if(!exp->expType)
6808 {
6809 exp->expType = op1->type;
6810 if(op1->type)
6811 op1->type->refCount++;
6812 }
6813 return 0x1;
6814 }
6815
6816 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6817 {
6818 unsigned char value2 = op2->uc;
6819
6820 exp->type = 2;
6821 exp->string = PrintUChar(op1->uc -= value2);
6822 if(!exp->expType)
6823 {
6824 exp->expType = op1->type;
6825 if(op1->type)
6826 op1->type->refCount++;
6827 }
6828 return 0x1;
6829 }
6830
6831 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6832 {
6833 float value2 = op2->f;
6834
6835 exp->type = 2;
6836 exp->string = PrintFloat(op1->f -= value2);
6837 if(!exp->expType)
6838 {
6839 exp->expType = op1->type;
6840 if(op1->type)
6841 op1->type->refCount++;
6842 }
6843 return 0x1;
6844 }
6845
6846 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6847 {
6848 double value2 = op2->d;
6849
6850 exp->type = 2;
6851 exp->string = PrintDouble(op1->d -= value2);
6852 if(!exp->expType)
6853 {
6854 exp->expType = op1->type;
6855 if(op1->type)
6856 op1->type->refCount++;
6857 }
6858 return 0x1;
6859 }
6860
6861 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6862 {
6863 int value2 = op2->i;
6864
6865 exp->type = 2;
6866 exp->string = PrintInt(op1->i *= value2);
6867 if(!exp->expType)
6868 {
6869 exp->expType = op1->type;
6870 if(op1->type)
6871 op1->type->refCount++;
6872 }
6873 return 0x1;
6874 }
6875
6876 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6877 {
6878 unsigned int value2 = op2->ui;
6879
6880 exp->type = 2;
6881 exp->string = PrintUInt(op1->ui *= value2);
6882 if(!exp->expType)
6883 {
6884 exp->expType = op1->type;
6885 if(op1->type)
6886 op1->type->refCount++;
6887 }
6888 return 0x1;
6889 }
6890
6891 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6892 {
6893 short value2 = op2->s;
6894
6895 exp->type = 2;
6896 exp->string = PrintShort(op1->s *= value2);
6897 if(!exp->expType)
6898 {
6899 exp->expType = op1->type;
6900 if(op1->type)
6901 op1->type->refCount++;
6902 }
6903 return 0x1;
6904 }
6905
6906 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6907 {
6908 unsigned short value2 = op2->us;
6909
6910 exp->type = 2;
6911 exp->string = PrintUShort(op1->us *= value2);
6912 if(!exp->expType)
6913 {
6914 exp->expType = op1->type;
6915 if(op1->type)
6916 op1->type->refCount++;
6917 }
6918 return 0x1;
6919 }
6920
6921 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6922 {
6923 char value2 = op2->c;
6924
6925 exp->type = 2;
6926 exp->string = PrintChar(op1->c *= value2);
6927 if(!exp->expType)
6928 {
6929 exp->expType = op1->type;
6930 if(op1->type)
6931 op1->type->refCount++;
6932 }
6933 return 0x1;
6934 }
6935
6936 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6937 {
6938 unsigned char value2 = op2->uc;
6939
6940 exp->type = 2;
6941 exp->string = PrintUChar(op1->uc *= value2);
6942 if(!exp->expType)
6943 {
6944 exp->expType = op1->type;
6945 if(op1->type)
6946 op1->type->refCount++;
6947 }
6948 return 0x1;
6949 }
6950
6951 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6952 {
6953 float value2 = op2->f;
6954
6955 exp->type = 2;
6956 exp->string = PrintFloat(op1->f *= value2);
6957 if(!exp->expType)
6958 {
6959 exp->expType = op1->type;
6960 if(op1->type)
6961 op1->type->refCount++;
6962 }
6963 return 0x1;
6964 }
6965
6966 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6967 {
6968 double value2 = op2->d;
6969
6970 exp->type = 2;
6971 exp->string = PrintDouble(op1->d *= value2);
6972 if(!exp->expType)
6973 {
6974 exp->expType = op1->type;
6975 if(op1->type)
6976 op1->type->refCount++;
6977 }
6978 return 0x1;
6979 }
6980
6981 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6982 {
6983 int value2 = op2->i;
6984
6985 exp->type = 2;
6986 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
6987 if(!exp->expType)
6988 {
6989 exp->expType = op1->type;
6990 if(op1->type)
6991 op1->type->refCount++;
6992 }
6993 return 0x1;
6994 }
6995
6996 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6997 {
6998 unsigned int value2 = op2->ui;
6999
7000 exp->type = 2;
7001 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
7002 if(!exp->expType)
7003 {
7004 exp->expType = op1->type;
7005 if(op1->type)
7006 op1->type->refCount++;
7007 }
7008 return 0x1;
7009 }
7010
7011 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7012 {
7013 short value2 = op2->s;
7014
7015 exp->type = 2;
7016 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
7017 if(!exp->expType)
7018 {
7019 exp->expType = op1->type;
7020 if(op1->type)
7021 op1->type->refCount++;
7022 }
7023 return 0x1;
7024 }
7025
7026 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7027 {
7028 unsigned short value2 = op2->us;
7029
7030 exp->type = 2;
7031 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
7032 if(!exp->expType)
7033 {
7034 exp->expType = op1->type;
7035 if(op1->type)
7036 op1->type->refCount++;
7037 }
7038 return 0x1;
7039 }
7040
7041 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7042 {
7043 char value2 = op2->c;
7044
7045 exp->type = 2;
7046 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
7047 if(!exp->expType)
7048 {
7049 exp->expType = op1->type;
7050 if(op1->type)
7051 op1->type->refCount++;
7052 }
7053 return 0x1;
7054 }
7055
7056 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7057 {
7058 unsigned char value2 = op2->uc;
7059
7060 exp->type = 2;
7061 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
7062 if(!exp->expType)
7063 {
7064 exp->expType = op1->type;
7065 if(op1->type)
7066 op1->type->refCount++;
7067 }
7068 return 0x1;
7069 }
7070
7071 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7072 {
7073 float value2 = op2->f;
7074
7075 exp->type = 2;
7076 exp->string = PrintFloat(value2 ? (op1->f /= value2) : 0);
7077 if(!exp->expType)
7078 {
7079 exp->expType = op1->type;
7080 if(op1->type)
7081 op1->type->refCount++;
7082 }
7083 return 0x1;
7084 }
7085
7086 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7087 {
7088 double value2 = op2->d;
7089
7090 exp->type = 2;
7091 exp->string = PrintDouble(value2 ? (op1->d /= value2) : 0);
7092 if(!exp->expType)
7093 {
7094 exp->expType = op1->type;
7095 if(op1->type)
7096 op1->type->refCount++;
7097 }
7098 return 0x1;
7099 }
7100
7101 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7102 {
7103 int value2 = op2->i;
7104
7105 exp->type = 2;
7106 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
7107 if(!exp->expType)
7108 {
7109 exp->expType = op1->type;
7110 if(op1->type)
7111 op1->type->refCount++;
7112 }
7113 return 0x1;
7114 }
7115
7116 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7117 {
7118 unsigned int value2 = op2->ui;
7119
7120 exp->type = 2;
7121 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
7122 if(!exp->expType)
7123 {
7124 exp->expType = op1->type;
7125 if(op1->type)
7126 op1->type->refCount++;
7127 }
7128 return 0x1;
7129 }
7130
7131 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7132 {
7133 short value2 = op2->s;
7134
7135 exp->type = 2;
7136 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
7137 if(!exp->expType)
7138 {
7139 exp->expType = op1->type;
7140 if(op1->type)
7141 op1->type->refCount++;
7142 }
7143 return 0x1;
7144 }
7145
7146 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7147 {
7148 unsigned short value2 = op2->us;
7149
7150 exp->type = 2;
7151 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
7152 if(!exp->expType)
7153 {
7154 exp->expType = op1->type;
7155 if(op1->type)
7156 op1->type->refCount++;
7157 }
7158 return 0x1;
7159 }
7160
7161 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7162 {
7163 char value2 = op2->c;
7164
7165 exp->type = 2;
7166 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
7167 if(!exp->expType)
7168 {
7169 exp->expType = op1->type;
7170 if(op1->type)
7171 op1->type->refCount++;
7172 }
7173 return 0x1;
7174 }
7175
7176 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7177 {
7178 unsigned char value2 = op2->uc;
7179
7180 exp->type = 2;
7181 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
7182 if(!exp->expType)
7183 {
7184 exp->expType = op1->type;
7185 if(op1->type)
7186 op1->type->refCount++;
7187 }
7188 return 0x1;
7189 }
7190
7191 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7192 {
7193 int value2 = op2->i;
7194
7195 exp->type = 2;
7196 exp->string = PrintInt(op1->i & value2);
7197 if(!exp->expType)
7198 {
7199 exp->expType = op1->type;
7200 if(op1->type)
7201 op1->type->refCount++;
7202 }
7203 return 0x1;
7204 }
7205
7206 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7207 {
7208 unsigned int value2 = op2->ui;
7209
7210 exp->type = 2;
7211 exp->string = PrintUInt(op1->ui & value2);
7212 if(!exp->expType)
7213 {
7214 exp->expType = op1->type;
7215 if(op1->type)
7216 op1->type->refCount++;
7217 }
7218 return 0x1;
7219 }
7220
7221 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7222 {
7223 short value2 = op2->s;
7224
7225 exp->type = 2;
7226 exp->string = PrintShort(op1->s & value2);
7227 if(!exp->expType)
7228 {
7229 exp->expType = op1->type;
7230 if(op1->type)
7231 op1->type->refCount++;
7232 }
7233 return 0x1;
7234 }
7235
7236 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7237 {
7238 unsigned short value2 = op2->us;
7239
7240 exp->type = 2;
7241 exp->string = PrintUShort(op1->us & value2);
7242 if(!exp->expType)
7243 {
7244 exp->expType = op1->type;
7245 if(op1->type)
7246 op1->type->refCount++;
7247 }
7248 return 0x1;
7249 }
7250
7251 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7252 {
7253 char value2 = op2->c;
7254
7255 exp->type = 2;
7256 exp->string = PrintChar(op1->c & value2);
7257 if(!exp->expType)
7258 {
7259 exp->expType = op1->type;
7260 if(op1->type)
7261 op1->type->refCount++;
7262 }
7263 return 0x1;
7264 }
7265
7266 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7267 {
7268 unsigned char value2 = op2->uc;
7269
7270 exp->type = 2;
7271 exp->string = PrintUChar(op1->uc & value2);
7272 if(!exp->expType)
7273 {
7274 exp->expType = op1->type;
7275 if(op1->type)
7276 op1->type->refCount++;
7277 }
7278 return 0x1;
7279 }
7280
7281 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7282 {
7283 int value2 = op2->i;
7284
7285 exp->type = 2;
7286 exp->string = PrintInt(op1->i | value2);
7287 if(!exp->expType)
7288 {
7289 exp->expType = op1->type;
7290 if(op1->type)
7291 op1->type->refCount++;
7292 }
7293 return 0x1;
7294 }
7295
7296 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7297 {
7298 unsigned int value2 = op2->ui;
7299
7300 exp->type = 2;
7301 exp->string = PrintUInt(op1->ui | value2);
7302 if(!exp->expType)
7303 {
7304 exp->expType = op1->type;
7305 if(op1->type)
7306 op1->type->refCount++;
7307 }
7308 return 0x1;
7309 }
7310
7311 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7312 {
7313 short value2 = op2->s;
7314
7315 exp->type = 2;
7316 exp->string = PrintShort(op1->s | value2);
7317 if(!exp->expType)
7318 {
7319 exp->expType = op1->type;
7320 if(op1->type)
7321 op1->type->refCount++;
7322 }
7323 return 0x1;
7324 }
7325
7326 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7327 {
7328 unsigned short value2 = op2->us;
7329
7330 exp->type = 2;
7331 exp->string = PrintUShort(op1->us | value2);
7332 if(!exp->expType)
7333 {
7334 exp->expType = op1->type;
7335 if(op1->type)
7336 op1->type->refCount++;
7337 }
7338 return 0x1;
7339 }
7340
7341 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7342 {
7343 char value2 = op2->c;
7344
7345 exp->type = 2;
7346 exp->string = PrintChar(op1->c | value2);
7347 if(!exp->expType)
7348 {
7349 exp->expType = op1->type;
7350 if(op1->type)
7351 op1->type->refCount++;
7352 }
7353 return 0x1;
7354 }
7355
7356 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7357 {
7358 unsigned char value2 = op2->uc;
7359
7360 exp->type = 2;
7361 exp->string = PrintUChar(op1->uc | value2);
7362 if(!exp->expType)
7363 {
7364 exp->expType = op1->type;
7365 if(op1->type)
7366 op1->type->refCount++;
7367 }
7368 return 0x1;
7369 }
7370
7371 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7372 {
7373 int value2 = op2->i;
7374
7375 exp->type = 2;
7376 exp->string = PrintInt(op1->i ^ value2);
7377 if(!exp->expType)
7378 {
7379 exp->expType = op1->type;
7380 if(op1->type)
7381 op1->type->refCount++;
7382 }
7383 return 0x1;
7384 }
7385
7386 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7387 {
7388 unsigned int value2 = op2->ui;
7389
7390 exp->type = 2;
7391 exp->string = PrintUInt(op1->ui ^ value2);
7392 if(!exp->expType)
7393 {
7394 exp->expType = op1->type;
7395 if(op1->type)
7396 op1->type->refCount++;
7397 }
7398 return 0x1;
7399 }
7400
7401 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7402 {
7403 short value2 = op2->s;
7404
7405 exp->type = 2;
7406 exp->string = PrintShort(op1->s ^ value2);
7407 if(!exp->expType)
7408 {
7409 exp->expType = op1->type;
7410 if(op1->type)
7411 op1->type->refCount++;
7412 }
7413 return 0x1;
7414 }
7415
7416 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7417 {
7418 unsigned short value2 = op2->us;
7419
7420 exp->type = 2;
7421 exp->string = PrintUShort(op1->us ^ value2);
7422 if(!exp->expType)
7423 {
7424 exp->expType = op1->type;
7425 if(op1->type)
7426 op1->type->refCount++;
7427 }
7428 return 0x1;
7429 }
7430
7431 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7432 {
7433 char value2 = op2->c;
7434
7435 exp->type = 2;
7436 exp->string = PrintChar(op1->c ^ value2);
7437 if(!exp->expType)
7438 {
7439 exp->expType = op1->type;
7440 if(op1->type)
7441 op1->type->refCount++;
7442 }
7443 return 0x1;
7444 }
7445
7446 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7447 {
7448 unsigned char value2 = op2->uc;
7449
7450 exp->type = 2;
7451 exp->string = PrintUChar(op1->uc ^ value2);
7452 if(!exp->expType)
7453 {
7454 exp->expType = op1->type;
7455 if(op1->type)
7456 op1->type->refCount++;
7457 }
7458 return 0x1;
7459 }
7460
7461 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7462 {
7463 int value2 = op2->i;
7464
7465 exp->type = 2;
7466 exp->string = PrintInt(op1->i << value2);
7467 if(!exp->expType)
7468 {
7469 exp->expType = op1->type;
7470 if(op1->type)
7471 op1->type->refCount++;
7472 }
7473 return 0x1;
7474 }
7475
7476 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7477 {
7478 unsigned int value2 = op2->ui;
7479
7480 exp->type = 2;
7481 exp->string = PrintUInt(op1->ui << value2);
7482 if(!exp->expType)
7483 {
7484 exp->expType = op1->type;
7485 if(op1->type)
7486 op1->type->refCount++;
7487 }
7488 return 0x1;
7489 }
7490
7491 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7492 {
7493 short value2 = op2->s;
7494
7495 exp->type = 2;
7496 exp->string = PrintShort(op1->s << value2);
7497 if(!exp->expType)
7498 {
7499 exp->expType = op1->type;
7500 if(op1->type)
7501 op1->type->refCount++;
7502 }
7503 return 0x1;
7504 }
7505
7506 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7507 {
7508 unsigned short value2 = op2->us;
7509
7510 exp->type = 2;
7511 exp->string = PrintUShort(op1->us << value2);
7512 if(!exp->expType)
7513 {
7514 exp->expType = op1->type;
7515 if(op1->type)
7516 op1->type->refCount++;
7517 }
7518 return 0x1;
7519 }
7520
7521 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7522 {
7523 char value2 = op2->c;
7524
7525 exp->type = 2;
7526 exp->string = PrintChar(op1->c << value2);
7527 if(!exp->expType)
7528 {
7529 exp->expType = op1->type;
7530 if(op1->type)
7531 op1->type->refCount++;
7532 }
7533 return 0x1;
7534 }
7535
7536 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7537 {
7538 unsigned char value2 = op2->uc;
7539
7540 exp->type = 2;
7541 exp->string = PrintUChar(op1->uc << value2);
7542 if(!exp->expType)
7543 {
7544 exp->expType = op1->type;
7545 if(op1->type)
7546 op1->type->refCount++;
7547 }
7548 return 0x1;
7549 }
7550
7551 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7552 {
7553 int value2 = op2->i;
7554
7555 exp->type = 2;
7556 exp->string = PrintInt(op1->i >> value2);
7557 if(!exp->expType)
7558 {
7559 exp->expType = op1->type;
7560 if(op1->type)
7561 op1->type->refCount++;
7562 }
7563 return 0x1;
7564 }
7565
7566 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7567 {
7568 unsigned int value2 = op2->ui;
7569
7570 exp->type = 2;
7571 exp->string = PrintUInt(op1->ui >> value2);
7572 if(!exp->expType)
7573 {
7574 exp->expType = op1->type;
7575 if(op1->type)
7576 op1->type->refCount++;
7577 }
7578 return 0x1;
7579 }
7580
7581 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7582 {
7583 short value2 = op2->s;
7584
7585 exp->type = 2;
7586 exp->string = PrintShort(op1->s >> value2);
7587 if(!exp->expType)
7588 {
7589 exp->expType = op1->type;
7590 if(op1->type)
7591 op1->type->refCount++;
7592 }
7593 return 0x1;
7594 }
7595
7596 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7597 {
7598 unsigned short value2 = op2->us;
7599
7600 exp->type = 2;
7601 exp->string = PrintUShort(op1->us >> value2);
7602 if(!exp->expType)
7603 {
7604 exp->expType = op1->type;
7605 if(op1->type)
7606 op1->type->refCount++;
7607 }
7608 return 0x1;
7609 }
7610
7611 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7612 {
7613 char value2 = op2->c;
7614
7615 exp->type = 2;
7616 exp->string = PrintChar(op1->c >> value2);
7617 if(!exp->expType)
7618 {
7619 exp->expType = op1->type;
7620 if(op1->type)
7621 op1->type->refCount++;
7622 }
7623 return 0x1;
7624 }
7625
7626 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7627 {
7628 unsigned char value2 = op2->uc;
7629
7630 exp->type = 2;
7631 exp->string = PrintUChar(op1->uc >> value2);
7632 if(!exp->expType)
7633 {
7634 exp->expType = op1->type;
7635 if(op1->type)
7636 op1->type->refCount++;
7637 }
7638 return 0x1;
7639 }
7640
7641 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
7642 {
7643 exp->type = 2;
7644 exp->string = PrintInt(~op1->i);
7645 if(!exp->expType)
7646 {
7647 exp->expType = op1->type;
7648 if(op1->type)
7649 op1->type->refCount++;
7650 }
7651 return 0x1;
7652 }
7653
7654 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
7655 {
7656 exp->type = 2;
7657 exp->string = PrintUInt(~op1->ui);
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 ShortBitNot(struct Expression * exp, struct Operand * op1)
7668 {
7669 exp->type = 2;
7670 exp->string = PrintShort(~op1->s);
7671 if(!exp->expType)
7672 {
7673 exp->expType = op1->type;
7674 if(op1->type)
7675 op1->type->refCount++;
7676 }
7677 return 0x1;
7678 }
7679
7680 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
7681 {
7682 exp->type = 2;
7683 exp->string = PrintUShort(~op1->us);
7684 if(!exp->expType)
7685 {
7686 exp->expType = op1->type;
7687 if(op1->type)
7688 op1->type->refCount++;
7689 }
7690 return 0x1;
7691 }
7692
7693 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
7694 {
7695 exp->type = 2;
7696 exp->string = PrintChar(~op1->c);
7697 if(!exp->expType)
7698 {
7699 exp->expType = op1->type;
7700 if(op1->type)
7701 op1->type->refCount++;
7702 }
7703 return 0x1;
7704 }
7705
7706 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
7707 {
7708 exp->type = 2;
7709 exp->string = PrintUChar(~op1->uc);
7710 if(!exp->expType)
7711 {
7712 exp->expType = op1->type;
7713 if(op1->type)
7714 op1->type->refCount++;
7715 }
7716 return 0x1;
7717 }
7718
7719 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7720 {
7721 int value2 = op2->i;
7722
7723 exp->type = 2;
7724 exp->string = PrintInt(op1->i &= value2);
7725 if(!exp->expType)
7726 {
7727 exp->expType = op1->type;
7728 if(op1->type)
7729 op1->type->refCount++;
7730 }
7731 return 0x1;
7732 }
7733
7734 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7735 {
7736 unsigned int value2 = op2->ui;
7737
7738 exp->type = 2;
7739 exp->string = PrintUInt(op1->ui &= value2);
7740 if(!exp->expType)
7741 {
7742 exp->expType = op1->type;
7743 if(op1->type)
7744 op1->type->refCount++;
7745 }
7746 return 0x1;
7747 }
7748
7749 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7750 {
7751 short value2 = op2->s;
7752
7753 exp->type = 2;
7754 exp->string = PrintShort(op1->s &= value2);
7755 if(!exp->expType)
7756 {
7757 exp->expType = op1->type;
7758 if(op1->type)
7759 op1->type->refCount++;
7760 }
7761 return 0x1;
7762 }
7763
7764 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7765 {
7766 unsigned short value2 = op2->us;
7767
7768 exp->type = 2;
7769 exp->string = PrintUShort(op1->us &= value2);
7770 if(!exp->expType)
7771 {
7772 exp->expType = op1->type;
7773 if(op1->type)
7774 op1->type->refCount++;
7775 }
7776 return 0x1;
7777 }
7778
7779 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7780 {
7781 char value2 = op2->c;
7782
7783 exp->type = 2;
7784 exp->string = PrintChar(op1->c &= value2);
7785 if(!exp->expType)
7786 {
7787 exp->expType = op1->type;
7788 if(op1->type)
7789 op1->type->refCount++;
7790 }
7791 return 0x1;
7792 }
7793
7794 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7795 {
7796 unsigned char value2 = op2->uc;
7797
7798 exp->type = 2;
7799 exp->string = PrintUChar(op1->uc &= value2);
7800 if(!exp->expType)
7801 {
7802 exp->expType = op1->type;
7803 if(op1->type)
7804 op1->type->refCount++;
7805 }
7806 return 0x1;
7807 }
7808
7809 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7810 {
7811 int value2 = op2->i;
7812
7813 exp->type = 2;
7814 exp->string = PrintInt(op1->i |= value2);
7815 if(!exp->expType)
7816 {
7817 exp->expType = op1->type;
7818 if(op1->type)
7819 op1->type->refCount++;
7820 }
7821 return 0x1;
7822 }
7823
7824 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7825 {
7826 unsigned int value2 = op2->ui;
7827
7828 exp->type = 2;
7829 exp->string = PrintUInt(op1->ui |= value2);
7830 if(!exp->expType)
7831 {
7832 exp->expType = op1->type;
7833 if(op1->type)
7834 op1->type->refCount++;
7835 }
7836 return 0x1;
7837 }
7838
7839 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7840 {
7841 short value2 = op2->s;
7842
7843 exp->type = 2;
7844 exp->string = PrintShort(op1->s |= value2);
7845 if(!exp->expType)
7846 {
7847 exp->expType = op1->type;
7848 if(op1->type)
7849 op1->type->refCount++;
7850 }
7851 return 0x1;
7852 }
7853
7854 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7855 {
7856 unsigned short value2 = op2->us;
7857
7858 exp->type = 2;
7859 exp->string = PrintUShort(op1->us |= value2);
7860 if(!exp->expType)
7861 {
7862 exp->expType = op1->type;
7863 if(op1->type)
7864 op1->type->refCount++;
7865 }
7866 return 0x1;
7867 }
7868
7869 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7870 {
7871 char value2 = op2->c;
7872
7873 exp->type = 2;
7874 exp->string = PrintChar(op1->c |= value2);
7875 if(!exp->expType)
7876 {
7877 exp->expType = op1->type;
7878 if(op1->type)
7879 op1->type->refCount++;
7880 }
7881 return 0x1;
7882 }
7883
7884 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7885 {
7886 unsigned char value2 = op2->uc;
7887
7888 exp->type = 2;
7889 exp->string = PrintUChar(op1->uc |= value2);
7890 if(!exp->expType)
7891 {
7892 exp->expType = op1->type;
7893 if(op1->type)
7894 op1->type->refCount++;
7895 }
7896 return 0x1;
7897 }
7898
7899 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7900 {
7901 int value2 = op2->i;
7902
7903 exp->type = 2;
7904 exp->string = PrintInt(op1->i ^= value2);
7905 if(!exp->expType)
7906 {
7907 exp->expType = op1->type;
7908 if(op1->type)
7909 op1->type->refCount++;
7910 }
7911 return 0x1;
7912 }
7913
7914 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7915 {
7916 unsigned int value2 = op2->ui;
7917
7918 exp->type = 2;
7919 exp->string = PrintUInt(op1->ui ^= value2);
7920 if(!exp->expType)
7921 {
7922 exp->expType = op1->type;
7923 if(op1->type)
7924 op1->type->refCount++;
7925 }
7926 return 0x1;
7927 }
7928
7929 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7930 {
7931 short value2 = op2->s;
7932
7933 exp->type = 2;
7934 exp->string = PrintShort(op1->s ^= value2);
7935 if(!exp->expType)
7936 {
7937 exp->expType = op1->type;
7938 if(op1->type)
7939 op1->type->refCount++;
7940 }
7941 return 0x1;
7942 }
7943
7944 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7945 {
7946 unsigned short value2 = op2->us;
7947
7948 exp->type = 2;
7949 exp->string = PrintUShort(op1->us ^= value2);
7950 if(!exp->expType)
7951 {
7952 exp->expType = op1->type;
7953 if(op1->type)
7954 op1->type->refCount++;
7955 }
7956 return 0x1;
7957 }
7958
7959 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7960 {
7961 char value2 = op2->c;
7962
7963 exp->type = 2;
7964 exp->string = PrintChar(op1->c ^= value2);
7965 if(!exp->expType)
7966 {
7967 exp->expType = op1->type;
7968 if(op1->type)
7969 op1->type->refCount++;
7970 }
7971 return 0x1;
7972 }
7973
7974 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7975 {
7976 unsigned char value2 = op2->uc;
7977
7978 exp->type = 2;
7979 exp->string = PrintUChar(op1->uc ^= value2);
7980 if(!exp->expType)
7981 {
7982 exp->expType = op1->type;
7983 if(op1->type)
7984 op1->type->refCount++;
7985 }
7986 return 0x1;
7987 }
7988
7989 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7990 {
7991 int value2 = op2->i;
7992
7993 exp->type = 2;
7994 exp->string = PrintInt(op1->i <<= value2);
7995 if(!exp->expType)
7996 {
7997 exp->expType = op1->type;
7998 if(op1->type)
7999 op1->type->refCount++;
8000 }
8001 return 0x1;
8002 }
8003
8004 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8005 {
8006 unsigned int value2 = op2->ui;
8007
8008 exp->type = 2;
8009 exp->string = PrintUInt(op1->ui <<= value2);
8010 if(!exp->expType)
8011 {
8012 exp->expType = op1->type;
8013 if(op1->type)
8014 op1->type->refCount++;
8015 }
8016 return 0x1;
8017 }
8018
8019 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8020 {
8021 short value2 = op2->s;
8022
8023 exp->type = 2;
8024 exp->string = PrintShort(op1->s <<= value2);
8025 if(!exp->expType)
8026 {
8027 exp->expType = op1->type;
8028 if(op1->type)
8029 op1->type->refCount++;
8030 }
8031 return 0x1;
8032 }
8033
8034 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8035 {
8036 unsigned short value2 = op2->us;
8037
8038 exp->type = 2;
8039 exp->string = PrintUShort(op1->us <<= value2);
8040 if(!exp->expType)
8041 {
8042 exp->expType = op1->type;
8043 if(op1->type)
8044 op1->type->refCount++;
8045 }
8046 return 0x1;
8047 }
8048
8049 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8050 {
8051 char value2 = op2->c;
8052
8053 exp->type = 2;
8054 exp->string = PrintChar(op1->c <<= value2);
8055 if(!exp->expType)
8056 {
8057 exp->expType = op1->type;
8058 if(op1->type)
8059 op1->type->refCount++;
8060 }
8061 return 0x1;
8062 }
8063
8064 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8065 {
8066 unsigned char value2 = op2->uc;
8067
8068 exp->type = 2;
8069 exp->string = PrintUChar(op1->uc <<= value2);
8070 if(!exp->expType)
8071 {
8072 exp->expType = op1->type;
8073 if(op1->type)
8074 op1->type->refCount++;
8075 }
8076 return 0x1;
8077 }
8078
8079 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8080 {
8081 int value2 = op2->i;
8082
8083 exp->type = 2;
8084 exp->string = PrintInt(op1->i >>= value2);
8085 if(!exp->expType)
8086 {
8087 exp->expType = op1->type;
8088 if(op1->type)
8089 op1->type->refCount++;
8090 }
8091 return 0x1;
8092 }
8093
8094 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8095 {
8096 unsigned int value2 = op2->ui;
8097
8098 exp->type = 2;
8099 exp->string = PrintUInt(op1->ui >>= value2);
8100 if(!exp->expType)
8101 {
8102 exp->expType = op1->type;
8103 if(op1->type)
8104 op1->type->refCount++;
8105 }
8106 return 0x1;
8107 }
8108
8109 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8110 {
8111 short value2 = op2->s;
8112
8113 exp->type = 2;
8114 exp->string = PrintShort(op1->s >>= value2);
8115 if(!exp->expType)
8116 {
8117 exp->expType = op1->type;
8118 if(op1->type)
8119 op1->type->refCount++;
8120 }
8121 return 0x1;
8122 }
8123
8124 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8125 {
8126 unsigned short value2 = op2->us;
8127
8128 exp->type = 2;
8129 exp->string = PrintUShort(op1->us >>= value2);
8130 if(!exp->expType)
8131 {
8132 exp->expType = op1->type;
8133 if(op1->type)
8134 op1->type->refCount++;
8135 }
8136 return 0x1;
8137 }
8138
8139 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8140 {
8141 char value2 = op2->c;
8142
8143 exp->type = 2;
8144 exp->string = PrintChar(op1->c >>= value2);
8145 if(!exp->expType)
8146 {
8147 exp->expType = op1->type;
8148 if(op1->type)
8149 op1->type->refCount++;
8150 }
8151 return 0x1;
8152 }
8153
8154 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8155 {
8156 unsigned char value2 = op2->uc;
8157
8158 exp->type = 2;
8159 exp->string = PrintUChar(op1->uc >>= value2);
8160 if(!exp->expType)
8161 {
8162 exp->expType = op1->type;
8163 if(op1->type)
8164 op1->type->refCount++;
8165 }
8166 return 0x1;
8167 }
8168
8169 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
8170 {
8171 exp->type = 2;
8172 exp->string = PrintInt(!op1->i);
8173 if(!exp->expType)
8174 {
8175 exp->expType = op1->type;
8176 if(op1->type)
8177 op1->type->refCount++;
8178 }
8179 return 0x1;
8180 }
8181
8182 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
8183 {
8184 exp->type = 2;
8185 exp->string = PrintUInt(!op1->ui);
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 ShortNot(struct Expression * exp, struct Operand * op1)
8196 {
8197 exp->type = 2;
8198 exp->string = PrintShort(!op1->s);
8199 if(!exp->expType)
8200 {
8201 exp->expType = op1->type;
8202 if(op1->type)
8203 op1->type->refCount++;
8204 }
8205 return 0x1;
8206 }
8207
8208 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
8209 {
8210 exp->type = 2;
8211 exp->string = PrintUShort(!op1->us);
8212 if(!exp->expType)
8213 {
8214 exp->expType = op1->type;
8215 if(op1->type)
8216 op1->type->refCount++;
8217 }
8218 return 0x1;
8219 }
8220
8221 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
8222 {
8223 exp->type = 2;
8224 exp->string = PrintChar(!op1->c);
8225 if(!exp->expType)
8226 {
8227 exp->expType = op1->type;
8228 if(op1->type)
8229 op1->type->refCount++;
8230 }
8231 return 0x1;
8232 }
8233
8234 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
8235 {
8236 exp->type = 2;
8237 exp->string = PrintUChar(!op1->uc);
8238 if(!exp->expType)
8239 {
8240 exp->expType = op1->type;
8241 if(op1->type)
8242 op1->type->refCount++;
8243 }
8244 return 0x1;
8245 }
8246
8247 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8248 {
8249 int value2 = op2->i;
8250
8251 exp->type = 2;
8252 exp->string = PrintInt(op1->i == value2);
8253 if(!exp->expType)
8254 {
8255 exp->expType = op1->type;
8256 if(op1->type)
8257 op1->type->refCount++;
8258 }
8259 return 0x1;
8260 }
8261
8262 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8263 {
8264 unsigned int value2 = op2->ui;
8265
8266 exp->type = 2;
8267 exp->string = PrintUInt(op1->ui == value2);
8268 if(!exp->expType)
8269 {
8270 exp->expType = op1->type;
8271 if(op1->type)
8272 op1->type->refCount++;
8273 }
8274 return 0x1;
8275 }
8276
8277 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8278 {
8279 short value2 = op2->s;
8280
8281 exp->type = 2;
8282 exp->string = PrintShort(op1->s == value2);
8283 if(!exp->expType)
8284 {
8285 exp->expType = op1->type;
8286 if(op1->type)
8287 op1->type->refCount++;
8288 }
8289 return 0x1;
8290 }
8291
8292 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8293 {
8294 unsigned short value2 = op2->us;
8295
8296 exp->type = 2;
8297 exp->string = PrintUShort(op1->us == value2);
8298 if(!exp->expType)
8299 {
8300 exp->expType = op1->type;
8301 if(op1->type)
8302 op1->type->refCount++;
8303 }
8304 return 0x1;
8305 }
8306
8307 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8308 {
8309 char value2 = op2->c;
8310
8311 exp->type = 2;
8312 exp->string = PrintChar(op1->c == value2);
8313 if(!exp->expType)
8314 {
8315 exp->expType = op1->type;
8316 if(op1->type)
8317 op1->type->refCount++;
8318 }
8319 return 0x1;
8320 }
8321
8322 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8323 {
8324 unsigned char value2 = op2->uc;
8325
8326 exp->type = 2;
8327 exp->string = PrintUChar(op1->uc == value2);
8328 if(!exp->expType)
8329 {
8330 exp->expType = op1->type;
8331 if(op1->type)
8332 op1->type->refCount++;
8333 }
8334 return 0x1;
8335 }
8336
8337 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8338 {
8339 float value2 = op2->f;
8340
8341 exp->type = 2;
8342 exp->string = PrintFloat(op1->f == value2);
8343 if(!exp->expType)
8344 {
8345 exp->expType = op1->type;
8346 if(op1->type)
8347 op1->type->refCount++;
8348 }
8349 return 0x1;
8350 }
8351
8352 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8353 {
8354 double value2 = op2->d;
8355
8356 exp->type = 2;
8357 exp->string = PrintDouble(op1->d == value2);
8358 if(!exp->expType)
8359 {
8360 exp->expType = op1->type;
8361 if(op1->type)
8362 op1->type->refCount++;
8363 }
8364 return 0x1;
8365 }
8366
8367 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8368 {
8369 int value2 = op2->i;
8370
8371 exp->type = 2;
8372 exp->string = PrintInt(op1->i != value2);
8373 if(!exp->expType)
8374 {
8375 exp->expType = op1->type;
8376 if(op1->type)
8377 op1->type->refCount++;
8378 }
8379 return 0x1;
8380 }
8381
8382 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8383 {
8384 unsigned int value2 = op2->ui;
8385
8386 exp->type = 2;
8387 exp->string = PrintUInt(op1->ui != value2);
8388 if(!exp->expType)
8389 {
8390 exp->expType = op1->type;
8391 if(op1->type)
8392 op1->type->refCount++;
8393 }
8394 return 0x1;
8395 }
8396
8397 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8398 {
8399 short value2 = op2->s;
8400
8401 exp->type = 2;
8402 exp->string = PrintShort(op1->s != value2);
8403 if(!exp->expType)
8404 {
8405 exp->expType = op1->type;
8406 if(op1->type)
8407 op1->type->refCount++;
8408 }
8409 return 0x1;
8410 }
8411
8412 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8413 {
8414 unsigned short value2 = op2->us;
8415
8416 exp->type = 2;
8417 exp->string = PrintUShort(op1->us != value2);
8418 if(!exp->expType)
8419 {
8420 exp->expType = op1->type;
8421 if(op1->type)
8422 op1->type->refCount++;
8423 }
8424 return 0x1;
8425 }
8426
8427 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8428 {
8429 char value2 = op2->c;
8430
8431 exp->type = 2;
8432 exp->string = PrintChar(op1->c != value2);
8433 if(!exp->expType)
8434 {
8435 exp->expType = op1->type;
8436 if(op1->type)
8437 op1->type->refCount++;
8438 }
8439 return 0x1;
8440 }
8441
8442 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8443 {
8444 unsigned char value2 = op2->uc;
8445
8446 exp->type = 2;
8447 exp->string = PrintUChar(op1->uc != value2);
8448 if(!exp->expType)
8449 {
8450 exp->expType = op1->type;
8451 if(op1->type)
8452 op1->type->refCount++;
8453 }
8454 return 0x1;
8455 }
8456
8457 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8458 {
8459 float value2 = op2->f;
8460
8461 exp->type = 2;
8462 exp->string = PrintFloat(op1->f != value2);
8463 if(!exp->expType)
8464 {
8465 exp->expType = op1->type;
8466 if(op1->type)
8467 op1->type->refCount++;
8468 }
8469 return 0x1;
8470 }
8471
8472 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8473 {
8474 double value2 = op2->d;
8475
8476 exp->type = 2;
8477 exp->string = PrintDouble(op1->d != value2);
8478 if(!exp->expType)
8479 {
8480 exp->expType = op1->type;
8481 if(op1->type)
8482 op1->type->refCount++;
8483 }
8484 return 0x1;
8485 }
8486
8487 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8488 {
8489 int value2 = op2->i;
8490
8491 exp->type = 2;
8492 exp->string = PrintInt(op1->i && value2);
8493 if(!exp->expType)
8494 {
8495 exp->expType = op1->type;
8496 if(op1->type)
8497 op1->type->refCount++;
8498 }
8499 return 0x1;
8500 }
8501
8502 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8503 {
8504 unsigned int value2 = op2->ui;
8505
8506 exp->type = 2;
8507 exp->string = PrintUInt(op1->ui && value2);
8508 if(!exp->expType)
8509 {
8510 exp->expType = op1->type;
8511 if(op1->type)
8512 op1->type->refCount++;
8513 }
8514 return 0x1;
8515 }
8516
8517 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8518 {
8519 short value2 = op2->s;
8520
8521 exp->type = 2;
8522 exp->string = PrintShort(op1->s && value2);
8523 if(!exp->expType)
8524 {
8525 exp->expType = op1->type;
8526 if(op1->type)
8527 op1->type->refCount++;
8528 }
8529 return 0x1;
8530 }
8531
8532 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8533 {
8534 unsigned short value2 = op2->us;
8535
8536 exp->type = 2;
8537 exp->string = PrintUShort(op1->us && value2);
8538 if(!exp->expType)
8539 {
8540 exp->expType = op1->type;
8541 if(op1->type)
8542 op1->type->refCount++;
8543 }
8544 return 0x1;
8545 }
8546
8547 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8548 {
8549 char value2 = op2->c;
8550
8551 exp->type = 2;
8552 exp->string = PrintChar(op1->c && value2);
8553 if(!exp->expType)
8554 {
8555 exp->expType = op1->type;
8556 if(op1->type)
8557 op1->type->refCount++;
8558 }
8559 return 0x1;
8560 }
8561
8562 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8563 {
8564 unsigned char value2 = op2->uc;
8565
8566 exp->type = 2;
8567 exp->string = PrintUChar(op1->uc && value2);
8568 if(!exp->expType)
8569 {
8570 exp->expType = op1->type;
8571 if(op1->type)
8572 op1->type->refCount++;
8573 }
8574 return 0x1;
8575 }
8576
8577 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8578 {
8579 float value2 = op2->f;
8580
8581 exp->type = 2;
8582 exp->string = PrintFloat(op1->f && value2);
8583 if(!exp->expType)
8584 {
8585 exp->expType = op1->type;
8586 if(op1->type)
8587 op1->type->refCount++;
8588 }
8589 return 0x1;
8590 }
8591
8592 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8593 {
8594 double value2 = op2->d;
8595
8596 exp->type = 2;
8597 exp->string = PrintDouble(op1->d && value2);
8598 if(!exp->expType)
8599 {
8600 exp->expType = op1->type;
8601 if(op1->type)
8602 op1->type->refCount++;
8603 }
8604 return 0x1;
8605 }
8606
8607 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8608 {
8609 int value2 = op2->i;
8610
8611 exp->type = 2;
8612 exp->string = PrintInt(op1->i || value2);
8613 if(!exp->expType)
8614 {
8615 exp->expType = op1->type;
8616 if(op1->type)
8617 op1->type->refCount++;
8618 }
8619 return 0x1;
8620 }
8621
8622 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8623 {
8624 unsigned int value2 = op2->ui;
8625
8626 exp->type = 2;
8627 exp->string = PrintUInt(op1->ui || value2);
8628 if(!exp->expType)
8629 {
8630 exp->expType = op1->type;
8631 if(op1->type)
8632 op1->type->refCount++;
8633 }
8634 return 0x1;
8635 }
8636
8637 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8638 {
8639 short value2 = op2->s;
8640
8641 exp->type = 2;
8642 exp->string = PrintShort(op1->s || value2);
8643 if(!exp->expType)
8644 {
8645 exp->expType = op1->type;
8646 if(op1->type)
8647 op1->type->refCount++;
8648 }
8649 return 0x1;
8650 }
8651
8652 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8653 {
8654 unsigned short value2 = op2->us;
8655
8656 exp->type = 2;
8657 exp->string = PrintUShort(op1->us || value2);
8658 if(!exp->expType)
8659 {
8660 exp->expType = op1->type;
8661 if(op1->type)
8662 op1->type->refCount++;
8663 }
8664 return 0x1;
8665 }
8666
8667 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8668 {
8669 char value2 = op2->c;
8670
8671 exp->type = 2;
8672 exp->string = PrintChar(op1->c || value2);
8673 if(!exp->expType)
8674 {
8675 exp->expType = op1->type;
8676 if(op1->type)
8677 op1->type->refCount++;
8678 }
8679 return 0x1;
8680 }
8681
8682 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8683 {
8684 unsigned char value2 = op2->uc;
8685
8686 exp->type = 2;
8687 exp->string = PrintUChar(op1->uc || value2);
8688 if(!exp->expType)
8689 {
8690 exp->expType = op1->type;
8691 if(op1->type)
8692 op1->type->refCount++;
8693 }
8694 return 0x1;
8695 }
8696
8697 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8698 {
8699 float value2 = op2->f;
8700
8701 exp->type = 2;
8702 exp->string = PrintFloat(op1->f || value2);
8703 if(!exp->expType)
8704 {
8705 exp->expType = op1->type;
8706 if(op1->type)
8707 op1->type->refCount++;
8708 }
8709 return 0x1;
8710 }
8711
8712 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8713 {
8714 double value2 = op2->d;
8715
8716 exp->type = 2;
8717 exp->string = PrintDouble(op1->d || value2);
8718 if(!exp->expType)
8719 {
8720 exp->expType = op1->type;
8721 if(op1->type)
8722 op1->type->refCount++;
8723 }
8724 return 0x1;
8725 }
8726
8727 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8728 {
8729 int value2 = op2->i;
8730
8731 exp->type = 2;
8732 exp->string = PrintInt(op1->i > value2);
8733 if(!exp->expType)
8734 {
8735 exp->expType = op1->type;
8736 if(op1->type)
8737 op1->type->refCount++;
8738 }
8739 return 0x1;
8740 }
8741
8742 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8743 {
8744 unsigned int value2 = op2->ui;
8745
8746 exp->type = 2;
8747 exp->string = PrintUInt(op1->ui > value2);
8748 if(!exp->expType)
8749 {
8750 exp->expType = op1->type;
8751 if(op1->type)
8752 op1->type->refCount++;
8753 }
8754 return 0x1;
8755 }
8756
8757 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8758 {
8759 short value2 = op2->s;
8760
8761 exp->type = 2;
8762 exp->string = PrintShort(op1->s > value2);
8763 if(!exp->expType)
8764 {
8765 exp->expType = op1->type;
8766 if(op1->type)
8767 op1->type->refCount++;
8768 }
8769 return 0x1;
8770 }
8771
8772 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8773 {
8774 unsigned short value2 = op2->us;
8775
8776 exp->type = 2;
8777 exp->string = PrintUShort(op1->us > value2);
8778 if(!exp->expType)
8779 {
8780 exp->expType = op1->type;
8781 if(op1->type)
8782 op1->type->refCount++;
8783 }
8784 return 0x1;
8785 }
8786
8787 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8788 {
8789 char value2 = op2->c;
8790
8791 exp->type = 2;
8792 exp->string = PrintChar(op1->c > value2);
8793 if(!exp->expType)
8794 {
8795 exp->expType = op1->type;
8796 if(op1->type)
8797 op1->type->refCount++;
8798 }
8799 return 0x1;
8800 }
8801
8802 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8803 {
8804 unsigned char value2 = op2->uc;
8805
8806 exp->type = 2;
8807 exp->string = PrintUChar(op1->uc > value2);
8808 if(!exp->expType)
8809 {
8810 exp->expType = op1->type;
8811 if(op1->type)
8812 op1->type->refCount++;
8813 }
8814 return 0x1;
8815 }
8816
8817 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8818 {
8819 float value2 = op2->f;
8820
8821 exp->type = 2;
8822 exp->string = PrintFloat(op1->f > value2);
8823 if(!exp->expType)
8824 {
8825 exp->expType = op1->type;
8826 if(op1->type)
8827 op1->type->refCount++;
8828 }
8829 return 0x1;
8830 }
8831
8832 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8833 {
8834 double value2 = op2->d;
8835
8836 exp->type = 2;
8837 exp->string = PrintDouble(op1->d > value2);
8838 if(!exp->expType)
8839 {
8840 exp->expType = op1->type;
8841 if(op1->type)
8842 op1->type->refCount++;
8843 }
8844 return 0x1;
8845 }
8846
8847 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8848 {
8849 int value2 = op2->i;
8850
8851 exp->type = 2;
8852 exp->string = PrintInt(op1->i < value2);
8853 if(!exp->expType)
8854 {
8855 exp->expType = op1->type;
8856 if(op1->type)
8857 op1->type->refCount++;
8858 }
8859 return 0x1;
8860 }
8861
8862 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8863 {
8864 unsigned int value2 = op2->ui;
8865
8866 exp->type = 2;
8867 exp->string = PrintUInt(op1->ui < value2);
8868 if(!exp->expType)
8869 {
8870 exp->expType = op1->type;
8871 if(op1->type)
8872 op1->type->refCount++;
8873 }
8874 return 0x1;
8875 }
8876
8877 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8878 {
8879 short value2 = op2->s;
8880
8881 exp->type = 2;
8882 exp->string = PrintShort(op1->s < value2);
8883 if(!exp->expType)
8884 {
8885 exp->expType = op1->type;
8886 if(op1->type)
8887 op1->type->refCount++;
8888 }
8889 return 0x1;
8890 }
8891
8892 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8893 {
8894 unsigned short value2 = op2->us;
8895
8896 exp->type = 2;
8897 exp->string = PrintUShort(op1->us < value2);
8898 if(!exp->expType)
8899 {
8900 exp->expType = op1->type;
8901 if(op1->type)
8902 op1->type->refCount++;
8903 }
8904 return 0x1;
8905 }
8906
8907 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8908 {
8909 char value2 = op2->c;
8910
8911 exp->type = 2;
8912 exp->string = PrintChar(op1->c < value2);
8913 if(!exp->expType)
8914 {
8915 exp->expType = op1->type;
8916 if(op1->type)
8917 op1->type->refCount++;
8918 }
8919 return 0x1;
8920 }
8921
8922 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8923 {
8924 unsigned char value2 = op2->uc;
8925
8926 exp->type = 2;
8927 exp->string = PrintUChar(op1->uc < value2);
8928 if(!exp->expType)
8929 {
8930 exp->expType = op1->type;
8931 if(op1->type)
8932 op1->type->refCount++;
8933 }
8934 return 0x1;
8935 }
8936
8937 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8938 {
8939 float value2 = op2->f;
8940
8941 exp->type = 2;
8942 exp->string = PrintFloat(op1->f < value2);
8943 if(!exp->expType)
8944 {
8945 exp->expType = op1->type;
8946 if(op1->type)
8947 op1->type->refCount++;
8948 }
8949 return 0x1;
8950 }
8951
8952 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8953 {
8954 double value2 = op2->d;
8955
8956 exp->type = 2;
8957 exp->string = PrintDouble(op1->d < value2);
8958 if(!exp->expType)
8959 {
8960 exp->expType = op1->type;
8961 if(op1->type)
8962 op1->type->refCount++;
8963 }
8964 return 0x1;
8965 }
8966
8967 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8968 {
8969 int value2 = op2->i;
8970
8971 exp->type = 2;
8972 exp->string = PrintInt(op1->i >= value2);
8973 if(!exp->expType)
8974 {
8975 exp->expType = op1->type;
8976 if(op1->type)
8977 op1->type->refCount++;
8978 }
8979 return 0x1;
8980 }
8981
8982 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8983 {
8984 unsigned int value2 = op2->ui;
8985
8986 exp->type = 2;
8987 exp->string = PrintUInt(op1->ui >= value2);
8988 if(!exp->expType)
8989 {
8990 exp->expType = op1->type;
8991 if(op1->type)
8992 op1->type->refCount++;
8993 }
8994 return 0x1;
8995 }
8996
8997 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8998 {
8999 short value2 = op2->s;
9000
9001 exp->type = 2;
9002 exp->string = PrintShort(op1->s >= value2);
9003 if(!exp->expType)
9004 {
9005 exp->expType = op1->type;
9006 if(op1->type)
9007 op1->type->refCount++;
9008 }
9009 return 0x1;
9010 }
9011
9012 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9013 {
9014 unsigned short value2 = op2->us;
9015
9016 exp->type = 2;
9017 exp->string = PrintUShort(op1->us >= value2);
9018 if(!exp->expType)
9019 {
9020 exp->expType = op1->type;
9021 if(op1->type)
9022 op1->type->refCount++;
9023 }
9024 return 0x1;
9025 }
9026
9027 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9028 {
9029 char value2 = op2->c;
9030
9031 exp->type = 2;
9032 exp->string = PrintChar(op1->c >= value2);
9033 if(!exp->expType)
9034 {
9035 exp->expType = op1->type;
9036 if(op1->type)
9037 op1->type->refCount++;
9038 }
9039 return 0x1;
9040 }
9041
9042 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9043 {
9044 unsigned char value2 = op2->uc;
9045
9046 exp->type = 2;
9047 exp->string = PrintUChar(op1->uc >= value2);
9048 if(!exp->expType)
9049 {
9050 exp->expType = op1->type;
9051 if(op1->type)
9052 op1->type->refCount++;
9053 }
9054 return 0x1;
9055 }
9056
9057 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9058 {
9059 float value2 = op2->f;
9060
9061 exp->type = 2;
9062 exp->string = PrintFloat(op1->f >= value2);
9063 if(!exp->expType)
9064 {
9065 exp->expType = op1->type;
9066 if(op1->type)
9067 op1->type->refCount++;
9068 }
9069 return 0x1;
9070 }
9071
9072 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9073 {
9074 double value2 = op2->d;
9075
9076 exp->type = 2;
9077 exp->string = PrintDouble(op1->d >= value2);
9078 if(!exp->expType)
9079 {
9080 exp->expType = op1->type;
9081 if(op1->type)
9082 op1->type->refCount++;
9083 }
9084 return 0x1;
9085 }
9086
9087 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9088 {
9089 int value2 = op2->i;
9090
9091 exp->type = 2;
9092 exp->string = PrintInt(op1->i <= value2);
9093 if(!exp->expType)
9094 {
9095 exp->expType = op1->type;
9096 if(op1->type)
9097 op1->type->refCount++;
9098 }
9099 return 0x1;
9100 }
9101
9102 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9103 {
9104 unsigned int value2 = op2->ui;
9105
9106 exp->type = 2;
9107 exp->string = PrintUInt(op1->ui <= value2);
9108 if(!exp->expType)
9109 {
9110 exp->expType = op1->type;
9111 if(op1->type)
9112 op1->type->refCount++;
9113 }
9114 return 0x1;
9115 }
9116
9117 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9118 {
9119 short value2 = op2->s;
9120
9121 exp->type = 2;
9122 exp->string = PrintShort(op1->s <= value2);
9123 if(!exp->expType)
9124 {
9125 exp->expType = op1->type;
9126 if(op1->type)
9127 op1->type->refCount++;
9128 }
9129 return 0x1;
9130 }
9131
9132 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9133 {
9134 unsigned short value2 = op2->us;
9135
9136 exp->type = 2;
9137 exp->string = PrintUShort(op1->us <= value2);
9138 if(!exp->expType)
9139 {
9140 exp->expType = op1->type;
9141 if(op1->type)
9142 op1->type->refCount++;
9143 }
9144 return 0x1;
9145 }
9146
9147 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9148 {
9149 char value2 = op2->c;
9150
9151 exp->type = 2;
9152 exp->string = PrintChar(op1->c <= value2);
9153 if(!exp->expType)
9154 {
9155 exp->expType = op1->type;
9156 if(op1->type)
9157 op1->type->refCount++;
9158 }
9159 return 0x1;
9160 }
9161
9162 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9163 {
9164 unsigned char value2 = op2->uc;
9165
9166 exp->type = 2;
9167 exp->string = PrintUChar(op1->uc <= value2);
9168 if(!exp->expType)
9169 {
9170 exp->expType = op1->type;
9171 if(op1->type)
9172 op1->type->refCount++;
9173 }
9174 return 0x1;
9175 }
9176
9177 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9178 {
9179 float value2 = op2->f;
9180
9181 exp->type = 2;
9182 exp->string = PrintFloat(op1->f <= value2);
9183 if(!exp->expType)
9184 {
9185 exp->expType = op1->type;
9186 if(op1->type)
9187 op1->type->refCount++;
9188 }
9189 return 0x1;
9190 }
9191
9192 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9193 {
9194 double value2 = op2->d;
9195
9196 exp->type = 2;
9197 exp->string = PrintDouble(op1->d <= value2);
9198 if(!exp->expType)
9199 {
9200 exp->expType = op1->type;
9201 if(op1->type)
9202 op1->type->refCount++;
9203 }
9204 return 0x1;
9205 }
9206
9207 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9208 {
9209 exp->type = 2;
9210 exp->string = PrintInt(op1->i ? op2->i : op3->i);
9211 if(!exp->expType)
9212 {
9213 exp->expType = op1->type;
9214 if(op1->type)
9215 op1->type->refCount++;
9216 }
9217 return 0x1;
9218 }
9219
9220 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9221 {
9222 exp->type = 2;
9223 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
9224 if(!exp->expType)
9225 {
9226 exp->expType = op1->type;
9227 if(op1->type)
9228 op1->type->refCount++;
9229 }
9230 return 0x1;
9231 }
9232
9233 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9234 {
9235 exp->type = 2;
9236 exp->string = PrintShort(op1->s ? op2->s : op3->s);
9237 if(!exp->expType)
9238 {
9239 exp->expType = op1->type;
9240 if(op1->type)
9241 op1->type->refCount++;
9242 }
9243 return 0x1;
9244 }
9245
9246 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9247 {
9248 exp->type = 2;
9249 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
9250 if(!exp->expType)
9251 {
9252 exp->expType = op1->type;
9253 if(op1->type)
9254 op1->type->refCount++;
9255 }
9256 return 0x1;
9257 }
9258
9259 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9260 {
9261 exp->type = 2;
9262 exp->string = PrintChar(op1->c ? op2->c : op3->c);
9263 if(!exp->expType)
9264 {
9265 exp->expType = op1->type;
9266 if(op1->type)
9267 op1->type->refCount++;
9268 }
9269 return 0x1;
9270 }
9271
9272 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9273 {
9274 exp->type = 2;
9275 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
9276 if(!exp->expType)
9277 {
9278 exp->expType = op1->type;
9279 if(op1->type)
9280 op1->type->refCount++;
9281 }
9282 return 0x1;
9283 }
9284
9285 static unsigned int FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9286 {
9287 exp->type = 2;
9288 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
9289 if(!exp->expType)
9290 {
9291 exp->expType = op1->type;
9292 if(op1->type)
9293 op1->type->refCount++;
9294 }
9295 return 0x1;
9296 }
9297
9298 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9299 {
9300 exp->type = 2;
9301 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
9302 if(!exp->expType)
9303 {
9304 exp->expType = op1->type;
9305 if(op1->type)
9306 op1->type->refCount++;
9307 }
9308 return 0x1;
9309 }
9310
9311 struct OpTable intOps = 
9312 {
9313 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
9314 };
9315
9316 struct OpTable uintOps = 
9317 {
9318 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
9319 };
9320
9321 struct OpTable shortOps = 
9322 {
9323 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
9324 };
9325
9326 struct OpTable ushortOps = 
9327 {
9328 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
9329 };
9330
9331 struct OpTable floatOps = 
9332 {
9333 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
9334 };
9335
9336 struct OpTable doubleOps = 
9337 {
9338 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
9339 };
9340
9341 struct OpTable charOps = 
9342 {
9343 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
9344 };
9345
9346 struct OpTable ucharOps = 
9347 {
9348 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
9349 };
9350
9351 void ReadString(char * output, char * string)
9352 {
9353 int len = strlen(string);
9354 int c, d = 0;
9355 unsigned int quoted = 0x0, escaped = 0x0;
9356
9357 for(c = 0; c < len; c++)
9358 {
9359 char ch = string[c];
9360
9361 if(escaped)
9362 {
9363 switch(ch)
9364 {
9365 case 'n':
9366 output[d] = '\n';
9367 break;
9368 case 't':
9369 output[d] = '\t';
9370 break;
9371 case 'a':
9372 output[d] = '\a';
9373 break;
9374 case 'b':
9375 output[d] = '\b';
9376 break;
9377 case 'f':
9378 output[d] = '\f';
9379 break;
9380 case 'r':
9381 output[d] = '\r';
9382 break;
9383 case 'v':
9384 output[d] = '\v';
9385 break;
9386 case '\\':
9387 output[d] = '\\';
9388 break;
9389 case '\"':
9390 output[d] = '\"';
9391 break;
9392 default:
9393 output[d++] = '\\';
9394 output[d] = ch;
9395 }
9396 d++;
9397 escaped = 0x0;
9398 }
9399 else
9400 {
9401 if(ch == '\"')
9402 quoted ^= 0x1;
9403 else if(quoted)
9404 {
9405 if(ch == '\\')
9406 escaped = 0x1;
9407 else
9408 output[d++] = ch;
9409 }
9410 }
9411 }
9412 output[d] = '\0';
9413 }
9414
9415 extern long long __ecereNameSpace__ecere__com___strtoi64(char *  string, char * *  endString, int base);
9416
9417 extern uint64 __ecereNameSpace__ecere__com___strtoui64(char *  string, char * *  endString, int base);
9418
9419 extern double strtod(char * , char * * );
9420
9421 struct Operand GetOperand(struct Expression * exp)
9422 {
9423 struct Operand op = 
9424 {
9425 0, 0, 0, 0, 
9426 {
9427 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
9428 }
9429 };
9430 struct Type * type = exp->expType;
9431
9432 if(type)
9433 {
9434 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9435 {
9436 if(!type->_class->registered->dataType)
9437 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9438 type = type->_class->registered->dataType;
9439 }
9440 op.kind = type->kind;
9441 op.type = exp->expType;
9442 if(exp->isConstant && exp->type == 2)
9443 {
9444 switch(op.kind)
9445 {
9446 case 1:
9447 {
9448 if(exp->constant[0] == '\'')
9449 op.c = exp->constant[1];
9450 else if(type->isSigned)
9451 {
9452 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9453 op.ops = charOps;
9454 }
9455 else
9456 {
9457 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9458 op.ops = ucharOps;
9459 }
9460 break;
9461 }
9462 case 2:
9463 if(type->isSigned)
9464 {
9465 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9466 op.ops = shortOps;
9467 }
9468 else
9469 {
9470 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9471 op.ops = ushortOps;
9472 }
9473 break;
9474 case 3:
9475 case 5:
9476 if(type->isSigned)
9477 {
9478 op.i = strtol(exp->constant, (((void *)0)), 0);
9479 op.ops = intOps;
9480 }
9481 else
9482 {
9483 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9484 op.ops = uintOps;
9485 }
9486 op.kind = 3;
9487 break;
9488 case 4:
9489 if(type->isSigned)
9490 {
9491 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9492 op.ops = intOps;
9493 }
9494 else
9495 {
9496 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9497 op.ops = uintOps;
9498 }
9499 op.kind = 3;
9500 break;
9501 case 22:
9502 if(type->isSigned)
9503 {
9504 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9505 op.ops = intOps;
9506 }
9507 else
9508 {
9509 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9510 op.ops = uintOps;
9511 }
9512 op.kind = 3;
9513 break;
9514 case 23:
9515 if(type->isSigned)
9516 {
9517 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9518 op.ops = intOps;
9519 }
9520 else
9521 {
9522 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9523 op.ops = uintOps;
9524 }
9525 op.kind = 3;
9526 break;
9527 case 6:
9528 op.f = (float)strtod(exp->constant, (((void *)0)));
9529 op.ops = floatOps;
9530 break;
9531 case 7:
9532 op.d = (double)strtod(exp->constant, (((void *)0)));
9533 op.ops = doubleOps;
9534 break;
9535 case 12:
9536 case 13:
9537 case 8:
9538 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9539 op.kind = 13;
9540 op.ops = uintOps;
9541 break;
9542 }
9543 }
9544 }
9545 return op;
9546 }
9547
9548 int __ecereVMethodID_class_OnGetString;
9549
9550 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9551
9552 static void UnusedFunction()
9553 {
9554 int a;
9555
9556 ((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);
9557 }
9558
9559 extern int __ecereVMethodID_class_OnGetString;
9560
9561 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9562 {
9563 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9564
9565 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9566 {
9567 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9568 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9569 else
9570 {
9571 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9572 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9573 struct Type * type;
9574 void * ptr = inst->data + dataMember->offset + offset;
9575 char * result = (((void *)0));
9576
9577 exp->loc = member->loc = inst->loc;
9578 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9579 if(!dataMember->dataType)
9580 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9581 type = dataMember->dataType;
9582 if(type->kind == 8)
9583 {
9584 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9585
9586 if(_class->type == 4)
9587 {
9588 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9589
9590 if(enumClass)
9591 {
9592 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9593 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9594
9595 for(item = e->values.first; item; item = item->next)
9596 {
9597 if((int)item->data == *(int *)ptr)
9598 {
9599 result = item->name;
9600 break;
9601 }
9602 }
9603 if(result)
9604 {
9605 exp->identifier = MkIdentifier(result);
9606 exp->type = 0;
9607 exp->destType = MkClassType(_class->fullName);
9608 ProcessExpressionType(exp);
9609 }
9610 }
9611 }
9612 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9613 {
9614 if(!_class->dataType)
9615 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9616 type = _class->dataType;
9617 }
9618 }
9619 if(!result)
9620 {
9621 switch(type->kind)
9622 {
9623 case 6:
9624 {
9625 FreeExpContents(exp);
9626 exp->constant = PrintFloat(*(float *)ptr);
9627 exp->type = 2;
9628 break;
9629 }
9630 case 7:
9631 {
9632 FreeExpContents(exp);
9633 exp->constant = PrintDouble(*(double *)ptr);
9634 exp->type = 2;
9635 break;
9636 }
9637 case 3:
9638 {
9639 FreeExpContents(exp);
9640 exp->constant = PrintInt(*(int *)ptr);
9641 exp->type = 2;
9642 break;
9643 }
9644 case 4:
9645 {
9646 FreeExpContents(exp);
9647 exp->constant = PrintInt64(*(long long *)ptr);
9648 exp->type = 2;
9649 break;
9650 }
9651 case 22:
9652 {
9653 FreeExpContents(exp);
9654 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9655 exp->type = 2;
9656 break;
9657 }
9658 case 23:
9659 {
9660 FreeExpContents(exp);
9661 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9662 exp->type = 2;
9663 break;
9664 }
9665 default:
9666 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9667 }
9668 }
9669 ListAdd(memberList, member);
9670 }
9671 if(parentDataMember->type == 1)
9672 break;
9673 }
9674 }
9675
9676 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9677
9678 void PopulateInstance(struct Instantiation * inst)
9679 {
9680 struct Symbol * classSym = inst->_class->symbol;
9681 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9682 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9683 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9684
9685 if(!inst->members)
9686 inst->members = MkListOne(MkMembersInitList(memberList));
9687 else
9688 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*inst->members), MkMembersInitList(memberList));
9689 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9690 {
9691 if(!dataMember->isProperty)
9692 {
9693 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9694 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9695 else
9696 {
9697 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9698 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9699 struct Type * type;
9700 void * ptr = inst->data + dataMember->offset;
9701 char * result = (((void *)0));
9702
9703 exp->loc = member->loc = inst->loc;
9704 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9705 if(!dataMember->dataType)
9706 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9707 type = dataMember->dataType;
9708 if(type->kind == 8)
9709 {
9710 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9711
9712 if(_class->type == 4)
9713 {
9714 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9715
9716 if(enumClass)
9717 {
9718 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9719 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9720
9721 for(item = e->values.first; item; item = item->next)
9722 {
9723 if((int)item->data == *(int *)ptr)
9724 {
9725 result = item->name;
9726 break;
9727 }
9728 }
9729 }
9730 if(result)
9731 {
9732 exp->identifier = MkIdentifier(result);
9733 exp->type = 0;
9734 exp->destType = MkClassType(_class->fullName);
9735 ProcessExpressionType(exp);
9736 }
9737 }
9738 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9739 {
9740 if(!_class->dataType)
9741 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9742 type = _class->dataType;
9743 }
9744 }
9745 if(!result)
9746 {
9747 switch(type->kind)
9748 {
9749 case 6:
9750 {
9751 exp->constant = PrintFloat(*(float *)ptr);
9752 exp->type = 2;
9753 break;
9754 }
9755 case 7:
9756 {
9757 exp->constant = PrintDouble(*(double *)ptr);
9758 exp->type = 2;
9759 break;
9760 }
9761 case 3:
9762 {
9763 exp->constant = PrintInt(*(int *)ptr);
9764 exp->type = 2;
9765 break;
9766 }
9767 case 4:
9768 {
9769 exp->constant = PrintInt64(*(long long *)ptr);
9770 exp->type = 2;
9771 break;
9772 }
9773 case 22:
9774 {
9775 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9776 exp->type = 2;
9777 break;
9778 }
9779 default:
9780 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9781 }
9782 }
9783 ListAdd(memberList, member);
9784 }
9785 }
9786 }
9787 }
9788
9789 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);
9790
9791 extern void FreeInstance(struct Instantiation * inst);
9792
9793 void ComputeInstantiation(struct Expression * exp)
9794 {
9795 struct Instantiation * inst = exp->instance;
9796 struct MembersInit * members;
9797 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9798 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9799 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9800 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9801 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9802 int subMemberStackPos = 0;
9803 uint64 bits = 0;
9804
9805 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9806 {
9807 if(inst->data)
9808 return ;
9809 if(_class->type == 0 || _class->type == 5)
9810 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9811 else
9812 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9813 }
9814 if(inst->members)
9815 {
9816 for(members = (*inst->members).first; members; members = members->next)
9817 {
9818 switch(members->type)
9819 {
9820 case 0:
9821 {
9822 if(members->dataMembers)
9823 {
9824 struct MemberInit * member;
9825
9826 for(member = (*members->dataMembers).first; member; member = member->next)
9827 {
9828 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9829 unsigned int found = 0x0;
9830 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9831 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9832 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9833 unsigned int dataMemberOffset;
9834
9835 if(!ident)
9836 {
9837 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9838 if(curMember)
9839 {
9840 if(curMember->isProperty)
9841 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9842 else
9843 {
9844 dataMember = curMember;
9845 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9846 if(_class->type == 0)
9847 dataMemberOffset += _class->base->structSize;
9848 }
9849 found = 0x1;
9850 }
9851 }
9852 else
9853 {
9854 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9855 if(prop)
9856 {
9857 found = 0x1;
9858 if(prop->memberAccess == 1)
9859 {
9860 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9861 curClass = prop->_class;
9862 }
9863 }
9864 else
9865 {
9866 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9867 int _subMemberStackPos = 0;
9868
9869 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9870 if(dataMember)
9871 {
9872 found = 0x1;
9873 if(dataMember->memberAccess == 1)
9874 {
9875 curMember = dataMember;
9876 curClass = dataMember->_class;
9877 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
9878 subMemberStackPos = _subMemberStackPos;
9879 }
9880 }
9881 }
9882 }
9883 if(found && member->initializer && member->initializer->type == 0)
9884 {
9885 struct Expression * value = member->initializer->exp;
9886 struct Type * type = (((void *)0));
9887 unsigned int deepMember = 0x0;
9888
9889 if(prop)
9890 {
9891 type = prop->dataType;
9892 }
9893 else if(dataMember)
9894 {
9895 if(!dataMember->dataType)
9896 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9897 type = dataMember->dataType;
9898 }
9899 if(ident && ident->next)
9900 {
9901 deepMember = 0x1;
9902 for(ident = ident->next; ident && type; ident = ident->next)
9903 {
9904 if(type->kind == 8)
9905 {
9906 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9907 if(prop)
9908 type = prop->dataType;
9909 else
9910 {
9911 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9912 if(dataMember)
9913 type = dataMember->dataType;
9914 }
9915 }
9916 else if(type->kind == 9 || type->kind == 10)
9917 {
9918 struct Type * memberType;
9919
9920 for(memberType = type->members.first; memberType; memberType = memberType->next)
9921 {
9922 if(!strcmp(memberType->name, ident->string))
9923 {
9924 type = memberType;
9925 break;
9926 }
9927 }
9928 }
9929 }
9930 }
9931 if(value)
9932 {
9933 FreeType(value->destType);
9934 value->destType = type;
9935 if(type)
9936 type->refCount++;
9937 ComputeExpression(value);
9938 }
9939 if(!deepMember && type && value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9940 {
9941 if(type->kind == 8)
9942 {
9943 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9944
9945 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9946 {
9947 if(!_class->dataType)
9948 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9949 type = _class->dataType;
9950 }
9951 }
9952 if(dataMember)
9953 {
9954 void * ptr = inst->data + dataMemberOffset;
9955
9956 if(value->type == 2)
9957 {
9958 switch(type->kind)
9959 {
9960 case 3:
9961 {
9962 GetInt(value, (int *)ptr);
9963 break;
9964 }
9965 case 4:
9966 {
9967 GetInt64(value, (long long *)ptr);
9968 break;
9969 }
9970 case 22:
9971 {
9972 GetIntPtr(value, (intptr_t *)ptr);
9973 break;
9974 }
9975 case 23:
9976 {
9977 GetIntSize(value, (ssize_t *)ptr);
9978 break;
9979 }
9980 case 6:
9981 {
9982 GetFloat(value, (float *)ptr);
9983 break;
9984 }
9985 case 7:
9986 {
9987 GetDouble(value, (double *)ptr);
9988 break;
9989 }
9990 }
9991 }
9992 else if(value->type == 1)
9993 {
9994 if(type->kind == 8)
9995 {
9996 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9997
9998 if(_class->type == 1)
9999 {
10000 ComputeTypeSize(type);
10001 if(value->instance->data)
10002 memcpy(ptr, value->instance->data, type->size);
10003 }
10004 }
10005 }
10006 }
10007 else if(prop)
10008 {
10009 if(value->type == 1 && value->instance->data)
10010 {
10011 if(type->kind == 8)
10012 {
10013 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10014
10015 if(_class && (_class->type != 0 || __ecereNameSpace__ecere__com__eClass_IsDerived(((struct __ecereNameSpace__ecere__com__Instance *)(char *)((struct __ecereNameSpace__ecere__com__Instance *)value->instance->data))->_class, _class)))
10016 {
10017 void (* Set)(void *, void *) = (void *)prop->Set;
10018
10019 Set(inst->data, value->instance->data);
10020 PopulateInstance(inst);
10021 }
10022 }
10023 }
10024 else if(value->type == 2)
10025 {
10026 switch(type->kind)
10027 {
10028 case 7:
10029 {
10030 void (* Set)(void *, double) = (void *)prop->Set;
10031
10032 Set(inst->data, strtod(value->constant, (((void *)0))));
10033 break;
10034 }
10035 case 6:
10036 {
10037 void (* Set)(void *, float) = (void *)prop->Set;
10038
10039 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
10040 break;
10041 }
10042 case 3:
10043 {
10044 void (* Set)(void *, int) = (void *)prop->Set;
10045
10046 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
10047 break;
10048 }
10049 case 4:
10050 {
10051 void (* Set)(void *, long long) = (void *)prop->Set;
10052
10053 Set(inst->data, __ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10054 break;
10055 }
10056 case 22:
10057 {
10058 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10059
10060 Set(inst->data, (intptr_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10061 break;
10062 }
10063 case 23:
10064 {
10065 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10066
10067 Set(inst->data, (ssize_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10068 break;
10069 }
10070 }
10071 }
10072 else if(value->type == 3)
10073 {
10074 char temp[1024];
10075
10076 ReadString(temp, value->string);
10077 ((void (*)(void *, void *))(void *)prop->Set)(inst->data, temp);
10078 }
10079 }
10080 }
10081 else if(!deepMember && type && _class->type == 3)
10082 {
10083 if(prop)
10084 {
10085 if(value->type == 2)
10086 {
10087 if(type->kind == 8)
10088 {
10089 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10090
10091 if(_class->type == 3)
10092 {
10093 if(!_class->dataType)
10094 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10095 type = _class->dataType;
10096 }
10097 }
10098 switch(type->kind)
10099 {
10100 case 6:
10101 {
10102 float fValue;
10103 float (* Set)(float) = (void *)prop->Set;
10104
10105 GetFloat(member->initializer->exp, &fValue);
10106 exp->constant = PrintFloat(Set(fValue));
10107 exp->type = 2;
10108 break;
10109 }
10110 case 7:
10111 {
10112 double dValue;
10113 double (* Set)(double) = (void *)prop->Set;
10114
10115 GetDouble(member->initializer->exp, &dValue);
10116 exp->constant = PrintDouble(Set(dValue));
10117 exp->type = 2;
10118 break;
10119 }
10120 }
10121 }
10122 }
10123 }
10124 else if(!deepMember && type && _class->type == 2)
10125 {
10126 if(prop)
10127 {
10128 if(value->type == 1 && value->instance->data)
10129 {
10130 unsigned int (* Set)(void *) = (void *)prop->Set;
10131
10132 bits = Set(value->instance->data);
10133 }
10134 else if(value->type == 2)
10135 {
10136 }
10137 }
10138 else if(dataMember)
10139 {
10140 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
10141 struct Type * type;
10142 int part = 0;
10143
10144 GetInt(value, &part);
10145 bits = (bits & ~bitMember->mask);
10146 if(!bitMember->dataType)
10147 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
10148 type = bitMember->dataType;
10149 if(type->kind == 8 && type->_class && type->_class->registered)
10150 {
10151 if(!type->_class->registered->dataType)
10152 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
10153 type = type->_class->registered->dataType;
10154 }
10155 switch(type->kind)
10156 {
10157 case 1:
10158 if(type->isSigned)
10159 bits |= ((char)part << bitMember->pos);
10160 else
10161 bits |= ((unsigned char)part << bitMember->pos);
10162 break;
10163 case 2:
10164 if(type->isSigned)
10165 bits |= ((short)part << bitMember->pos);
10166 else
10167 bits |= ((unsigned short)part << bitMember->pos);
10168 break;
10169 case 3:
10170 case 5:
10171 if(type->isSigned)
10172 bits |= (part << bitMember->pos);
10173 else
10174 bits |= ((unsigned int)part << bitMember->pos);
10175 break;
10176 case 4:
10177 if(type->isSigned)
10178 bits |= ((long long)part << bitMember->pos);
10179 else
10180 bits |= ((uint64)part << bitMember->pos);
10181 break;
10182 case 22:
10183 if(type->isSigned)
10184 {
10185 bits |= ((intptr_t)part << bitMember->pos);
10186 }
10187 else
10188 {
10189 bits |= ((uintptr_t)part << bitMember->pos);
10190 }
10191 break;
10192 case 23:
10193 if(type->isSigned)
10194 {
10195 bits |= ((ssize_t)part << bitMember->pos);
10196 }
10197 else
10198 {
10199 bits |= ((size_t)part << bitMember->pos);
10200 }
10201 break;
10202 }
10203 }
10204 }
10205 }
10206 else
10207 {
10208 if(_class && _class->type == 3)
10209 {
10210 ComputeExpression(member->initializer->exp);
10211 exp->constant = member->initializer->exp->constant;
10212 exp->type = 2;
10213 member->initializer->exp->constant = (((void *)0));
10214 }
10215 }
10216 }
10217 }
10218 break;
10219 }
10220 }
10221 }
10222 }
10223 if(_class && _class->type == 2)
10224 {
10225 exp->constant = PrintHexUInt(bits);
10226 exp->type = 2;
10227 }
10228 if(exp->type != 1)
10229 {
10230 FreeInstance(inst);
10231 }
10232 }
10233
10234 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
10235 {
10236 if(exp->op.op == SIZEOF)
10237 {
10238 FreeExpContents(exp);
10239 exp->type = 2;
10240 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
10241 }
10242 else
10243 {
10244 if(!exp->op.exp1)
10245 {
10246 switch(exp->op.op)
10247 {
10248 case '+':
10249 {
10250 struct Expression * exp2 = exp->op.exp2;
10251
10252 exp->op.exp2 = (((void *)0));
10253 FreeExpContents(exp);
10254 FreeType(exp->expType);
10255 FreeType(exp->destType);
10256 *exp = *exp2;
10257 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
10258 break;
10259 }
10260 case '-':
10261 if(op1->ops.Neg)
10262 {
10263 FreeExpContents(exp);
10264 op1->ops.Neg(exp, op1);
10265 }
10266 break;
10267 case '~':
10268 if(op1->ops.BitNot)
10269 {
10270 FreeExpContents(exp);
10271 op1->ops.BitNot(exp, op1);
10272 }
10273 break;
10274 case '!':
10275 if(op1->ops.Not)
10276 {
10277 FreeExpContents(exp);
10278 op1->ops.Not(exp, op1);
10279 }
10280 break;
10281 }
10282 }
10283 else
10284 {
10285 switch(exp->op.op)
10286 {
10287 case '+':
10288 if(op1->ops.Add)
10289 {
10290 FreeExpContents(exp);
10291 op1->ops.Add(exp, op1, op2);
10292 }
10293 break;
10294 case '-':
10295 if(op1->ops.Sub)
10296 {
10297 FreeExpContents(exp);
10298 op1->ops.Sub(exp, op1, op2);
10299 }
10300 break;
10301 case '*':
10302 if(op1->ops.Mul)
10303 {
10304 FreeExpContents(exp);
10305 op1->ops.Mul(exp, op1, op2);
10306 }
10307 break;
10308 case '/':
10309 if(op1->ops.Div)
10310 {
10311 FreeExpContents(exp);
10312 op1->ops.Div(exp, op1, op2);
10313 }
10314 break;
10315 case '%':
10316 if(op1->ops.Mod)
10317 {
10318 FreeExpContents(exp);
10319 op1->ops.Mod(exp, op1, op2);
10320 }
10321 break;
10322 case '&':
10323 if(exp->op.exp2)
10324 {
10325 if(op1->ops.BitAnd)
10326 {
10327 FreeExpContents(exp);
10328 op1->ops.BitAnd(exp, op1, op2);
10329 }
10330 }
10331 break;
10332 case '|':
10333 if(op1->ops.BitOr)
10334 {
10335 FreeExpContents(exp);
10336 op1->ops.BitOr(exp, op1, op2);
10337 }
10338 break;
10339 case '^':
10340 if(op1->ops.BitXor)
10341 {
10342 FreeExpContents(exp);
10343 op1->ops.BitXor(exp, op1, op2);
10344 }
10345 break;
10346 case LEFT_OP:
10347 if(op1->ops.LShift)
10348 {
10349 FreeExpContents(exp);
10350 op1->ops.LShift(exp, op1, op2);
10351 }
10352 break;
10353 case RIGHT_OP:
10354 if(op1->ops.RShift)
10355 {
10356 FreeExpContents(exp);
10357 op1->ops.RShift(exp, op1, op2);
10358 }
10359 break;
10360 case EQ_OP:
10361 if(op1->ops.Equ)
10362 {
10363 FreeExpContents(exp);
10364 op1->ops.Equ(exp, op1, op2);
10365 }
10366 break;
10367 case NE_OP:
10368 if(op1->ops.Nqu)
10369 {
10370 FreeExpContents(exp);
10371 op1->ops.Nqu(exp, op1, op2);
10372 }
10373 break;
10374 case AND_OP:
10375 if(op1->ops.And)
10376 {
10377 FreeExpContents(exp);
10378 op1->ops.And(exp, op1, op2);
10379 }
10380 break;
10381 case OR_OP:
10382 if(op1->ops.Or)
10383 {
10384 FreeExpContents(exp);
10385 op1->ops.Or(exp, op1, op2);
10386 }
10387 break;
10388 case '>':
10389 if(op1->ops.Grt)
10390 {
10391 FreeExpContents(exp);
10392 op1->ops.Grt(exp, op1, op2);
10393 }
10394 break;
10395 case '<':
10396 if(op1->ops.Sma)
10397 {
10398 FreeExpContents(exp);
10399 op1->ops.Sma(exp, op1, op2);
10400 }
10401 break;
10402 case GE_OP:
10403 if(op1->ops.GrtEqu)
10404 {
10405 FreeExpContents(exp);
10406 op1->ops.GrtEqu(exp, op1, op2);
10407 }
10408 break;
10409 case LE_OP:
10410 if(op1->ops.SmaEqu)
10411 {
10412 FreeExpContents(exp);
10413 op1->ops.SmaEqu(exp, op1, op2);
10414 }
10415 break;
10416 }
10417 }
10418 }
10419 }
10420
10421 void PrintTypeNoConst(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
10422
10423 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10424
10425 void ComputeExpression(struct Expression * exp)
10426 {
10427 char expString[10240];
10428
10429 expString[0] = '\0';
10430 switch(exp->type)
10431 {
10432 case 1:
10433 {
10434 ComputeInstantiation(exp);
10435 break;
10436 }
10437 case 4:
10438 {
10439 struct Expression * exp1, * exp2 = (((void *)0));
10440 struct Operand op1 = 
10441 {
10442 0, 0, 0, 0, 
10443 {
10444 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10445 }
10446 };
10447 struct Operand op2 = 
10448 {
10449 0, 0, 0, 0, 
10450 {
10451 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10452 }
10453 };
10454
10455 if(exp->op.exp2)
10456 ComputeExpression(exp->op.exp2);
10457 if(exp->op.exp1)
10458 {
10459 ComputeExpression(exp->op.exp1);
10460 exp1 = exp->op.exp1;
10461 exp2 = exp->op.exp2;
10462 op1 = GetOperand(exp1);
10463 if(op1.type)
10464 op1.type->refCount++;
10465 if(exp2)
10466 {
10467 op2 = GetOperand(exp2);
10468 if(op2.type)
10469 op2.type->refCount++;
10470 }
10471 }
10472 else
10473 {
10474 exp1 = exp->op.exp2;
10475 op1 = GetOperand(exp1);
10476 if(op1.type)
10477 op1.type->refCount++;
10478 }
10479 CallOperator(exp, exp1, exp2, &op1, &op2);
10480 if(op1.type)
10481 FreeType(op1.type);
10482 if(op2.type)
10483 FreeType(op2.type);
10484 break;
10485 }
10486 case 5:
10487 case 34:
10488 {
10489 struct Expression * e, * n;
10490
10491 for(e = (*exp->list).first; e; e = n)
10492 {
10493 n = e->next;
10494 if(!n)
10495 {
10496 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10497
10498 ComputeExpression(e);
10499 FreeType(exp->expType);
10500 FreeType(exp->destType);
10501 *exp = *e;
10502 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10503 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10504 }
10505 else
10506 {
10507 FreeExpression(e);
10508 }
10509 }
10510 break;
10511 }
10512 case 8:
10513 {
10514 struct Expression * memberExp = exp->member.exp;
10515 struct Identifier * memberID = exp->member.member;
10516 struct Type * type;
10517
10518 ComputeExpression(exp->member.exp);
10519 type = exp->member.exp->expType;
10520 if(type)
10521 {
10522 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)));
10523 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10524 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10525 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10526
10527 if(type->kind == 19 && exp->member.exp->type == 26)
10528 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10529 if(!_class)
10530 {
10531 char string[256];
10532 struct Symbol * classSym;
10533
10534 string[0] = '\0';
10535 PrintTypeNoConst(type, string, 0x0, 0x1);
10536 classSym = FindClass(string);
10537 _class = classSym ? classSym->registered : (((void *)0));
10538 }
10539 if(exp->member.member)
10540 {
10541 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10542 if(!prop)
10543 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10544 }
10545 if(!prop && !member && _class && exp->member.member)
10546 {
10547 struct Symbol * classSym = FindClass(exp->member.member->string);
10548
10549 convertTo = _class;
10550 _class = classSym ? classSym->registered : (((void *)0));
10551 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10552 }
10553 if(prop)
10554 {
10555 if(prop->compiled)
10556 {
10557 struct Type * type = prop->dataType;
10558
10559 if(_class->type == 3)
10560 {
10561 if(type->kind == 8)
10562 {
10563 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10564
10565 if(_class->type == 3)
10566 {
10567 if(!_class->dataType)
10568 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10569 type = _class->dataType;
10570 }
10571 }
10572 switch(type->kind)
10573 {
10574 case 6:
10575 {
10576 float value;
10577 float (* Get)(float) = (void *)prop->Get;
10578
10579 GetFloat(exp->member.exp, &value);
10580 exp->constant = PrintFloat(Get ? Get(value) : value);
10581 exp->type = 2;
10582 break;
10583 }
10584 case 7:
10585 {
10586 double value;
10587 double (* Get)(double);
10588
10589 GetDouble(exp->member.exp, &value);
10590 if(convertTo)
10591 Get = (void *)prop->Set;
10592 else
10593 Get = (void *)prop->Get;
10594 exp->constant = PrintDouble(Get ? Get(value) : value);
10595 exp->type = 2;
10596 break;
10597 }
10598 }
10599 }
10600 else
10601 {
10602 if(convertTo)
10603 {
10604 struct Expression * value = exp->member.exp;
10605 struct Type * type;
10606
10607 if(!prop->dataType)
10608 ProcessPropertyType(prop);
10609 type = prop->dataType;
10610 if(!type)
10611 {
10612 }
10613 else if(_class->type == 1)
10614 {
10615 switch(type->kind)
10616 {
10617 case 8:
10618 {
10619 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10620
10621 if(propertyClass->type == 1 && value->type == 1)
10622 {
10623 void (* Set)(void *, void *) = (void *)prop->Set;
10624
10625 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10626 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10627 exp->instance->_class = MkSpecifierName(_class->fullName);
10628 exp->instance->loc = exp->loc;
10629 exp->type = 1;
10630 Set(exp->instance->data, value->instance->data);
10631 PopulateInstance(exp->instance);
10632 }
10633 break;
10634 }
10635 case 3:
10636 {
10637 int intValue;
10638 void (* Set)(void *, int) = (void *)prop->Set;
10639
10640 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10641 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10642 exp->instance->_class = MkSpecifierName(_class->fullName);
10643 exp->instance->loc = exp->loc;
10644 exp->type = 1;
10645 GetInt(value, &intValue);
10646 Set(exp->instance->data, intValue);
10647 PopulateInstance(exp->instance);
10648 break;
10649 }
10650 case 4:
10651 {
10652 long long intValue;
10653 void (* Set)(void *, long long) = (void *)prop->Set;
10654
10655 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10656 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10657 exp->instance->_class = MkSpecifierName(_class->fullName);
10658 exp->instance->loc = exp->loc;
10659 exp->type = 1;
10660 GetInt64(value, &intValue);
10661 Set(exp->instance->data, intValue);
10662 PopulateInstance(exp->instance);
10663 break;
10664 }
10665 case 22:
10666 {
10667 intptr_t intValue;
10668 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10669
10670 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10671 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10672 exp->instance->_class = MkSpecifierName(_class->fullName);
10673 exp->instance->loc = exp->loc;
10674 exp->type = 1;
10675 GetIntPtr(value, &intValue);
10676 Set(exp->instance->data, intValue);
10677 PopulateInstance(exp->instance);
10678 break;
10679 }
10680 case 23:
10681 {
10682 ssize_t intValue;
10683 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10684
10685 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10686 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10687 exp->instance->_class = MkSpecifierName(_class->fullName);
10688 exp->instance->loc = exp->loc;
10689 exp->type = 1;
10690 GetIntSize(value, &intValue);
10691 Set(exp->instance->data, intValue);
10692 PopulateInstance(exp->instance);
10693 break;
10694 }
10695 case 7:
10696 {
10697 double doubleValue;
10698 void (* Set)(void *, double) = (void *)prop->Set;
10699
10700 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10701 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10702 exp->instance->_class = MkSpecifierName(_class->fullName);
10703 exp->instance->loc = exp->loc;
10704 exp->type = 1;
10705 GetDouble(value, &doubleValue);
10706 Set(exp->instance->data, doubleValue);
10707 PopulateInstance(exp->instance);
10708 break;
10709 }
10710 }
10711 }
10712 else if(_class->type == 2)
10713 {
10714 switch(type->kind)
10715 {
10716 case 8:
10717 {
10718 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10719
10720 if(propertyClass->type == 1 && value->instance->data)
10721 {
10722 unsigned int (* Set)(void *) = (void *)prop->Set;
10723 unsigned int bits = Set(value->instance->data);
10724
10725 exp->constant = PrintHexUInt(bits);
10726 exp->type = 2;
10727 break;
10728 }
10729 else if(_class->type == 2)
10730 {
10731 unsigned int value;
10732 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10733 unsigned int bits;
10734
10735 GetUInt(exp->member.exp, &value);
10736 bits = Set(value);
10737 exp->constant = PrintHexUInt(bits);
10738 exp->type = 2;
10739 }
10740 }
10741 }
10742 }
10743 }
10744 else
10745 {
10746 if(_class->type == 2)
10747 {
10748 unsigned int value;
10749
10750 GetUInt(exp->member.exp, &value);
10751 switch(type->kind)
10752 {
10753 case 8:
10754 {
10755 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10756
10757 if(_class->type == 1)
10758 {
10759 void (* Get)(unsigned int, void *) = (void *)prop->Get;
10760
10761 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10762 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10763 exp->instance->_class = MkSpecifierName(_class->fullName);
10764 exp->instance->loc = exp->loc;
10765 exp->type = 1;
10766 Get(value, exp->instance->data);
10767 PopulateInstance(exp->instance);
10768 }
10769 else if(_class->type == 2)
10770 {
10771 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10772 uint64 bits = Get(value);
10773
10774 exp->constant = PrintHexUInt64(bits);
10775 exp->type = 2;
10776 }
10777 break;
10778 }
10779 }
10780 }
10781 else if(_class->type == 1)
10782 {
10783 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10784
10785 switch(type->kind)
10786 {
10787 case 8:
10788 {
10789 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10790
10791 if(_class->type == 1 && value)
10792 {
10793 void (* Get)(void *, void *) = (void *)prop->Get;
10794
10795 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10796 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10797 exp->instance->_class = MkSpecifierName(_class->fullName);
10798 exp->instance->loc = exp->loc;
10799 exp->type = 1;
10800 Get(value, exp->instance->data);
10801 PopulateInstance(exp->instance);
10802 }
10803 break;
10804 }
10805 }
10806 }
10807 }
10808 }
10809 }
10810 else
10811 {
10812 exp->isConstant = 0x0;
10813 }
10814 }
10815 else if(member)
10816 {
10817 }
10818 }
10819 if(exp->type != 8)
10820 {
10821 FreeExpression(memberExp);
10822 FreeIdentifier(memberID);
10823 }
10824 break;
10825 }
10826 case 10:
10827 {
10828 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10829
10830 FreeExpContents(exp);
10831 exp->constant = PrintUInt(ComputeTypeSize(type));
10832 exp->type = 2;
10833 FreeType(type);
10834 break;
10835 }
10836 case 15:
10837 {
10838 struct Symbol * classSym = exp->_class->symbol;
10839
10840 if(classSym && classSym->registered)
10841 {
10842 if(classSym->registered->fixed)
10843 {
10844 FreeSpecifier(exp->_class);
10845 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10846 exp->type = 2;
10847 }
10848 else
10849 {
10850 char className[1024];
10851
10852 strcpy(className, "__ecereClass_");
10853 FullClassNameCat(className, classSym->string, 0x1);
10854 MangleClassName(className);
10855 FreeExpContents(exp);
10856 exp->type = 9;
10857 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10858 exp->member.member = MkIdentifier("structSize");
10859 }
10860 }
10861 break;
10862 }
10863 case 11:
10864 {
10865 struct Type * type;
10866 struct Expression * e = exp;
10867
10868 if(exp->type == 11)
10869 {
10870 if(exp->cast.exp)
10871 ComputeExpression(exp->cast.exp);
10872 e = exp->cast.exp;
10873 }
10874 if(e && exp->expType)
10875 {
10876 type = exp->expType;
10877 if(type->kind == 8)
10878 {
10879 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10880
10881 if(_class && (_class->type == 3 || _class->type == 2))
10882 {
10883 if(!_class->dataType)
10884 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10885 type = _class->dataType;
10886 }
10887 }
10888 switch(type->kind)
10889 {
10890 case 1:
10891 if(type->isSigned)
10892 {
10893 char value;
10894
10895 GetChar(e, &value);
10896 FreeExpContents(exp);
10897 exp->constant = PrintChar(value);
10898 exp->type = 2;
10899 }
10900 else
10901 {
10902 unsigned char value;
10903
10904 GetUChar(e, &value);
10905 FreeExpContents(exp);
10906 exp->constant = PrintUChar(value);
10907 exp->type = 2;
10908 }
10909 break;
10910 case 2:
10911 if(type->isSigned)
10912 {
10913 short value;
10914
10915 GetShort(e, &value);
10916 FreeExpContents(exp);
10917 exp->constant = PrintShort(value);
10918 exp->type = 2;
10919 }
10920 else
10921 {
10922 unsigned short value;
10923
10924 GetUShort(e, &value);
10925 FreeExpContents(exp);
10926 exp->constant = PrintUShort(value);
10927 exp->type = 2;
10928 }
10929 break;
10930 case 3:
10931 if(type->isSigned)
10932 {
10933 int value;
10934
10935 GetInt(e, &value);
10936 FreeExpContents(exp);
10937 exp->constant = PrintInt(value);
10938 exp->type = 2;
10939 }
10940 else
10941 {
10942 unsigned int value;
10943
10944 GetUInt(e, &value);
10945 FreeExpContents(exp);
10946 exp->constant = PrintUInt(value);
10947 exp->type = 2;
10948 }
10949 break;
10950 case 4:
10951 if(type->isSigned)
10952 {
10953 long long value;
10954
10955 GetInt64(e, &value);
10956 FreeExpContents(exp);
10957 exp->constant = PrintInt64(value);
10958 exp->type = 2;
10959 }
10960 else
10961 {
10962 uint64 value;
10963
10964 GetUInt64(e, &value);
10965 FreeExpContents(exp);
10966 exp->constant = PrintUInt64(value);
10967 exp->type = 2;
10968 }
10969 break;
10970 case 22:
10971 if(type->isSigned)
10972 {
10973 intptr_t value;
10974
10975 GetIntPtr(e, &value);
10976 FreeExpContents(exp);
10977 exp->constant = PrintInt64((long long)value);
10978 exp->type = 2;
10979 }
10980 else
10981 {
10982 uintptr_t value;
10983
10984 GetUIntPtr(e, &value);
10985 FreeExpContents(exp);
10986 exp->constant = PrintUInt64((uint64)value);
10987 exp->type = 2;
10988 }
10989 break;
10990 case 23:
10991 if(type->isSigned)
10992 {
10993 ssize_t value;
10994
10995 GetIntSize(e, &value);
10996 FreeExpContents(exp);
10997 exp->constant = PrintInt64((long long)value);
10998 exp->type = 2;
10999 }
11000 else
11001 {
11002 size_t value;
11003
11004 GetUIntSize(e, &value);
11005 FreeExpContents(exp);
11006 exp->constant = PrintUInt64((uint64)value);
11007 exp->type = 2;
11008 }
11009 break;
11010 case 6:
11011 {
11012 float value;
11013
11014 GetFloat(e, &value);
11015 FreeExpContents(exp);
11016 exp->constant = PrintFloat(value);
11017 exp->type = 2;
11018 break;
11019 }
11020 case 7:
11021 {
11022 double value;
11023
11024 GetDouble(e, &value);
11025 FreeExpContents(exp);
11026 exp->constant = PrintDouble(value);
11027 exp->type = 2;
11028 break;
11029 }
11030 }
11031 }
11032 break;
11033 }
11034 case 12:
11035 {
11036 struct Operand op1 = 
11037 {
11038 0, 0, 0, 0, 
11039 {
11040 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11041 }
11042 };
11043 struct Operand op2 = 
11044 {
11045 0, 0, 0, 0, 
11046 {
11047 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11048 }
11049 };
11050 struct Operand op3 = 
11051 {
11052 0, 0, 0, 0, 
11053 {
11054 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11055 }
11056 };
11057
11058 if(exp->cond.exp)
11059 ComputeExpression((*exp->cond.exp).last);
11060 if(exp->cond.elseExp)
11061 ComputeExpression(exp->cond.elseExp);
11062 if(exp->cond.cond)
11063 ComputeExpression(exp->cond.cond);
11064 op1 = GetOperand(exp->cond.cond);
11065 if(op1.type)
11066 op1.type->refCount++;
11067 op2 = GetOperand((*exp->cond.exp).last);
11068 if(op2.type)
11069 op2.type->refCount++;
11070 op3 = GetOperand(exp->cond.elseExp);
11071 if(op3.type)
11072 op3.type->refCount++;
11073 if(op1.ops.Cond)
11074 {
11075 FreeExpContents(exp);
11076 op1.ops.Cond(exp, &op1, &op2, &op3);
11077 }
11078 if(op1.type)
11079 FreeType(op1.type);
11080 if(op2.type)
11081 FreeType(op2.type);
11082 if(op3.type)
11083 FreeType(op3.type);
11084 break;
11085 }
11086 }
11087 }
11088
11089 void ApplyAnyObjectLogic(struct Expression * e);
11090
11091 extern void CopyTypeInto(struct Type * type, struct Type * src);
11092
11093 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
11094 {
11095 unsigned int result = 0x1;
11096
11097 if(destType)
11098 {
11099 struct __ecereNameSpace__ecere__sys__OldList converts = 
11100 {
11101 0, 0, 0, 0, 0
11102 };
11103 struct Conversion * convert;
11104
11105 if(destType->kind == 0)
11106 return 0x0;
11107 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
11108 result = 0x0;
11109 if(converts.count)
11110 {
11111 for(convert = converts.first; convert; convert = convert->next)
11112 {
11113 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
11114
11115 if(!empty)
11116 {
11117 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11118 int objectType = exp->expType ? exp->expType->classObjectType : 0;
11119
11120 *newExp = *exp;
11121 newExp->destType = (((void *)0));
11122 if(convert->isGet)
11123 {
11124 exp->type = 8;
11125 exp->addedThis = 0x1;
11126 exp->member.exp = newExp;
11127 FreeType(exp->member.exp->expType);
11128 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
11129 exp->member.exp->expType->classObjectType = objectType;
11130 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
11131 exp->member.memberType = 1;
11132 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11133 exp->needCast = 0x1;
11134 if(exp->expType)
11135 exp->expType->refCount++;
11136 ApplyAnyObjectLogic(exp->member.exp);
11137 }
11138 else
11139 {
11140 {
11141 exp->type = 8;
11142 exp->addedThis = 0x1;
11143 exp->member.exp = newExp;
11144 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
11145 {
11146 newExp->byReference = 0x1;
11147 }
11148 FreeType(exp->member.exp->expType);
11149 exp->member.exp->expType = (((void *)0));
11150 if(convert->convert->dataType)
11151 {
11152 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11153 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
11154 exp->member.exp->expType->refCount = 1;
11155 exp->member.exp->expType->classObjectType = objectType;
11156 ApplyAnyObjectLogic(exp->member.exp);
11157 }
11158 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
11159 exp->member.memberType = 4;
11160 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11161 exp->needCast = 0x1;
11162 if(convert->resultType)
11163 convert->resultType->refCount++;
11164 }
11165 }
11166 }
11167 else
11168 {
11169 FreeType(exp->expType);
11170 if(convert->isGet)
11171 {
11172 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11173 exp->needCast = 0x1;
11174 if(exp->expType)
11175 exp->expType->refCount++;
11176 }
11177 else
11178 {
11179 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11180 exp->needCast = 0x1;
11181 if(convert->resultType)
11182 convert->resultType->refCount++;
11183 }
11184 }
11185 }
11186 if(exp->isConstant && inCompiler)
11187 ComputeExpression(exp);
11188 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
11189 }
11190 if(!result && exp->expType && converts.count)
11191 {
11192 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
11193 }
11194 if(!result && exp->expType && exp->destType)
11195 {
11196 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))
11197 result = 0x1;
11198 }
11199 }
11200 return result;
11201 }
11202
11203 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
11204
11205 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
11206
11207 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
11208
11209 void CheckTemplateTypes(struct Expression * exp)
11210 {
11211 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
11212 {
11213 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11214 struct Statement * compound;
11215 struct Context * context;
11216
11217 *newExp = *exp;
11218 if(exp->destType)
11219 exp->destType->refCount++;
11220 if(exp->expType)
11221 exp->expType->refCount++;
11222 newExp->prev = (((void *)0));
11223 newExp->next = (((void *)0));
11224 switch(exp->expType->kind)
11225 {
11226 case 7:
11227 if(exp->destType->classObjectType)
11228 {
11229 if(exp->destType)
11230 exp->destType->refCount--;
11231 if(exp->expType)
11232 exp->expType->refCount--;
11233 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11234 }
11235 else
11236 {
11237 struct __ecereNameSpace__ecere__sys__OldList * specs;
11238 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11239 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11240
11241 context = PushContext();
11242 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11243 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11244 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11245 exp->type = 25;
11246 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11247 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
11248 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
11249 exp->compound->compound.context = context;
11250 PopContext(context);
11251 }
11252 break;
11253 default:
11254 exp->type = 11;
11255 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
11256 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11257 break;
11258 }
11259 }
11260 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
11261 {
11262 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11263 struct Statement * compound;
11264 struct Context * context;
11265
11266 *newExp = *exp;
11267 if(exp->destType)
11268 exp->destType->refCount++;
11269 if(exp->expType)
11270 exp->expType->refCount++;
11271 newExp->prev = (((void *)0));
11272 newExp->next = (((void *)0));
11273 switch(exp->expType->kind)
11274 {
11275 case 7:
11276 if(exp->destType->classObjectType)
11277 {
11278 if(exp->destType)
11279 exp->destType->refCount--;
11280 if(exp->expType)
11281 exp->expType->refCount--;
11282 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11283 }
11284 else
11285 {
11286 struct __ecereNameSpace__ecere__sys__OldList * specs;
11287 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11288 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11289
11290 context = PushContext();
11291 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11292 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11293 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11294 exp->type = 25;
11295 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11296 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
11297 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
11298 exp->compound->compound.context = context;
11299 PopContext(context);
11300 }
11301 break;
11302 case 8:
11303 {
11304 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
11305 {
11306 exp->type = 5;
11307 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
11308 ProcessExpressionType((*exp->list).first);
11309 break;
11310 }
11311 else
11312 {
11313 exp->type = 5;
11314 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
11315 newExp->needCast = 0x1;
11316 ProcessExpressionType((*exp->list).first);
11317 break;
11318 }
11319 }
11320 default:
11321 {
11322 if(exp->expType->kind == 20)
11323 {
11324 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
11325
11326 if(type)
11327 {
11328 FreeType(exp->destType);
11329 FreeType(exp->expType);
11330 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11331 break;
11332 }
11333 }
11334 if(newExp->type == 8 && newExp->member.memberType == 3)
11335 {
11336 exp->type = 4;
11337 exp->op.op = '*';
11338 exp->op.exp1 = (((void *)0));
11339 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
11340 }
11341 else
11342 {
11343 char typeString[1024];
11344 struct Declarator * decl;
11345 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11346
11347 typeString[0] = '\0';
11348 PrintType(exp->expType, typeString, 0x0, 0x0);
11349 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11350 exp->type = 11;
11351 exp->cast.typeName = MkTypeName(specs, decl);
11352 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11353 exp->cast.exp->needCast = 0x1;
11354 }
11355 break;
11356 }
11357 }
11358 }
11359 }
11360
11361 extern int strncmp(const char * , const char * , size_t n);
11362
11363 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
11364
11365 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
11366 {
11367 int nsLen = strlen(nameSpace);
11368 struct Symbol * symbol;
11369
11370 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)))
11371 {
11372 char * s = symbol->string;
11373
11374 if(!strncmp(s, nameSpace, nsLen))
11375 {
11376 int c;
11377 char * namePart;
11378
11379 for(c = strlen(s) - 1; c >= 0; c--)
11380 if(s[c] == ':')
11381 break;
11382 namePart = s + c + 1;
11383 if(!strcmp(namePart, name))
11384 {
11385 return symbol;
11386 }
11387 }
11388 else
11389 break;
11390 }
11391 return (((void *)0));
11392 }
11393
11394 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
11395 {
11396 int c;
11397 char nameSpace[1024];
11398 char * namePart;
11399 unsigned int gotColon = 0x0;
11400
11401 nameSpace[0] = '\0';
11402 for(c = strlen(name) - 1; c >= 0; c--)
11403 if(name[c] == ':')
11404 {
11405 gotColon = 0x1;
11406 break;
11407 }
11408 namePart = name + c + 1;
11409 while(c >= 0 && name[c] == ':')
11410 c--;
11411 if(c >= 0)
11412 {
11413 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
11414
11415 if(symbol)
11416 return symbol;
11417 memcpy(nameSpace, name, c + 1);
11418 nameSpace[c + 1] = (char)0;
11419 return ScanWithNameSpace(tree, nameSpace, namePart);
11420 }
11421 else if(gotColon)
11422 {
11423 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11424
11425 return symbol;
11426 }
11427 else
11428 {
11429 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11430
11431 if(symbol)
11432 return symbol;
11433 return ScanWithNameSpace(tree, "", namePart);
11434 }
11435 return (((void *)0));
11436 }
11437
11438 static void ProcessDeclaration(struct Declaration * decl);
11439
11440 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
11441 {
11442 struct Context * ctx;
11443 struct Symbol * symbol = (((void *)0));
11444
11445 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
11446 {
11447 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
11448 {
11449 symbol = (((void *)0));
11450 if(thisNameSpace)
11451 {
11452 char curName[1024];
11453
11454 strcpy(curName, thisNameSpace);
11455 strcat(curName, "::");
11456 strcat(curName, name);
11457 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
11458 }
11459 if(!symbol)
11460 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
11461 }
11462 else
11463 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
11464 if(symbol || ctx == endContext)
11465 break;
11466 }
11467 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
11468 {
11469 if(symbol->pointerExternal->type == 0)
11470 {
11471 struct FunctionDefinition * function = symbol->pointerExternal->function;
11472 struct Context * tmpContext = curContext;
11473
11474 curContext = (((void *)0));
11475 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
11476 curContext = tmpContext;
11477 symbol->pointerExternal->symbol = symbol;
11478 DeclareType(symbol->type, 0x1, 0x1);
11479 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
11480 symbol->id = curExternal->symbol->idCode;
11481 }
11482 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
11483 {
11484 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
11485 symbol->id = curExternal->symbol->idCode;
11486 }
11487 }
11488 return symbol;
11489 }
11490
11491 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
11492 {
11493 if(!type->isSigned && type->kind != 22 && type->kind != 23)
11494 ListAdd(specs, MkSpecifier(UNSIGNED));
11495 switch(type->kind)
11496 {
11497 case 8:
11498 {
11499 if(type->_class->registered)
11500 {
11501 if(!type->_class->registered->dataType)
11502 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11503 GetTypeSpecs(type->_class->registered->dataType, specs);
11504 }
11505 break;
11506 }
11507 case 7:
11508 ListAdd(specs, MkSpecifier(DOUBLE));
11509 break;
11510 case 6:
11511 ListAdd(specs, MkSpecifier(FLOAT));
11512 break;
11513 case 1:
11514 ListAdd(specs, MkSpecifier(CHAR));
11515 break;
11516 case 2:
11517 ListAdd(specs, MkSpecifier(SHORT));
11518 break;
11519 case 4:
11520 ListAdd(specs, MkSpecifier(INT64));
11521 break;
11522 case 22:
11523 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
11524 break;
11525 case 23:
11526 ListAdd(specs, MkSpecifierName(type->isSigned ? "intsize" : "uintsize"));
11527 break;
11528 case 3:
11529 default:
11530 ListAdd(specs, MkSpecifier(INT));
11531 break;
11532 }
11533 }
11534
11535 static void PrintArraySize(struct Type * arrayType, char * string)
11536 {
11537 char size[256];
11538
11539 size[0] = '\0';
11540 strcat(size, "[");
11541 if(arrayType->enumClass)
11542 strcat(size, arrayType->enumClass->string);
11543 else if(arrayType->arraySizeExp)
11544 PrintExpression(arrayType->arraySizeExp, size);
11545 strcat(size, "]");
11546 strcat(string, size);
11547 }
11548
11549 static void PrintTypeSpecs(struct Type * type, char * string, unsigned int fullName, unsigned int printConst)
11550 {
11551 if(type)
11552 {
11553 if(printConst && type->constant)
11554 strcat(string, "const ");
11555 switch(type->kind)
11556 {
11557 case 8:
11558 {
11559 struct Symbol * c = type->_class;
11560
11561 if(type->classObjectType == 2)
11562 strcat(string, "typed_object");
11563 else if(type->classObjectType == 3)
11564 strcat(string, "any_object");
11565 else
11566 {
11567 if(c && c->string)
11568 strcat(string, (fullName || !c->registered) ? c->string : c->registered->name);
11569 }
11570 if(type->byReference)
11571 strcat(string, " &");
11572 break;
11573 }
11574 case 0:
11575 strcat(string, "void");
11576 break;
11577 case 3:
11578 strcat(string, type->isSigned ? "int" : "uint");
11579 break;
11580 case 4:
11581 strcat(string, type->isSigned ? "int64" : "uint64");
11582 break;
11583 case 22:
11584 strcat(string, type->isSigned ? "intptr" : "uintptr");
11585 break;
11586 case 23:
11587 strcat(string, type->isSigned ? "intsize" : "uintsize");
11588 break;
11589 case 1:
11590 strcat(string, type->isSigned ? "char" : "byte");
11591 break;
11592 case 2:
11593 strcat(string, type->isSigned ? "short" : "uint16");
11594 break;
11595 case 6:
11596 strcat(string, "float");
11597 break;
11598 case 7:
11599 strcat(string, "double");
11600 break;
11601 case 9:
11602 if(type->enumName)
11603 {
11604 strcat(string, "struct ");
11605 strcat(string, type->enumName);
11606 }
11607 else if(type->typeName)
11608 strcat(string, type->typeName);
11609 else
11610 {
11611 struct Type * member;
11612
11613 strcat(string, "struct { ");
11614 for(member = type->members.first; member; member = member->next)
11615 {
11616 PrintType(member, string, 0x1, fullName);
11617 strcat(string, "; ");
11618 }
11619 strcat(string, "}");
11620 }
11621 break;
11622 case 10:
11623 if(type->enumName)
11624 {
11625 strcat(string, "union ");
11626 strcat(string, type->enumName);
11627 }
11628 else if(type->typeName)
11629 strcat(string, type->typeName);
11630 else
11631 {
11632 strcat(string, "union ");
11633 strcat(string, "(unnamed)");
11634 }
11635 break;
11636 case 15:
11637 if(type->enumName)
11638 {
11639 strcat(string, "enum ");
11640 strcat(string, type->enumName);
11641 }
11642 else if(type->typeName)
11643 strcat(string, type->typeName);
11644 else
11645 strcat(string, "int");
11646 break;
11647 case 14:
11648 strcat(string, "...");
11649 break;
11650 case 19:
11651 strcat(string, "subclass(");
11652 strcat(string, type->_class ? type->_class->string : "int");
11653 strcat(string, ")");
11654 break;
11655 case 20:
11656 strcat(string, type->templateParameter->identifier->string);
11657 break;
11658 case 21:
11659 strcat(string, "thisclass");
11660 break;
11661 case 17:
11662 strcat(string, "__builtin_va_list");
11663 break;
11664 }
11665 }
11666 }
11667
11668 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
11669
11670 static void PrintName(struct Type * type, char * string, unsigned int fullName)
11671 {
11672 if(type->name && type->name[0])
11673 {
11674 if(fullName)
11675 strcat(string, type->name);
11676 else
11677 {
11678 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11679
11680 if(name)
11681 name += 2;
11682 else
11683 name = type->name;
11684 strcat(string, name);
11685 }
11686 }
11687 }
11688
11689 static void PrintAttribs(struct Type * type, char * string)
11690 {
11691 if(type)
11692 {
11693 if(type->dllExport)
11694 strcat(string, "dllexport ");
11695 if(type->attrStdcall)
11696 strcat(string, "stdcall ");
11697 }
11698 }
11699
11700 static void PrePrintType(struct Type * type, char * string, unsigned int fullName, struct Type * parentType, unsigned int printConst)
11701 {
11702 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
11703 {
11704 struct Type * attrType = (((void *)0));
11705
11706 if((type->kind == 11 || type->kind == 16) && (!parentType || parentType->kind != 13))
11707 PrintAttribs(type, string);
11708 if(printConst && type->constant && (type->kind == 11 || type->kind == 16))
11709 strcat(string, " const");
11710 PrePrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName, type, printConst);
11711 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
11712 strcat(string, " (");
11713 if(type->kind == 13)
11714 {
11715 if(type->type->kind == 11 || type->type->kind == 16)
11716 PrintAttribs(type->type, string);
11717 }
11718 if(type->kind == 13)
11719 {
11720 if(type->type->kind == 11 || type->type->kind == 16 || type->type->kind == 12)
11721 strcat(string, "*");
11722 else
11723 strcat(string, " *");
11724 }
11725 if(printConst && type->constant && type->kind == 13)
11726 strcat(string, " const");
11727 }
11728 else
11729 PrintTypeSpecs(type, string, fullName, printConst);
11730 }
11731
11732 static void PostPrintType(struct Type * type, char * string, unsigned int fullName)
11733 {
11734 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
11735 strcat(string, ")");
11736 if(type->kind == 12)
11737 PrintArraySize(type, string);
11738 else if(type->kind == 11)
11739 {
11740 struct Type * param;
11741
11742 strcat(string, "(");
11743 for(param = type->params.first; param; param = param->next)
11744 {
11745 PrintType(param, string, 0x1, fullName);
11746 if(param->next)
11747 strcat(string, ", ");
11748 }
11749 strcat(string, ")");
11750 }
11751 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
11752 PostPrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName);
11753 }
11754
11755 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName, unsigned int printConst)
11756 {
11757 PrePrintType(type, string, fullName, (((void *)0)), printConst);
11758 if(type->thisClass || (printName && type->name && type->name[0]))
11759 strcat(string, " ");
11760 if((type->thisClass || type->staticMethod))
11761 {
11762 struct Symbol * _class = type->thisClass;
11763
11764 if((type->classObjectType == 2 || type->classObjectType == 1) || (_class && !strcmp(_class->string, "class")))
11765 {
11766 if(type->classObjectType == 1)
11767 strcat(string, "class");
11768 else
11769 strcat(string, type->byReference ? "typed_object&" : "typed_object");
11770 }
11771 else if(_class && _class->string)
11772 {
11773 char * s = _class->string;
11774
11775 if(fullName)
11776 strcat(string, s);
11777 else
11778 {
11779 char * name = __ecereNameSpace__ecere__sys__RSearchString(s, "::", strlen(s), 0x1, 0x0);
11780
11781 if(name)
11782 name += 2;
11783 else
11784 name = s;
11785 strcat(string, name);
11786 }
11787 }
11788 strcat(string, "::");
11789 }
11790 if(printName && type->name)
11791 PrintName(type, string, fullName);
11792 PostPrintType(type, string, fullName);
11793 if(type->bitFieldCount)
11794 {
11795 char count[100];
11796
11797 sprintf(count, ":%d", type->bitFieldCount);
11798 strcat(string, count);
11799 }
11800 }
11801
11802 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11803 {
11804 _PrintType(type, string, printName, fullName, 0x1);
11805 }
11806
11807 void PrintTypeNoConst(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11808 {
11809 _PrintType(type, string, printName, fullName, 0x0);
11810 }
11811
11812 static struct Type * FindMember(struct Type * type, char * string)
11813 {
11814 struct Type * memberType;
11815
11816 for(memberType = type->members.first; memberType; memberType = memberType->next)
11817 {
11818 if(!memberType->name)
11819 {
11820 struct Type * subType = FindMember(memberType, string);
11821
11822 if(subType)
11823 return subType;
11824 }
11825 else if(!strcmp(memberType->name, string))
11826 return memberType;
11827 }
11828 return (((void *)0));
11829 }
11830
11831 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11832 {
11833 struct Type * memberType;
11834
11835 for(memberType = type->members.first; memberType; memberType = memberType->next)
11836 {
11837 if(!memberType->name)
11838 {
11839 struct Type * subType = FindMember(memberType, string);
11840
11841 if(subType)
11842 {
11843 *offset += memberType->offset;
11844 return subType;
11845 }
11846 }
11847 else if(!strcmp(memberType->name, string))
11848 {
11849 *offset += memberType->offset;
11850 return memberType;
11851 }
11852 }
11853 return (((void *)0));
11854 }
11855
11856 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11857
11858 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11859
11860 struct Expression * ParseExpressionString(char * expression)
11861 {
11862 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11863 ((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));
11864 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11865 echoOn = 0x0;
11866 parsedExpression = (((void *)0));
11867 resetScanner();
11868 expression_yyparse();
11869 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11870 return parsedExpression;
11871 }
11872
11873 extern char *  QMkString(char *  source);
11874
11875 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11876 {
11877 struct Identifier * id = exp->identifier;
11878 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11879 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11880 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11881 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11882
11883 if(_class && _class->type == 4)
11884 {
11885 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11886 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11887
11888 if(enumClass)
11889 {
11890 struct __ecereNameSpace__ecere__com__Class * baseClass;
11891
11892 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11893 {
11894 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11895
11896 for(value = e->values.first; value; value = value->next)
11897 {
11898 if(!strcmp(value->name, id->string))
11899 break;
11900 }
11901 if(value)
11902 {
11903 char constant[256];
11904
11905 FreeExpContents(exp);
11906 exp->type = 2;
11907 exp->isConstant = 0x1;
11908 if(!strcmp(baseClass->dataTypeString, "int"))
11909 sprintf(constant, "%d", (int)value->data);
11910 else
11911 sprintf(constant, "0x%X", (int)value->data);
11912 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11913 exp->expType = MkClassType(baseClass->fullName);
11914 break;
11915 }
11916 }
11917 }
11918 if(value)
11919 return 0x1;
11920 }
11921 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11922 {
11923 ProcessMethodType(method);
11924 exp->expType = __extension__ ({
11925 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11926
11927 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), __ecereInstance1;
11928 });
11929 return 0x1;
11930 }
11931 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11932 {
11933 if(!prop->dataType)
11934 ProcessPropertyType(prop);
11935 exp->expType = prop->dataType;
11936 if(prop->dataType)
11937 prop->dataType->refCount++;
11938 return 0x1;
11939 }
11940 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11941 {
11942 if(!member->dataType)
11943 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11944 exp->expType = member->dataType;
11945 if(member->dataType)
11946 member->dataType->refCount++;
11947 return 0x1;
11948 }
11949 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11950 {
11951 if(!classProp->dataType)
11952 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11953 if(classProp->constant)
11954 {
11955 FreeExpContents(exp);
11956 exp->isConstant = 0x1;
11957 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
11958 {
11959 exp->type = 3;
11960 exp->constant = QMkString((char *)classProp->Get(_class));
11961 }
11962 else
11963 {
11964 char constant[256];
11965
11966 exp->type = 2;
11967 sprintf(constant, "%d", (int)classProp->Get(_class));
11968 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11969 }
11970 }
11971 else
11972 {
11973 }
11974 exp->expType = classProp->dataType;
11975 if(classProp->dataType)
11976 classProp->dataType->refCount++;
11977 return 0x1;
11978 }
11979 return 0x0;
11980 }
11981
11982 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
11983 {
11984 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
11985 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
11986 struct __ecereNameSpace__ecere__com__NameSpace * child;
11987
11988 if(!data)
11989 {
11990 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)))
11991 {
11992 data = ScanGlobalData(child, name);
11993 if(data)
11994 break;
11995 }
11996 }
11997 return data;
11998 }
11999
12000 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
12001
12002 extern char *  strncpy(char * , const char * , size_t n);
12003
12004 static struct GlobalData * FindGlobalData(char * name)
12005 {
12006 int start = 0, c;
12007 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
12008
12009 nameSpace = globalData;
12010 for(c = 0; name[c]; c++)
12011 {
12012 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
12013 {
12014 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
12015 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
12016
12017 strncpy(spaceName, name + start, c - start);
12018 spaceName[c - start] = '\0';
12019 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
12020 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
12021 if(!newSpace)
12022 return (((void *)0));
12023 nameSpace = newSpace;
12024 if(name[c] == ':')
12025 c++;
12026 start = c + 1;
12027 }
12028 }
12029 if(c - start)
12030 {
12031 return ScanGlobalData(nameSpace, name + start);
12032 }
12033 return (((void *)0));
12034 }
12035
12036 static int definedExpStackPos;
12037
12038 static void * definedExpStack[512];
12039
12040 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
12041 {
12042 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
12043
12044 FreeExpContents(checkedExp);
12045 FreeType(checkedExp->expType);
12046 FreeType(checkedExp->destType);
12047 *checkedExp = *newExp;
12048 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12049 checkedExp->prev = prev;
12050 checkedExp->next = next;
12051 }
12052
12053 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
12054
12055 extern int printf(char * , ...);
12056
12057 void __ecereMethod_Expression_Clear();
12058
12059 void ApplyAnyObjectLogic(struct Expression * e)
12060 {
12061 struct Type * destType = e->destType;
12062
12063 if(destType && (destType->classObjectType == 3))
12064 {
12065 if(e && e->expType)
12066 {
12067 struct Type * type = e->expType;
12068 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
12069
12070 if(type->kind == 8 && type->_class && type->_class->registered)
12071 {
12072 _class = type->_class->registered;
12073 }
12074 else if(type->kind == 19)
12075 {
12076 _class = FindClass("ecere::com::Class")->registered;
12077 }
12078 else
12079 {
12080 char string[1024] = "";
12081 struct Symbol * classSym;
12082
12083 PrintTypeNoConst(type, string, 0x0, 0x1);
12084 classSym = FindClass(string);
12085 if(classSym)
12086 _class = classSym->registered;
12087 }
12088 if((_class && (_class->type == 4 || _class->type == 3 || _class->type == 2 || _class->type == 1000) && strcmp(_class->fullName, "class") && strcmp(_class->fullName, "uintptr") && strcmp(_class->fullName, "intptr")) || (!e->expType->classObjectType && (((type->kind != 13 && type->kind != 22 && type->kind != 19 && (type->kind != 8 || !type->_class || !type->_class->registered || type->_class->registered->type == 1))) || destType->byReference)))
12089 {
12090 if(!_class || strcmp(_class->fullName, "char *"))
12091 {
12092 struct Expression * checkedExp = e, * newExp;
12093
12094 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12095 {
12096 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12097 {
12098 if(checkedExp->type == 25)
12099 {
12100 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12101 }
12102 else
12103 checkedExp = (*checkedExp->list).last;
12104 }
12105 else if(checkedExp->type == 11)
12106 checkedExp = checkedExp->cast.exp;
12107 }
12108 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
12109 {
12110 newExp = checkedExp->op.exp2;
12111 checkedExp->op.exp2 = (((void *)0));
12112 FreeExpContents(checkedExp);
12113 if(e->expType && e->expType->passAsTemplate)
12114 {
12115 char size[100];
12116
12117 ComputeTypeSize(e->expType);
12118 sprintf(size, "%d", e->expType->size);
12119 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))))));
12120 }
12121 ReplaceExpContents(checkedExp, newExp);
12122 e->byReference = 0x1;
12123 }
12124 else if(!e->byReference || (_class && _class->type == 5))
12125 {
12126 struct Expression * checkedExp, * newExp;
12127
12128 {
12129 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;
12130
12131 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
12132 {
12133 struct Context * context = PushContext();
12134 struct Declarator * decl;
12135 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12136 char typeString[1024];
12137 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12138
12139 typeString[0] = '\0';
12140 *newExp = *e;
12141 newExp->prev = (((void *)0));
12142 newExp->next = (((void *)0));
12143 newExp->expType = (((void *)0));
12144 PrintTypeNoConst(e->expType, typeString, 0x0, 0x1);
12145 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12146 newExp->destType = ProcessType(specs, decl);
12147 curContext = context;
12148 if(curCompound)
12149 {
12150 char name[100];
12151 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
12152
12153 e->type = 25;
12154 sprintf(name, "__internalValue%03X", internalValueCounter++);
12155 if(!curCompound->compound.declarations)
12156 curCompound->compound.declarations = MkList();
12157 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
12158 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
12159 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
12160 e->compound = MkCompoundStmt((((void *)0)), stmts);
12161 }
12162 else
12163 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
12164 {
12165 struct Type * type = e->destType;
12166
12167 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12168 CopyTypeInto(e->destType, type);
12169 e->destType->refCount = 1;
12170 e->destType->classObjectType = 0;
12171 FreeType(type);
12172 }
12173 e->compound->compound.context = context;
12174 PopContext(context);
12175 curContext = context->parent;
12176 }
12177 }
12178 checkedExp = e;
12179 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12180 {
12181 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12182 {
12183 if(checkedExp->type == 25)
12184 {
12185 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12186 }
12187 else
12188 checkedExp = (*checkedExp->list).last;
12189 }
12190 else if(checkedExp->type == 11)
12191 checkedExp = checkedExp->cast.exp;
12192 }
12193 {
12194 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12195
12196 *operand = *checkedExp;
12197 checkedExp->destType = (((void *)0));
12198 checkedExp->expType = (((void *)0));
12199 __ecereMethod_Expression_Clear(checkedExp);
12200 checkedExp->type = 4;
12201 checkedExp->op.op = '&';
12202 checkedExp->op.exp1 = (((void *)0));
12203 checkedExp->op.exp2 = operand;
12204 }
12205 }
12206 }
12207 }
12208 }
12209 }
12210 {
12211 }
12212 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))))
12213 {
12214 if(e->expType->classObjectType && destType && destType->classObjectType)
12215 {
12216 return ;
12217 }
12218 else
12219 {
12220 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12221
12222 *thisExp = *e;
12223 thisExp->prev = (((void *)0));
12224 thisExp->next = (((void *)0));
12225 __ecereMethod_Expression_Clear(e);
12226 e->type = 5;
12227 e->list = MkListOne(MkExpOp((((void *)0)), '*', thisExp->type == 0 ? thisExp : MkExpBrackets(MkListOne(thisExp))));
12228 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
12229 ((struct Expression *)(*e->list).first)->byReference = 0x1;
12230 {
12231 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12232 CopyTypeInto(e->expType, thisExp->expType);
12233 e->expType->byReference = 0x0;
12234 e->expType->refCount = 1;
12235 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))
12236 {
12237 e->expType->classObjectType = 0;
12238 }
12239 }
12240 }
12241 }
12242 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
12243 {
12244 if(destType->kind == 14)
12245 {
12246 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unspecified type\n", (((void *)0))));
12247 }
12248 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
12249 {
12250 unsigned int byReference = e->expType->byReference;
12251 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12252 struct Declarator * decl;
12253 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12254 char typeString[1024];
12255 struct Type * type;
12256 int backupClassObjectType;
12257 unsigned int backupByReference;
12258
12259 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
12260 type = e->expType;
12261 else
12262 type = destType;
12263 backupClassObjectType = type->classObjectType;
12264 backupByReference = type->byReference;
12265 type->classObjectType = 0;
12266 type->byReference = 0x0;
12267 typeString[0] = '\0';
12268 PrintType(type, typeString, 0x0, 0x1);
12269 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12270 type->classObjectType = backupClassObjectType;
12271 type->byReference = backupByReference;
12272 *thisExp = *e;
12273 thisExp->prev = (((void *)0));
12274 thisExp->next = (((void *)0));
12275 __ecereMethod_Expression_Clear(e);
12276 if((type->kind == 8 && type->_class && type->_class->registered && (type->_class->registered->type == 1000 || type->_class->registered->type == 2 || type->_class->registered->type == 4 || type->_class->registered->type == 3)) || (type->kind != 13 && type->kind != 22 && type->kind != 12 && type->kind != 8) || (!destType->byReference && byReference && (destType->kind != 13 || type->kind != 13)))
12277 {
12278 e->type = 4;
12279 e->op.op = '*';
12280 e->op.exp1 = (((void *)0));
12281 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
12282 }
12283 else
12284 {
12285 e->type = 11;
12286 e->cast.typeName = MkTypeName(specs, decl);
12287 e->cast.exp = thisExp;
12288 e->byReference = 0x1;
12289 }
12290 e->expType = type;
12291 e->destType = destType;
12292 type->refCount++;
12293 destType->refCount++;
12294 }
12295 }
12296 }
12297
12298 extern char *  strstr(const char * , const char * );
12299
12300 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
12301
12302 struct __ecereNameSpace__ecere__com__DefinedExpression
12303 {
12304 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
12305 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
12306 char *  name;
12307 char *  value;
12308 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
12309 } __attribute__ ((gcc_struct));
12310
12311 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12312
12313 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12314
12315 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
12316
12317 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
12318
12319 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
12320
12321 extern struct Expression * CopyExpression(struct Expression * exp);
12322
12323 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
12324
12325 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
12326
12327 static void ProcessStatement(struct Statement * stmt);
12328
12329 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
12330
12331 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
12332
12333 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
12334
12335 extern char *  sourceFile;
12336
12337 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
12338
12339 void ProcessExpressionType(struct Expression * exp)
12340 {
12341 unsigned int unresolved = 0x0;
12342 struct Location oldyylloc = yylloc;
12343 unsigned int notByReference = 0x0;
12344
12345 if(!exp || exp->expType)
12346 return ;
12347 yylloc = exp->loc;
12348 switch(exp->type)
12349 {
12350 case 0:
12351 {
12352 struct Identifier * id = exp->identifier;
12353
12354 if(!id)
12355 return ;
12356 if(id->_class && id->_class->name)
12357 {
12358 id->classSym = id->_class->symbol;
12359 }
12360 if(strstr(id->string, "__ecereClass") == id->string)
12361 {
12362 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
12363 break;
12364 }
12365 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
12366 {
12367 ReplaceClassMembers(exp, thisClass);
12368 if(exp->type != 0)
12369 {
12370 ProcessExpressionType(exp);
12371 break;
12372 }
12373 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
12374 break;
12375 }
12376 else
12377 {
12378 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12379
12380 if(!symbol)
12381 {
12382 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
12383 break;
12384 else
12385 {
12386 if(thisClass)
12387 {
12388 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
12389 if(exp->type != 0)
12390 {
12391 ProcessExpressionType(exp);
12392 break;
12393 }
12394 }
12395 else if(currentClass && !id->_class)
12396 {
12397 if(ResolveIdWithClass(exp, currentClass, 0x1))
12398 break;
12399 }
12400 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12401 }
12402 }
12403 if(symbol)
12404 {
12405 struct Type * type = symbol->type;
12406 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
12407
12408 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
12409 {
12410 struct Context * context = SetupTemplatesContext(_class);
12411
12412 type = ReplaceThisClassType(_class);
12413 FinishTemplatesContext(context);
12414 if(type)
12415 type->refCount = 0;
12416 }
12417 FreeSpecifier(id->_class);
12418 id->_class = (((void *)0));
12419 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12420 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
12421 id->classSym = (((void *)0));
12422 exp->expType = type;
12423 if(type)
12424 type->refCount++;
12425 if(type && (type->kind == 15 || (_class && _class->type == 4)))
12426 exp->isConstant = 0x1;
12427 if(symbol->isParam || !strcmp(id->string, "this"))
12428 {
12429 if(_class && _class->type == 1 && !type->declaredWithStruct)
12430 exp->byReference = 0x1;
12431 }
12432 if(symbol->isIterator)
12433 {
12434 if(symbol->isIterator == 3)
12435 {
12436 exp->type = 5;
12437 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
12438 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
12439 exp->expType = (((void *)0));
12440 ProcessExpressionType(exp);
12441 }
12442 else if(symbol->isIterator != 4)
12443 {
12444 exp->type = 8;
12445 exp->member.exp = MkExpIdentifier(exp->identifier);
12446 exp->member.exp->expType = exp->expType;
12447 exp->member.member = MkIdentifier("data");
12448 exp->expType = (((void *)0));
12449 ProcessExpressionType(exp);
12450 }
12451 }
12452 break;
12453 }
12454 else
12455 {
12456 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
12457
12458 if(thisNameSpace && !(id->_class && !id->_class->name))
12459 {
12460 char name[1024];
12461
12462 strcpy(name, thisNameSpace);
12463 strcat(name, "::");
12464 strcat(name, id->string);
12465 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
12466 }
12467 if(!definedExp)
12468 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
12469 if(definedExp)
12470 {
12471 int c;
12472
12473 for(c = 0; c < definedExpStackPos; c++)
12474 if(definedExpStack[c] == definedExp)
12475 break;
12476 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
12477 {
12478 struct Location backupYylloc = yylloc;
12479
12480 definedExpStack[definedExpStackPos++] = definedExp;
12481 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
12482 ((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));
12483 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
12484 echoOn = 0x0;
12485 parsedExpression = (((void *)0));
12486 resetScanner();
12487 expression_yyparse();
12488 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
12489 yylloc = backupYylloc;
12490 if(parsedExpression)
12491 {
12492 FreeIdentifier(id);
12493 exp->type = 5;
12494 exp->list = MkListOne(parsedExpression);
12495 parsedExpression->loc = yylloc;
12496 ProcessExpressionType(exp);
12497 definedExpStackPos--;
12498 return ;
12499 }
12500 definedExpStackPos--;
12501 }
12502 else
12503 {
12504 if(inCompiler)
12505 {
12506 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
12507 }
12508 }
12509 }
12510 else
12511 {
12512 struct GlobalData * data = (((void *)0));
12513
12514 if(thisNameSpace && !(id->_class && !id->_class->name))
12515 {
12516 char name[1024];
12517
12518 strcpy(name, thisNameSpace);
12519 strcat(name, "::");
12520 strcat(name, id->string);
12521 data = FindGlobalData(name);
12522 }
12523 if(!data)
12524 data = FindGlobalData(id->string);
12525 if(data)
12526 {
12527 DeclareGlobalData(data);
12528 exp->expType = data->dataType;
12529 if(data->dataType)
12530 data->dataType->refCount++;
12531 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12532 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12533 FreeSpecifier(id->_class);
12534 id->_class = (((void *)0));
12535 break;
12536 }
12537 else
12538 {
12539 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
12540
12541 if(thisNameSpace && !(id->_class && !id->_class->name))
12542 {
12543 char name[1024];
12544
12545 strcpy(name, thisNameSpace);
12546 strcat(name, "::");
12547 strcat(name, id->string);
12548 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12549 }
12550 if(!function)
12551 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12552 if(function)
12553 {
12554 char name[1024];
12555
12556 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12557 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12558 name[0] = (char)0;
12559 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12560 strcpy(name, "__ecereFunction_");
12561 FullClassNameCat(name, id->string, 0x0);
12562 if(DeclareFunction(function, name))
12563 {
12564 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12565 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12566 }
12567 exp->expType = function->dataType;
12568 if(function->dataType)
12569 function->dataType->refCount++;
12570 FreeSpecifier(id->_class);
12571 id->_class = (((void *)0));
12572 break;
12573 }
12574 }
12575 }
12576 }
12577 }
12578 unresolved = 0x1;
12579 break;
12580 }
12581 case 1:
12582 {
12583 struct __ecereNameSpace__ecere__com__Class * _class;
12584
12585 if(!exp->instance->_class)
12586 {
12587 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12588 {
12589 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12590 }
12591 }
12592 ProcessInstantiationType(exp->instance);
12593 exp->isConstant = exp->instance->isConstant;
12594 if(exp->instance->_class)
12595 {
12596 exp->expType = MkClassType(exp->instance->_class->name);
12597 }
12598 break;
12599 }
12600 case 2:
12601 {
12602 if(!exp->expType)
12603 {
12604 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12605
12606 exp->expType = type;
12607 if(exp->constant[0] == '\'')
12608 {
12609 if((int)((unsigned char *)exp->constant)[1] > 127)
12610 {
12611 int nb;
12612 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12613
12614 if(nb < 2)
12615 ch = exp->constant[1];
12616 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12617 exp->constant = PrintUInt(ch);
12618 type->kind = 8;
12619 type->_class = FindClass("unichar");
12620 type->isSigned = 0x0;
12621 }
12622 else
12623 {
12624 type->kind = 1;
12625 type->isSigned = 0x1;
12626 }
12627 }
12628 else if(strchr(exp->constant, '.'))
12629 {
12630 char ch = exp->constant[strlen(exp->constant) - 1];
12631
12632 if(ch == 'f')
12633 type->kind = 6;
12634 else
12635 type->kind = 7;
12636 type->isSigned = 0x1;
12637 }
12638 else
12639 {
12640 if(exp->constant[0] == '0' && exp->constant[1])
12641 type->isSigned = 0x0;
12642 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12643 type->isSigned = 0x0;
12644 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12645 type->isSigned = 0x0;
12646 else
12647 type->isSigned = 0x1;
12648 type->kind = 3;
12649 }
12650 exp->isConstant = 0x1;
12651 if(exp->destType && exp->destType->kind == 7)
12652 type->kind = 7;
12653 else if(exp->destType && exp->destType->kind == 6)
12654 type->kind = 6;
12655 else if(exp->destType && exp->destType->kind == 4)
12656 type->kind = 4;
12657 }
12658 break;
12659 }
12660 case 3:
12661 {
12662 exp->isConstant = 0x1;
12663 exp->expType = __extension__ ({
12664 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12665
12666 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
12667 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12668
12669 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 1, __ecereInstance1->constant = 0x1, __ecereInstance1;
12670 }), __ecereInstance2;
12671 });
12672 break;
12673 }
12674 case 13:
12675 case 28:
12676 ProcessExpressionType(exp->_new.size);
12677 exp->expType = __extension__ ({
12678 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12679
12680 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_new.typeName->qualifiers, exp->_new.typeName->declarator), __ecereInstance1;
12681 });
12682 DeclareType(exp->expType->type, 0x0, 0x0);
12683 break;
12684 case 14:
12685 case 29:
12686 ProcessExpressionType(exp->_renew.size);
12687 ProcessExpressionType(exp->_renew.exp);
12688 exp->expType = __extension__ ({
12689 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12690
12691 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), __ecereInstance1;
12692 });
12693 DeclareType(exp->expType->type, 0x0, 0x0);
12694 break;
12695 case 4:
12696 {
12697 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12698 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12699 unsigned int useDestType = 0x0, useSideType = 0x0;
12700 struct Location oldyylloc = yylloc;
12701 unsigned int useSideUnit = 0x0;
12702 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
12703
12704 switch(exp->op.op)
12705 {
12706 case '=':
12707 case MUL_ASSIGN:
12708 case DIV_ASSIGN:
12709 case MOD_ASSIGN:
12710 case ADD_ASSIGN:
12711 case SUB_ASSIGN:
12712 case LEFT_ASSIGN:
12713 case RIGHT_ASSIGN:
12714 case AND_ASSIGN:
12715 case XOR_ASSIGN:
12716 case OR_ASSIGN:
12717 assign = 0x1;
12718 break;
12719 case '!':
12720 break;
12721 case AND_OP:
12722 case OR_OP:
12723 boolOps = 0x1;
12724 boolResult = 0x1;
12725 break;
12726 case EQ_OP:
12727 case '<':
12728 case '>':
12729 case LE_OP:
12730 case GE_OP:
12731 case NE_OP:
12732 boolResult = 0x1;
12733 useSideType = 0x1;
12734 break;
12735 case '+':
12736 case '-':
12737 useSideUnit = 0x1;
12738 case '|':
12739 case '&':
12740 case '^':
12741 case '/':
12742 case '%':
12743 case '*':
12744 if(exp->op.op != '*' || exp->op.exp1)
12745 {
12746 useSideType = 0x1;
12747 useDestType = 0x1;
12748 }
12749 break;
12750 }
12751 if(exp->op.op == '&')
12752 {
12753 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12754 {
12755 struct Identifier * id = exp->op.exp2->identifier;
12756 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12757
12758 if(symbol && symbol->isIterator == 2)
12759 {
12760 exp->type = 8;
12761 exp->member.exp = exp->op.exp2;
12762 exp->member.member = MkIdentifier("key");
12763 exp->expType = (((void *)0));
12764 exp->op.exp2->expType = symbol->type;
12765 symbol->type->refCount++;
12766 ProcessExpressionType(exp);
12767 FreeType(dummy);
12768 break;
12769 }
12770 }
12771 }
12772 if(exp->op.exp1)
12773 {
12774 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))
12775 {
12776 if(exp->op.exp1->destType)
12777 FreeType(exp->op.exp1->destType);
12778 exp->op.exp1->destType = exp->destType;
12779 if(exp->destType)
12780 exp->destType->refCount++;
12781 }
12782 else if(!assign)
12783 {
12784 if(exp->op.exp1->destType)
12785 FreeType(exp->op.exp1->destType);
12786 exp->op.exp1->destType = dummy;
12787 dummy->refCount++;
12788 }
12789 if(exp->op.exp1->destType && exp->op.op != '=')
12790 exp->op.exp1->destType->count++;
12791 ProcessExpressionType(exp->op.exp1);
12792 if(exp->op.exp1->destType && exp->op.op != '=')
12793 exp->op.exp1->destType->count--;
12794 if(exp->op.exp1->destType == dummy)
12795 {
12796 FreeType(dummy);
12797 exp->op.exp1->destType = (((void *)0));
12798 }
12799 type1 = exp->op.exp1->expType;
12800 }
12801 if(exp->op.exp2)
12802 {
12803 char expString[10240];
12804
12805 expString[0] = '\0';
12806 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12807 {
12808 if(exp->op.exp1)
12809 {
12810 exp->op.exp2->destType = exp->op.exp1->expType;
12811 if(exp->op.exp1->expType)
12812 exp->op.exp1->expType->refCount++;
12813 }
12814 else
12815 {
12816 exp->op.exp2->destType = exp->destType;
12817 if(exp->destType)
12818 exp->destType->refCount++;
12819 }
12820 if(type1)
12821 type1->refCount++;
12822 exp->expType = type1;
12823 }
12824 else if(assign)
12825 {
12826 if(inCompiler)
12827 PrintExpression(exp->op.exp2, expString);
12828 if(type1 && type1->kind == 13)
12829 {
12830 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)
12831 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12832 else if(exp->op.op == '=')
12833 {
12834 if(exp->op.exp2->destType)
12835 FreeType(exp->op.exp2->destType);
12836 exp->op.exp2->destType = type1;
12837 if(type1)
12838 type1->refCount++;
12839 }
12840 }
12841 else
12842 {
12843 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)
12844 ;
12845 else
12846 {
12847 if(exp->op.exp2->destType)
12848 FreeType(exp->op.exp2->destType);
12849 exp->op.exp2->destType = type1;
12850 if(type1)
12851 type1->refCount++;
12852 }
12853 }
12854 if(type1)
12855 type1->refCount++;
12856 exp->expType = type1;
12857 }
12858 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)))
12859 {
12860 if(exp->op.exp2->destType)
12861 FreeType(exp->op.exp2->destType);
12862 exp->op.exp2->destType = exp->destType;
12863 if(exp->destType)
12864 exp->destType->refCount++;
12865 }
12866 else
12867 {
12868 if(exp->op.exp2->destType)
12869 FreeType(exp->op.exp2->destType);
12870 exp->op.exp2->destType = dummy;
12871 dummy->refCount++;
12872 }
12873 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12874 {
12875 FreeType(exp->op.exp2->destType);
12876 exp->op.exp2->destType = type1;
12877 type1->refCount++;
12878 }
12879 if(exp->op.exp2->destType && exp->op.op != '=')
12880 exp->op.exp2->destType->count++;
12881 ProcessExpressionType(exp->op.exp2);
12882 if(exp->op.exp2->destType && exp->op.op != '=')
12883 exp->op.exp2->destType->count--;
12884 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12885 {
12886 if(exp->op.exp2->expType->kind == 23 || exp->op.exp2->expType->kind == 22 || exp->op.exp2->expType->kind == 4 || exp->op.exp2->expType->kind == 3 || exp->op.exp2->expType->kind == 2 || exp->op.exp2->expType->kind == 1)
12887 {
12888 if(exp->op.op != '=' && type1->type->kind == 0)
12889 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12890 }
12891 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)))
12892 {
12893 if(exp->op.op == ADD_ASSIGN)
12894 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12895 }
12896 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))
12897 {
12898 if(exp->op.op == ADD_ASSIGN)
12899 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12900 }
12901 else if(inCompiler)
12902 {
12903 char type1String[1024];
12904 char type2String[1024];
12905
12906 type1String[0] = '\0';
12907 type2String[0] = '\0';
12908 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12909 PrintType(type1, type2String, 0x0, 0x1);
12910 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12911 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12912 }
12913 }
12914 if(exp->op.exp2->destType == dummy)
12915 {
12916 FreeType(dummy);
12917 exp->op.exp2->destType = (((void *)0));
12918 }
12919 type2 = exp->op.exp2->expType;
12920 }
12921 dummy->kind = 0;
12922 if(exp->op.op == SIZEOF)
12923 {
12924 exp->expType = __extension__ ({
12925 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12926
12927 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
12928 });
12929 exp->isConstant = 0x1;
12930 }
12931 else if(exp->op.op == '*' && !exp->op.exp1)
12932 {
12933 exp->expType = Dereference(type2);
12934 if(type2 && type2->kind == 8)
12935 notByReference = 0x1;
12936 }
12937 else if(exp->op.op == '&' && !exp->op.exp1)
12938 exp->expType = Reference(type2);
12939 else if(!assign)
12940 {
12941 if(boolOps)
12942 {
12943 if(exp->op.exp1)
12944 {
12945 if(exp->op.exp1->destType)
12946 FreeType(exp->op.exp1->destType);
12947 exp->op.exp1->destType = MkClassType("bool");
12948 exp->op.exp1->destType->truth = 0x1;
12949 if(!exp->op.exp1->expType)
12950 ProcessExpressionType(exp->op.exp1);
12951 else
12952 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12953 FreeType(exp->op.exp1->expType);
12954 exp->op.exp1->expType = MkClassType("bool");
12955 exp->op.exp1->expType->truth = 0x1;
12956 }
12957 if(exp->op.exp2)
12958 {
12959 if(exp->op.exp2->destType)
12960 FreeType(exp->op.exp2->destType);
12961 exp->op.exp2->destType = MkClassType("bool");
12962 exp->op.exp2->destType->truth = 0x1;
12963 if(!exp->op.exp2->expType)
12964 ProcessExpressionType(exp->op.exp2);
12965 else
12966 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12967 FreeType(exp->op.exp2->expType);
12968 exp->op.exp2->expType = MkClassType("bool");
12969 exp->op.exp2->expType->truth = 0x1;
12970 }
12971 }
12972 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")))))
12973 {
12974 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
12975 {
12976 if(exp->op.exp2->destType)
12977 FreeType(exp->op.exp2->destType);
12978 exp->op.exp2->destType = type1;
12979 type1->refCount++;
12980 if(exp->op.exp1->destType)
12981 FreeType(exp->op.exp1->destType);
12982 exp->op.exp1->destType = type2;
12983 type2->refCount++;
12984 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)
12985 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);
12986 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
12987 {
12988 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12989
12990 if(argExp)
12991 {
12992 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12993
12994 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
12995 ProcessExpressionType(exp->op.exp1);
12996 if(type2->kind != 13)
12997 {
12998 ProcessExpressionType(classExp);
12999 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"))))))));
13000 if(!exp->op.exp2->expType)
13001 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
13002 ProcessExpressionType(exp->op.exp2);
13003 }
13004 }
13005 }
13006 if(!boolResult && ((type1->kind == 13 || type1->kind == 12 || (type1->kind == 8 && !strcmp(type1->_class->string, "String"))) && (type2->kind == 23 || type2->kind == 22 || type2->kind == 4 || type2->kind == 3 || type2->kind == 2 || type2->kind == 1)))
13007 {
13008 if(type1->kind != 8 && type1->type->kind == 0)
13009 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
13010 exp->expType = type1;
13011 if(type1)
13012 type1->refCount++;
13013 }
13014 else if(!boolResult && ((type2->kind == 13 || type2->kind == 12 || (type2->kind == 8 && !strcmp(type2->_class->string, "String"))) && (type1->kind == 23 || type1->kind == 22 || type1->kind == 4 || type1->kind == 3 || type1->kind == 2 || type1->kind == 1)))
13015 {
13016 if(type2->kind != 8 && type2->type->kind == 0)
13017 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
13018 exp->expType = type2;
13019 if(type2)
13020 type2->refCount++;
13021 }
13022 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))
13023 {
13024 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
13025 }
13026 else
13027 {
13028 unsigned int success = 0x0;
13029
13030 if(type1->kind == 13 && type2->kind == 13)
13031 {
13032 if(exp->op.op == '+')
13033 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
13034 else if(exp->op.op == '-')
13035 {
13036 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
13037 {
13038 exp->expType = __extension__ ({
13039 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13040
13041 __ecereInstance1->kind = 3, __ecereInstance1->refCount = 1, __ecereInstance1;
13042 });
13043 success = 0x1;
13044 if(type1->type->kind == 20)
13045 {
13046 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
13047
13048 if(argExp)
13049 {
13050 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
13051
13052 ProcessExpressionType(classExp);
13053 exp->type = 5;
13054 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")))))));
13055 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
13056 FreeType(dummy);
13057 return ;
13058 }
13059 }
13060 }
13061 }
13062 }
13063 if(!success && exp->op.exp1->type == 2)
13064 {
13065 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13066 {
13067 if(exp->expType)
13068 FreeType(exp->expType);
13069 exp->expType = exp->op.exp1->destType;
13070 if(exp->op.exp1->destType)
13071 exp->op.exp1->destType->refCount++;
13072 success = 0x1;
13073 }
13074 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13075 {
13076 if(exp->expType)
13077 FreeType(exp->expType);
13078 exp->expType = exp->op.exp2->destType;
13079 if(exp->op.exp2->destType)
13080 exp->op.exp2->destType->refCount++;
13081 success = 0x1;
13082 }
13083 }
13084 else if(!success)
13085 {
13086 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13087 {
13088 if(exp->expType)
13089 FreeType(exp->expType);
13090 exp->expType = exp->op.exp2->destType;
13091 if(exp->op.exp2->destType)
13092 exp->op.exp2->destType->refCount++;
13093 success = 0x1;
13094 }
13095 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13096 {
13097 if(exp->expType)
13098 FreeType(exp->expType);
13099 exp->expType = exp->op.exp1->destType;
13100 if(exp->op.exp1->destType)
13101 exp->op.exp1->destType->refCount++;
13102 success = 0x1;
13103 }
13104 }
13105 if(!success)
13106 {
13107 char expString1[10240];
13108 char expString2[10240];
13109 char type1[1024];
13110 char type2[1024];
13111
13112 expString1[0] = '\0';
13113 expString2[0] = '\0';
13114 type1[0] = '\0';
13115 type2[0] = '\0';
13116 if(inCompiler)
13117 {
13118 PrintExpression(exp->op.exp1, expString1);
13119 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13120 PrintExpression(exp->op.exp2, expString2);
13121 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13122 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
13123 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
13124 }
13125 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
13126 }
13127 }
13128 }
13129 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13130 {
13131 if(exp->op.exp1->destType)
13132 FreeType(exp->op.exp1->destType);
13133 exp->op.exp1->destType = type2->_class->registered->dataType;
13134 if(type2->_class->registered->dataType)
13135 type2->_class->registered->dataType->refCount++;
13136 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13137 exp->expType = type2;
13138 if(type2)
13139 type2->refCount++;
13140 }
13141 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13142 {
13143 if(exp->op.exp2->destType)
13144 FreeType(exp->op.exp2->destType);
13145 exp->op.exp2->destType = type1->_class->registered->dataType;
13146 if(type1->_class->registered->dataType)
13147 type1->_class->registered->dataType->refCount++;
13148 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13149 exp->expType = type1;
13150 if(type1)
13151 type1->refCount++;
13152 }
13153 else if(type1)
13154 {
13155 unsigned int valid = 0x0;
13156
13157 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
13158 {
13159 if(exp->op.exp2->destType)
13160 FreeType(exp->op.exp2->destType);
13161 if(!type1->_class->registered->dataType)
13162 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
13163 exp->op.exp2->destType = type1->_class->registered->dataType;
13164 exp->op.exp2->destType->refCount++;
13165 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13166 type2 = exp->op.exp2->destType;
13167 exp->expType = type2;
13168 type2->refCount++;
13169 }
13170 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
13171 {
13172 if(exp->op.exp1->destType)
13173 FreeType(exp->op.exp1->destType);
13174 if(!type2->_class->registered->dataType)
13175 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
13176 exp->op.exp1->destType = type2->_class->registered->dataType;
13177 exp->op.exp1->destType->refCount++;
13178 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13179 type1 = exp->op.exp1->destType;
13180 exp->expType = type1;
13181 type1->refCount++;
13182 }
13183 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
13184 {
13185 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
13186 {
13187 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
13188 {
13189 if(exp->expType)
13190 FreeType(exp->expType);
13191 exp->expType = exp->op.exp1->expType;
13192 if(exp->op.exp2->expType)
13193 exp->op.exp1->expType->refCount++;
13194 valid = 0x1;
13195 }
13196 }
13197 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
13198 {
13199 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
13200 {
13201 if(exp->expType)
13202 FreeType(exp->expType);
13203 exp->expType = exp->op.exp2->expType;
13204 if(exp->op.exp2->expType)
13205 exp->op.exp2->expType->refCount++;
13206 valid = 0x1;
13207 }
13208 }
13209 }
13210 if(!valid)
13211 {
13212 if(exp->op.exp2->destType)
13213 FreeType(exp->op.exp2->destType);
13214 exp->op.exp2->destType = type1;
13215 type1->refCount++;
13216 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13217 {
13218 if(exp->expType)
13219 FreeType(exp->expType);
13220 exp->expType = exp->op.exp2->destType;
13221 if(exp->op.exp2->destType)
13222 exp->op.exp2->destType->refCount++;
13223 }
13224 else if(type1 && type2)
13225 {
13226 char expString1[10240];
13227 char expString2[10240];
13228 char type1String[1024];
13229 char type2String[1024];
13230
13231 expString1[0] = '\0';
13232 expString2[0] = '\0';
13233 type1String[0] = '\0';
13234 type2String[0] = '\0';
13235 if(inCompiler)
13236 {
13237 PrintExpression(exp->op.exp1, expString1);
13238 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13239 PrintExpression(exp->op.exp2, expString2);
13240 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13241 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
13242 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
13243 }
13244 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
13245 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
13246 {
13247 exp->expType = exp->op.exp1->expType;
13248 if(exp->op.exp1->expType)
13249 exp->op.exp1->expType->refCount++;
13250 }
13251 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13252 {
13253 exp->expType = exp->op.exp2->expType;
13254 if(exp->op.exp2->expType)
13255 exp->op.exp2->expType->refCount++;
13256 }
13257 }
13258 }
13259 }
13260 else if(type2)
13261 {
13262 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13263 {
13264 struct Type * oldType = exp->op.exp1->expType;
13265
13266 exp->op.exp1->expType = (((void *)0));
13267 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13268 FreeType(oldType);
13269 else
13270 exp->op.exp1->expType = oldType;
13271 }
13272 if(exp->op.exp1->destType)
13273 FreeType(exp->op.exp1->destType);
13274 exp->op.exp1->destType = type2;
13275 type2->refCount++;
13276 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13277 {
13278 if(exp->expType)
13279 FreeType(exp->expType);
13280 exp->expType = exp->op.exp1->destType;
13281 if(exp->op.exp1->destType)
13282 exp->op.exp1->destType->refCount++;
13283 }
13284 }
13285 }
13286 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
13287 {
13288 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13289 {
13290 if(exp->op.exp1->destType)
13291 FreeType(exp->op.exp1->destType);
13292 exp->op.exp1->destType = type2->_class->registered->dataType;
13293 if(type2->_class->registered->dataType)
13294 type2->_class->registered->dataType->refCount++;
13295 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13296 }
13297 if(exp->op.op == '!')
13298 {
13299 exp->expType = MkClassType("bool");
13300 exp->expType->truth = 0x1;
13301 }
13302 else
13303 {
13304 exp->expType = type2;
13305 if(type2)
13306 type2->refCount++;
13307 }
13308 }
13309 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
13310 {
13311 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13312 {
13313 if(exp->op.exp2->destType)
13314 FreeType(exp->op.exp2->destType);
13315 exp->op.exp2->destType = type1->_class->registered->dataType;
13316 if(type1->_class->registered->dataType)
13317 type1->_class->registered->dataType->refCount++;
13318 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13319 }
13320 exp->expType = type1;
13321 if(type1)
13322 type1->refCount++;
13323 }
13324 }
13325 yylloc = exp->loc;
13326 if(exp->op.exp1 && !exp->op.exp1->expType)
13327 {
13328 char expString[10000];
13329
13330 expString[0] = '\0';
13331 if(inCompiler)
13332 {
13333 PrintExpression(exp->op.exp1, expString);
13334 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13335 }
13336 if(expString[0])
13337 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13338 }
13339 if(exp->op.exp2 && !exp->op.exp2->expType)
13340 {
13341 char expString[10240];
13342
13343 expString[0] = '\0';
13344 if(inCompiler)
13345 {
13346 PrintExpression(exp->op.exp2, expString);
13347 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13348 }
13349 if(expString[0])
13350 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13351 }
13352 if(boolResult)
13353 {
13354 FreeType(exp->expType);
13355 exp->expType = MkClassType("bool");
13356 exp->expType->truth = 0x1;
13357 }
13358 if(exp->op.op != SIZEOF)
13359 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
13360 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
13361 {
13362 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
13363 }
13364 yylloc = oldyylloc;
13365 FreeType(dummy);
13366 break;
13367 }
13368 case 5:
13369 case 34:
13370 {
13371 struct Expression * e;
13372
13373 exp->isConstant = 0x1;
13374 for(e = (*exp->list).first; e; e = e->next)
13375 {
13376 unsigned int inced = 0x0;
13377
13378 if(!e->next)
13379 {
13380 FreeType(e->destType);
13381 e->destType = exp->destType;
13382 if(e->destType)
13383 {
13384 exp->destType->refCount++;
13385 e->destType->count++;
13386 inced = 0x1;
13387 }
13388 }
13389 ProcessExpressionType(e);
13390 if(inced)
13391 exp->destType->count--;
13392 if(!exp->expType && !e->next)
13393 {
13394 exp->expType = e->expType;
13395 if(e->expType)
13396 e->expType->refCount++;
13397 }
13398 if(!e->isConstant)
13399 exp->isConstant = 0x0;
13400 }
13401 e = (*exp->list).first;
13402 if(!e->next && e->type == 8)
13403 {
13404 struct Expression * next = exp->next, * prev = exp->prev;
13405
13406 FreeType(exp->expType);
13407 FreeType(exp->destType);
13408 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
13409 *exp = *e;
13410 exp->prev = prev;
13411 exp->next = next;
13412 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
13413 ProcessExpressionType(exp);
13414 }
13415 break;
13416 }
13417 case 6:
13418 {
13419 struct Expression * e;
13420
13421 exp->isConstant = 0x1;
13422 ProcessExpressionType(exp->index.exp);
13423 if(!exp->index.exp->isConstant)
13424 exp->isConstant = 0x0;
13425 if(exp->index.exp->expType)
13426 {
13427 struct Type * source = exp->index.exp->expType;
13428
13429 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)
13430 {
13431 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
13432
13433 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
13434 if(exp->index.index && (*exp->index.index).last)
13435 {
13436 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
13437 }
13438 }
13439 }
13440 for(e = (*exp->index.index).first; e; e = e->next)
13441 {
13442 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
13443 {
13444 if(e->destType)
13445 FreeType(e->destType);
13446 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
13447 }
13448 ProcessExpressionType(e);
13449 if(!e->next)
13450 {
13451 }
13452 if(!e->isConstant)
13453 exp->isConstant = 0x0;
13454 }
13455 if(!exp->expType)
13456 exp->expType = Dereference(exp->index.exp->expType);
13457 if(exp->expType)
13458 DeclareType(exp->expType, 0x0, 0x0);
13459 break;
13460 }
13461 case 7:
13462 {
13463 struct Expression * e;
13464 struct Type * functionType;
13465 struct Type * methodType = (((void *)0));
13466 char name[1024];
13467
13468 name[0] = '\0';
13469 if(inCompiler)
13470 {
13471 PrintExpression(exp->call.exp, name);
13472 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
13473 {
13474 PrintExpression(exp->call.exp, name);
13475 }
13476 }
13477 if(exp->call.exp->type == 0)
13478 {
13479 struct Expression * idExp = exp->call.exp;
13480 struct Identifier * id = idExp->identifier;
13481
13482 if(!strcmp(id->string, "__builtin_frame_address"))
13483 {
13484 exp->expType = ProcessTypeString("void *", 0x1);
13485 if(exp->call.arguments && (*exp->call.arguments).first)
13486 ProcessExpressionType((*exp->call.arguments).first);
13487 break;
13488 }
13489 else if(!strcmp(id->string, "__ENDIAN_PAD"))
13490 {
13491 exp->expType = ProcessTypeString("int", 0x1);
13492 if(exp->call.arguments && (*exp->call.arguments).first)
13493 ProcessExpressionType((*exp->call.arguments).first);
13494 break;
13495 }
13496 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
13497 {
13498 struct Expression * a = (((void *)0));
13499 struct Expression * b = (((void *)0));
13500 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
13501
13502 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
13503 {
13504 a = (*exp->call.arguments).first;
13505 b = (*exp->call.arguments).last;
13506 tempExp1 = a;
13507 tempExp2 = b;
13508 }
13509 else if((*exp->call.arguments).count == 1)
13510 {
13511 a = (*exp->call.arguments).first;
13512 tempExp1 = a;
13513 }
13514 if(a)
13515 {
13516 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
13517 idExp->identifier = (((void *)0));
13518 FreeExpContents(exp);
13519 ProcessExpressionType(a);
13520 if(b)
13521 ProcessExpressionType(b);
13522 exp->type = 5;
13523 exp->list = MkList();
13524 if(a->expType && (!b || b->expType))
13525 {
13526 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
13527 {
13528 if(inCompiler)
13529 {
13530 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13531 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
13532 struct Declaration * decl;
13533 char temp1[1024], temp2[1024];
13534
13535 GetTypeSpecs(a->expType, specs);
13536 if(a && !a->isConstant && a->type != 0)
13537 {
13538 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
13539 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
13540 tempExp1 = QMkExpId(temp1);
13541 tempExp1->expType = a->expType;
13542 if(a->expType)
13543 a->expType->refCount++;
13544 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
13545 }
13546 if(b && !b->isConstant && b->type != 0)
13547 {
13548 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
13549 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
13550 tempExp2 = QMkExpId(temp2);
13551 tempExp2->expType = b->expType;
13552 if(b->expType)
13553 b->expType->refCount++;
13554 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
13555 }
13556 decl = MkDeclaration(specs, decls);
13557 if(!curCompound->compound.declarations)
13558 curCompound->compound.declarations = MkList();
13559 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
13560 }
13561 }
13562 }
13563 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13564 {
13565 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13566
13567 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13568 exp->expType = a->expType;
13569 if(a->expType)
13570 a->expType->refCount++;
13571 }
13572 else if(!strcmp(id->string, "Abs"))
13573 {
13574 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13575 exp->expType = a->expType;
13576 if(a->expType)
13577 a->expType->refCount++;
13578 }
13579 else if(!strcmp(id->string, "Sgn"))
13580 {
13581 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"))))));
13582 exp->expType = ProcessTypeString("int", 0x0);
13583 }
13584 FreeExpression(tempExp1);
13585 if(tempExp2)
13586 FreeExpression(tempExp2);
13587 FreeIdentifier(id);
13588 break;
13589 }
13590 }
13591 }
13592 {
13593 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
13594
13595 if(!exp->call.exp->destType)
13596 {
13597 exp->call.exp->destType = dummy;
13598 dummy->refCount++;
13599 }
13600 ProcessExpressionType(exp->call.exp);
13601 if(exp->call.exp->destType == dummy)
13602 {
13603 FreeType(dummy);
13604 exp->call.exp->destType = (((void *)0));
13605 }
13606 FreeType(dummy);
13607 }
13608 functionType = exp->call.exp->expType;
13609 if(functionType && functionType->kind == 16)
13610 {
13611 methodType = functionType;
13612 functionType = methodType->method->dataType;
13613 if(exp->call.exp->expType->usedClass)
13614 {
13615 char typeString[1024];
13616
13617 typeString[0] = '\0';
13618 {
13619 struct Symbol * back = functionType->thisClass;
13620
13621 functionType->thisClass = (((void *)0));
13622 PrintType(functionType, typeString, 0x1, 0x1);
13623 functionType->thisClass = back;
13624 }
13625 if(strstr(typeString, "thisclass"))
13626 {
13627 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13628 struct Declarator * decl;
13629
13630 {
13631 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13632
13633 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13634 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13635 thisClassParams = 0x0;
13636 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13637 {
13638 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13639
13640 thisClass = exp->call.exp->expType->usedClass;
13641 ProcessDeclarator(decl);
13642 thisClass = backupThisClass;
13643 }
13644 thisClassParams = 0x1;
13645 functionType = ProcessType(specs, decl);
13646 functionType->refCount = 0;
13647 FinishTemplatesContext(context);
13648 }
13649 FreeList(specs, FreeSpecifier);
13650 FreeDeclarator(decl);
13651 }
13652 }
13653 }
13654 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13655 {
13656 struct Type * type = functionType->type;
13657
13658 if(!functionType->refCount)
13659 {
13660 functionType->type = (((void *)0));
13661 FreeType(functionType);
13662 }
13663 functionType = type;
13664 }
13665 if(functionType && functionType->kind != 11)
13666 {
13667 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13668 }
13669 else if(functionType)
13670 {
13671 unsigned int emptyParams = 0x0, noParams = 0x0;
13672 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13673 struct Type * type = functionType->params.first;
13674 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13675 int extra = 0;
13676 struct Location oldyylloc = yylloc;
13677
13678 if(!type)
13679 emptyParams = 0x1;
13680 if(functionType->extraParam && e && functionType->thisClass)
13681 {
13682 e->destType = MkClassType(functionType->thisClass->string);
13683 e = e->next;
13684 }
13685 if(!functionType->staticMethod)
13686 {
13687 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13688 {
13689 type = MkClassType(memberExp->member.exp->expType->_class->string);
13690 if(e)
13691 {
13692 e->destType = type;
13693 e = e->next;
13694 type = functionType->params.first;
13695 }
13696 else
13697 type->refCount = 0;
13698 }
13699 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13700 {
13701 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13702 if(e)
13703 {
13704 e->destType = type;
13705 e = e->next;
13706 type = functionType->params.first;
13707 }
13708 else
13709 type->refCount = 0;
13710 }
13711 }
13712 if(type && type->kind == 0)
13713 {
13714 noParams = 0x1;
13715 if(!type->refCount)
13716 FreeType(type);
13717 type = (((void *)0));
13718 }
13719 for(; e; e = e->next)
13720 {
13721 if(!type && !emptyParams)
13722 {
13723 yylloc = e->loc;
13724 if(methodType && methodType->methodClass)
13725 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);
13726 else
13727 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);
13728 break;
13729 }
13730 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13731 {
13732 struct Type * templatedType = (((void *)0));
13733 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13734 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13735 int id = 0;
13736
13737 if(_class && _class->templateArgs)
13738 {
13739 struct __ecereNameSpace__ecere__com__Class * sClass;
13740
13741 for(sClass = _class; sClass; sClass = sClass->base)
13742 {
13743 if(sClass->templateClass)
13744 sClass = sClass->templateClass;
13745 id = 0;
13746 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13747 {
13748 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13749 {
13750 struct __ecereNameSpace__ecere__com__Class * nextClass;
13751
13752 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13753 {
13754 if(nextClass->templateClass)
13755 nextClass = nextClass->templateClass;
13756 id += nextClass->templateParams.count;
13757 }
13758 break;
13759 }
13760 id++;
13761 }
13762 if(curParam)
13763 break;
13764 }
13765 }
13766 if(curParam && _class->templateArgs[id].dataTypeString)
13767 {
13768 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13769
13770 {
13771 struct Context * context = SetupTemplatesContext(_class);
13772
13773 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13774 FinishTemplatesContext(context);
13775 }
13776 e->destType = templatedType;
13777 if(templatedType)
13778 {
13779 templatedType->passAsTemplate = 0x1;
13780 }
13781 }
13782 else
13783 {
13784 e->destType = type;
13785 if(type)
13786 type->refCount++;
13787 }
13788 }
13789 else
13790 {
13791 if(type && type->kind == 14 && type->prev && type->prev->kind == 8 && type->prev->classObjectType)
13792 {
13793 e->destType = type->prev;
13794 e->destType->refCount++;
13795 }
13796 else
13797 {
13798 e->destType = type;
13799 if(type)
13800 type->refCount++;
13801 }
13802 }
13803 if(type && type->kind != 14)
13804 {
13805 struct Type * next = type->next;
13806
13807 if(!type->refCount)
13808 FreeType(type);
13809 type = next;
13810 }
13811 }
13812 if(type && type->kind != 14)
13813 {
13814 if(methodType && methodType->methodClass)
13815 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);
13816 else
13817 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);
13818 }
13819 yylloc = oldyylloc;
13820 if(type && !type->refCount)
13821 FreeType(type);
13822 }
13823 else
13824 {
13825 functionType = __extension__ ({
13826 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13827
13828 __ecereInstance1->refCount = 0, __ecereInstance1->kind = 11, __ecereInstance1;
13829 });
13830 if(exp->call.exp->type == 0)
13831 {
13832 char * string = exp->call.exp->identifier->string;
13833
13834 if(inCompiler)
13835 {
13836 struct Symbol * symbol;
13837 struct Location oldyylloc = yylloc;
13838
13839 yylloc = exp->call.exp->identifier->loc;
13840 if(strstr(string, "__builtin_") == string)
13841 {
13842 if(exp->destType)
13843 {
13844 functionType->returnType = exp->destType;
13845 exp->destType->refCount++;
13846 }
13847 }
13848 else
13849 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13850 symbol = __extension__ ({
13851 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
13852
13853 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString(string), __ecereInstance1->type = ProcessTypeString("int()", 0x1), __ecereInstance1;
13854 });
13855 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13856 if(strstr(symbol->string, "::"))
13857 globalContext->hasNameSpace = 0x1;
13858 yylloc = oldyylloc;
13859 }
13860 }
13861 else if(exp->call.exp->type == 8)
13862 {
13863 }
13864 else
13865 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13866 if(!functionType->returnType)
13867 {
13868 functionType->returnType = __extension__ ({
13869 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13870
13871 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
13872 });
13873 }
13874 }
13875 if(functionType && functionType->kind == 11)
13876 {
13877 exp->expType = functionType->returnType;
13878 if(functionType->returnType)
13879 functionType->returnType->refCount++;
13880 if(!functionType->refCount)
13881 FreeType(functionType);
13882 }
13883 if(exp->call.arguments)
13884 {
13885 for(e = (*exp->call.arguments).first; e; e = e->next)
13886 {
13887 struct Type * destType = e->destType;
13888
13889 ProcessExpressionType(e);
13890 }
13891 }
13892 break;
13893 }
13894 case 8:
13895 {
13896 struct Type * type;
13897 struct Location oldyylloc = yylloc;
13898 unsigned int thisPtr = (exp->member.exp && exp->member.exp->type == 0 && !strcmp(exp->member.exp->identifier->string, "this"));
13899
13900 exp->thisPtr = thisPtr;
13901 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13902 {
13903 exp->member.member->classSym = exp->member.member->_class->symbol;
13904 }
13905 ProcessExpressionType(exp->member.exp);
13906 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)
13907 {
13908 exp->isConstant = 0x0;
13909 }
13910 else
13911 exp->isConstant = exp->member.exp->isConstant;
13912 type = exp->member.exp->expType;
13913 yylloc = exp->loc;
13914 if(type && (type->kind == 20))
13915 {
13916 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13917 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13918
13919 if(_class)
13920 {
13921 for(param = _class->templateParams.first; param; param = param->next)
13922 {
13923 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
13924 break;
13925 }
13926 }
13927 if(param && param->defaultArg.member)
13928 {
13929 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
13930
13931 if(argExp)
13932 {
13933 struct Expression * expMember = exp->member.exp;
13934 struct Declarator * decl;
13935 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13936 char thisClassTypeString[1024];
13937
13938 FreeIdentifier(exp->member.member);
13939 ProcessExpressionType(argExp);
13940 {
13941 char * colon = strstr(param->defaultArg.memberString, "::");
13942
13943 if(colon)
13944 {
13945 char className[1024];
13946 struct __ecereNameSpace__ecere__com__Class * sClass;
13947
13948 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
13949 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
13950 }
13951 else
13952 strcpy(thisClassTypeString, _class->fullName);
13953 }
13954 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
13955 exp->expType = ProcessType(specs, decl);
13956 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
13957 {
13958 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13959 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13960 int c;
13961 int paramCount = 0;
13962 int lastParam = -1;
13963 char templateString[1024];
13964 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13965
13966 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13967 for(cClass = expClass; cClass; cClass = cClass->base)
13968 {
13969 int p = 0;
13970
13971 for(param = cClass->templateParams.first; param; param = param->next)
13972 {
13973 int id = p;
13974 struct __ecereNameSpace__ecere__com__Class * sClass;
13975 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13976
13977 for(sClass = cClass->base; sClass; sClass = sClass->base)
13978 id += sClass->templateParams.count;
13979 arg = expClass->templateArgs[id];
13980 for(sClass = _class; sClass; sClass = sClass->base)
13981 {
13982 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
13983 int p = 0;
13984 struct __ecereNameSpace__ecere__com__Class * nextClass;
13985
13986 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13987 p += nextClass->templateParams.count;
13988 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
13989 {
13990 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
13991 {
13992 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13993 {
13994 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
13995 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
13996 break;
13997 }
13998 }
13999 }
14000 }
14001 {
14002 char argument[256];
14003
14004 argument[0] = '\0';
14005 switch(param->type)
14006 {
14007 case 2:
14008 {
14009 char expString[1024];
14010 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14011 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14012 struct Expression * exp;
14013 char * string = PrintHexUInt64(arg.expression.ui64);
14014
14015 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14016 ProcessExpressionType(exp);
14017 ComputeExpression(exp);
14018 expString[0] = '\0';
14019 PrintExpression(exp, expString);
14020 strcat(argument, expString);
14021 FreeExpression(exp);
14022 break;
14023 }
14024 case 1:
14025 {
14026 strcat(argument, arg.member->name);
14027 break;
14028 }
14029 case 0:
14030 {
14031 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14032 {
14033 if(!strcmp(arg.dataTypeString, "thisclass"))
14034 strcat(argument, thisClassTypeString);
14035 else
14036 strcat(argument, arg.dataTypeString);
14037 }
14038 break;
14039 }
14040 }
14041 if(argument[0])
14042 {
14043 if(paramCount)
14044 strcat(templateString, ", ");
14045 if(lastParam != p - 1)
14046 {
14047 strcat(templateString, param->name);
14048 strcat(templateString, " = ");
14049 }
14050 strcat(templateString, argument);
14051 paramCount++;
14052 lastParam = p;
14053 }
14054 p++;
14055 }
14056 }
14057 }
14058 {
14059 int len = strlen(templateString);
14060
14061 if(templateString[len - 1] == '>')
14062 templateString[len++] = ' ';
14063 templateString[len++] = '>';
14064 templateString[len++] = '\0';
14065 }
14066 {
14067 struct Context * context = SetupTemplatesContext(_class);
14068
14069 FreeType(exp->expType);
14070 exp->expType = ProcessTypeString(templateString, 0x0);
14071 FinishTemplatesContext(context);
14072 }
14073 }
14074 exp->type = 5;
14075 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")))))))));
14076 }
14077 }
14078 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
14079 {
14080 type = ProcessTemplateParameterType(type->templateParameter);
14081 }
14082 }
14083 if(type && (type->kind == 20))
14084 ;
14085 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15 || type->kind == 4 || type->kind == 2 || type->kind == 5 || type->kind == 1 || type->kind == 22 || type->kind == 23 || type->kind == 6 || type->kind == 7 || (type->kind == 13 && type->type->kind == 1)))
14086 {
14087 struct Identifier * id = exp->member.member;
14088 int typeKind = type->kind;
14089 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));
14090
14091 if(typeKind == 19 && exp->member.exp->type == 26)
14092 {
14093 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
14094 typeKind = 8;
14095 }
14096 if(id)
14097 {
14098 if(typeKind == 3 || typeKind == 15)
14099 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
14100 else if(!_class)
14101 {
14102 if(type->kind == 8 && type->_class && type->_class->registered)
14103 {
14104 _class = type->_class->registered;
14105 }
14106 else if((type->kind == 12 || type->kind == 13) && type->type && type->type->kind == 1)
14107 {
14108 _class = FindClass("char *")->registered;
14109 }
14110 else if(type->kind == 13)
14111 {
14112 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "uintptr");
14113 FreeType(exp->expType);
14114 exp->expType = ProcessTypeString("uintptr", 0x0);
14115 exp->byReference = 0x1;
14116 }
14117 else
14118 {
14119 char string[1024] = "";
14120 struct Symbol * classSym;
14121
14122 PrintTypeNoConst(type, string, 0x0, 0x1);
14123 classSym = FindClass(string);
14124 if(classSym)
14125 _class = classSym->registered;
14126 }
14127 }
14128 }
14129 if(_class && id)
14130 {
14131 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
14132 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
14133 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
14134 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
14135 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
14136
14137 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
14138 exp->member.memberType = 1;
14139 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
14140 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
14141 if(typeKind != 19)
14142 {
14143 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
14144 {
14145 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
14146 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
14147 {
14148 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14149 if(prop)
14150 member = (((void *)0));
14151 }
14152 if(!member && !prop)
14153 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14154 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
14155 exp->member.thisPtr = 0x1;
14156 }
14157 else
14158 {
14159 if(!id->classSym)
14160 {
14161 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
14162 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
14163 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
14164 }
14165 if(!prop && !member)
14166 {
14167 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
14168 if(!method)
14169 {
14170 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14171 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
14172 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
14173 }
14174 }
14175 if(member && prop)
14176 {
14177 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
14178 prop = (((void *)0));
14179 else
14180 member = (((void *)0));
14181 }
14182 }
14183 }
14184 if(!prop && !member && !method)
14185 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
14186 if(!prop && !member && !method)
14187 {
14188 if(typeKind == 19)
14189 {
14190 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
14191 if(classProp)
14192 {
14193 exp->member.memberType = 5;
14194 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
14195 }
14196 else
14197 {
14198 char structName[1024];
14199 struct Identifier * id = exp->member.member;
14200 struct Expression * classExp = exp->member.exp;
14201
14202 type->refCount++;
14203 FreeType(classExp->expType);
14204 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
14205 strcpy(structName, "__ecereClassData_");
14206 FullClassNameCat(structName, type->_class->string, 0x0);
14207 exp->type = 9;
14208 exp->member.member = id;
14209 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"))))))));
14210 FreeType(type);
14211 ProcessExpressionType(exp);
14212 return ;
14213 }
14214 }
14215 else
14216 {
14217 struct Symbol * classSym = FindClass(id->string);
14218
14219 if(classSym)
14220 {
14221 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
14222
14223 if(convertClass)
14224 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
14225 }
14226 }
14227 }
14228 if(prop)
14229 {
14230 exp->member.memberType = 1;
14231 if(!prop->dataType)
14232 ProcessPropertyType(prop);
14233 exp->expType = prop->dataType;
14234 if(prop->dataType)
14235 prop->dataType->refCount++;
14236 }
14237 else if(member)
14238 {
14239 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14240 {
14241 FreeExpContents(exp);
14242 exp->type = 0;
14243 exp->identifier = MkIdentifier("class");
14244 ProcessExpressionType(exp);
14245 return ;
14246 }
14247 exp->member.memberType = 3;
14248 DeclareStruct(_class->fullName, 0x0);
14249 if(!member->dataType)
14250 {
14251 struct Context * context = SetupTemplatesContext(_class);
14252
14253 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
14254 FinishTemplatesContext(context);
14255 }
14256 exp->expType = member->dataType;
14257 if(member->dataType)
14258 member->dataType->refCount++;
14259 }
14260 else if(revConvert)
14261 {
14262 exp->member.memberType = 4;
14263 exp->expType = MkClassType(revConvert->_class->fullName);
14264 }
14265 else if(method)
14266 {
14267 {
14268 exp->member.memberType = 2;
14269 }
14270 if(!method->dataType)
14271 ProcessMethodType(method);
14272 exp->expType = __extension__ ({
14273 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14274
14275 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1;
14276 });
14277 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
14278 exp->expType->usedClass = _class;
14279 }
14280 else if(!classProp)
14281 {
14282 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14283 {
14284 FreeExpContents(exp);
14285 exp->type = 0;
14286 exp->identifier = MkIdentifier("class");
14287 ProcessExpressionType(exp);
14288 return ;
14289 }
14290 yylloc = exp->member.member->loc;
14291 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
14292 if(inCompiler)
14293 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
14294 }
14295 if(_class && exp->expType)
14296 {
14297 struct __ecereNameSpace__ecere__com__Class * tClass;
14298
14299 tClass = _class;
14300 while(tClass && !tClass->templateClass)
14301 tClass = tClass->base;
14302 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
14303 {
14304 int id = 0;
14305 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14306 struct __ecereNameSpace__ecere__com__Class * sClass;
14307
14308 for(sClass = tClass; sClass; sClass = sClass->base)
14309 {
14310 id = 0;
14311 if(sClass->templateClass)
14312 sClass = sClass->templateClass;
14313 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14314 {
14315 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
14316 {
14317 for(sClass = sClass->base; sClass; sClass = sClass->base)
14318 id += sClass->templateParams.count;
14319 break;
14320 }
14321 id++;
14322 }
14323 if(curParam)
14324 break;
14325 }
14326 if(curParam && tClass->templateArgs[id].dataTypeString)
14327 {
14328 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14329 struct Context * context = SetupTemplatesContext(tClass);
14330
14331 FreeType(exp->expType);
14332 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
14333 if(exp->expType)
14334 {
14335 if(exp->expType->kind == 21)
14336 {
14337 FreeType(exp->expType);
14338 exp->expType = ReplaceThisClassType(_class);
14339 }
14340 if(tClass->templateClass)
14341 exp->expType->passAsTemplate = 0x1;
14342 if(!exp->destType)
14343 {
14344 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
14345 if(exp->destType->kind == 21)
14346 {
14347 FreeType(exp->destType);
14348 exp->destType = ReplaceThisClassType(_class);
14349 }
14350 }
14351 }
14352 FinishTemplatesContext(context);
14353 }
14354 }
14355 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
14356 {
14357 int id = 0;
14358 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14359 struct __ecereNameSpace__ecere__com__Class * sClass;
14360
14361 for(sClass = tClass; sClass; sClass = sClass->base)
14362 {
14363 id = 0;
14364 if(sClass->templateClass)
14365 sClass = sClass->templateClass;
14366 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14367 {
14368 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
14369 {
14370 for(sClass = sClass->base; sClass; sClass = sClass->base)
14371 id += sClass->templateParams.count;
14372 break;
14373 }
14374 id++;
14375 }
14376 if(curParam)
14377 break;
14378 }
14379 if(curParam)
14380 {
14381 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14382 struct Context * context = SetupTemplatesContext(tClass);
14383 struct Type * basicType;
14384
14385 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
14386 if(basicType)
14387 {
14388 if(basicType->kind == 21)
14389 {
14390 FreeType(basicType);
14391 basicType = ReplaceThisClassType(_class);
14392 }
14393 FreeType(exp->expType);
14394 exp->expType = __extension__ ({
14395 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14396
14397 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = basicType, __ecereInstance1;
14398 });
14399 if(!exp->destType)
14400 {
14401 exp->destType = exp->expType;
14402 exp->destType->refCount++;
14403 }
14404 {
14405 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14406 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14407 struct Declarator * decl;
14408
14409 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
14410 *newExp = *exp;
14411 if(exp->destType)
14412 exp->destType->refCount++;
14413 if(exp->expType)
14414 exp->expType->refCount++;
14415 exp->type = 11;
14416 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
14417 exp->cast.exp = newExp;
14418 }
14419 }
14420 FinishTemplatesContext(context);
14421 }
14422 }
14423 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
14424 {
14425 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
14426
14427 if(expClass)
14428 {
14429 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
14430 int c;
14431 int p = 0;
14432 int paramCount = 0;
14433 int lastParam = -1;
14434 char templateString[1024];
14435 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
14436
14437 sprintf(templateString, "%s<", expClass->templateClass->fullName);
14438 while(cClass != expClass)
14439 {
14440 struct __ecereNameSpace__ecere__com__Class * sClass;
14441
14442 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
14443 ;
14444 cClass = sClass;
14445 for(param = cClass->templateParams.first; param; param = param->next)
14446 {
14447 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
14448 int c;
14449 int cp = 0;
14450 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
14451 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
14452
14453 while(cClassCur != tClass && !paramCur)
14454 {
14455 struct __ecereNameSpace__ecere__com__Class * sClassCur;
14456
14457 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
14458 ;
14459 cClassCur = sClassCur;
14460 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
14461 {
14462 if(!strcmp(paramCur->name, param->name))
14463 {
14464 break;
14465 }
14466 cp++;
14467 }
14468 }
14469 if(paramCur && paramCur->type == 0)
14470 arg = tClass->templateArgs[cp];
14471 else
14472 arg = expClass->templateArgs[p];
14473 {
14474 char argument[256];
14475
14476 argument[0] = '\0';
14477 switch(param->type)
14478 {
14479 case 2:
14480 {
14481 char expString[1024];
14482 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14483 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14484 struct Expression * exp;
14485 char * string = PrintHexUInt64(arg.expression.ui64);
14486
14487 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14488 ProcessExpressionType(exp);
14489 ComputeExpression(exp);
14490 expString[0] = '\0';
14491 PrintExpression(exp, expString);
14492 strcat(argument, expString);
14493 FreeExpression(exp);
14494 break;
14495 }
14496 case 1:
14497 {
14498 strcat(argument, arg.member->name);
14499 break;
14500 }
14501 case 0:
14502 {
14503 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14504 strcat(argument, arg.dataTypeString);
14505 break;
14506 }
14507 }
14508 if(argument[0])
14509 {
14510 if(paramCount)
14511 strcat(templateString, ", ");
14512 if(lastParam != p - 1)
14513 {
14514 strcat(templateString, param->name);
14515 strcat(templateString, " = ");
14516 }
14517 strcat(templateString, argument);
14518 paramCount++;
14519 lastParam = p;
14520 }
14521 }
14522 p++;
14523 }
14524 }
14525 {
14526 int len = strlen(templateString);
14527
14528 if(templateString[len - 1] == '>')
14529 templateString[len++] = ' ';
14530 templateString[len++] = '>';
14531 templateString[len++] = '\0';
14532 }
14533 FreeType(exp->expType);
14534 {
14535 struct Context * context = SetupTemplatesContext(tClass);
14536
14537 exp->expType = ProcessTypeString(templateString, 0x0);
14538 FinishTemplatesContext(context);
14539 }
14540 }
14541 }
14542 }
14543 }
14544 else
14545 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)");
14546 }
14547 else if(type && (type->kind == 9 || type->kind == 10))
14548 {
14549 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
14550
14551 if(memberType)
14552 {
14553 exp->expType = memberType;
14554 if(memberType)
14555 memberType->refCount++;
14556 }
14557 }
14558 else
14559 {
14560 char expString[10240];
14561
14562 expString[0] = '\0';
14563 if(inCompiler)
14564 {
14565 PrintExpression(exp, expString);
14566 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14567 }
14568 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
14569 }
14570 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
14571 {
14572 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
14573 {
14574 struct Identifier * id = exp->member.member;
14575 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));
14576
14577 if(_class)
14578 {
14579 FreeType(exp->expType);
14580 exp->expType = ReplaceThisClassType(_class);
14581 }
14582 }
14583 }
14584 yylloc = oldyylloc;
14585 break;
14586 }
14587 case 9:
14588 {
14589 struct Type * destType = exp->destType;
14590
14591 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
14592 {
14593 exp->member.member->classSym = exp->member.member->_class->symbol;
14594 }
14595 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
14596 exp->type = 8;
14597 if(destType)
14598 destType->count++;
14599 ProcessExpressionType(exp);
14600 if(destType)
14601 destType->count--;
14602 break;
14603 }
14604 case 15:
14605 {
14606 struct Symbol * classSym = exp->_class->symbol;
14607
14608 if(classSym && classSym->registered)
14609 {
14610 if(classSym->registered->type == 5)
14611 {
14612 char name[1024];
14613
14614 name[0] = '\0';
14615 DeclareStruct(classSym->string, 0x0);
14616 FreeSpecifier(exp->_class);
14617 exp->type = 10;
14618 FullClassNameCat(name, classSym->string, 0x0);
14619 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
14620 }
14621 else
14622 {
14623 if(classSym->registered->fixed)
14624 {
14625 FreeSpecifier(exp->_class);
14626 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
14627 exp->type = 2;
14628 }
14629 else
14630 {
14631 char className[1024];
14632
14633 strcpy(className, "__ecereClass_");
14634 FullClassNameCat(className, classSym->string, 0x1);
14635 MangleClassName(className);
14636 DeclareClass(classSym, className);
14637 FreeExpContents(exp);
14638 exp->type = 9;
14639 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14640 exp->member.member = MkIdentifier("structSize");
14641 }
14642 }
14643 }
14644 exp->expType = __extension__ ({
14645 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14646
14647 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
14648 });
14649 break;
14650 }
14651 case 10:
14652 {
14653 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
14654
14655 exp->expType = __extension__ ({
14656 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14657
14658 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
14659 });
14660 exp->isConstant = 0x1;
14661 DeclareType(type, 0x0, 0x0);
14662 FreeType(type);
14663 break;
14664 }
14665 case 11:
14666 {
14667 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14668
14669 type->count = 1;
14670 FreeType(exp->cast.exp->destType);
14671 exp->cast.exp->destType = type;
14672 type->refCount++;
14673 ProcessExpressionType(exp->cast.exp);
14674 type->count = 0;
14675 exp->expType = type;
14676 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14677 {
14678 void * prev = exp->prev, * next = exp->next;
14679 struct Type * expType = exp->cast.exp->destType;
14680 struct Expression * castExp = exp->cast.exp;
14681 struct Type * destType = exp->destType;
14682
14683 if(expType)
14684 expType->refCount++;
14685 FreeType(exp->expType);
14686 FreeTypeName(exp->cast.typeName);
14687 *exp = *castExp;
14688 FreeType(exp->expType);
14689 FreeType(exp->destType);
14690 exp->expType = expType;
14691 exp->destType = destType;
14692 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14693 exp->prev = prev;
14694 exp->next = next;
14695 }
14696 else
14697 {
14698 exp->isConstant = exp->cast.exp->isConstant;
14699 }
14700 break;
14701 }
14702 case 35:
14703 {
14704 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14705
14706 exp->expType = type;
14707 break;
14708 }
14709 case 36:
14710 {
14711 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14712
14713 ProcessExpressionType(exp->vaArg.exp);
14714 exp->expType = type;
14715 break;
14716 }
14717 case 12:
14718 {
14719 struct Expression * e;
14720
14721 exp->isConstant = 0x1;
14722 FreeType(exp->cond.cond->destType);
14723 exp->cond.cond->destType = MkClassType("bool");
14724 exp->cond.cond->destType->truth = 0x1;
14725 ProcessExpressionType(exp->cond.cond);
14726 if(!exp->cond.cond->isConstant)
14727 exp->isConstant = 0x0;
14728 for(e = (*exp->cond.exp).first; e; e = e->next)
14729 {
14730 if(!e->next)
14731 {
14732 FreeType(e->destType);
14733 e->destType = exp->destType;
14734 if(e->destType)
14735 e->destType->refCount++;
14736 }
14737 ProcessExpressionType(e);
14738 if(!e->next)
14739 {
14740 exp->expType = e->expType;
14741 if(e->expType)
14742 e->expType->refCount++;
14743 }
14744 if(!e->isConstant)
14745 exp->isConstant = 0x0;
14746 }
14747 FreeType(exp->cond.elseExp->destType);
14748 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14749 if(exp->cond.elseExp->destType)
14750 exp->cond.elseExp->destType->refCount++;
14751 ProcessExpressionType(exp->cond.elseExp);
14752 if(!exp->cond.elseExp->isConstant)
14753 exp->isConstant = 0x0;
14754 break;
14755 }
14756 case 25:
14757 {
14758 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14759 {
14760 struct Statement * last = (*exp->compound->compound.statements).last;
14761
14762 if(last->type == 3 && last->expressions && (*last->expressions).last)
14763 {
14764 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14765 if(exp->destType)
14766 exp->destType->refCount++;
14767 }
14768 ProcessStatement(exp->compound);
14769 exp->expType = (last->expressions && (*last->expressions).last) ? ((struct Expression *)(*last->expressions).last)->expType : (((void *)0));
14770 if(exp->expType)
14771 exp->expType->refCount++;
14772 }
14773 break;
14774 }
14775 case 26:
14776 {
14777 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14778
14779 if(spec && spec->type == 1)
14780 {
14781 exp->expType = MkClassType(spec->name);
14782 exp->expType->kind = 19;
14783 exp->byReference = 0x1;
14784 }
14785 else
14786 {
14787 exp->expType = MkClassType("ecere::com::Class");
14788 exp->byReference = 0x1;
14789 }
14790 break;
14791 }
14792 case 27:
14793 {
14794 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14795
14796 if(_class)
14797 {
14798 struct Identifier * id = exp->classData.id;
14799 char structName[1024];
14800 struct Expression * classExp;
14801
14802 strcpy(structName, "__ecereClassData_");
14803 FullClassNameCat(structName, _class->fullName, 0x0);
14804 exp->type = 9;
14805 exp->member.member = id;
14806 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14807 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14808 else
14809 classExp = MkExpIdentifier(MkIdentifier("class"));
14810 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"))))))));
14811 ProcessExpressionType(exp);
14812 return ;
14813 }
14814 break;
14815 }
14816 case 37:
14817 {
14818 struct Type * type = (((void *)0));
14819 char * typeString = (((void *)0));
14820 char typeStringBuf[1024];
14821
14822 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))
14823 {
14824 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14825
14826 typeString = templateClass->templateArgs[2].dataTypeString;
14827 }
14828 else if(exp->list)
14829 {
14830 struct Expression * e;
14831
14832 for(e = (*exp->list).first; e; e = e->next)
14833 {
14834 ProcessExpressionType(e);
14835 if(e->expType)
14836 {
14837 if(!type)
14838 {
14839 type = e->expType;
14840 type->refCount++;
14841 }
14842 else
14843 {
14844 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14845 {
14846 FreeType(type);
14847 type = e->expType;
14848 e->expType = (((void *)0));
14849 e = (*exp->list).first;
14850 ProcessExpressionType(e);
14851 if(e->expType)
14852 {
14853 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14854 {
14855 FreeType(e->expType);
14856 e->expType = (((void *)0));
14857 FreeType(type);
14858 type = (((void *)0));
14859 break;
14860 }
14861 }
14862 }
14863 }
14864 if(e->expType)
14865 {
14866 FreeType(e->expType);
14867 e->expType = (((void *)0));
14868 }
14869 }
14870 }
14871 if(type)
14872 {
14873 typeStringBuf[0] = '\0';
14874 PrintTypeNoConst(type, typeStringBuf, 0x0, 0x1);
14875 typeString = typeStringBuf;
14876 FreeType(type);
14877 type = (((void *)0));
14878 }
14879 }
14880 if(typeString)
14881 {
14882 char templateString[1024];
14883 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14884 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14885 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14886 struct Expression * expExt;
14887 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14888
14889 sprintf(templateString, "Container<%s>", typeString);
14890 if(exp->list)
14891 {
14892 struct Expression * e;
14893
14894 type = ProcessTypeString(typeString, 0x0);
14895 while(e = (*exp->list).first)
14896 {
14897 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14898 e->destType = type;
14899 type->refCount++;
14900 ProcessExpressionType(e);
14901 ListAdd(initializers, MkInitializerAssignment(e));
14902 }
14903 FreeType(type);
14904 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14905 }
14906 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
14907 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
14908 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14909 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
14910 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14911 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
14912 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14913 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
14914 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14915 ListAdd(structInitializers, MkInitializerAssignment(__extension__ ({
14916 struct Expression * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14917
14918 __ecereInstance1->type = 2, __ecereInstance1->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, (void *)0), __ecereInstance1;
14919 })));
14920 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14921 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
14922 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14923 exp->expType = ProcessTypeString(templateString, 0x0);
14924 exp->type = 5;
14925 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
14926 ProcessExpressionType(expExt);
14927 }
14928 else
14929 {
14930 exp->expType = ProcessTypeString("Container", 0x0);
14931 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
14932 }
14933 break;
14934 }
14935 }
14936 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
14937 {
14938 FreeType(exp->expType);
14939 exp->expType = ReplaceThisClassType(thisClass);
14940 }
14941 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
14942 {
14943 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
14944
14945 if(symbol)
14946 {
14947 if(exp->expType->kind != 15)
14948 {
14949 struct Type * member;
14950 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
14951
14952 FreeType(exp->expType);
14953 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14954 exp->expType->kind = symbol->type->kind;
14955 exp->expType->refCount++;
14956 exp->expType->enumName = enumName;
14957 exp->expType->members = symbol->type->members;
14958 for(member = symbol->type->members.first; member; member = member->next)
14959 member->refCount++;
14960 }
14961 else
14962 {
14963 struct __ecereNameSpace__ecere__sys__NamedLink * member;
14964
14965 for(member = symbol->type->members.first; member; member = member->next)
14966 {
14967 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(structSize_NamedLink), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
14968
14969 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
14970 }
14971 }
14972 }
14973 }
14974 yylloc = exp->loc;
14975 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
14976 ;
14977 else if(exp->destType && !exp->destType->keepCast)
14978 {
14979 if(!CheckExpressionType(exp, exp->destType, 0x0))
14980 {
14981 if(!exp->destType->count || unresolved)
14982 {
14983 if(!exp->expType)
14984 {
14985 yylloc = exp->loc;
14986 if(exp->destType->kind != 14)
14987 {
14988 char type2[1024];
14989
14990 type2[0] = '\0';
14991 if(inCompiler)
14992 {
14993 char expString[10240];
14994
14995 expString[0] = '\0';
14996 PrintType(exp->destType, type2, 0x0, 0x1);
14997 if(inCompiler)
14998 {
14999 PrintExpression(exp, expString);
15000 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15001 }
15002 if(unresolved)
15003 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
15004 else if(exp->type != 16)
15005 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
15006 }
15007 }
15008 else
15009 {
15010 char expString[10240];
15011
15012 expString[0] = '\0';
15013 if(inCompiler)
15014 {
15015 PrintExpression(exp, expString);
15016 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15017 }
15018 if(unresolved)
15019 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
15020 else if(exp->type != 16)
15021 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
15022 }
15023 }
15024 else
15025 {
15026 char type1[1024];
15027 char type2[1024];
15028
15029 type1[0] = '\0';
15030 type2[0] = '\0';
15031 if(inCompiler)
15032 {
15033 PrintType(exp->expType, type1, 0x0, 0x1);
15034 PrintType(exp->destType, type2, 0x0, 0x1);
15035 }
15036 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)))
15037 ;
15038 else
15039 {
15040 char expString[10240];
15041
15042 expString[0] = '\0';
15043 if(inCompiler)
15044 {
15045 PrintExpression(exp, expString);
15046 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15047 }
15048 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
15049 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
15050 FreeType(exp->expType);
15051 exp->destType->refCount++;
15052 exp->expType = exp->destType;
15053 }
15054 }
15055 }
15056 }
15057 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
15058 {
15059 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
15060 char typeString[1024];
15061 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15062 struct Declarator * decl;
15063
15064 typeString[0] = '\0';
15065 *newExp = *exp;
15066 if(exp->expType)
15067 exp->expType->refCount++;
15068 if(exp->expType)
15069 exp->expType->refCount++;
15070 exp->type = 11;
15071 newExp->destType = exp->expType;
15072 PrintType(exp->expType, typeString, 0x0, 0x0);
15073 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
15074 exp->cast.typeName = MkTypeName(specs, decl);
15075 exp->cast.exp = newExp;
15076 }
15077 }
15078 else if(unresolved)
15079 {
15080 if(exp->identifier->_class && exp->identifier->_class->name)
15081 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
15082 else if(exp->identifier->string && exp->identifier->string[0])
15083 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
15084 }
15085 else if(!exp->expType && exp->type != 16)
15086 {
15087 char expString[10240];
15088
15089 expString[0] = '\0';
15090 if(inCompiler)
15091 {
15092 PrintExpression(exp, expString);
15093 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15094 }
15095 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
15096 }
15097 if(inCompiler)
15098 ApplyAnyObjectLogic(exp);
15099 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5 && (!exp->destType || (exp->destType->kind != 3 && exp->destType->kind != 4 && exp->destType->kind != 22 && exp->destType->kind != 23 && exp->destType->kind != 5 && exp->destType->kind != 2 && exp->destType->kind != 1)))
15100 {
15101 exp->byReference = 0x1;
15102 }
15103 yylloc = oldyylloc;
15104 }
15105
15106 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)
15107 {
15108 if(*curMember)
15109 {
15110 *curMember = (*curMember)->next;
15111 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
15112 {
15113 *curMember = subMemberStack[--(*subMemberStackPos)];
15114 *curMember = (*curMember)->next;
15115 }
15116 while((*curMember) && (*curMember)->isProperty)
15117 *curMember = (*curMember)->next;
15118 if(subMemberStackPos)
15119 {
15120 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
15121 {
15122 subMemberStack[(*subMemberStackPos)++] = *curMember;
15123 *curMember = (*curMember)->members.first;
15124 while(*curMember && (*curMember)->isProperty)
15125 *curMember = (*curMember)->next;
15126 }
15127 }
15128 }
15129 while(!*curMember)
15130 {
15131 if(!*curMember)
15132 {
15133 if(subMemberStackPos && *subMemberStackPos)
15134 {
15135 *curMember = subMemberStack[--(*subMemberStackPos)];
15136 *curMember = (*curMember)->next;
15137 }
15138 else
15139 {
15140 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
15141
15142 if(*curClass == _class)
15143 break;
15144 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
15145 ;
15146 *curMember = (*curClass)->membersAndProperties.first;
15147 }
15148 while((*curMember) && (*curMember)->isProperty)
15149 *curMember = (*curMember)->next;
15150 if(subMemberStackPos)
15151 {
15152 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
15153 {
15154 subMemberStack[(*subMemberStackPos)++] = *curMember;
15155 *curMember = (*curMember)->members.first;
15156 while(*curMember && (*curMember)->isProperty)
15157 *curMember = (*curMember)->next;
15158 }
15159 }
15160 }
15161 }
15162 }
15163
15164 static void ProcessInitializer(struct Initializer * init, struct Type * type)
15165 {
15166 switch(init->type)
15167 {
15168 case 0:
15169 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
15170 {
15171 if(init->exp && !init->exp->destType)
15172 {
15173 FreeType(init->exp->destType);
15174 init->exp->destType = type;
15175 if(type)
15176 type->refCount++;
15177 }
15178 if(init->exp)
15179 {
15180 ProcessExpressionType(init->exp);
15181 init->isConstant = init->exp->isConstant;
15182 }
15183 break;
15184 }
15185 else
15186 {
15187 struct Expression * exp = init->exp;
15188 struct Instantiation * inst = exp->instance;
15189 struct MembersInit * members;
15190
15191 init->type = 1;
15192 init->list = MkList();
15193 if(inst->members)
15194 {
15195 for(members = (*inst->members).first; members; members = members->next)
15196 {
15197 if(members->type == 0)
15198 {
15199 struct MemberInit * member;
15200
15201 for(member = (*members->dataMembers).first; member; member = member->next)
15202 {
15203 ListAdd(init->list, member->initializer);
15204 member->initializer = (((void *)0));
15205 }
15206 }
15207 }
15208 }
15209 FreeExpression(exp);
15210 }
15211 case 1:
15212 {
15213 struct Initializer * i;
15214 struct Type * initializerType = (((void *)0));
15215 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
15216 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
15217 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
15218 int subMemberStackPos = 0;
15219
15220 if(type && type->kind == 12)
15221 initializerType = Dereference(type);
15222 else if(type && (type->kind == 9 || type->kind == 10))
15223 initializerType = type->members.first;
15224 for(i = (*init->list).first; i; i = i->next)
15225 {
15226 if(type && type->kind == 8 && type->_class && type->_class->registered)
15227 {
15228 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
15229 if(curMember)
15230 {
15231 if(!curMember->dataType)
15232 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
15233 initializerType = curMember->dataType;
15234 }
15235 }
15236 ProcessInitializer(i, initializerType);
15237 if(initializerType && type && (type->kind == 9 || type->kind == 10))
15238 initializerType = initializerType->next;
15239 if(!i->isConstant)
15240 init->isConstant = 0x0;
15241 }
15242 if(type && type->kind == 12)
15243 FreeType(initializerType);
15244 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
15245 {
15246 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
15247 }
15248 break;
15249 }
15250 }
15251 }
15252
15253 extern struct Symbol * FindType(struct Context * ctx, char *  name);
15254
15255 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
15256
15257 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
15258 {
15259 switch(spec->type)
15260 {
15261 case 0:
15262 {
15263 if(spec->specifier == THISCLASS)
15264 {
15265 if(thisClass)
15266 {
15267 spec->type = 1;
15268 spec->name = ReplaceThisClass(thisClass);
15269 spec->symbol = FindClass(spec->name);
15270 ProcessSpecifier(spec, declareStruct);
15271 }
15272 }
15273 break;
15274 }
15275 case 1:
15276 {
15277 struct Symbol * symbol = FindType(curContext, spec->name);
15278
15279 if(symbol)
15280 DeclareType(symbol->type, 0x1, 0x1);
15281 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
15282 DeclareStruct(spec->name, 0x0);
15283 break;
15284 }
15285 case 2:
15286 {
15287 struct Enumerator * e;
15288
15289 if(spec->list)
15290 {
15291 for(e = (*spec->list).first; e; e = e->next)
15292 {
15293 if(e->exp)
15294 ProcessExpressionType(e->exp);
15295 }
15296 }
15297 break;
15298 }
15299 case 3:
15300 case 4:
15301 {
15302 if(spec->definitions)
15303 {
15304 struct ClassDef * def;
15305 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
15306
15307 ProcessClass(spec->definitions, symbol);
15308 }
15309 break;
15310 }
15311 }
15312 }
15313
15314 static void ProcessDeclarator(struct Declarator * decl)
15315 {
15316 switch(decl->type)
15317 {
15318 case 1:
15319 if(decl->identifier->classSym)
15320 {
15321 FreeSpecifier(decl->identifier->_class);
15322 decl->identifier->_class = (((void *)0));
15323 }
15324 break;
15325 case 3:
15326 if(decl->array.exp)
15327 ProcessExpressionType(decl->array.exp);
15328 case 0:
15329 case 2:
15330 case 4:
15331 case 5:
15332 case 6:
15333 case 7:
15334 if(decl->declarator)
15335 ProcessDeclarator(decl->declarator);
15336 if(decl->type == 4)
15337 {
15338 struct Identifier * id = GetDeclId(decl);
15339
15340 if(id && id->_class)
15341 {
15342 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
15343
15344 if(!decl->function.parameters)
15345 decl->function.parameters = MkList();
15346 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
15347 id->_class = (((void *)0));
15348 }
15349 if(decl->function.parameters)
15350 {
15351 struct TypeName * param;
15352
15353 for(param = (*decl->function.parameters).first; param; param = param->next)
15354 {
15355 if(param->qualifiers && (*param->qualifiers).first)
15356 {
15357 struct Specifier * spec = (*param->qualifiers).first;
15358
15359 if(spec && spec->specifier == TYPED_OBJECT)
15360 {
15361 struct Declarator * d = param->declarator;
15362 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);
15363
15364 FreeList(param->qualifiers, FreeSpecifier);
15365 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
15366 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
15367 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
15368 param = newParam;
15369 }
15370 else if(spec && spec->specifier == ANY_OBJECT)
15371 {
15372 struct Declarator * d = param->declarator;
15373
15374 FreeList(param->qualifiers, FreeSpecifier);
15375 param->qualifiers = MkListOne(MkSpecifier(VOID));
15376 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
15377 }
15378 else if(spec->specifier == THISCLASS)
15379 {
15380 if(thisClass)
15381 {
15382 spec->type = 1;
15383 spec->name = ReplaceThisClass(thisClass);
15384 spec->symbol = FindClass(spec->name);
15385 ProcessSpecifier(spec, 0x0);
15386 }
15387 }
15388 }
15389 if(param->declarator)
15390 ProcessDeclarator(param->declarator);
15391 }
15392 }
15393 }
15394 break;
15395 }
15396 }
15397
15398 extern struct Identifier * CopyIdentifier(struct Identifier * id);
15399
15400 extern void FreeInitDeclarator(struct InitDeclarator * decl);
15401
15402 static void ProcessDeclaration(struct Declaration * decl)
15403 {
15404 yylloc = decl->loc;
15405 switch(decl->type)
15406 {
15407 case 1:
15408 {
15409 unsigned int declareStruct = 0x0;
15410
15411 if(decl->declarators)
15412 {
15413 struct InitDeclarator * d;
15414
15415 for(d = (*decl->declarators).first; d; d = d->next)
15416 {
15417 struct Type * type, * subType;
15418
15419 ProcessDeclarator(d->declarator);
15420 type = ProcessType(decl->specifiers, d->declarator);
15421 if(d->initializer)
15422 {
15423 ProcessInitializer(d->initializer, type);
15424 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
15425 {
15426 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
15427 {
15428 struct Instantiation * inst = d->initializer->exp->instance;
15429
15430 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
15431 d->initializer->exp->instance = (((void *)0));
15432 if(decl->specifiers)
15433 FreeList(decl->specifiers, FreeSpecifier);
15434 FreeList(decl->declarators, FreeInitDeclarator);
15435 d = (((void *)0));
15436 decl->type = 2;
15437 decl->inst = inst;
15438 }
15439 }
15440 }
15441 for(subType = type; subType; )
15442 {
15443 if(subType->kind == 8)
15444 {
15445 declareStruct = 0x1;
15446 break;
15447 }
15448 else if(subType->kind == 13)
15449 break;
15450 else if(subType->kind == 12)
15451 subType = subType->arrayType;
15452 else
15453 break;
15454 }
15455 FreeType(type);
15456 if(!d)
15457 break;
15458 }
15459 }
15460 if(decl->specifiers)
15461 {
15462 struct Specifier * s;
15463
15464 for(s = (*decl->specifiers).first; s; s = s->next)
15465 {
15466 ProcessSpecifier(s, declareStruct);
15467 }
15468 }
15469 break;
15470 }
15471 case 2:
15472 {
15473 ProcessInstantiationType(decl->inst);
15474 break;
15475 }
15476 case 0:
15477 {
15478 struct Specifier * spec;
15479 struct Declarator * d;
15480 unsigned int declareStruct = 0x0;
15481
15482 if(decl->declarators)
15483 {
15484 for(d = (*decl->declarators).first; d; d = d->next)
15485 {
15486 struct Type * type = ProcessType(decl->specifiers, d->declarator);
15487 struct Type * subType;
15488
15489 ProcessDeclarator(d);
15490 for(subType = type; subType; )
15491 {
15492 if(subType->kind == 8)
15493 {
15494 declareStruct = 0x1;
15495 break;
15496 }
15497 else if(subType->kind == 13)
15498 break;
15499 else if(subType->kind == 12)
15500 subType = subType->arrayType;
15501 else
15502 break;
15503 }
15504 FreeType(type);
15505 }
15506 }
15507 if(decl->specifiers)
15508 {
15509 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
15510 ProcessSpecifier(spec, declareStruct);
15511 }
15512 break;
15513 }
15514 }
15515 }
15516
15517 static struct FunctionDefinition * curFunction;
15518
15519 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
15520 {
15521 char propName[1024], propNameM[1024];
15522 char getName[1024], setName[1024];
15523 struct __ecereNameSpace__ecere__sys__OldList * args;
15524
15525 DeclareProperty(prop, setName, getName);
15526 strcpy(propName, "__ecereProp_");
15527 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15528 strcat(propName, "_");
15529 FullClassNameCat(propName, prop->name, 0x1);
15530 MangleClassName(propName);
15531 strcpy(propNameM, "__ecerePropM_");
15532 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
15533 strcat(propNameM, "_");
15534 FullClassNameCat(propNameM, prop->name, 0x1);
15535 MangleClassName(propNameM);
15536 if(prop->isWatchable)
15537 {
15538 args = MkList();
15539 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15540 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15541 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15542 args = MkList();
15543 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15544 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15545 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15546 }
15547 {
15548 args = MkList();
15549 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15550 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15551 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15552 args = MkList();
15553 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15554 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15555 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15556 }
15557 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15558 curFunction->propSet->fireWatchersDone = 0x1;
15559 }
15560
15561 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
15562
15563 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
15564
15565 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
15566
15567 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
15568
15569 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
15570
15571 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
15572
15573 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
15574
15575 extern void FreePropertyWatch(struct PropertyWatch * watcher);
15576
15577 static void ProcessStatement(struct Statement * stmt)
15578 {
15579 yylloc = stmt->loc;
15580 switch(stmt->type)
15581 {
15582 case 0:
15583 ProcessStatement(stmt->labeled.stmt);
15584 break;
15585 case 1:
15586 if(stmt->caseStmt.exp)
15587 {
15588 FreeType(stmt->caseStmt.exp->destType);
15589 stmt->caseStmt.exp->destType = curSwitchType;
15590 if(curSwitchType)
15591 curSwitchType->refCount++;
15592 ProcessExpressionType(stmt->caseStmt.exp);
15593 ComputeExpression(stmt->caseStmt.exp);
15594 }
15595 if(stmt->caseStmt.stmt)
15596 ProcessStatement(stmt->caseStmt.stmt);
15597 break;
15598 case 2:
15599 {
15600 if(stmt->compound.context)
15601 {
15602 struct Declaration * decl;
15603 struct Statement * s;
15604 struct Statement * prevCompound = curCompound;
15605 struct Context * prevContext = curContext;
15606
15607 if(!stmt->compound.isSwitch)
15608 {
15609 curCompound = stmt;
15610 curContext = stmt->compound.context;
15611 }
15612 if(stmt->compound.declarations)
15613 {
15614 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
15615 ProcessDeclaration(decl);
15616 }
15617 if(stmt->compound.statements)
15618 {
15619 for(s = (*stmt->compound.statements).first; s; s = s->next)
15620 ProcessStatement(s);
15621 }
15622 curContext = prevContext;
15623 curCompound = prevCompound;
15624 }
15625 break;
15626 }
15627 case 3:
15628 {
15629 struct Expression * exp;
15630
15631 if(stmt->expressions)
15632 {
15633 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15634 ProcessExpressionType(exp);
15635 }
15636 break;
15637 }
15638 case 4:
15639 {
15640 struct Expression * exp;
15641
15642 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15643 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15644 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15645 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15646 {
15647 ProcessExpressionType(exp);
15648 }
15649 if(stmt->ifStmt.stmt)
15650 ProcessStatement(stmt->ifStmt.stmt);
15651 if(stmt->ifStmt.elseStmt)
15652 ProcessStatement(stmt->ifStmt.elseStmt);
15653 break;
15654 }
15655 case 5:
15656 {
15657 struct Type * oldSwitchType = curSwitchType;
15658
15659 if(stmt->switchStmt.exp)
15660 {
15661 struct Expression * exp;
15662
15663 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15664 {
15665 if(!exp->next)
15666 {
15667 ProcessExpressionType(exp);
15668 }
15669 if(!exp->next)
15670 curSwitchType = exp->expType;
15671 }
15672 }
15673 ProcessStatement(stmt->switchStmt.stmt);
15674 curSwitchType = oldSwitchType;
15675 break;
15676 }
15677 case 6:
15678 {
15679 if(stmt->whileStmt.exp)
15680 {
15681 struct Expression * exp;
15682
15683 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15684 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15685 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15686 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15687 {
15688 ProcessExpressionType(exp);
15689 }
15690 }
15691 if(stmt->whileStmt.stmt)
15692 ProcessStatement(stmt->whileStmt.stmt);
15693 break;
15694 }
15695 case 7:
15696 {
15697 if(stmt->doWhile.exp)
15698 {
15699 struct Expression * exp;
15700
15701 if((*stmt->doWhile.exp).last)
15702 {
15703 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15704 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15705 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15706 }
15707 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15708 {
15709 ProcessExpressionType(exp);
15710 }
15711 }
15712 if(stmt->doWhile.stmt)
15713 ProcessStatement(stmt->doWhile.stmt);
15714 break;
15715 }
15716 case 8:
15717 {
15718 struct Expression * exp;
15719
15720 if(stmt->forStmt.init)
15721 ProcessStatement(stmt->forStmt.init);
15722 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15723 {
15724 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15725 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15726 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15727 }
15728 if(stmt->forStmt.check)
15729 ProcessStatement(stmt->forStmt.check);
15730 if(stmt->forStmt.increment)
15731 {
15732 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15733 ProcessExpressionType(exp);
15734 }
15735 if(stmt->forStmt.stmt)
15736 ProcessStatement(stmt->forStmt.stmt);
15737 break;
15738 }
15739 case 18:
15740 {
15741 struct Identifier * id = stmt->forEachStmt.id;
15742 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15743 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15744 struct Statement * block = stmt->forEachStmt.stmt;
15745 char iteratorType[1024];
15746 struct Type * source;
15747 struct Expression * e;
15748 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));
15749 struct Expression * arrayExp;
15750 char * typeString = (((void *)0));
15751 int builtinCount = 0;
15752
15753 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15754 {
15755 if(!e->next)
15756 {
15757 FreeType(e->destType);
15758 e->destType = ProcessTypeString("Container", 0x0);
15759 }
15760 if(!isBuiltin || e->next)
15761 ProcessExpressionType(e);
15762 }
15763 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15764 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15765 {
15766 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15767 struct Symbol * symbol;
15768 struct Expression * expIt = (((void *)0));
15769 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15770 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15771 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15772 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15773
15774 stmt->type = 2;
15775 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15776 stmt->compound.context->parent = curContext;
15777 curContext = stmt->compound.context;
15778 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15779 {
15780 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15781 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15782
15783 isCustomAVLTree = 0x1;
15784 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15785 isAVLTree = 0x1;
15786 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15787 isMap = 0x1;
15788 }
15789 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15790 isArray = 0x1;
15791 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15792 {
15793 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15794
15795 isLinkList = 0x1;
15796 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15797 }
15798 if(isArray)
15799 {
15800 struct Declarator * decl;
15801 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15802
15803 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15804 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15805 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15806 }
15807 else if(isBuiltin)
15808 {
15809 struct Type * type = (((void *)0));
15810 char typeStringBuf[1024];
15811
15812 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15813 if(((struct Expression *)(*exp).last)->type == 11)
15814 {
15815 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15816
15817 if(typeName)
15818 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15819 }
15820 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)
15821 {
15822 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15823
15824 typeString = templateClass->templateArgs[2].dataTypeString;
15825 }
15826 else if(arrayExp->list)
15827 {
15828 struct Expression * e;
15829
15830 for(e = (*arrayExp->list).first; e; e = e->next)
15831 {
15832 ProcessExpressionType(e);
15833 if(e->expType)
15834 {
15835 if(!type)
15836 {
15837 type = e->expType;
15838 type->refCount++;
15839 }
15840 else
15841 {
15842 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15843 {
15844 FreeType(type);
15845 type = e->expType;
15846 e->expType = (((void *)0));
15847 e = (*arrayExp->list).first;
15848 ProcessExpressionType(e);
15849 if(e->expType)
15850 {
15851 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15852 {
15853 FreeType(e->expType);
15854 e->expType = (((void *)0));
15855 FreeType(type);
15856 type = (((void *)0));
15857 break;
15858 }
15859 }
15860 }
15861 }
15862 if(e->expType)
15863 {
15864 FreeType(e->expType);
15865 e->expType = (((void *)0));
15866 }
15867 }
15868 }
15869 if(type)
15870 {
15871 typeStringBuf[0] = '\0';
15872 PrintType(type, typeStringBuf, 0x0, 0x1);
15873 typeString = typeStringBuf;
15874 FreeType(type);
15875 }
15876 }
15877 if(typeString)
15878 {
15879 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15880 struct Declarator * decl;
15881 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15882
15883 if(arrayExp->list)
15884 {
15885 struct Expression * e;
15886
15887 builtinCount = (*arrayExp->list).count;
15888 type = ProcessTypeString(typeString, 0x0);
15889 while(e = (*arrayExp->list).first)
15890 {
15891 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15892 e->destType = type;
15893 type->refCount++;
15894 ProcessExpressionType(e);
15895 ListAdd(initializers, MkInitializerAssignment(e));
15896 }
15897 FreeType(type);
15898 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15899 }
15900 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15901 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15902 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(PlugDeclarator(decl, MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), (((void *)0)))), MkInitializerList(initializers)))));
15903 FreeList(exp, FreeExpression);
15904 }
15905 else
15906 {
15907 arrayExp->expType = ProcessTypeString("Container", 0x0);
15908 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15909 }
15910 }
15911 else if(isLinkList && !isList)
15912 {
15913 struct Declarator * decl;
15914 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15915
15916 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15917 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15918 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15919 }
15920 else if(_class->templateArgs)
15921 {
15922 if(isMap)
15923 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15924 else
15925 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
15926 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
15927 }
15928 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
15929 if(block && block->type == 2 && block->compound.context)
15930 {
15931 block->compound.context->parent = stmt->compound.context;
15932 }
15933 if(filter)
15934 {
15935 block = MkIfStmt(filter, block, (((void *)0)));
15936 }
15937 if(isArray)
15938 {
15939 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));
15940 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15941 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15942 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15943 }
15944 else if(isBuiltin)
15945 {
15946 char count[128];
15947
15948 sprintf(count, "%d", builtinCount);
15949 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));
15950 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15951 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15952 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15953 }
15954 else if(isLinkList && !isList)
15955 {
15956 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
15957 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
15958
15959 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
15960 {
15961 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));
15962 }
15963 else
15964 {
15965 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15966 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
15967
15968 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));
15969 }
15970 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15971 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15972 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15973 }
15974 else
15975 {
15976 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
15977 }
15978 ProcessExpressionType(expIt);
15979 if((*stmt->compound.declarations).first)
15980 ProcessDeclaration((*stmt->compound.declarations).first);
15981 if(symbol)
15982 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
15983 ProcessStatement(stmt);
15984 curContext = stmt->compound.context->parent;
15985 break;
15986 }
15987 else
15988 {
15989 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
15990 }
15991 break;
15992 }
15993 case 9:
15994 break;
15995 case 10:
15996 break;
15997 case 11:
15998 break;
15999 case 12:
16000 {
16001 struct Expression * exp;
16002
16003 if(stmt->expressions)
16004 {
16005 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
16006 {
16007 if(!exp->next)
16008 {
16009 if(curFunction && !curFunction->type)
16010 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
16011 FreeType(exp->destType);
16012 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
16013 if(exp->destType)
16014 exp->destType->refCount++;
16015 }
16016 ProcessExpressionType(exp);
16017 }
16018 }
16019 break;
16020 }
16021 case 14:
16022 {
16023 ProcessDeclaration(stmt->decl);
16024 break;
16025 }
16026 case 13:
16027 {
16028 struct AsmField * field;
16029
16030 if(stmt->asmStmt.inputFields)
16031 {
16032 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
16033 if(field->expression)
16034 ProcessExpressionType(field->expression);
16035 }
16036 if(stmt->asmStmt.outputFields)
16037 {
16038 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
16039 if(field->expression)
16040 ProcessExpressionType(field->expression);
16041 }
16042 if(stmt->asmStmt.clobberedFields)
16043 {
16044 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
16045 {
16046 if(field->expression)
16047 ProcessExpressionType(field->expression);
16048 }
16049 }
16050 break;
16051 }
16052 case 17:
16053 {
16054 struct PropertyWatch * propWatch;
16055 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16056 struct Expression * object = stmt->_watch.object;
16057 struct Expression * watcher = stmt->_watch.watcher;
16058
16059 if(watcher)
16060 ProcessExpressionType(watcher);
16061 if(object)
16062 ProcessExpressionType(object);
16063 if(inCompiler)
16064 {
16065 if(watcher || thisClass)
16066 {
16067 struct External * external = curExternal;
16068 struct Context * context = curContext;
16069
16070 stmt->type = 3;
16071 stmt->expressions = MkList();
16072 curExternal = external->prev;
16073 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
16074 {
16075 struct ClassFunction * func;
16076 char watcherName[1024];
16077 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
16078 struct External * createdExternal;
16079 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
16080
16081 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
16082 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
16083 if(propWatch->deleteWatch)
16084 strcat(watcherName, "_delete");
16085 else
16086 {
16087 struct Identifier * propID;
16088
16089 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
16090 {
16091 strcat(watcherName, "_");
16092 strcat(watcherName, propID->string);
16093 }
16094 }
16095 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
16096 {
16097 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
16098 ProcessClassFunctionBody(func, propWatch->compound);
16099 propWatch->compound = (((void *)0));
16100 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
16101 createdExternal->symbol->idCode = external->symbol->idCode;
16102 curExternal = createdExternal;
16103 ProcessFunction(createdExternal->function);
16104 {
16105 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
16106
16107 externalDecl->declaration = decl;
16108 if(decl->symbol && !decl->symbol->pointerExternal)
16109 decl->symbol->pointerExternal = externalDecl;
16110 }
16111 if(propWatch->deleteWatch)
16112 {
16113 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16114
16115 ListAdd(args, CopyExpression(object));
16116 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16117 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
16118 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
16119 }
16120 else
16121 {
16122 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
16123 struct Identifier * propID;
16124
16125 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
16126 {
16127 char propName[1024];
16128 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16129
16130 if(prop)
16131 {
16132 char getName[1024], setName[1024];
16133 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16134
16135 DeclareProperty(prop, setName, getName);
16136 strcpy(propName, "__ecereProp_");
16137 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16138 strcat(propName, "_");
16139 FullClassNameCat(propName, prop->name, 0x1);
16140 ListAdd(args, CopyExpression(object));
16141 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16142 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16143 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
16144 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
16145 }
16146 else
16147 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16148 }
16149 }
16150 }
16151 else
16152 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
16153 }
16154 curExternal = external;
16155 curContext = context;
16156 if(watcher)
16157 FreeExpression(watcher);
16158 if(object)
16159 FreeExpression(object);
16160 FreeList(watches, FreePropertyWatch);
16161 }
16162 else
16163 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
16164 }
16165 else
16166 {
16167 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
16168 {
16169 ProcessStatement(propWatch->compound);
16170 }
16171 }
16172 break;
16173 }
16174 case 15:
16175 {
16176 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16177 struct Expression * object = stmt->_watch.object;
16178 struct __ecereNameSpace__ecere__com__Class * _class;
16179
16180 if(object)
16181 ProcessExpressionType(object);
16182 if(inCompiler)
16183 {
16184 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
16185 if(_class)
16186 {
16187 struct Identifier * propID;
16188
16189 stmt->type = 3;
16190 stmt->expressions = MkList();
16191 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
16192 {
16193 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
16194 }
16195 else if(!watches)
16196 {
16197 }
16198 if(watches)
16199 {
16200 for(propID = (*watches).first; propID; propID = propID->next)
16201 {
16202 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16203
16204 if(prop)
16205 {
16206 CreateFireWatcher(prop, object, stmt);
16207 }
16208 else
16209 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
16210 }
16211 }
16212 else
16213 {
16214 struct __ecereNameSpace__ecere__com__Property * prop;
16215 struct __ecereNameSpace__ecere__com__Class * base;
16216
16217 for(base = _class; base; base = base->base)
16218 {
16219 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
16220 {
16221 if(prop->isProperty && prop->isWatchable)
16222 {
16223 CreateFireWatcher(prop, object, stmt);
16224 }
16225 }
16226 }
16227 }
16228 if(object)
16229 FreeExpression(object);
16230 FreeList(watches, FreeIdentifier);
16231 }
16232 else
16233 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16234 }
16235 break;
16236 }
16237 case 16:
16238 {
16239 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16240 struct Expression * object = stmt->_watch.object;
16241 struct Expression * watcher = stmt->_watch.watcher;
16242 struct __ecereNameSpace__ecere__com__Class * _class;
16243
16244 if(object)
16245 ProcessExpressionType(object);
16246 if(watcher)
16247 ProcessExpressionType(watcher);
16248 if(inCompiler)
16249 {
16250 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
16251 if(watcher || thisClass)
16252 {
16253 if(_class)
16254 {
16255 struct Identifier * propID;
16256
16257 stmt->type = 3;
16258 stmt->expressions = MkList();
16259 if(!watches)
16260 {
16261 struct __ecereNameSpace__ecere__sys__OldList * args;
16262
16263 args = MkList();
16264 ListAdd(args, CopyExpression(object));
16265 ListAdd(args, MkExpConstant("0"));
16266 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16267 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16268 }
16269 else
16270 {
16271 for(propID = (*watches).first; propID; propID = propID->next)
16272 {
16273 char propName[1024];
16274 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16275
16276 if(prop)
16277 {
16278 char getName[1024], setName[1024];
16279 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16280
16281 DeclareProperty(prop, setName, getName);
16282 strcpy(propName, "__ecereProp_");
16283 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16284 strcat(propName, "_");
16285 FullClassNameCat(propName, prop->name, 0x1);
16286 MangleClassName(propName);
16287 ListAdd(args, CopyExpression(object));
16288 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16289 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16290 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16291 }
16292 else
16293 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16294 }
16295 }
16296 if(object)
16297 FreeExpression(object);
16298 if(watcher)
16299 FreeExpression(watcher);
16300 FreeList(watches, FreeIdentifier);
16301 }
16302 else
16303 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16304 }
16305 else
16306 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
16307 }
16308 break;
16309 }
16310 }
16311 }
16312
16313 extern struct Expression * QBrackets(struct Expression * exp);
16314
16315 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
16316
16317 extern struct Declarator * QMkPtrDecl(char *  id);
16318
16319 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
16320
16321 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
16322
16323 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
16324
16325 static void ProcessFunction(struct FunctionDefinition * function)
16326 {
16327 struct Identifier * id = GetDeclId(function->declarator);
16328 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
16329 struct Type * type = symbol ? symbol->type : (((void *)0));
16330 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
16331 struct Context * oldTopContext = topContext;
16332
16333 yylloc = function->loc;
16334 if(type && type->thisClass)
16335 {
16336 struct Symbol * classSym = type->thisClass;
16337 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
16338 char className[1024];
16339 char structName[1024];
16340 struct Declarator * funcDecl;
16341 struct Symbol * thisSymbol;
16342 unsigned int typedObject = 0x0;
16343
16344 if(_class && !_class->base)
16345 {
16346 _class = currentClass;
16347 if(_class && !_class->symbol)
16348 _class->symbol = FindClass(_class->fullName);
16349 classSym = _class ? _class->symbol : (((void *)0));
16350 typedObject = 0x1;
16351 }
16352 thisClass = _class;
16353 if(inCompiler && _class)
16354 {
16355 if(type->kind == 11)
16356 {
16357 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
16358 {
16359 struct Type * param = symbol->type->params.first;
16360
16361 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
16362 FreeType(param);
16363 }
16364 if(type->classObjectType != 1)
16365 {
16366 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
16367 symbol->type->staticMethod = 0x1;
16368 symbol->type->thisClass = (((void *)0));
16369 symbol->type->extraParam = 0x0;
16370 }
16371 }
16372 strcpy(className, "__ecereClass_");
16373 FullClassNameCat(className, _class->fullName, 0x1);
16374 MangleClassName(className);
16375 structName[0] = (char)0;
16376 FullClassNameCat(structName, _class->fullName, 0x0);
16377 funcDecl = GetFuncDecl(function->declarator);
16378 if(funcDecl)
16379 {
16380 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16381 {
16382 struct TypeName * param = (*funcDecl->function.parameters).first;
16383
16384 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16385 {
16386 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16387 FreeTypeName(param);
16388 }
16389 }
16390 if(!function->propertyNoThis)
16391 {
16392 struct TypeName * thisParam;
16393
16394 if(type->classObjectType != 1)
16395 {
16396 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16397 if(!funcDecl->function.parameters)
16398 funcDecl->function.parameters = MkList();
16399 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16400 }
16401 if(typedObject)
16402 {
16403 if(type->classObjectType != 1)
16404 {
16405 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
16406 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
16407 }
16408 thisParam = __extension__ ({
16409 struct TypeName * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName);
16410
16411 __ecereInstance1->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), __ecereInstance1->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), __ecereInstance1;
16412 });
16413 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16414 }
16415 }
16416 }
16417 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16418 {
16419 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16420
16421 funcDecl = GetFuncDecl(initDecl->declarator);
16422 if(funcDecl)
16423 {
16424 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16425 {
16426 struct TypeName * param = (*funcDecl->function.parameters).first;
16427
16428 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16429 {
16430 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16431 FreeTypeName(param);
16432 }
16433 }
16434 if(type->classObjectType != 1)
16435 {
16436 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
16437 {
16438 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16439
16440 if(!funcDecl->function.parameters)
16441 funcDecl->function.parameters = MkList();
16442 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16443 }
16444 }
16445 }
16446 }
16447 }
16448 if(function->body)
16449 {
16450 if(type->classObjectType != 1)
16451 {
16452 thisSymbol = __extension__ ({
16453 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
16454
16455 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("this"), __ecereInstance1->type = classSym ? MkClassType(classSym->string) : (((void *)0)), __ecereInstance1;
16456 });
16457 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16458 if(typedObject && thisSymbol->type)
16459 {
16460 thisSymbol->type->classObjectType = 2;
16461 thisSymbol->type->byReference = type->byReference;
16462 }
16463 }
16464 }
16465 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
16466 {
16467 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
16468
16469 {
16470 struct __ecereNameSpace__ecere__com__Class * base;
16471
16472 for(base = _class; base && base->type != 1000; base = base->next)
16473 {
16474 for(member = base->membersAndProperties.first; member; member = member->next)
16475 if(!member->isProperty)
16476 break;
16477 if(member)
16478 break;
16479 }
16480 }
16481 for(member = _class->membersAndProperties.first; member; member = member->next)
16482 if(!member->isProperty)
16483 break;
16484 if(member)
16485 {
16486 char pointerName[1024];
16487 struct Declaration * decl;
16488 struct Initializer * initializer;
16489 struct Expression * exp, * bytePtr;
16490
16491 strcpy(pointerName, "__ecerePointer_");
16492 FullClassNameCat(pointerName, _class->fullName, 0x0);
16493 {
16494 char className[1024];
16495
16496 strcpy(className, "__ecereClass_");
16497 FullClassNameCat(className, classSym->string, 0x1);
16498 MangleClassName(className);
16499 DeclareClass(classSym, className);
16500 }
16501 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
16502 if(_class->fixed)
16503 {
16504 char string[256];
16505
16506 sprintf(string, "%d", _class->offset);
16507 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
16508 }
16509 else
16510 {
16511 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
16512 }
16513 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
16514 exp->expType = __extension__ ({
16515 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16516
16517 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
16518 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16519
16520 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 0, __ecereInstance1;
16521 }), __ecereInstance2;
16522 });
16523 if(function->body)
16524 {
16525 yylloc = function->body->loc;
16526 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
16527 {
16528 struct Context * prevContext = curContext;
16529
16530 curContext = function->body->compound.context;
16531 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
16532 curContext = prevContext;
16533 }
16534 decl->symbol = (((void *)0));
16535 if(!function->body->compound.declarations)
16536 function->body->compound.declarations = MkList();
16537 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
16538 }
16539 }
16540 }
16541 }
16542 else
16543 thisClass = (((void *)0));
16544 if(id)
16545 {
16546 FreeSpecifier(id->_class);
16547 id->_class = (((void *)0));
16548 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16549 {
16550 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16551
16552 id = GetDeclId(initDecl->declarator);
16553 FreeSpecifier(id->_class);
16554 id->_class = (((void *)0));
16555 }
16556 }
16557 if(function->body)
16558 topContext = function->body->compound.context;
16559 {
16560 struct FunctionDefinition * oldFunction = curFunction;
16561
16562 curFunction = function;
16563 if(function->body)
16564 ProcessStatement(function->body);
16565 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
16566 {
16567 struct Statement * prevCompound = curCompound;
16568 struct Context * prevContext = curContext;
16569 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
16570
16571 if(!function->body->compound.statements)
16572 function->body->compound.statements = MkList();
16573 ListAdd(function->body->compound.statements, fireWatchers);
16574 curCompound = function->body;
16575 curContext = function->body->compound.context;
16576 ProcessStatement(fireWatchers);
16577 curContext = prevContext;
16578 curCompound = prevCompound;
16579 }
16580 curFunction = oldFunction;
16581 }
16582 if(function->declarator)
16583 {
16584 ProcessDeclarator(function->declarator);
16585 }
16586 topContext = oldTopContext;
16587 thisClass = oldThisClass;
16588 }
16589
16590 extern void FreeSymbol(struct Symbol * symbol);
16591
16592 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
16593
16594 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
16595 {
16596 struct ClassDef * def;
16597 struct External * external = curExternal;
16598 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
16599
16600 for(def = definitions->first; def; def = def->next)
16601 {
16602 if(def->type == 0)
16603 {
16604 if(def->function->declarator)
16605 curExternal = def->function->declarator->symbol->pointerExternal;
16606 else
16607 curExternal = external;
16608 ProcessFunction((struct FunctionDefinition *)def->function);
16609 }
16610 else if(def->type == 2)
16611 {
16612 if(def->decl->type == 2)
16613 {
16614 thisClass = regClass;
16615 ProcessInstantiationType(def->decl->inst);
16616 thisClass = (((void *)0));
16617 }
16618 else
16619 {
16620 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
16621
16622 if(regClass)
16623 thisClass = regClass;
16624 ProcessDeclaration(def->decl);
16625 thisClass = backThisClass;
16626 }
16627 }
16628 else if(def->type == 1 && def->defProperties)
16629 {
16630 struct MemberInit * defProperty;
16631 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);
16632
16633 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16634 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
16635 {
16636 thisClass = regClass;
16637 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
16638 thisClass = (((void *)0));
16639 }
16640 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16641 FreeSymbol(thisSymbol);
16642 }
16643 else if(def->type == 3 && def->propertyDef)
16644 {
16645 struct PropertyDef * prop = def->propertyDef;
16646
16647 thisClass = regClass;
16648 if(prop->setStmt)
16649 {
16650 if(regClass)
16651 {
16652 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16653
16654 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16655 }
16656 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16657 ProcessStatement(prop->setStmt);
16658 }
16659 if(prop->getStmt)
16660 {
16661 if(regClass)
16662 {
16663 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16664
16665 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16666 }
16667 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16668 ProcessStatement(prop->getStmt);
16669 }
16670 if(prop->issetStmt)
16671 {
16672 if(regClass)
16673 {
16674 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16675
16676 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16677 }
16678 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16679 ProcessStatement(prop->issetStmt);
16680 }
16681 thisClass = (((void *)0));
16682 }
16683 else if(def->type == 4 && def->propertyWatch)
16684 {
16685 struct PropertyWatch * propertyWatch = def->propertyWatch;
16686
16687 thisClass = regClass;
16688 if(propertyWatch->compound)
16689 {
16690 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);
16691
16692 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16693 curExternal = (((void *)0));
16694 ProcessStatement(propertyWatch->compound);
16695 }
16696 thisClass = (((void *)0));
16697 }
16698 }
16699 }
16700
16701 void DeclareFunctionUtil(char * s)
16702 {
16703 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
16704
16705 if(function)
16706 {
16707 char name[1024];
16708
16709 name[0] = (char)0;
16710 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
16711 strcpy(name, "__ecereFunction_");
16712 FullClassNameCat(name, s, 0x0);
16713 DeclareFunction(function, name);
16714 }
16715 }
16716
16717 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16718
16719 void ComputeDataTypes()
16720 {
16721 struct External * external;
16722 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16723 struct External * after = (((void *)0));
16724
16725 currentClass = (((void *)0));
16726 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16727 for(external = (*ast).first; external; external = external->next)
16728 {
16729 if(external->type == 1)
16730 {
16731 struct Declaration * decl = external->declaration;
16732
16733 if(decl)
16734 {
16735 struct __ecereNameSpace__ecere__sys__OldList * decls = decl->declarators;
16736
16737 if(decls)
16738 {
16739 struct InitDeclarator * initDecl = (*decls).first;
16740
16741 if(initDecl)
16742 {
16743 struct Declarator * declarator = initDecl->declarator;
16744
16745 if(declarator && declarator->type == 1)
16746 {
16747 struct Identifier * id = declarator->identifier;
16748
16749 if(id && id->string)
16750 {
16751 if(!strcmp(id->string, "uintptr_t") || !strcmp(id->string, "intptr_t") || !strcmp(id->string, "size_t") || !strcmp(id->string, "ssize_t"))
16752 {
16753 external->symbol->id = -1001, external->symbol->idCode = -1001;
16754 after = external;
16755 }
16756 }
16757 }
16758 }
16759 }
16760 }
16761 }
16762 }
16763 temp->symbol = __extension__ ({
16764 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
16765
16766 __ecereInstance1->id = -1000, __ecereInstance1->idCode = -1000, __ecereInstance1;
16767 });
16768 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), after, temp);
16769 curExternal = temp;
16770 DeclareFunctionUtil("eSystem_New");
16771 DeclareFunctionUtil("eSystem_New0");
16772 DeclareFunctionUtil("eSystem_Renew");
16773 DeclareFunctionUtil("eSystem_Renew0");
16774 DeclareFunctionUtil("eClass_GetProperty");
16775 DeclareStruct("ecere::com::Class", 0x0);
16776 DeclareStruct("ecere::com::Instance", 0x0);
16777 DeclareStruct("ecere::com::Property", 0x0);
16778 DeclareStruct("ecere::com::DataMember", 0x0);
16779 DeclareStruct("ecere::com::Method", 0x0);
16780 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16781 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16782 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16783 for(external = (*ast).first; external; external = external->next)
16784 {
16785 afterExternal = curExternal = external;
16786 if(external->type == 0)
16787 {
16788 currentClass = external->function->_class;
16789 ProcessFunction(external->function);
16790 }
16791 else if(external->type == 1)
16792 {
16793 currentClass = (((void *)0));
16794 ProcessDeclaration(external->declaration);
16795 }
16796 else if(external->type == 2)
16797 {
16798 struct ClassDefinition * _class = external->_class;
16799
16800 currentClass = external->symbol->registered;
16801 if(_class->definitions)
16802 {
16803 ProcessClass(_class->definitions, _class->symbol);
16804 }
16805 if(inCompiler)
16806 {
16807 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16808 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16809 }
16810 }
16811 else if(external->type == 4)
16812 {
16813 thisNameSpace = external->id->string;
16814 }
16815 }
16816 currentClass = (((void *)0));
16817 thisNameSpace = (((void *)0));
16818 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16819 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16820 }
16821
16822 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);
16823
16824 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, char *  name, char *  baseName, int size, int sizeClass, unsigned int (*  Constructor)(void * ), void (*  Destructor)(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
16825
16826 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16827 {
16828 struct __ecereNameSpace__ecere__com__Class * class;
16829
16830 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16831 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16832 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16833 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16834 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16835 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16836 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16837 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16838 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16839 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16840 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16841 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16842 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16843 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16844 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16845 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16846 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16847 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16848 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16849 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16850 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16851 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16852 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
16853 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
16854 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntSize", "bool GetIntSize(Expression exp, intsize * value2)", GetIntSize, module, 1);
16855 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntSize", "bool GetUIntSize(Expression exp, uintsize * value2)", GetUIntSize, module, 1);
16856 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16857 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16858 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16859 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16860 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16861 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16862 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16863 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16864 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16865 __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);
16866 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16867 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16868 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16869 __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);
16870 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16871 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16872 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16873 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16874 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16875 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16876 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16877 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16878 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16879 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16880 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16881 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16882 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16883 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
16884 __ecereClass_Conversion = class;
16885 __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);
16886 __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);
16887 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16888 __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);
16889 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16890 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16891 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16892 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16893 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16894 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16895 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16896 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16897 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16898 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16899 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintTypeNoConst", "void PrintTypeNoConst(Type type, char * string, bool printName, bool fullName)", PrintTypeNoConst, module, 1);
16900 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16901 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16902 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16903 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16904 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16905 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
16906 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16907 }
16908
16909 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16910 {
16911
16912 }
16913